@medusajs/js-sdk 2.0.1-snapshot-20241025090810 → 2.0.2-snapshot-20241104135243

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/dist/admin/notification.d.ts +80 -0
  2. package/dist/admin/notification.d.ts.map +1 -1
  3. package/dist/admin/notification.js +80 -0
  4. package/dist/admin/notification.js.map +1 -1
  5. package/dist/admin/order-edit.d.ts +166 -1
  6. package/dist/admin/order-edit.d.ts.map +1 -1
  7. package/dist/admin/order-edit.js +165 -0
  8. package/dist/admin/order-edit.js.map +1 -1
  9. package/dist/admin/order.d.ts +248 -22
  10. package/dist/admin/order.d.ts.map +1 -1
  11. package/dist/admin/order.js +240 -0
  12. package/dist/admin/order.js.map +1 -1
  13. package/dist/admin/payment-collection.d.ts +55 -0
  14. package/dist/admin/payment-collection.d.ts.map +1 -1
  15. package/dist/admin/payment-collection.js +55 -0
  16. package/dist/admin/payment-collection.js.map +1 -1
  17. package/dist/admin/payment.d.ts +162 -1
  18. package/dist/admin/payment.d.ts.map +1 -1
  19. package/dist/admin/payment.js +161 -0
  20. package/dist/admin/payment.js.map +1 -1
  21. package/dist/admin/price-list.d.ts +195 -1
  22. package/dist/admin/price-list.d.ts.map +1 -1
  23. package/dist/admin/price-list.js +194 -0
  24. package/dist/admin/price-list.js.map +1 -1
  25. package/dist/admin/price-preference.d.ts +133 -0
  26. package/dist/admin/price-preference.d.ts.map +1 -1
  27. package/dist/admin/price-preference.js +133 -0
  28. package/dist/admin/price-preference.js.map +1 -1
  29. package/dist/admin/product-category.d.ts +150 -0
  30. package/dist/admin/product-category.d.ts.map +1 -1
  31. package/dist/admin/product-category.js +150 -0
  32. package/dist/admin/product-category.js.map +1 -1
  33. package/dist/admin/product-collection.d.ts +149 -0
  34. package/dist/admin/product-collection.d.ts.map +1 -1
  35. package/dist/admin/product-collection.js +149 -0
  36. package/dist/admin/product-collection.js.map +1 -1
  37. package/dist/esm/admin/notification.d.ts +80 -0
  38. package/dist/esm/admin/notification.d.ts.map +1 -1
  39. package/dist/esm/admin/notification.js +80 -0
  40. package/dist/esm/admin/notification.js.map +1 -1
  41. package/dist/esm/admin/order-edit.d.ts +166 -1
  42. package/dist/esm/admin/order-edit.d.ts.map +1 -1
  43. package/dist/esm/admin/order-edit.js +165 -0
  44. package/dist/esm/admin/order-edit.js.map +1 -1
  45. package/dist/esm/admin/order.d.ts +248 -22
  46. package/dist/esm/admin/order.d.ts.map +1 -1
  47. package/dist/esm/admin/order.js +240 -0
  48. package/dist/esm/admin/order.js.map +1 -1
  49. package/dist/esm/admin/payment-collection.d.ts +55 -0
  50. package/dist/esm/admin/payment-collection.d.ts.map +1 -1
  51. package/dist/esm/admin/payment-collection.js +55 -0
  52. package/dist/esm/admin/payment-collection.js.map +1 -1
  53. package/dist/esm/admin/payment.d.ts +162 -1
  54. package/dist/esm/admin/payment.d.ts.map +1 -1
  55. package/dist/esm/admin/payment.js +161 -0
  56. package/dist/esm/admin/payment.js.map +1 -1
  57. package/dist/esm/admin/price-list.d.ts +195 -1
  58. package/dist/esm/admin/price-list.d.ts.map +1 -1
  59. package/dist/esm/admin/price-list.js +194 -0
  60. package/dist/esm/admin/price-list.js.map +1 -1
  61. package/dist/esm/admin/price-preference.d.ts +133 -0
  62. package/dist/esm/admin/price-preference.d.ts.map +1 -1
  63. package/dist/esm/admin/price-preference.js +133 -0
  64. package/dist/esm/admin/price-preference.js.map +1 -1
  65. package/dist/esm/admin/product-category.d.ts +150 -0
  66. package/dist/esm/admin/product-category.d.ts.map +1 -1
  67. package/dist/esm/admin/product-category.js +150 -0
  68. package/dist/esm/admin/product-category.js.map +1 -1
  69. package/dist/esm/admin/product-collection.d.ts +149 -0
  70. package/dist/esm/admin/product-collection.d.ts.map +1 -1
  71. package/dist/esm/admin/product-collection.js +149 -0
  72. package/dist/esm/admin/product-collection.js.map +1 -1
  73. package/package.json +2 -2
