-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
Copy pathreservations.ts
97 lines (89 loc) · 3.08 KB
/
reservations.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import {
AdminPostReservationsReq,
AdminPostReservationsReservationReq,
AdminReservationsDeleteRes,
AdminReservationsRes,
AdminGetReservationsParams,
AdminReservationsListRes,
} from "@medusajs/medusa"
import qs from "qs"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
class AdminReservationsResource extends BaseResource {
/**
* Get a reservation
* @experimental This feature is under development and may change in the future.
* To use this feature please install @medusajs/inventory
* @description gets a reservation
* @returns The reservation with the provided id
*/
retrieve(
id: string,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsRes> {
const path = `/admin/reservations/${id}`
return this.client.request("GET", path, undefined, {}, customHeaders)
}
/**
* List reservations
* @experimental This feature is under development and may change in the future.
* To use this feature please install @medusajs/inventory
* @description Lists reservations
* @returns A list of reservations matching the provided query
*/
list(
query?: AdminGetReservationsParams,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsListRes> {
let path = `/admin/reservations`
if (query) {
const queryString = qs.stringify(query)
path += `?${queryString}`
}
return this.client.request("GET", path, undefined, {}, customHeaders)
}
/**
* create a reservation
* @description create a reservation
* @experimental This feature is under development and may change in the future.
* To use this feature please install @medusajs/inventory
* @returns the created reservation
*/
create(
payload: AdminPostReservationsReq,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsRes> {
const path = `/admin/reservations`
return this.client.request("POST", path, payload, {}, customHeaders)
}
/**
* update a reservation
* @description update a reservation
* @experimental This feature is under development and may change in the future.
* To use this feature please install @medusajs/inventory
* @returns The updated reservation
*/
update(
id: string,
payload: AdminPostReservationsReservationReq,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsRes> {
const path = `/admin/reservations/${id}`
return this.client.request("POST", path, payload, {}, customHeaders)
}
/**
* remove a reservation
* @description remove a reservation
* @experimental This feature is under development and may change in the future.
* To use this feature please install @medusajs/inventory
* @returns reservation removal confirmation
*/
delete(
id: string,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsDeleteRes> {
const path = `/admin/reservations/${id}`
return this.client.request("DELETE", path, undefined, {}, customHeaders)
}
}
export default AdminReservationsResource