@medusajs/js-sdk 2.0.5-preview-20241119150151 → 2.0.5-preview-20241119180151
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/product-tag.d.ts +130 -0
- package/dist/admin/product-tag.d.ts.map +1 -1
- package/dist/admin/product-tag.js +130 -0
- package/dist/admin/product-tag.js.map +1 -1
- package/dist/admin/product-type.d.ts +131 -0
- package/dist/admin/product-type.d.ts.map +1 -1
- package/dist/admin/product-type.js +131 -0
- package/dist/admin/product-type.js.map +1 -1
- package/dist/admin/product-variant.d.ts +48 -1
- package/dist/admin/product-variant.d.ts.map +1 -1
- package/dist/admin/product-variant.js +49 -2
- package/dist/admin/product-variant.js.map +1 -1
- package/dist/admin/product.d.ts +634 -2
- package/dist/admin/product.d.ts.map +1 -1
- package/dist/admin/product.js +636 -4
- package/dist/admin/product.js.map +1 -1
- package/dist/esm/admin/product-tag.d.ts +130 -0
- package/dist/esm/admin/product-tag.d.ts.map +1 -1
- package/dist/esm/admin/product-tag.js +130 -0
- package/dist/esm/admin/product-tag.js.map +1 -1
- package/dist/esm/admin/product-type.d.ts +131 -0
- package/dist/esm/admin/product-type.d.ts.map +1 -1
- package/dist/esm/admin/product-type.js +131 -0
- package/dist/esm/admin/product-type.js.map +1 -1
- package/dist/esm/admin/product-variant.d.ts +48 -1
- package/dist/esm/admin/product-variant.d.ts.map +1 -1
- package/dist/esm/admin/product-variant.js +49 -2
- package/dist/esm/admin/product-variant.js.map +1 -1
- package/dist/esm/admin/product.d.ts +634 -2
- package/dist/esm/admin/product.d.ts.map +1 -1
- package/dist/esm/admin/product.js +636 -4
- package/dist/esm/admin/product.js.map +1 -1
- package/package.json +2 -2
@@ -10,10 +10,140 @@ export declare class ProductTag {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method creates a product tag. It sends a request to the
|
15
|
+
* [Create Product Tag](https://docs.medusajs.com/api/admin#product-tags_postproducttags)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param body - The details of the product tag.
|
19
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
20
|
+
* @param headers - Headers to pass in the request
|
21
|
+
* @returns The product tag's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* sdk.admin.productTag.create({
|
25
|
+
* value: "shirt"
|
26
|
+
* })
|
27
|
+
* .then(({ product_tag }) => {
|
28
|
+
* console.log(product_tag)
|
29
|
+
* })
|
30
|
+
*/
|
13
31
|
create(body: HttpTypes.AdminCreateProductTag, query?: HttpTypes.AdminProductTagParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTagResponse>;
|
32
|
+
/**
|
33
|
+
* This method updates a tag's details. It sends a request to the
|
34
|
+
* [Update Product Tag](https://docs.medusajs.com/api/admin#product-tags_postproducttagsid)
|
35
|
+
* API route.
|
36
|
+
*
|
37
|
+
* @param id - The tag's ID.
|
38
|
+
* @param body - The data to update in the tag.
|
39
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
40
|
+
* @param headers - Headers to pass in the request
|
41
|
+
* @returns The product tag's details.
|
42
|
+
*
|
43
|
+
* @example
|
44
|
+
* sdk.admin.productTag.update("ptag_123", {
|
45
|
+
* value: "shirt"
|
46
|
+
* })
|
47
|
+
* .then(({ product_tag }) => {
|
48
|
+
* console.log(product_tag)
|
49
|
+
* })
|
50
|
+
*/
|
14
51
|
update(id: string, body: HttpTypes.AdminUpdateProductTag, query?: HttpTypes.AdminProductTagParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTagResponse>;
|
52
|
+
/**
|
53
|
+
* This method retrieves a paginated list of product tags. It sends a request to the
|
54
|
+
* [List Product Tags](https://docs.medusajs.com/api/admin#product-tags_getproducttags) API route.
|
55
|
+
*
|
56
|
+
* @param query - Filters and pagination configurations.
|
57
|
+
* @param headers - Headers to pass in the request.
|
58
|
+
* @returns The paginated list of product tags.
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* To retrieve the list of product tags:
|
62
|
+
*
|
63
|
+
* ```ts
|
64
|
+
* sdk.admin.productTag.list()
|
65
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
66
|
+
* console.log(product_tags)
|
67
|
+
* })
|
68
|
+
* ```
|
69
|
+
*
|
70
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
71
|
+
*
|
72
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
73
|
+
*
|
74
|
+
* ```ts
|
75
|
+
* sdk.admin.productTag.list({
|
76
|
+
* limit: 10,
|
77
|
+
* offset: 10
|
78
|
+
* })
|
79
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
80
|
+
* console.log(product_tags)
|
81
|
+
* })
|
82
|
+
* ```
|
83
|
+
*
|
84
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
85
|
+
* in each product tag:
|
86
|
+
*
|
87
|
+
* ```ts
|
88
|
+
* sdk.admin.productTag.list({
|
89
|
+
* fields: "id,*products"
|
90
|
+
* })
|
91
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
92
|
+
* console.log(product_tags)
|
93
|
+
* })
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
97
|
+
*/
|
15
98
|
list(query?: HttpTypes.AdminProductTagListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTagListResponse>;
|
99
|
+
/**
|
100
|
+
* This method retrieves a product tag by its ID. It sends a request to the
|
101
|
+
* [Get Product Tag](https://docs.medusajs.com/api/admin#product-tags_getproducttagsid) API route.
|
102
|
+
*
|
103
|
+
* @param id - The product tag's ID.
|
104
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
105
|
+
* @param headers - Headers to pass in the request
|
106
|
+
* @returns The product tag's details.
|
107
|
+
*
|
108
|
+
* @example
|
109
|
+
* To retrieve a product tag by its ID:
|
110
|
+
*
|
111
|
+
* ```ts
|
112
|
+
* sdk.admin.productTag.retrieve("ptag_123")
|
113
|
+
* .then(({ product_tag }) => {
|
114
|
+
* console.log(product_tag)
|
115
|
+
* })
|
116
|
+
* ```
|
117
|
+
*
|
118
|
+
* To specify the fields and relations to retrieve:
|
119
|
+
*
|
120
|
+
* ```ts
|
121
|
+
* sdk.admin.productTag.retrieve("ptag_123", {
|
122
|
+
* fields: "id,*products"
|
123
|
+
* })
|
124
|
+
* .then(({ product_tag }) => {
|
125
|
+
* console.log(product_tag)
|
126
|
+
* })
|
127
|
+
* ```
|
128
|
+
*
|
129
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
130
|
+
*/
|
16
131
|
retrieve(id: string, query?: HttpTypes.AdminProductTagParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTagResponse>;
|
132
|
+
/**
|
133
|
+
* This method deletes a product tag. It sends a request to the
|
134
|
+
* [Delete Product Tag](https://docs.medusajs.com/api/admin#product-tags_deleteproducttagsid)
|
135
|
+
* API route.
|
136
|
+
*
|
137
|
+
* @param id - The tag's ID.
|
138
|
+
* @param headers - Headers to pass in the request
|
139
|
+
* @returns The deletion's details.
|
140
|
+
*
|
141
|
+
* @example
|
142
|
+
* sdk.admin.productTag.delete("ptag_123")
|
143
|
+
* .then(({ deleted }) => {
|
144
|
+
* console.log(deleted)
|
145
|
+
* })
|
146
|
+
*/
|
17
147
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTagDeleteResponse>;
|
18
148
|
}
|
19
149
|
//# sourceMappingURL=product-tag.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-tag.d.ts","sourceRoot":"","sources":["../../src/admin/product-tag.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,CAAA;AAExC,qBAAa,UAAU;IACrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"product-tag.d.ts","sourceRoot":"","sources":["../../src/admin/product-tag.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,CAAA;AAExC,qBAAa,UAAU;IACrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,EACrC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,EACrC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,yBAAyB,EAC3C,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
|
@@ -8,6 +8,24 @@ class ProductTag {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method creates a product tag. It sends a request to the
|
13
|
+
* [Create Product Tag](https://docs.medusajs.com/api/admin#product-tags_postproducttags)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param body - The details of the product tag.
|
17
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The product tag's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* sdk.admin.productTag.create({
|
23
|
+
* value: "shirt"
|
24
|
+
* })
|
25
|
+
* .then(({ product_tag }) => {
|
26
|
+
* console.log(product_tag)
|
27
|
+
* })
|
28
|
+
*/
|
11
29
|
async create(body, query, headers) {
|
12
30
|
return this.client.fetch(`/admin/product-tags`, {
|
13
31
|
method: "POST",
|
@@ -16,6 +34,25 @@ class ProductTag {
|
|
16
34
|
query,
|
17
35
|
});
|
18
36
|
}
|
37
|
+
/**
|
38
|
+
* This method updates a tag's details. It sends a request to the
|
39
|
+
* [Update Product Tag](https://docs.medusajs.com/api/admin#product-tags_postproducttagsid)
|
40
|
+
* API route.
|
41
|
+
*
|
42
|
+
* @param id - The tag's ID.
|
43
|
+
* @param body - The data to update in the tag.
|
44
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
45
|
+
* @param headers - Headers to pass in the request
|
46
|
+
* @returns The product tag's details.
|
47
|
+
*
|
48
|
+
* @example
|
49
|
+
* sdk.admin.productTag.update("ptag_123", {
|
50
|
+
* value: "shirt"
|
51
|
+
* })
|
52
|
+
* .then(({ product_tag }) => {
|
53
|
+
* console.log(product_tag)
|
54
|
+
* })
|
55
|
+
*/
|
19
56
|
async update(id, body, query, headers) {
|
20
57
|
return this.client.fetch(`/admin/product-tags/${id}`, {
|
21
58
|
method: "POST",
|
@@ -24,18 +61,111 @@ class ProductTag {
|
|
24
61
|
query,
|
25
62
|
});
|
26
63
|
}
|
64
|
+
/**
|
65
|
+
* This method retrieves a paginated list of product tags. It sends a request to the
|
66
|
+
* [List Product Tags](https://docs.medusajs.com/api/admin#product-tags_getproducttags) API route.
|
67
|
+
*
|
68
|
+
* @param query - Filters and pagination configurations.
|
69
|
+
* @param headers - Headers to pass in the request.
|
70
|
+
* @returns The paginated list of product tags.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* To retrieve the list of product tags:
|
74
|
+
*
|
75
|
+
* ```ts
|
76
|
+
* sdk.admin.productTag.list()
|
77
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
78
|
+
* console.log(product_tags)
|
79
|
+
* })
|
80
|
+
* ```
|
81
|
+
*
|
82
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
83
|
+
*
|
84
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* sdk.admin.productTag.list({
|
88
|
+
* limit: 10,
|
89
|
+
* offset: 10
|
90
|
+
* })
|
91
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
92
|
+
* console.log(product_tags)
|
93
|
+
* })
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
97
|
+
* in each product tag:
|
98
|
+
*
|
99
|
+
* ```ts
|
100
|
+
* sdk.admin.productTag.list({
|
101
|
+
* fields: "id,*products"
|
102
|
+
* })
|
103
|
+
* .then(({ product_tags, count, limit, offset }) => {
|
104
|
+
* console.log(product_tags)
|
105
|
+
* })
|
106
|
+
* ```
|
107
|
+
*
|
108
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
109
|
+
*/
|
27
110
|
async list(query, headers) {
|
28
111
|
return this.client.fetch(`/admin/product-tags`, {
|
29
112
|
headers,
|
30
113
|
query: query,
|
31
114
|
});
|
32
115
|
}
|
116
|
+
/**
|
117
|
+
* This method retrieves a product tag by its ID. It sends a request to the
|
118
|
+
* [Get Product Tag](https://docs.medusajs.com/api/admin#product-tags_getproducttagsid) API route.
|
119
|
+
*
|
120
|
+
* @param id - The product tag's ID.
|
121
|
+
* @param query - Configure the fields to retrieve in the product tag.
|
122
|
+
* @param headers - Headers to pass in the request
|
123
|
+
* @returns The product tag's details.
|
124
|
+
*
|
125
|
+
* @example
|
126
|
+
* To retrieve a product tag by its ID:
|
127
|
+
*
|
128
|
+
* ```ts
|
129
|
+
* sdk.admin.productTag.retrieve("ptag_123")
|
130
|
+
* .then(({ product_tag }) => {
|
131
|
+
* console.log(product_tag)
|
132
|
+
* })
|
133
|
+
* ```
|
134
|
+
*
|
135
|
+
* To specify the fields and relations to retrieve:
|
136
|
+
*
|
137
|
+
* ```ts
|
138
|
+
* sdk.admin.productTag.retrieve("ptag_123", {
|
139
|
+
* fields: "id,*products"
|
140
|
+
* })
|
141
|
+
* .then(({ product_tag }) => {
|
142
|
+
* console.log(product_tag)
|
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
|
+
*/
|
33
148
|
async retrieve(id, query, headers) {
|
34
149
|
return this.client.fetch(`/admin/product-tags/${id}`, {
|
35
150
|
query,
|
36
151
|
headers,
|
37
152
|
});
|
38
153
|
}
|
154
|
+
/**
|
155
|
+
* This method deletes a product tag. It sends a request to the
|
156
|
+
* [Delete Product Tag](https://docs.medusajs.com/api/admin#product-tags_deleteproducttagsid)
|
157
|
+
* API route.
|
158
|
+
*
|
159
|
+
* @param id - The tag's ID.
|
160
|
+
* @param headers - Headers to pass in the request
|
161
|
+
* @returns The deletion's details.
|
162
|
+
*
|
163
|
+
* @example
|
164
|
+
* sdk.admin.productTag.delete("ptag_123")
|
165
|
+
* .then(({ deleted }) => {
|
166
|
+
* console.log(deleted)
|
167
|
+
* })
|
168
|
+
*/
|
39
169
|
async delete(id, headers) {
|
40
170
|
return this.client.fetch(`/admin/product-tags/${id}`, {
|
41
171
|
method: "DELETE",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-tag.js","sourceRoot":"","sources":["../../src/admin/product-tag.ts"],"names":[],"mappings":";;;AAIA,MAAa,UAAU;IAKrB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,EACrB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAA2C,EAC3C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,EACrB;YACE,OAAO;YACP,KAAK,EAAE,KAAK;SACb,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;
|
1
|
+
{"version":3,"file":"product-tag.js","sourceRoot":"","sources":["../../src/admin/product-tag.ts"],"names":[],"mappings":";;;AAIA,MAAa,UAAU;IAKrB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,EACrB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CACR,KAA2C,EAC3C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,EACrB;YACE,OAAO;YACP,KAAK,EAAE,KAAK;SACb,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,uBAAuB,EAAE,EAAE,EAC3B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AAnND,gCAmNC"}
|
@@ -10,10 +10,141 @@ export declare class ProductType {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method creates a product type. It sends a request to the
|
15
|
+
* [Create Product Type](https://docs.medusajs.com/api/admin#product-types_postproducttypes)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param body - The product type's details.
|
19
|
+
* @param query - Configure the fields to retrieve in the product type.
|
20
|
+
* @param headers - Headers to pass in the request
|
21
|
+
* @returns The product type's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* sdk.admin.productType.create({
|
25
|
+
* value: "Clothes"
|
26
|
+
* })
|
27
|
+
* .then(({ product_type }) => {
|
28
|
+
* console.log(product_type)
|
29
|
+
* })
|
30
|
+
*/
|
13
31
|
create(body: HttpTypes.AdminCreateProductType, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTypeResponse>;
|
32
|
+
/**
|
33
|
+
* This method updates a product type. It sends a request to the
|
34
|
+
* [Update Product Type](https://docs.medusajs.com/api/admin#product-types_postproducttypesid)
|
35
|
+
* API route.
|
36
|
+
*
|
37
|
+
* @param id - The product type's ID.
|
38
|
+
* @param body - The data to update in the product type.
|
39
|
+
* @param query - Configure the fields to retrieve in the product type.
|
40
|
+
* @param headers - Headers to pass in the request
|
41
|
+
* @returns The product type's details.
|
42
|
+
*
|
43
|
+
* @example
|
44
|
+
* sdk.admin.productType.update("ptyp_123", {
|
45
|
+
* value: "Clothes"
|
46
|
+
* })
|
47
|
+
* .then(({ product_type }) => {
|
48
|
+
* console.log(product_type)
|
49
|
+
* })
|
50
|
+
*/
|
14
51
|
update(id: string, body: HttpTypes.AdminUpdateProductType, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTypeResponse>;
|
52
|
+
/**
|
53
|
+
* This method retrieves a paginated list of product types. It sends a request to the
|
54
|
+
* [List Product Types](https://docs.medusajs.com/api/admin#product-types_getproducttypes) API route.
|
55
|
+
*
|
56
|
+
* @param query - Filters and pagination configurations.
|
57
|
+
* @param headers - Headers to pass in the request.
|
58
|
+
* @returns The paginated list of product types.
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* To retrieve the list of product types:
|
62
|
+
*
|
63
|
+
* ```ts
|
64
|
+
* sdk.admin.productType.list()
|
65
|
+
* .then(({ product_types, count, limit, offset }) => {
|
66
|
+
* console.log(product_types)
|
67
|
+
* })
|
68
|
+
* ```
|
69
|
+
*
|
70
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
71
|
+
*
|
72
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
73
|
+
*
|
74
|
+
* ```ts
|
75
|
+
* sdk.admin.productType.list({
|
76
|
+
* limit: 10,
|
77
|
+
* offset: 10
|
78
|
+
* })
|
79
|
+
* .then(({ product_types, count, limit, offset }) => {
|
80
|
+
* console.log(product_types)
|
81
|
+
* })
|
82
|
+
* ```
|
83
|
+
*
|
84
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
85
|
+
* in each product type:
|
86
|
+
*
|
87
|
+
* ```ts
|
88
|
+
* sdk.admin.productType.list({
|
89
|
+
* fields: "id,*products"
|
90
|
+
* })
|
91
|
+
* .then(({ product_types, count, limit, offset }) => {
|
92
|
+
* console.log(product_types)
|
93
|
+
* })
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
97
|
+
*/
|
15
98
|
list(query?: HttpTypes.AdminProductTypeListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTypeListResponse>;
|
99
|
+
/**
|
100
|
+
* This method retrieves a product type by its ID. It sends a request to the
|
101
|
+
* [Get Product Type](https://docs.medusajs.com/api/admin#product-types_getproducttypesid)
|
102
|
+
* API route.
|
103
|
+
*
|
104
|
+
* @param id - The product type's ID.
|
105
|
+
* @param query - Configure the fields to retrieve in the product type.
|
106
|
+
* @param headers - Headers to pass in the request
|
107
|
+
* @returns The product type's details.
|
108
|
+
*
|
109
|
+
* @example
|
110
|
+
* To retrieve a product type by its ID:
|
111
|
+
*
|
112
|
+
* ```ts
|
113
|
+
* sdk.admin.productType.retrieve("ptyp_123")
|
114
|
+
* .then(({ product_type }) => {
|
115
|
+
* console.log(product_type)
|
116
|
+
* })
|
117
|
+
* ```
|
118
|
+
*
|
119
|
+
* To specify the fields and relations to retrieve:
|
120
|
+
*
|
121
|
+
* ```ts
|
122
|
+
* sdk.admin.productType.retrieve("ptyp_123", {
|
123
|
+
* fields: "id,*products"
|
124
|
+
* })
|
125
|
+
* .then(({ product_type }) => {
|
126
|
+
* console.log(product_type)
|
127
|
+
* })
|
128
|
+
* ```
|
129
|
+
*
|
130
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
131
|
+
*/
|
16
132
|
retrieve(id: string, query?: HttpTypes.AdminProductTypeParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTypeResponse>;
|
133
|
+
/**
|
134
|
+
* This method deletes a product type. It sends a request to the
|
135
|
+
* [Delete Product Type](https://docs.medusajs.com/api/admin#product-types_deleteproducttypesid)
|
136
|
+
* API route.
|
137
|
+
*
|
138
|
+
* @param id - The product type's ID.
|
139
|
+
* @param headers - Headers to pass in the request
|
140
|
+
* @returns The product type's details.
|
141
|
+
*
|
142
|
+
* @example
|
143
|
+
* sdk.admin.productType.delete("ptyp_123")
|
144
|
+
* .then(({ deleted }) => {
|
145
|
+
* console.log(deleted)
|
146
|
+
* })
|
147
|
+
*/
|
17
148
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductTypeDeleteResponse>;
|
18
149
|
}
|
19
150
|
//# sourceMappingURL=product-type.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-type.d.ts","sourceRoot":"","sources":["../../src/admin/product-type.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,CAAA;AAExC,qBAAa,WAAW;IACtB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"product-type.d.ts","sourceRoot":"","sources":["../../src/admin/product-type.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,CAAA;AAExC,qBAAa,WAAW;IACtB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,sBAAsB,EACtC,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,sBAAsB,EACtC,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,sBAAsB,EACxC,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
|
@@ -8,6 +8,24 @@ class ProductType {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method creates a product type. It sends a request to the
|
13
|
+
* [Create Product Type](https://docs.medusajs.com/api/admin#product-types_postproducttypes)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param body - The product type's details.
|
17
|
+
* @param query - Configure the fields to retrieve in the product type.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The product type's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* sdk.admin.productType.create({
|
23
|
+
* value: "Clothes"
|
24
|
+
* })
|
25
|
+
* .then(({ product_type }) => {
|
26
|
+
* console.log(product_type)
|
27
|
+
* })
|
28
|
+
*/
|
11
29
|
async create(body, query, headers) {
|
12
30
|
return this.client.fetch(`/admin/product-types`, {
|
13
31
|
method: "POST",
|
@@ -16,6 +34,25 @@ class ProductType {
|
|
16
34
|
query,
|
17
35
|
});
|
18
36
|
}
|
37
|
+
/**
|
38
|
+
* This method updates a product type. It sends a request to the
|
39
|
+
* [Update Product Type](https://docs.medusajs.com/api/admin#product-types_postproducttypesid)
|
40
|
+
* API route.
|
41
|
+
*
|
42
|
+
* @param id - The product type's ID.
|
43
|
+
* @param body - The data to update in the product type.
|
44
|
+
* @param query - Configure the fields to retrieve in the product type.
|
45
|
+
* @param headers - Headers to pass in the request
|
46
|
+
* @returns The product type's details.
|
47
|
+
*
|
48
|
+
* @example
|
49
|
+
* sdk.admin.productType.update("ptyp_123", {
|
50
|
+
* value: "Clothes"
|
51
|
+
* })
|
52
|
+
* .then(({ product_type }) => {
|
53
|
+
* console.log(product_type)
|
54
|
+
* })
|
55
|
+
*/
|
19
56
|
async update(id, body, query, headers) {
|
20
57
|
return this.client.fetch(`/admin/product-types/${id}`, {
|
21
58
|
method: "POST",
|
@@ -24,18 +61,112 @@ class ProductType {
|
|
24
61
|
query,
|
25
62
|
});
|
26
63
|
}
|
64
|
+
/**
|
65
|
+
* This method retrieves a paginated list of product types. It sends a request to the
|
66
|
+
* [List Product Types](https://docs.medusajs.com/api/admin#product-types_getproducttypes) API route.
|
67
|
+
*
|
68
|
+
* @param query - Filters and pagination configurations.
|
69
|
+
* @param headers - Headers to pass in the request.
|
70
|
+
* @returns The paginated list of product types.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* To retrieve the list of product types:
|
74
|
+
*
|
75
|
+
* ```ts
|
76
|
+
* sdk.admin.productType.list()
|
77
|
+
* .then(({ product_types, count, limit, offset }) => {
|
78
|
+
* console.log(product_types)
|
79
|
+
* })
|
80
|
+
* ```
|
81
|
+
*
|
82
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
83
|
+
*
|
84
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* sdk.admin.productType.list({
|
88
|
+
* limit: 10,
|
89
|
+
* offset: 10
|
90
|
+
* })
|
91
|
+
* .then(({ product_types, count, limit, offset }) => {
|
92
|
+
* console.log(product_types)
|
93
|
+
* })
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
97
|
+
* in each product type:
|
98
|
+
*
|
99
|
+
* ```ts
|
100
|
+
* sdk.admin.productType.list({
|
101
|
+
* fields: "id,*products"
|
102
|
+
* })
|
103
|
+
* .then(({ product_types, count, limit, offset }) => {
|
104
|
+
* console.log(product_types)
|
105
|
+
* })
|
106
|
+
* ```
|
107
|
+
*
|
108
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
109
|
+
*/
|
27
110
|
async list(query, headers) {
|
28
111
|
return this.client.fetch(`/admin/product-types`, {
|
29
112
|
headers,
|
30
113
|
query: query,
|
31
114
|
});
|
32
115
|
}
|
116
|
+
/**
|
117
|
+
* This method retrieves a product type by its ID. It sends a request to the
|
118
|
+
* [Get Product Type](https://docs.medusajs.com/api/admin#product-types_getproducttypesid)
|
119
|
+
* API route.
|
120
|
+
*
|
121
|
+
* @param id - The product type's ID.
|
122
|
+
* @param query - Configure the fields to retrieve in the product type.
|
123
|
+
* @param headers - Headers to pass in the request
|
124
|
+
* @returns The product type's details.
|
125
|
+
*
|
126
|
+
* @example
|
127
|
+
* To retrieve a product type by its ID:
|
128
|
+
*
|
129
|
+
* ```ts
|
130
|
+
* sdk.admin.productType.retrieve("ptyp_123")
|
131
|
+
* .then(({ product_type }) => {
|
132
|
+
* console.log(product_type)
|
133
|
+
* })
|
134
|
+
* ```
|
135
|
+
*
|
136
|
+
* To specify the fields and relations to retrieve:
|
137
|
+
*
|
138
|
+
* ```ts
|
139
|
+
* sdk.admin.productType.retrieve("ptyp_123", {
|
140
|
+
* fields: "id,*products"
|
141
|
+
* })
|
142
|
+
* .then(({ product_type }) => {
|
143
|
+
* console.log(product_type)
|
144
|
+
* })
|
145
|
+
* ```
|
146
|
+
*
|
147
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
148
|
+
*/
|
33
149
|
async retrieve(id, query, headers) {
|
34
150
|
return this.client.fetch(`/admin/product-types/${id}`, {
|
35
151
|
query,
|
36
152
|
headers,
|
37
153
|
});
|
38
154
|
}
|
155
|
+
/**
|
156
|
+
* This method deletes a product type. It sends a request to the
|
157
|
+
* [Delete Product Type](https://docs.medusajs.com/api/admin#product-types_deleteproducttypesid)
|
158
|
+
* API route.
|
159
|
+
*
|
160
|
+
* @param id - The product type's ID.
|
161
|
+
* @param headers - Headers to pass in the request
|
162
|
+
* @returns The product type's details.
|
163
|
+
*
|
164
|
+
* @example
|
165
|
+
* sdk.admin.productType.delete("ptyp_123")
|
166
|
+
* .then(({ deleted }) => {
|
167
|
+
* console.log(deleted)
|
168
|
+
* })
|
169
|
+
*/
|
39
170
|
async delete(id, headers) {
|
40
171
|
return this.client.fetch(`/admin/product-types/${id}`, {
|
41
172
|
method: "DELETE",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-type.js","sourceRoot":"","sources":["../../src/admin/product-type.ts"],"names":[],"mappings":";;;AAIA,MAAa,WAAW;IAKtB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAsC,EACtC,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EACtB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAsC,EACtC,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EACtB;YACE,OAAO;YACP,KAAK,EAAE,KAAK;SACb,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAwC,EACxC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;
|
1
|
+
{"version":3,"file":"product-type.js","sourceRoot":"","sources":["../../src/admin/product-type.ts"],"names":[],"mappings":";;;AAIA,MAAa,WAAW;IAKtB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,IAAsC,EACtC,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EACtB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAsC,EACtC,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CACR,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EACtB;YACE,OAAO;YACP,KAAK,EAAE,KAAK;SACb,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAwC,EACxC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AApND,kCAoNC"}
|