@@ -8,6 +8,24 @@ class PaymentCollection {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method creates a payment collection. It sends a request to the
13
+ * [Create Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollections)
14
+ * API route.
15
+ *
16
+ * @param body - The details of the payment collection to create.
17
+ * @param query - Configure the fields to retrieve in the payment collection.
18
+ * @param headers - Headers to pass in the request
19
+ * @returns The payment collection's details.
20
+ *
21
+ * @example
22
+ * sdk.admin.paymentCollection.create({
23
+ * order_id: "order_123"
24
+ * })
25
+ * .then(({ payment_collection }) => {
26
+ * console.log(payment_collection)
27
+ * })
28
+ */
11
29
  async create(body, query, headers) {
12
30
  return await this.client.fetch(`/admin/payment-collections`, {
13
31
  method: "POST",
@@ -16,12 +34,49 @@ class PaymentCollection {
16
34
  query,
17
35
  });
18
36
  }
37
+ /**
38
+ * This method deletes a payment collection. It sends a request to the
39
+ * [Delete Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_deletepaymentcollectionsid)
40
+ * API route.
41
+ *
42
+ * @param id - The payment collection's ID.
43
+ * @param headers - Headers to pass in the request
44
+ * @returns The deletion's details.
45
+ *
46
+ * @example
47
+ * sdk.admin.paymentCollection.delete("paycol_123")
48
+ * .then(({ deleted }) => {
49
+ * console.log(deleted)
50
+ * })
51
+ */
19
52
  async delete(id, headers) {
20
53
  return await this.client.fetch(`/admin/payment-collections/${id}`, {
21
54
  method: "DELETE",
22
55
  headers,
23
56
  });
24
57
  }
58
+ /**
59
+ * This method marks a payment collection as paid. It sends a request to the
60
+ * [Mark as Paid](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollectionsidmarkaspaid)
61
+ * API route.
62
+ *
63
+ * The API route creates and authorizes a payment session, then capture its payment,
64
+ * using the manual payment provider.
65
+ *
66
+ * @param id - The payment collection to mark as paid.
67
+ * @param body - The details to mark the payment collection as paid.
68
+ * @param query - Configure the fields to retrieve in the payment collection.
69
+ * @param headers - Headers to pass in the request.
70
+ * @returns The payment collection's details.
71
+ *
72
+ * @example
73
+ * sdk.admin.paymentCollection.markAsPaid("paycol_123", {
74
+ * order_id: "order_123"
75
+ * })
76
+ * .then(({ payment_collection }) => {
77
+ * console.log(payment_collection)
78
+ * })
79
+ */
25
80
  async markAsPaid(id, body, query, headers) {
26
81
  return await this.client.fetch(`/admin/payment-collections/${id}/mark-as-paid`, {
27
82
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAtDD,8CAsDC"}
1
+ {"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AA7GD,8CA6GC"}
@@ -10,10 +10,171 @@ export declare class Payment {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a paginated list of payments. It sends a request to the
15
+ * [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
16
+ *
17
+ * @param query - Filters and pagination configurations.
18
+ * @param headers - Headers to pass in the request.
19
+ * @returns The paginated list of payments.
20
+ *
21
+ * @example
22
+ * To retrieve the list of payments:
23
+ *
24
+ * ```ts
25
+ * sdk.admin.payment.list()
26
+ * .then(({ payments, count, limit, offset }) => {
27
+ * console.log(payments)
28
+ * })
29
+ * ```
30
+ *
31
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
32
+ *
33
+ * For example, to retrieve only 10 items and skip 10 items:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.payment.list({
37
+ * limit: 10,
38
+ * offset: 10
39
+ * })
40
+ * .then(({ payments, count, limit, offset }) => {
41
+ * console.log(payments)
42
+ * })
43
+ * ```
44
+ *
45
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
46
+ * in each payment:
47
+ *
48
+ * ```ts
49
+ * sdk.admin.payment.list({
50
+ * fields: "id,*payment_collection"
51
+ * })
52
+ * .then(({ payments, count, limit, offset }) => {
53
+ * console.log(payments)
54
+ * })
55
+ * ```
56
+ *
57
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
58
+ */
13
59
  list(query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentsResponse>;
60
+ /**
61
+ * This method retrieves a paginated list of payment providers. It sends a request to the
62
+ * [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
63
+ *
64
+ * @param query - Filters and pagination configurations.
65
+ * @param headers - Headers to pass in the request.
66
+ * @returns The paginated list of payment providers.
67
+ *
68
+ * @example
69
+ * To retrieve the list of payment providers:
70
+ *
71
+ * ```ts
72
+ * sdk.admin.payment.listPaymentProviders()
73
+ * .then(({ payment_providers, count, limit, offset }) => {
74
+ * console.log(payment_providers)
75
+ * })
76
+ * ```
77
+ *
78
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
79
+ *
80
+ * For example, to retrieve only 10 items and skip 10 items:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.payment.listPaymentProviders({
84
+ * limit: 10,
85
+ * offset: 10
86
+ * })
87
+ * .then(({ payment_providers, count, limit, offset }) => {
88
+ * console.log(payment_providers)
89
+ * })
90
+ * ```
91
+ *
92
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
93
+ * in each payment provider:
94
+ *
95
+ * ```ts
96
+ * sdk.admin.payment.listPaymentProviders({
97
+ * fields: "id,is_enabled"
98
+ * })
99
+ * .then(({ payment_providers, count, limit, offset }) => {
100
+ * console.log(payment_providers)
101
+ * })
102
+ * ```
103
+ *
104
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
105
+ */
14
106
  listPaymentProviders(query?: HttpTypes.AdminGetPaymentProvidersParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentProviderListResponse>;
15
- retrieve(id: string, query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
107
+ /**
108
+ * This method retrieves a payment's details. It sends a request to the
109
+ * [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
110
+ * API route.
111
+ *
112
+ * @param id - The payment's ID.
113
+ * @param query - Configure the fields to retrieve in the payment.
114
+ * @param headers - Headers to pass in the request
115
+ * @returns The payment's details.
116
+ *
117
+ * @example
118
+ * To retrieve a payment by its ID:
119
+ *
120
+ * ```ts
121
+ * sdk.admin.payment.retrieve("pay_123")
122
+ * .then(({ payment }) => {
123
+ * console.log(payment)
124
+ * })
125
+ * ```
126
+ *
127
+ * To specify the fields and relations to retrieve:
128
+ *
129
+ * ```ts
130
+ * sdk.admin.payment.retrieve("pay_123", {
131
+ * fields: "id,*payment_collection"
132
+ * })
133
+ * .then(({ payment }) => {
134
+ * console.log(payment)
135
+ * })
136
+ * ```
137
+ *
138
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
139
+ */
140
+ retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
141
+ /**
142
+ * This method captures a payment. It sends a request to the
143
+ * [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
144
+ *
145
+ * The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
146
+ *
147
+ * @param id - The payment's ID.
148
+ * @param body - The capture's details.
149
+ * @param query - Configure the fields to retrieve in the payment.
150
+ * @param headers - Headers to pass in the request
151
+ * @returns The payment's details.
152
+ *
153
+ * @example
154
+ * sdk.admin.payment.capture("paycol_123", {})
155
+ * .then(({ payment }) => {
156
+ * console.log(payment)
157
+ * })
158
+ */
16
159
  capture(id: string, body: HttpTypes.AdminCapturePayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
160
+ /**
161
+ * This method refunds a payment. It sends a request to the
162
+ * [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
163
+ *
164
+ * The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
165
+ *
166
+ * @param id - The payment's ID.
167
+ * @param body - The refund's details.
168
+ * @param query - Configure the fields to retrieve in the payment.
169
+ * @param headers - Headers to pass in the request
170
+ * @returns The payment's details.
171
+ *
172
+ * @example
173
+ * sdk.admin.payment.refund("paycol_123", {})
174
+ * .then(({ payment }) => {
175
+ * console.log(payment)
176
+ * })
177
+ */
17
178
  refund(id: string, body: HttpTypes.AdminRefundPayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
18
179
  }
19
180
  //# sourceMappingURL=payment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;IAUnE,oBAAoB,CACxB,KAAK,CAAC,EAAE,SAAS,CAAC,8BAA8B,EAChD,OAAO,CAAC,EAAE,aAAa;IAWnB,QAAQ,CACZ,EA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E,SAAS,CAAC,mBAAmB,EACnC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,kBAAkB,EAClC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;CAY1B"}
@@ -8,24 +8,167 @@ class Payment {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method retrieves a paginated list of payments. It sends a request to the
13
+ * [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
14
+ *
15
+ * @param query - Filters and pagination configurations.
16
+ * @param headers - Headers to pass in the request.
17
+ * @returns The paginated list of payments.
18
+ *
19
+ * @example
20
+ * To retrieve the list of payments:
21
+ *
22
+ * ```ts
23
+ * sdk.admin.payment.list()
24
+ * .then(({ payments, count, limit, offset }) => {
25
+ * console.log(payments)
26
+ * })
27
+ * ```
28
+ *
29
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
30
+ *
31
+ * For example, to retrieve only 10 items and skip 10 items:
32
+ *
33
+ * ```ts
34
+ * sdk.admin.payment.list({
35
+ * limit: 10,
36
+ * offset: 10
37
+ * })
38
+ * .then(({ payments, count, limit, offset }) => {
39
+ * console.log(payments)
40
+ * })
41
+ * ```
42
+ *
43
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
44
+ * in each payment:
45
+ *
46
+ * ```ts
47
+ * sdk.admin.payment.list({
48
+ * fields: "id,*payment_collection"
49
+ * })
50
+ * .then(({ payments, count, limit, offset }) => {
51
+ * console.log(payments)
52
+ * })
53
+ * ```
54
+ *
55
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
56
+ */
11
57
  async list(query, headers) {
12
58
  return await this.client.fetch(`/admin/payments`, {
13
59
  query,
14
60
  headers,
15
61
  });
16
62
  }
63
+ /**
64
+ * This method retrieves a paginated list of payment providers. It sends a request to the
65
+ * [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
66
+ *
67
+ * @param query - Filters and pagination configurations.
68
+ * @param headers - Headers to pass in the request.
69
+ * @returns The paginated list of payment providers.
70
+ *
71
+ * @example
72
+ * To retrieve the list of payment providers:
73
+ *
74
+ * ```ts
75
+ * sdk.admin.payment.listPaymentProviders()
76
+ * .then(({ payment_providers, count, limit, offset }) => {
77
+ * console.log(payment_providers)
78
+ * })
79
+ * ```
80
+ *
81
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
82
+ *
83
+ * For example, to retrieve only 10 items and skip 10 items:
84
+ *
85
+ * ```ts
86
+ * sdk.admin.payment.listPaymentProviders({
87
+ * limit: 10,
88
+ * offset: 10
89
+ * })
90
+ * .then(({ payment_providers, count, limit, offset }) => {
91
+ * console.log(payment_providers)
92
+ * })
93
+ * ```
94
+ *
95
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
96
+ * in each payment provider:
97
+ *
98
+ * ```ts
99
+ * sdk.admin.payment.listPaymentProviders({
100
+ * fields: "id,is_enabled"
101
+ * })
102
+ * .then(({ payment_providers, count, limit, offset }) => {
103
+ * console.log(payment_providers)
104
+ * })
105
+ * ```
106
+ *
107
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
108
+ */
17
109
  async listPaymentProviders(query, headers) {
18
110
  return await this.client.fetch(`/admin/payments/payment-providers`, {
19
111
  query,
20
112
  headers,
21
113
  });
22
114
  }
115
+ /**
116
+ * This method retrieves a payment's details. It sends a request to the
117
+ * [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
118
+ * API route.
119
+ *
120
+ * @param id - The payment's ID.
121
+ * @param query - Configure the fields to retrieve in the payment.
122
+ * @param headers - Headers to pass in the request
123
+ * @returns The payment's details.
124
+ *
125
+ * @example
126
+ * To retrieve a payment by its ID:
127
+ *
128
+ * ```ts
129
+ * sdk.admin.payment.retrieve("pay_123")
130
+ * .then(({ payment }) => {
131
+ * console.log(payment)
132
+ * })
133
+ * ```
134
+ *
135
+ * To specify the fields and relations to retrieve:
136
+ *
137
+ * ```ts
138
+ * sdk.admin.payment.retrieve("pay_123", {
139
+ * fields: "id,*payment_collection"
140
+ * })
141
+ * .then(({ payment }) => {
142
+ * console.log(payment)
143
+ * })
144
+ * ```
145
+ *
146
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
147
+ */
23
148
  async retrieve(id, query, headers) {
24
149
  return await this.client.fetch(`/admin/payments/${id}`, {
25
150
  query,
26
151
  headers,
27
152
  });
28
153
  }
154
+ /**
155
+ * This method captures a payment. It sends a request to the
156
+ * [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
157
+ *
158
+ * The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
159
+ *
160
+ * @param id - The payment's ID.
161
+ * @param body - The capture's details.
162
+ * @param query - Configure the fields to retrieve in the payment.
163
+ * @param headers - Headers to pass in the request
164
+ * @returns The payment's details.
165
+ *
166
+ * @example
167
+ * sdk.admin.payment.capture("paycol_123", {})
168
+ * .then(({ payment }) => {
169
+ * console.log(payment)
170
+ * })
171
+ */
29
172
  async capture(id, body, query, headers) {
30
173
  return await this.client.fetch(`/admin/payments/${id}/capture`, {
31
174
  method: "POST",
@@ -34,6 +177,24 @@ class Payment {
34
177
  query,
35
178
  });
36
179
  }
180
+ /**
181
+ * This method refunds a payment. It sends a request to the
182
+ * [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
183
+ *
184
+ * The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
185
+ *
186
+ * @param id - The payment's ID.
187
+ * @param body - The refund's details.
188
+ * @param query - Configure the fields to retrieve in the payment.
189
+ * @param headers - Headers to pass in the request
190
+ * @returns The payment's details.
191
+ *
192
+ * @example
193
+ * sdk.admin.payment.refund("paycol_123", {})
194
+ * .then(({ payment }) => {
195
+ * console.log(payment)
196
+ * })
197
+ */
37
198
  async refund(id, body, query, headers) {
38
199
  return await this.client.fetch(`/admin/payments/${id}/refund`, {
39
200
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":";;;AAIA,MAAa,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAqC,EACrC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAlFD,0BAkFC"}
1
+ {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":";;;AAIA,MAAa,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAnPD,0BAmPC"}
@@ -10,12 +10,206 @@ export declare class PriceList {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a price list. It sends a request to the
15
+ * [Get Price List](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelistsid)
16
+ * API route.
17
+ *
18
+ * @param id - The price list's ID.
19
+ * @param query - Configure the fields to retrieve in the price list.
20
+ * @param headers - Headers to pass in the request
21
+ * @returns The price list's details.
22
+ *
23
+ * @example
24
+ * To retrieve a price list by its ID:
25
+ *
26
+ * ```ts
27
+ * sdk.admin.priceList.retrieve("plist_123")
28
+ * .then(({ price_list }) => {
29
+ * console.log(price_list)
30
+ * })
31
+ * ```
32
+ *
33
+ * To specify the fields and relations to retrieve:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.priceList.retrieve("plist_123", {
37
+ * fields: "id,*prices"
38
+ * })
39
+ * .then(({ price_list }) => {
40
+ * console.log(price_list)
41
+ * })
42
+ * ```
43
+ *
44
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
45
+ */
13
46
  retrieve(id: string, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
47
+ /**
48
+ * This method retrieves a paginated list of price lists. It sends a request to the
49
+ * [List Price Lists](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelists) API route.
50
+ *
51
+ * @param query - Filters and pagination configurations.
52
+ * @param headers - Headers to pass in the request.
53
+ * @returns The paginated list of price lists.
54
+ *
55
+ * @example
56
+ * To retrieve the list of price lists:
57
+ *
58
+ * ```ts
59
+ * sdk.admin.priceList.list()
60
+ * .then(({ price_lists, count, limit, offset }) => {
61
+ * console.log(price_lists)
62
+ * })
63
+ * ```
64
+ *
65
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
66
+ *
67
+ * For example, to retrieve only 10 items and skip 10 items:
68
+ *
69
+ * ```ts
70
+ * sdk.admin.priceList.list({
71
+ * limit: 10,
72
+ * offset: 10
73
+ * })
74
+ * .then(({ price_lists, count, limit, offset }) => {
75
+ * console.log(price_lists)
76
+ * })
77
+ * ```
78
+ *
79
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
80
+ * in each price list:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.priceList.list({
84
+ * fields: "id,*prices"
85
+ * })
86
+ * .then(({ price_lists, count, limit, offset }) => {
87
+ * console.log(price_lists)
88
+ * })
89
+ * ```
90
+ *
91
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
92
+ */
14
93
  list(query?: HttpTypes.AdminPriceListListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListListResponse>;
94
+ /**
95
+ * This method creates a price list. It sends a request to the
96
+ * [Create Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelists)
97
+ * API route.
98
+ *
99
+ * @param body - The details of the price list to create.
100
+ * @param query - Configure the fields to retrieve in the price list.
101
+ * @param headers - Headers to pass in the request
102
+ * @returns The price list's details.
103
+ *
104
+ * @example
105
+ * sdk.admin.priceList.create({
106
+ * title: "My Price List",
107
+ * status: "active",
108
+ * type: "sale",
109
+ * prices: [
110
+ * {
111
+ * variant_id: "variant_123",
112
+ * amount: 10,
113
+ * currency_code: "usd",
114
+ * rules: {
115
+ * region_id: "reg_123"
116
+ * }
117
+ * }
118
+ * ]
119
+ * })
120
+ * .then(({ price_list }) => {
121
+ * console.log(price_list)
122
+ * })
123
+ */
15
124
  create(body: HttpTypes.AdminCreatePriceList, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
125
+ /**
126
+ * This method updates a price list. It sends a request to the
127
+ * [Update Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsid)
128
+ * API route.
129
+ *
130
+ * @param id - The price list's ID.
131
+ * @param body - The data to update in the price list.
132
+ * @param query - Configure the fields to retrieve in the price list.
133
+ * @param headers - Headers to pass in the request
134
+ * @returns The price list's details.
135
+ *
136
+ * @example
137
+ * sdk.admin.priceList.update("plist_123", {
138
+ * title: "My Price List",
139
+ * })
140
+ * .then(({ price_list }) => {
141
+ * console.log(price_list)
142
+ * })
143
+ */
16
144
  update(id: string, body: HttpTypes.AdminUpdatePriceList, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
145
+ /**
146
+ * This method deletes a price list. It sends a request to the
147
+ * [Delete Price List](https://docs.medusajs.com/v2/api/admin#price-lists_deletepricelistsid)
148
+ * API route.
149
+ *
150
+ * @param id - The price list's ID.
151
+ * @param headers - Headers to pass in the request
152
+ * @returns The deletion's details.
153
+ *
154
+ * @example
155
+ * sdk.admin.priceList.delete("plist_123")
156
+ * .then(({ deleted }) => {
157
+ * console.log(deleted)
158
+ * })
159
+ */
17
160
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListDeleteResponse>;
18
- batchPrices(id: string, body: HttpTypes.AdminBatchPriceListPrice, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
161
+ /**
162
+ * This method manages the prices of a price list to create, update, or delete them.
163
+ * It sends a request to the [Manage Prices](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidpricesbatch)
164
+ * API route.
165
+ *
166
+ * @param id - The price list's ID.
167
+ * @param body - The prices to create, update, or delete.
168
+ * @param query - Configure the fields to retrieve in the price list.
169
+ * @param headers - Headers to pass in the request
170
+ * @returns The price list's details.
171
+ *
172
+ * @example
173
+ * sdk.admin.priceList.batchPrices("plist_123", {
174
+ * create: [{
175
+ * variant_id: "variant_123",
176
+ * currency_code: "usd",
177
+ * amount: 10,
178
+ * rules: {
179
+ * region_id: "reg_123"
180
+ * }
181
+ * }],
182
+ * update: [{
183
+ * id: "price_123",
184
+ * variant_id: "variant_123",
185
+ * amount: 20,
186
+ * }],
187
+ * delete: ["price_123"]
188
+ * })
189
+ * .then(({ created, updated, deleted }) => {
190
+ * console.log(created, updated, deleted)
191
+ * })
192
+ */
193
+ batchPrices(id: string, body: HttpTypes.AdminBatchPriceListPrice, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListBatchResponse>;
194
+ /**
195
+ * This method removes products from a price list. It sends a request to the
196
+ * [Remove Product](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidproducts)
197
+ * API route.
198
+ *
199
+ * @param id - The price list's ID.
200
+ * @param body - The details of the products to remove.
201
+ * @param query - Configure the fields to retrieve in the price list.
202
+ * @param headers - Headers to pass in the request
203
+ * @returns The price list's details.
204
+ *
205
+ * @example
206
+ * sdk.admin.priceList.linkProducts("plist_123", {
207
+ * remove: ["prod_123"]
208
+ * })
209
+ * .then(({ price_list }) => {
210
+ * console.log(price_list)
211
+ * })
212
+ */
19
213
  linkProducts(id: string, body: HttpTypes.AdminLinkPriceListProducts, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
20
214
  }
21
215
  //# sourceMappingURL=price-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"price-list.d.ts","sourceRoot":"","sources":["../../src/admin/price-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,C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