@medusajs/js-sdk 3.0.0-snapshot-20251208164410 → 3.0.0-snapshot-20251211173847

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/admin/index.d.ts +5 -5
  2. package/dist/admin/index.d.ts.map +1 -1
  3. package/dist/admin/index.js +2 -2
  4. package/dist/admin/index.js.map +1 -1
  5. package/dist/admin/locale.d.ts +95 -0
  6. package/dist/admin/locale.d.ts.map +1 -0
  7. package/dist/admin/locale.js +104 -0
  8. package/dist/admin/locale.js.map +1 -0
  9. package/dist/admin/order.d.ts +22 -0
  10. package/dist/admin/order.d.ts.map +1 -1
  11. package/dist/admin/order.js +28 -0
  12. package/dist/admin/order.js.map +1 -1
  13. package/dist/admin/price-list.d.ts +17 -0
  14. package/dist/admin/price-list.d.ts.map +1 -1
  15. package/dist/admin/price-list.js +23 -0
  16. package/dist/admin/price-list.js.map +1 -1
  17. package/dist/admin/product.d.ts +0 -22
  18. package/dist/admin/product.d.ts.map +1 -1
  19. package/dist/admin/product.js +0 -29
  20. package/dist/admin/product.js.map +1 -1
  21. package/dist/esm/admin/index.d.ts +5 -5
  22. package/dist/esm/admin/index.d.ts.map +1 -1
  23. package/dist/esm/admin/index.js +2 -2
  24. package/dist/esm/admin/index.js.map +1 -1
  25. package/dist/esm/admin/locale.d.ts +95 -0
  26. package/dist/esm/admin/locale.d.ts.map +1 -0
  27. package/dist/esm/admin/locale.js +113 -0
  28. package/dist/esm/admin/locale.js.map +1 -0
  29. package/dist/esm/admin/order.d.ts +22 -0
  30. package/dist/esm/admin/order.d.ts.map +1 -1
  31. package/dist/esm/admin/order.js +30 -0
  32. package/dist/esm/admin/order.js.map +1 -1
  33. package/dist/esm/admin/price-list.d.ts +17 -0
  34. package/dist/esm/admin/price-list.d.ts.map +1 -1
  35. package/dist/esm/admin/price-list.js +25 -0
  36. package/dist/esm/admin/price-list.js.map +1 -1
  37. package/dist/esm/admin/product.d.ts +0 -22
  38. package/dist/esm/admin/product.d.ts.map +1 -1
  39. package/dist/esm/admin/product.js +0 -31
  40. package/dist/esm/admin/product.js.map +1 -1
  41. package/package.json +2 -2
  42. package/dist/admin/product-option.d.ts +0 -122
  43. package/dist/admin/product-option.d.ts.map +0 -1
  44. package/dist/admin/product-option.js +0 -150
  45. package/dist/admin/product-option.js.map +0 -1
  46. package/dist/esm/admin/product-option.d.ts +0 -122
  47. package/dist/esm/admin/product-option.d.ts.map +0 -1
  48. package/dist/esm/admin/product-option.js +0 -165
  49. package/dist/esm/admin/product-option.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/js-sdk",
3
- "version": "3.0.0-snapshot-20251208164410",
3
+ "version": "3.0.0-snapshot-20251211173847",
4
4
  "description": "SDK for the Medusa API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,7 +29,7 @@
29
29
  "author": "Medusa",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@medusajs/types": "3.0.0-snapshot-20251208164410"
32
+ "@medusajs/types": "3.0.0-snapshot-20251211173847"
33
33
  },
34
34
  "dependencies": {
35
35
  "fetch-event-stream": "^0.1.5",
@@ -1,122 +0,0 @@
1
- import { Client } from "../client";
2
- import { ClientHeaders } from "../types";
3
- import { HttpTypes, SelectParams } from "@medusajs/types";
4
- export declare class ProductOption {
5
- /**
6
- * @ignore
7
- */
8
- private client;
9
- /**
10
- * @ignore
11
- */
12
- constructor(client: Client);
13
- /**
14
- * This method creates a product option. It sends a request to the
15
- * [Create Option](TODO)
16
- * API route.
17
- *
18
- * @param body - The details of the option to create.
19
- * @param query - Configure the fields to retrieve in the option.
20
- * @param headers - Headers to pass in the request
21
- * @returns The option's details.
22
- *
23
- * @example
24
- * sdk.admin.productOption.create({
25
- * title: "Size",
26
- * values: ["S", "M"]
27
- * })
28
- * .then(({ product_option }) => {
29
- * console.log(product_option)
30
- * })
31
- */
32
- create(body: HttpTypes.AdminCreateProductOption, query?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
33
- /**
34
- * This method updates a product option. It sends a request to the
35
- * [Update Option](TODO)
36
- * API route.
37
- *
38
- * @param id - The product option's ID.
39
- * @param body - The data to update in the option.
40
- * @param query - Configure the fields to retrieve in the option.
41
- * @param headers - Headers to pass in the request
42
- * @returns The option's details.
43
- *
44
- * @example
45
- * sdk.admin.productOption.update("opt_123", {
46
- * title: "Size"
47
- * })
48
- * .then(({ product_option }) => {
49
- * console.log(product_option)
50
- * })
51
- */
52
- update(id: string, body: HttpTypes.AdminUpdateProductOption, query?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
53
- /**
54
- * This method retrieves a paginated list of product options. It sends a request to the
55
- * List Product Options API route.
56
- *
57
- * @param queryParams - Filters and pagination configurations.
58
- * @param headers - Headers to pass in the request.
59
- * @returns The paginated list of product options.
60
- *
61
- * @example
62
- * To retrieve the list of product options:
63
- *
64
- * ```ts
65
- * sdk.admin.productOption.list()
66
- * .then(({ product_options, count, limit, offset }) => {
67
- * console.log(product_options)
68
- * })
69
- * ```
70
- *
71
- * To configure the pagination, pass the `limit` and `offset` query parameters.
72
- *
73
- * For example, to retrieve only 10 items and skip 10 items:
74
- *
75
- * ```ts
76
- * sdk.admin.productOption.list({
77
- * limit: 10,
78
- * offset: 10
79
- * })
80
- * .then(({ product_options, count, limit, offset }) => {
81
- * console.log(product_options)
82
- * })
83
- * ```
84
- */
85
- list(queryParams?: HttpTypes.AdminProductOptionListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionListResponse>;
86
- /**
87
- * This method retrieves a product option by its ID. It sends a request to the
88
- * Get Product Option API route.
89
- *
90
- * @param id - The product option's ID.
91
- * @param query - Configure the fields to retrieve in the product option.
92
- * @param headers - Headers to pass in the request
93
- * @returns The product option's details.
94
- *
95
- * @example
96
- * To retrieve a product option by its ID:
97
- *
98
- * ```ts
99
- * sdk.admin.productOption.retrieve("opt_123")
100
- * .then(({ product_option }) => {
101
- * console.log(product_option)
102
- * })
103
- * ```
104
- */
105
- retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
106
- /**
107
- * This method deletes a product option. It sends a request to the
108
- * Delete Product Option API route.
109
- *
110
- * @param id - The product option's ID.
111
- * @param headers - Headers to pass in the request
112
- * @returns The deletion's details.
113
- *
114
- * @example
115
- * sdk.admin.productOption.delete("opt_123")
116
- * .then(({ deleted }) => {
117
- * console.log(deleted)
118
- * })
119
- */
120
- delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionDeleteResponse>;
121
- }
122
- //# sourceMappingURL=product-option.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-option.d.ts","sourceRoot":"","sources":["../../src/admin/product-option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,4BAA4B,EACpD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;OAkBG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
@@ -1,150 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductOption = void 0;
4
- class ProductOption {
5
- /**
6
- * @ignore
7
- */
8
- constructor(client) {
9
- this.client = client;
10
- }
11
- /**
12
- * This method creates a product option. It sends a request to the
13
- * [Create Option](TODO)
14
- * API route.
15
- *
16
- * @param body - The details of the option to create.
17
- * @param query - Configure the fields to retrieve in the option.
18
- * @param headers - Headers to pass in the request
19
- * @returns The option's details.
20
- *
21
- * @example
22
- * sdk.admin.productOption.create({
23
- * title: "Size",
24
- * values: ["S", "M"]
25
- * })
26
- * .then(({ product_option }) => {
27
- * console.log(product_option)
28
- * })
29
- */
30
- async create(body, query, headers) {
31
- return this.client.fetch(`/admin/product-options`, {
32
- method: "POST",
33
- headers,
34
- body,
35
- query,
36
- });
37
- }
38
- /**
39
- * This method updates a product option. It sends a request to the
40
- * [Update Option](TODO)
41
- * API route.
42
- *
43
- * @param id - The product option's ID.
44
- * @param body - The data to update in the option.
45
- * @param query - Configure the fields to retrieve in the option.
46
- * @param headers - Headers to pass in the request
47
- * @returns The option's details.
48
- *
49
- * @example
50
- * sdk.admin.productOption.update("opt_123", {
51
- * title: "Size"
52
- * })
53
- * .then(({ product_option }) => {
54
- * console.log(product_option)
55
- * })
56
- */
57
- async update(id, body, query, headers) {
58
- return this.client.fetch(`/admin/product-options/${id}`, {
59
- method: "POST",
60
- headers,
61
- body,
62
- query,
63
- });
64
- }
65
- /**
66
- * This method retrieves a paginated list of product options. It sends a request to the
67
- * List Product Options API route.
68
- *
69
- * @param queryParams - Filters and pagination configurations.
70
- * @param headers - Headers to pass in the request.
71
- * @returns The paginated list of product options.
72
- *
73
- * @example
74
- * To retrieve the list of product options:
75
- *
76
- * ```ts
77
- * sdk.admin.productOption.list()
78
- * .then(({ product_options, count, limit, offset }) => {
79
- * console.log(product_options)
80
- * })
81
- * ```
82
- *
83
- * To configure the pagination, pass the `limit` and `offset` query parameters.
84
- *
85
- * For example, to retrieve only 10 items and skip 10 items:
86
- *
87
- * ```ts
88
- * sdk.admin.productOption.list({
89
- * limit: 10,
90
- * offset: 10
91
- * })
92
- * .then(({ product_options, count, limit, offset }) => {
93
- * console.log(product_options)
94
- * })
95
- * ```
96
- */
97
- async list(queryParams, headers) {
98
- return this.client.fetch(`/admin/product-options`, {
99
- headers,
100
- query: queryParams,
101
- });
102
- }
103
- /**
104
- * This method retrieves a product option by its ID. It sends a request to the
105
- * Get Product Option API route.
106
- *
107
- * @param id - The product option's ID.
108
- * @param query - Configure the fields to retrieve in the product option.
109
- * @param headers - Headers to pass in the request
110
- * @returns The product option's details.
111
- *
112
- * @example
113
- * To retrieve a product option by its ID:
114
- *
115
- * ```ts
116
- * sdk.admin.productOption.retrieve("opt_123")
117
- * .then(({ product_option }) => {
118
- * console.log(product_option)
119
- * })
120
- * ```
121
- */
122
- async retrieve(id, query, headers) {
123
- return this.client.fetch(`/admin/product-options/${id}`, {
124
- query,
125
- headers,
126
- });
127
- }
128
- /**
129
- * This method deletes a product option. It sends a request to the
130
- * Delete Product Option API route.
131
- *
132
- * @param id - The product option's ID.
133
- * @param headers - Headers to pass in the request
134
- * @returns The deletion's details.
135
- *
136
- * @example
137
- * sdk.admin.productOption.delete("opt_123")
138
- * .then(({ deleted }) => {
139
- * console.log(deleted)
140
- * })
141
- */
142
- async delete(id, headers) {
143
- return this.client.fetch(`/admin/product-options/${id}`, {
144
- method: "DELETE",
145
- headers,
146
- });
147
- }
148
- }
149
- exports.ProductOption = ProductOption;
150
- //# sourceMappingURL=product-option.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-option.js","sourceRoot":"","sources":["../../src/admin/product-option.ts"],"names":[],"mappings":";;;AAIA,MAAa,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,IAAwC,EACxC,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EACxB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAwC,EACxC,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,KAAK,CAAC,IAAI,CACR,WAAoD,EACpD,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EACxB;YACE,OAAO;YACP,KAAK,EAAE,WAAW;SACnB,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AApLD,sCAoLC"}
@@ -1,122 +0,0 @@
1
- import { Client } from "../client";
2
- import { ClientHeaders } from "../types";
3
- import { HttpTypes, SelectParams } from "@medusajs/types";
4
- export declare class ProductOption {
5
- /**
6
- * @ignore
7
- */
8
- private client;
9
- /**
10
- * @ignore
11
- */
12
- constructor(client: Client);
13
- /**
14
- * This method creates a product option. It sends a request to the
15
- * [Create Option](TODO)
16
- * API route.
17
- *
18
- * @param body - The details of the option to create.
19
- * @param query - Configure the fields to retrieve in the option.
20
- * @param headers - Headers to pass in the request
21
- * @returns The option's details.
22
- *
23
- * @example
24
- * sdk.admin.productOption.create({
25
- * title: "Size",
26
- * values: ["S", "M"]
27
- * })
28
- * .then(({ product_option }) => {
29
- * console.log(product_option)
30
- * })
31
- */
32
- create(body: HttpTypes.AdminCreateProductOption, query?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
33
- /**
34
- * This method updates a product option. It sends a request to the
35
- * [Update Option](TODO)
36
- * API route.
37
- *
38
- * @param id - The product option's ID.
39
- * @param body - The data to update in the option.
40
- * @param query - Configure the fields to retrieve in the option.
41
- * @param headers - Headers to pass in the request
42
- * @returns The option's details.
43
- *
44
- * @example
45
- * sdk.admin.productOption.update("opt_123", {
46
- * title: "Size"
47
- * })
48
- * .then(({ product_option }) => {
49
- * console.log(product_option)
50
- * })
51
- */
52
- update(id: string, body: HttpTypes.AdminUpdateProductOption, query?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
53
- /**
54
- * This method retrieves a paginated list of product options. It sends a request to the
55
- * List Product Options API route.
56
- *
57
- * @param queryParams - Filters and pagination configurations.
58
- * @param headers - Headers to pass in the request.
59
- * @returns The paginated list of product options.
60
- *
61
- * @example
62
- * To retrieve the list of product options:
63
- *
64
- * ```ts
65
- * sdk.admin.productOption.list()
66
- * .then(({ product_options, count, limit, offset }) => {
67
- * console.log(product_options)
68
- * })
69
- * ```
70
- *
71
- * To configure the pagination, pass the `limit` and `offset` query parameters.
72
- *
73
- * For example, to retrieve only 10 items and skip 10 items:
74
- *
75
- * ```ts
76
- * sdk.admin.productOption.list({
77
- * limit: 10,
78
- * offset: 10
79
- * })
80
- * .then(({ product_options, count, limit, offset }) => {
81
- * console.log(product_options)
82
- * })
83
- * ```
84
- */
85
- list(queryParams?: HttpTypes.AdminProductOptionListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionListResponse>;
86
- /**
87
- * This method retrieves a product option by its ID. It sends a request to the
88
- * Get Product Option API route.
89
- *
90
- * @param id - The product option's ID.
91
- * @param query - Configure the fields to retrieve in the product option.
92
- * @param headers - Headers to pass in the request
93
- * @returns The product option's details.
94
- *
95
- * @example
96
- * To retrieve a product option by its ID:
97
- *
98
- * ```ts
99
- * sdk.admin.productOption.retrieve("opt_123")
100
- * .then(({ product_option }) => {
101
- * console.log(product_option)
102
- * })
103
- * ```
104
- */
105
- retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
106
- /**
107
- * This method deletes a product option. It sends a request to the
108
- * Delete Product Option API route.
109
- *
110
- * @param id - The product option's ID.
111
- * @param headers - Headers to pass in the request
112
- * @returns The deletion's details.
113
- *
114
- * @example
115
- * sdk.admin.productOption.delete("opt_123")
116
- * .then(({ deleted }) => {
117
- * console.log(deleted)
118
- * })
119
- */
120
- delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionDeleteResponse>;
121
- }
122
- //# sourceMappingURL=product-option.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-option.d.ts","sourceRoot":"","sources":["../../../src/admin/product-option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,4BAA4B,EACpD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;OAkBG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
@@ -1,165 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export class ProductOption {
11
- /**
12
- * @ignore
13
- */
14
- constructor(client) {
15
- this.client = client;
16
- }
17
- /**
18
- * This method creates a product option. It sends a request to the
19
- * [Create Option](TODO)
20
- * API route.
21
- *
22
- * @param body - The details of the option to create.
23
- * @param query - Configure the fields to retrieve in the option.
24
- * @param headers - Headers to pass in the request
25
- * @returns The option's details.
26
- *
27
- * @example
28
- * sdk.admin.productOption.create({
29
- * title: "Size",
30
- * values: ["S", "M"]
31
- * })
32
- * .then(({ product_option }) => {
33
- * console.log(product_option)
34
- * })
35
- */
36
- create(body, query, headers) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- return this.client.fetch(`/admin/product-options`, {
39
- method: "POST",
40
- headers,
41
- body,
42
- query,
43
- });
44
- });
45
- }
46
- /**
47
- * This method updates a product option. It sends a request to the
48
- * [Update Option](TODO)
49
- * API route.
50
- *
51
- * @param id - The product option's ID.
52
- * @param body - The data to update in the option.
53
- * @param query - Configure the fields to retrieve in the option.
54
- * @param headers - Headers to pass in the request
55
- * @returns The option's details.
56
- *
57
- * @example
58
- * sdk.admin.productOption.update("opt_123", {
59
- * title: "Size"
60
- * })
61
- * .then(({ product_option }) => {
62
- * console.log(product_option)
63
- * })
64
- */
65
- update(id, body, query, headers) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- return this.client.fetch(`/admin/product-options/${id}`, {
68
- method: "POST",
69
- headers,
70
- body,
71
- query,
72
- });
73
- });
74
- }
75
- /**
76
- * This method retrieves a paginated list of product options. It sends a request to the
77
- * List Product Options API route.
78
- *
79
- * @param queryParams - Filters and pagination configurations.
80
- * @param headers - Headers to pass in the request.
81
- * @returns The paginated list of product options.
82
- *
83
- * @example
84
- * To retrieve the list of product options:
85
- *
86
- * ```ts
87
- * sdk.admin.productOption.list()
88
- * .then(({ product_options, count, limit, offset }) => {
89
- * console.log(product_options)
90
- * })
91
- * ```
92
- *
93
- * To configure the pagination, pass the `limit` and `offset` query parameters.
94
- *
95
- * For example, to retrieve only 10 items and skip 10 items:
96
- *
97
- * ```ts
98
- * sdk.admin.productOption.list({
99
- * limit: 10,
100
- * offset: 10
101
- * })
102
- * .then(({ product_options, count, limit, offset }) => {
103
- * console.log(product_options)
104
- * })
105
- * ```
106
- */
107
- list(queryParams, headers) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- return this.client.fetch(`/admin/product-options`, {
110
- headers,
111
- query: queryParams,
112
- });
113
- });
114
- }
115
- /**
116
- * This method retrieves a product option by its ID. It sends a request to the
117
- * Get Product Option API route.
118
- *
119
- * @param id - The product option's ID.
120
- * @param query - Configure the fields to retrieve in the product option.
121
- * @param headers - Headers to pass in the request
122
- * @returns The product option's details.
123
- *
124
- * @example
125
- * To retrieve a product option by its ID:
126
- *
127
- * ```ts
128
- * sdk.admin.productOption.retrieve("opt_123")
129
- * .then(({ product_option }) => {
130
- * console.log(product_option)
131
- * })
132
- * ```
133
- */
134
- retrieve(id, query, headers) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- return this.client.fetch(`/admin/product-options/${id}`, {
137
- query,
138
- headers,
139
- });
140
- });
141
- }
142
- /**
143
- * This method deletes a product option. It sends a request to the
144
- * Delete Product Option API route.
145
- *
146
- * @param id - The product option's ID.
147
- * @param headers - Headers to pass in the request
148
- * @returns The deletion's details.
149
- *
150
- * @example
151
- * sdk.admin.productOption.delete("opt_123")
152
- * .then(({ deleted }) => {
153
- * console.log(deleted)
154
- * })
155
- */
156
- delete(id, headers) {
157
- return __awaiter(this, void 0, void 0, function* () {
158
- return this.client.fetch(`/admin/product-options/${id}`, {
159
- method: "DELETE",
160
- headers,
161
- });
162
- });
163
- }
164
- }
165
- //# sourceMappingURL=product-option.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-option.js","sourceRoot":"","sources":["../../../src/admin/product-option.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,IAAwC,EACxC,KAA0C,EAC1C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EACxB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAU,EACV,IAAwC,EACxC,KAA0C,EAC1C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,IAAI,CACR,WAAoD,EACpD,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EACxB;gBACE,OAAO;gBACP,KAAK,EAAE,WAAW;aACnB,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;;YACtE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAAE,EAAE,EAC9B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}