@medusajs/js-sdk 2.0.0 → 2.0.1-preview-20241025120203
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/api-key.d.ts +8 -8
- package/dist/admin/api-key.js +8 -8
- package/dist/admin/campaign.d.ts +8 -8
- package/dist/admin/campaign.js +8 -8
- package/dist/admin/claim.d.ts +22 -22
- package/dist/admin/claim.js +22 -22
- package/dist/admin/currency.d.ts +4 -4
- package/dist/admin/currency.js +4 -4
- package/dist/admin/customer-group.d.ts +8 -8
- package/dist/admin/customer-group.js +8 -8
- package/dist/admin/customer.d.ts +27 -7
- package/dist/admin/customer.d.ts.map +1 -1
- package/dist/admin/customer.js +33 -7
- package/dist/admin/customer.js.map +1 -1
- package/dist/admin/exchange.d.ts +21 -21
- package/dist/admin/exchange.js +21 -21
- package/dist/admin/fulfillment-provider.d.ts +2 -2
- package/dist/admin/fulfillment-provider.js +2 -2
- package/dist/admin/fulfillment-set.d.ts +6 -6
- package/dist/admin/fulfillment-set.js +6 -6
- package/dist/admin/fulfillment.d.ts +3 -3
- package/dist/admin/fulfillment.js +3 -3
- package/dist/admin/inventory-item.d.ts +12 -12
- package/dist/admin/inventory-item.js +12 -12
- package/dist/admin/invite.d.ts +8 -8
- package/dist/admin/invite.js +8 -8
- package/dist/admin/payment-collection.d.ts +0 -2
- package/dist/admin/payment-collection.d.ts.map +1 -1
- package/dist/admin/payment-collection.js +0 -12
- package/dist/admin/payment-collection.js.map +1 -1
- package/dist/admin/price-list.d.ts +195 -1
- package/dist/admin/price-list.d.ts.map +1 -1
- package/dist/admin/price-list.js +194 -0
- package/dist/admin/price-list.js.map +1 -1
- package/dist/admin/price-preference.d.ts +133 -0
- package/dist/admin/price-preference.d.ts.map +1 -1
- package/dist/admin/price-preference.js +133 -0
- package/dist/admin/price-preference.js.map +1 -1
- package/dist/admin/product-category.d.ts +150 -0
- package/dist/admin/product-category.d.ts.map +1 -1
- package/dist/admin/product-category.js +150 -0
- package/dist/admin/product-category.js.map +1 -1
- package/dist/admin/product-collection.d.ts +149 -0
- package/dist/admin/product-collection.d.ts.map +1 -1
- package/dist/admin/product-collection.js +149 -0
- package/dist/admin/product-collection.js.map +1 -1
- package/dist/auth/index.d.ts +10 -10
- package/dist/auth/index.js +10 -10
- package/dist/esm/admin/api-key.d.ts +8 -8
- package/dist/esm/admin/api-key.js +8 -8
- package/dist/esm/admin/campaign.d.ts +8 -8
- package/dist/esm/admin/campaign.js +8 -8
- package/dist/esm/admin/claim.d.ts +22 -22
- package/dist/esm/admin/claim.js +22 -22
- package/dist/esm/admin/currency.d.ts +4 -4
- package/dist/esm/admin/currency.js +4 -4
- package/dist/esm/admin/customer-group.d.ts +8 -8
- package/dist/esm/admin/customer-group.js +8 -8
- package/dist/esm/admin/customer.d.ts +27 -7
- package/dist/esm/admin/customer.d.ts.map +1 -1
- package/dist/esm/admin/customer.js +35 -7
- package/dist/esm/admin/customer.js.map +1 -1
- package/dist/esm/admin/exchange.d.ts +21 -21
- package/dist/esm/admin/exchange.js +21 -21
- package/dist/esm/admin/fulfillment-provider.d.ts +2 -2
- package/dist/esm/admin/fulfillment-provider.js +2 -2
- package/dist/esm/admin/fulfillment-set.d.ts +6 -6
- package/dist/esm/admin/fulfillment-set.js +6 -6
- package/dist/esm/admin/fulfillment.d.ts +3 -3
- package/dist/esm/admin/fulfillment.js +3 -3
- package/dist/esm/admin/inventory-item.d.ts +12 -12
- package/dist/esm/admin/inventory-item.js +12 -12
- package/dist/esm/admin/invite.d.ts +8 -8
- package/dist/esm/admin/invite.js +8 -8
- package/dist/esm/admin/payment-collection.d.ts +0 -2
- package/dist/esm/admin/payment-collection.d.ts.map +1 -1
- package/dist/esm/admin/payment-collection.js +0 -16
- package/dist/esm/admin/payment-collection.js.map +1 -1
- package/dist/esm/admin/price-list.d.ts +195 -1
- package/dist/esm/admin/price-list.d.ts.map +1 -1
- package/dist/esm/admin/price-list.js +194 -0
- package/dist/esm/admin/price-list.js.map +1 -1
- package/dist/esm/admin/price-preference.d.ts +133 -0
- package/dist/esm/admin/price-preference.d.ts.map +1 -1
- package/dist/esm/admin/price-preference.js +133 -0
- package/dist/esm/admin/price-preference.js.map +1 -1
- package/dist/esm/admin/product-category.d.ts +150 -0
- package/dist/esm/admin/product-category.d.ts.map +1 -1
- package/dist/esm/admin/product-category.js +150 -0
- package/dist/esm/admin/product-category.js.map +1 -1
- package/dist/esm/admin/product-collection.d.ts +149 -0
- package/dist/esm/admin/product-collection.d.ts.map +1 -1
- package/dist/esm/admin/product-collection.js +149 -0
- package/dist/esm/admin/product-collection.js.map +1 -1
- package/dist/esm/auth/index.d.ts +10 -10
- package/dist/esm/auth/index.js +10 -10
- package/dist/esm/store/index.d.ts +73 -73
- package/dist/esm/store/index.js +73 -73
- package/dist/store/index.d.ts +73 -73
- package/dist/store/index.js +73 -73
- package/package.json +2 -2
@@ -8,6 +8,24 @@ class ProductCollection {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method creates a product collection. It sends a request to the
|
13
|
+
* [Create Collection](https://docs.medusajs.com/api/admin#collections_postcollections)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param body - The details of the product collection to create.
|
17
|
+
* @param query - Configure the fields to retrieve in the product collection.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The product collection's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* sdk.admin.productCollection.create({
|
23
|
+
* title: "Summer Collection"
|
24
|
+
* })
|
25
|
+
* .then(({ collection }) => {
|
26
|
+
* console.log(collection)
|
27
|
+
* })
|
28
|
+
*/
|
11
29
|
async create(body, query, headers) {
|
12
30
|
return this.client.fetch(`/admin/collections`, {
|
13
31
|
method: "POST",
|
@@ -16,6 +34,25 @@ class ProductCollection {
|
|
16
34
|
query,
|
17
35
|
});
|
18
36
|
}
|
37
|
+
/**
|
38
|
+
* This method updates a collection. It sends a request to the
|
39
|
+
* [Update Collection](https://docs.medusajs.com/api/admin#collections_postcollectionsid)
|
40
|
+
* API route.
|
41
|
+
*
|
42
|
+
* @param id - The ID of the collection.
|
43
|
+
* @param body - The data to update in the collection.
|
44
|
+
* @param query - Configure the fields to retrieve in the product collection.
|
45
|
+
* @param headers - Headers to pass in the request
|
46
|
+
* @returns The product collection's details.
|
47
|
+
*
|
48
|
+
* @example
|
49
|
+
* sdk.admin.productCollection.update("pcol_123", {
|
50
|
+
* title: "Summer Collection"
|
51
|
+
* })
|
52
|
+
* .then(({ collection }) => {
|
53
|
+
* console.log(collection)
|
54
|
+
* })
|
55
|
+
*/
|
19
56
|
async update(id, body, query, headers) {
|
20
57
|
return this.client.fetch(`/admin/collections/${id}`, {
|
21
58
|
method: "POST",
|
@@ -24,24 +61,136 @@ class ProductCollection {
|
|
24
61
|
query,
|
25
62
|
});
|
26
63
|
}
|
64
|
+
/**
|
65
|
+
* This method retrieves a paginated list of collections. It sends a request to the
|
66
|
+
* [List Collections](https://docs.medusajs.com/api/admin#collections_getcollections) 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 collections.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* To retrieve the list of collections:
|
74
|
+
*
|
75
|
+
* ```ts
|
76
|
+
* sdk.admin.productCollection.list()
|
77
|
+
* .then(({ collections, count, limit, offset }) => {
|
78
|
+
* console.log(collections)
|
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.productCollection.list({
|
88
|
+
* limit: 10,
|
89
|
+
* offset: 10
|
90
|
+
* })
|
91
|
+
* .then(({ collections, count, limit, offset }) => {
|
92
|
+
* console.log(collections)
|
93
|
+
* })
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
97
|
+
* in each collection:
|
98
|
+
*
|
99
|
+
* ```ts
|
100
|
+
* sdk.admin.productCollection.list({
|
101
|
+
* fields: "id,*products"
|
102
|
+
* })
|
103
|
+
* .then(({ collections, count, limit, offset }) => {
|
104
|
+
* console.log(collections)
|
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(queryParams, headers) {
|
28
111
|
return this.client.fetch(`/admin/collections`, {
|
29
112
|
headers,
|
30
113
|
query: queryParams,
|
31
114
|
});
|
32
115
|
}
|
116
|
+
/**
|
117
|
+
* This method retrieves a collection by its ID. It sends a request to the
|
118
|
+
* [Get Collection](https://docs.medusajs.com/api/admin#collections_getcollectionsid) API route.
|
119
|
+
*
|
120
|
+
* @param id - The collection's ID.
|
121
|
+
* @param query - Configure the fields to retrieve in the collection.
|
122
|
+
* @param headers - Headers to pass in the request
|
123
|
+
* @returns The collection's details.
|
124
|
+
*
|
125
|
+
* @example
|
126
|
+
* To retrieve a collection by its ID:
|
127
|
+
*
|
128
|
+
* ```ts
|
129
|
+
* sdk.admin.productCollection.retrieve("pcol_123")
|
130
|
+
* .then(({ collection }) => {
|
131
|
+
* console.log(collection)
|
132
|
+
* })
|
133
|
+
* ```
|
134
|
+
*
|
135
|
+
* To specify the fields and relations to retrieve:
|
136
|
+
*
|
137
|
+
* ```ts
|
138
|
+
* sdk.admin.productCollection.retrieve("pcol_123", {
|
139
|
+
* fields: "id,*products"
|
140
|
+
* })
|
141
|
+
* .then(({ collection }) => {
|
142
|
+
* console.log(collection)
|
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/collections/${id}`, {
|
35
150
|
query,
|
36
151
|
headers,
|
37
152
|
});
|
38
153
|
}
|
154
|
+
/**
|
155
|
+
* This method deletes a product collection. It sends a request to the
|
156
|
+
* [Delete Collection](https://docs.medusajs.com/api/admin#collections_deletecollectionsid)
|
157
|
+
* API route.
|
158
|
+
*
|
159
|
+
* @param id - The collection's ID.
|
160
|
+
* @param headers - Headers to pass in the request
|
161
|
+
* @returns The deletion's details.
|
162
|
+
*
|
163
|
+
* @example
|
164
|
+
* sdk.admin.productCollection.delete("pcol_123")
|
165
|
+
* .then(({ deleted }) => {
|
166
|
+
* console.log(deleted)
|
167
|
+
* })
|
168
|
+
*/
|
39
169
|
async delete(id, headers) {
|
40
170
|
return this.client.fetch(`/admin/collections/${id}`, {
|
41
171
|
method: "DELETE",
|
42
172
|
headers,
|
43
173
|
});
|
44
174
|
}
|
175
|
+
/**
|
176
|
+
* This method manages the products of a collection to add or remove them. It sends a request
|
177
|
+
* to the [Manage Products](https://docs.medusajs.com/api/admin#collections_postcollectionsidproducts)
|
178
|
+
* API route.
|
179
|
+
*
|
180
|
+
* @param id - The collection's ID.
|
181
|
+
* @param body - The products to add or remove.
|
182
|
+
* @param headers - Headers to pass in the request
|
183
|
+
* @returns The product category's details.
|
184
|
+
*
|
185
|
+
* @example
|
186
|
+
* sdk.admin.productCollection.updateProducts("pcol_123", {
|
187
|
+
* add: ["prod_123"],
|
188
|
+
* remove: ["prod_321"]
|
189
|
+
* })
|
190
|
+
* .then(({ collection }) => {
|
191
|
+
* console.log(collection)
|
192
|
+
* })
|
193
|
+
*/
|
45
194
|
async updateProducts(id, body, headers) {
|
46
195
|
return this.client.fetch(`/admin/collections/${id}/products`, {
|
47
196
|
method: "POST",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-collection.js","sourceRoot":"","sources":["../../src/admin/product-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,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;
|
1
|
+
{"version":3,"file":"product-collection.js","sourceRoot":"","sources":["../../src/admin/product-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,IAAqC,EACrC,KAAuC,EACvC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;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,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CACR,WAAiD,EACjD,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,OAAO;YACP,KAAK,EAAE,WAAW;SACnB,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,sBAAsB,EAAE,EAAE,EAC1B;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,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,IAA6C,EAC7C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,WAAW,EACnC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;SACL,CACF,CAAA;IACH,CAAC;CACF;AArPD,8CAqPC"}
|
package/dist/auth/index.d.ts
CHANGED
@@ -7,7 +7,7 @@ export declare class Auth {
|
|
7
7
|
constructor(client: Client, config: Config);
|
8
8
|
/**
|
9
9
|
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
10
|
-
* [Retrieve Registration Token API route](https://docs.medusajs.com/
|
10
|
+
* [Retrieve Registration Token API route](https://docs.medusajs.com/api/store#auth_postactor_typeauth_provider_register).
|
11
11
|
*
|
12
12
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
13
13
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
@@ -30,10 +30,10 @@ export declare class Auth {
|
|
30
30
|
register: (actor: string, method: string, payload: HttpTypes.AdminSignUpWithEmailPassword) => Promise<string>;
|
31
31
|
/**
|
32
32
|
* This method retrieves the JWT authenticated token for an admin user, customer, or custom
|
33
|
-
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/
|
33
|
+
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_provider).
|
34
34
|
*
|
35
35
|
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
36
|
-
* [Set Authentication Session API route](https://docs.medusajs.com/
|
36
|
+
* [Set Authentication Session API route](https://docs.medusajs.com/api/admin#auth_postsession).
|
37
37
|
*
|
38
38
|
* Subsequent requests using the SDK will automatically have the necessary authentication headers / session
|
39
39
|
* set.
|
@@ -61,7 +61,7 @@ export declare class Auth {
|
|
61
61
|
}>;
|
62
62
|
/**
|
63
63
|
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
|
64
|
-
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/
|
64
|
+
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providercallback).
|
65
65
|
*
|
66
66
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
67
67
|
* @param method - The authentication provider to use. For example, `google`.
|
@@ -87,7 +87,7 @@ export declare class Auth {
|
|
87
87
|
callback: (actor: string, method: string, query?: Record<string, unknown>) => Promise<string>;
|
88
88
|
/**
|
89
89
|
* This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
|
90
|
-
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/
|
90
|
+
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/api/admin#auth_postadminauthtokenrefresh).
|
91
91
|
*
|
92
92
|
* @returns The refreshed JWT authentication token.
|
93
93
|
*
|
@@ -100,7 +100,7 @@ export declare class Auth {
|
|
100
100
|
refresh: () => Promise<string>;
|
101
101
|
/**
|
102
102
|
* This method deletes the authentication session of the currently logged-in user to log them out.
|
103
|
-
* It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/
|
103
|
+
* It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/api/admin#auth_deletesession).
|
104
104
|
*
|
105
105
|
* @example
|
106
106
|
* sdk.auth.logout()
|
@@ -111,11 +111,11 @@ export declare class Auth {
|
|
111
111
|
logout: () => Promise<void>;
|
112
112
|
/**
|
113
113
|
* This method requests a reset password token for an admin user, customer, or custom actor type.
|
114
|
-
* It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/
|
114
|
+
* It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
115
115
|
*
|
116
116
|
* To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
|
117
117
|
*
|
118
|
-
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/
|
118
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/resources/storefront-development/customers/reset-password).
|
119
119
|
*
|
120
120
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
121
121
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
@@ -146,9 +146,9 @@ export declare class Auth {
|
|
146
146
|
* More specifically, use this method when updating the password of an admin user, customer, or
|
147
147
|
* custom actor type after requesting to reset their password with {@link resetPassword}.
|
148
148
|
*
|
149
|
-
* This method sends a request to [this API route](https://docs.medusajs.com/
|
149
|
+
* This method sends a request to [this API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerupdate).
|
150
150
|
*
|
151
|
-
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/
|
151
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/resources/storefront-development/customers/reset-password).
|
152
152
|
*
|
153
153
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
154
154
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
package/dist/auth/index.js
CHANGED
@@ -5,7 +5,7 @@ class Auth {
|
|
5
5
|
constructor(client, config) {
|
6
6
|
/**
|
7
7
|
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
8
|
-
* [Retrieve Registration Token API route](https://docs.medusajs.com/
|
8
|
+
* [Retrieve Registration Token API route](https://docs.medusajs.com/api/store#auth_postactor_typeauth_provider_register).
|
9
9
|
*
|
10
10
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
11
11
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
@@ -35,10 +35,10 @@ class Auth {
|
|
35
35
|
};
|
36
36
|
/**
|
37
37
|
* This method retrieves the JWT authenticated token for an admin user, customer, or custom
|
38
|
-
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/
|
38
|
+
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_provider).
|
39
39
|
*
|
40
40
|
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
41
|
-
* [Set Authentication Session API route](https://docs.medusajs.com/
|
41
|
+
* [Set Authentication Session API route](https://docs.medusajs.com/api/admin#auth_postsession).
|
42
42
|
*
|
43
43
|
* Subsequent requests using the SDK will automatically have the necessary authentication headers / session
|
44
44
|
* set.
|
@@ -77,7 +77,7 @@ class Auth {
|
|
77
77
|
};
|
78
78
|
/**
|
79
79
|
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
|
80
|
-
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/
|
80
|
+
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providercallback).
|
81
81
|
*
|
82
82
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
83
83
|
* @param method - The authentication provider to use. For example, `google`.
|
@@ -110,7 +110,7 @@ class Auth {
|
|
110
110
|
};
|
111
111
|
/**
|
112
112
|
* This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
|
113
|
-
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/
|
113
|
+
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/api/admin#auth_postadminauthtokenrefresh).
|
114
114
|
*
|
115
115
|
* @returns The refreshed JWT authentication token.
|
116
116
|
*
|
@@ -131,7 +131,7 @@ class Auth {
|
|
131
131
|
};
|
132
132
|
/**
|
133
133
|
* This method deletes the authentication session of the currently logged-in user to log them out.
|
134
|
-
* It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/
|
134
|
+
* It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/api/admin#auth_deletesession).
|
135
135
|
*
|
136
136
|
* @example
|
137
137
|
* sdk.auth.logout()
|
@@ -149,11 +149,11 @@ class Auth {
|
|
149
149
|
};
|
150
150
|
/**
|
151
151
|
* This method requests a reset password token for an admin user, customer, or custom actor type.
|
152
|
-
* It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/
|
152
|
+
* It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
153
153
|
*
|
154
154
|
* To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
|
155
155
|
*
|
156
|
-
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/
|
156
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/resources/storefront-development/customers/reset-password).
|
157
157
|
*
|
158
158
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
159
159
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
@@ -184,9 +184,9 @@ class Auth {
|
|
184
184
|
* More specifically, use this method when updating the password of an admin user, customer, or
|
185
185
|
* custom actor type after requesting to reset their password with {@link resetPassword}.
|
186
186
|
*
|
187
|
-
* This method sends a request to [this API route](https://docs.medusajs.com/
|
187
|
+
* This method sends a request to [this API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerupdate).
|
188
188
|
*
|
189
|
-
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/
|
189
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/resources/storefront-development/customers/reset-password).
|
190
190
|
*
|
191
191
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
192
192
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
@@ -12,7 +12,7 @@ export declare class ApiKey {
|
|
12
12
|
constructor(client: Client);
|
13
13
|
/**
|
14
14
|
* This methods retrieves a paginated list of API keys. It sends a request to the
|
15
|
-
* [List API Keys](https://docs.medusajs.com/
|
15
|
+
* [List API Keys](https://docs.medusajs.com/api/admin#api-keys_getapikeys) API route.
|
16
16
|
*
|
17
17
|
* @param queryParams - Filters and pagination configurations.
|
18
18
|
* @param headers - Headers to pass in the request.
|
@@ -54,11 +54,11 @@ export declare class ApiKey {
|
|
54
54
|
* })
|
55
55
|
* ```
|
56
56
|
*
|
57
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
57
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
58
58
|
*/
|
59
59
|
list(queryParams?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyListResponse>;
|
60
60
|
/**
|
61
|
-
* This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/
|
61
|
+
* This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeys)
|
62
62
|
* API route.
|
63
63
|
*
|
64
64
|
* @param body - The API key's details.
|
@@ -78,7 +78,7 @@ export declare class ApiKey {
|
|
78
78
|
create(body: HttpTypes.AdminCreateApiKey, query?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
|
79
79
|
/**
|
80
80
|
* This method revokes an API key. It sends a request to the
|
81
|
-
* [Revoke API Key](https://docs.medusajs.com/
|
81
|
+
* [Revoke API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeysidrevoke) API route.
|
82
82
|
*
|
83
83
|
* @param id - The API key's ID.
|
84
84
|
* @param headers - Headers to pass in the request.
|
@@ -93,7 +93,7 @@ export declare class ApiKey {
|
|
93
93
|
revoke(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
|
94
94
|
/**
|
95
95
|
* This method retrieves an API key's details. It sends a request to the
|
96
|
-
* [Get API key](https://docs.medusajs.com/
|
96
|
+
* [Get API key](https://docs.medusajs.com/api/admin#api-keys_getapikeysid) API route.
|
97
97
|
*
|
98
98
|
* @param id - The API key's ID.
|
99
99
|
* @param headers - Headers to pass in the request.
|
@@ -108,7 +108,7 @@ export declare class ApiKey {
|
|
108
108
|
retrieve(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
|
109
109
|
/**
|
110
110
|
* This method updates an API key's details. It sends a request to the
|
111
|
-
* [Update API Key](https://docs.medusajs.com/
|
111
|
+
* [Update API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeysid) API route.
|
112
112
|
*
|
113
113
|
* @param id - The API key's ID.
|
114
114
|
* @param body - The data to update in the API key.
|
@@ -127,7 +127,7 @@ export declare class ApiKey {
|
|
127
127
|
update(id: string, body: HttpTypes.AdminUpdateApiKey, query?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
|
128
128
|
/**
|
129
129
|
* This method deletes an API key by its ID. It sends a request to the
|
130
|
-
* [Delete API Key](https://docs.medusajs.com/
|
130
|
+
* [Delete API Key](https://docs.medusajs.com/api/admin#api-keys_deleteapikeysid) API route.
|
131
131
|
*
|
132
132
|
* @param id - The API key's ID.
|
133
133
|
* @param headers - Headers to pass in the request.
|
@@ -142,7 +142,7 @@ export declare class ApiKey {
|
|
142
142
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyDeleteResponse>;
|
143
143
|
/**
|
144
144
|
* This method manages the sales channels associated with a publishable API key to either add
|
145
|
-
* or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/
|
145
|
+
* or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/api/admin#api-keys_postapikeysidsaleschannels)
|
146
146
|
* API route.
|
147
147
|
*
|
148
148
|
* @param id - The API key's ID.
|
@@ -16,7 +16,7 @@ export class ApiKey {
|
|
16
16
|
}
|
17
17
|
/**
|
18
18
|
* This methods retrieves a paginated list of API keys. It sends a request to the
|
19
|
-
* [List API Keys](https://docs.medusajs.com/
|
19
|
+
* [List API Keys](https://docs.medusajs.com/api/admin#api-keys_getapikeys) API route.
|
20
20
|
*
|
21
21
|
* @param queryParams - Filters and pagination configurations.
|
22
22
|
* @param headers - Headers to pass in the request.
|
@@ -58,7 +58,7 @@ export class ApiKey {
|
|
58
58
|
* })
|
59
59
|
* ```
|
60
60
|
*
|
61
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
61
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
62
62
|
*/
|
63
63
|
list(queryParams, headers) {
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -69,7 +69,7 @@ export class ApiKey {
|
|
69
69
|
});
|
70
70
|
}
|
71
71
|
/**
|
72
|
-
* This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/
|
72
|
+
* This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeys)
|
73
73
|
* API route.
|
74
74
|
*
|
75
75
|
* @param body - The API key's details.
|
@@ -98,7 +98,7 @@ export class ApiKey {
|
|
98
98
|
}
|
99
99
|
/**
|
100
100
|
* This method revokes an API key. It sends a request to the
|
101
|
-
* [Revoke API Key](https://docs.medusajs.com/
|
101
|
+
* [Revoke API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeysidrevoke) API route.
|
102
102
|
*
|
103
103
|
* @param id - The API key's ID.
|
104
104
|
* @param headers - Headers to pass in the request.
|
@@ -120,7 +120,7 @@ export class ApiKey {
|
|
120
120
|
}
|
121
121
|
/**
|
122
122
|
* This method retrieves an API key's details. It sends a request to the
|
123
|
-
* [Get API key](https://docs.medusajs.com/
|
123
|
+
* [Get API key](https://docs.medusajs.com/api/admin#api-keys_getapikeysid) API route.
|
124
124
|
*
|
125
125
|
* @param id - The API key's ID.
|
126
126
|
* @param headers - Headers to pass in the request.
|
@@ -141,7 +141,7 @@ export class ApiKey {
|
|
141
141
|
}
|
142
142
|
/**
|
143
143
|
* This method updates an API key's details. It sends a request to the
|
144
|
-
* [Update API Key](https://docs.medusajs.com/
|
144
|
+
* [Update API Key](https://docs.medusajs.com/api/admin#api-keys_postapikeysid) API route.
|
145
145
|
*
|
146
146
|
* @param id - The API key's ID.
|
147
147
|
* @param body - The data to update in the API key.
|
@@ -169,7 +169,7 @@ export class ApiKey {
|
|
169
169
|
}
|
170
170
|
/**
|
171
171
|
* This method deletes an API key by its ID. It sends a request to the
|
172
|
-
* [Delete API Key](https://docs.medusajs.com/
|
172
|
+
* [Delete API Key](https://docs.medusajs.com/api/admin#api-keys_deleteapikeysid) API route.
|
173
173
|
*
|
174
174
|
* @param id - The API key's ID.
|
175
175
|
* @param headers - Headers to pass in the request.
|
@@ -191,7 +191,7 @@ export class ApiKey {
|
|
191
191
|
}
|
192
192
|
/**
|
193
193
|
* This method manages the sales channels associated with a publishable API key to either add
|
194
|
-
* or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/
|
194
|
+
* or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/api/admin#api-keys_postapikeysidsaleschannels)
|
195
195
|
* API route.
|
196
196
|
*
|
197
197
|
* @param id - The API key's ID.
|
@@ -12,7 +12,7 @@ export declare class Campaign {
|
|
12
12
|
constructor(client: Client);
|
13
13
|
/**
|
14
14
|
* This method retrieves a campaign by its ID. It sends a request to the
|
15
|
-
* [Get Campaign](https://docs.medusajs.com/
|
15
|
+
* [Get Campaign](https://docs.medusajs.com/api/admin#campaigns_getcampaignsid) API route.
|
16
16
|
*
|
17
17
|
* @param id - The campaign's ID.
|
18
18
|
* @param query - Configure the fields to retrieve in the campaign.
|
@@ -40,12 +40,12 @@ export declare class Campaign {
|
|
40
40
|
* })
|
41
41
|
* ```
|
42
42
|
*
|
43
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
43
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
44
44
|
*/
|
45
45
|
retrieve(id: string, query?: HttpTypes.AdminGetCampaignParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCampaignResponse>;
|
46
46
|
/**
|
47
47
|
* This method retrieves a paginated list of campaigns. It sends a request to the
|
48
|
-
* [List Campaigns](https://docs.medusajs.com/
|
48
|
+
* [List Campaigns](https://docs.medusajs.com/api/admin#campaigns_getcampaigns) API route.
|
49
49
|
*
|
50
50
|
* @param query - Filters and pagination configurations.
|
51
51
|
* @param headers - Headers to pass in the request.
|
@@ -87,12 +87,12 @@ export declare class Campaign {
|
|
87
87
|
* })
|
88
88
|
* ```
|
89
89
|
*
|
90
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
90
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
91
91
|
*/
|
92
92
|
list(query?: HttpTypes.AdminGetCampaignsParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCampaignListResponse>;
|
93
93
|
/**
|
94
94
|
* This method creates a campaign. It sends a request to the
|
95
|
-
* [Create Campaign](https://docs.medusajs.com/
|
95
|
+
* [Create Campaign](https://docs.medusajs.com/api/admin#campaigns_postcampaigns) API route.
|
96
96
|
*
|
97
97
|
* @param payload - The details of the campaign to create.
|
98
98
|
* @param headers - Headers to pass in the request
|
@@ -109,7 +109,7 @@ export declare class Campaign {
|
|
109
109
|
create(payload: HttpTypes.AdminCreateCampaign, headers?: ClientHeaders): Promise<HttpTypes.AdminCampaignResponse>;
|
110
110
|
/**
|
111
111
|
* This method updates a campaign. It sends a request to the
|
112
|
-
* [Update Campaign](https://docs.medusajs.com/
|
112
|
+
* [Update Campaign](https://docs.medusajs.com/api/admin#campaigns_postcampaignsid) API route.
|
113
113
|
*
|
114
114
|
* @param id - The campaign's ID.
|
115
115
|
* @param payload - The data to update in the campaign.
|
@@ -127,7 +127,7 @@ export declare class Campaign {
|
|
127
127
|
update(id: string, payload: HttpTypes.AdminUpdateCampaign, headers?: ClientHeaders): Promise<HttpTypes.AdminCampaignResponse>;
|
128
128
|
/**
|
129
129
|
* This method deletes a campaign by its ID. It sends a request to the
|
130
|
-
* [Delete Campaign](https://docs.medusajs.com/
|
130
|
+
* [Delete Campaign](https://docs.medusajs.com/api/admin#campaigns_deletecampaignsid) API route.
|
131
131
|
*
|
132
132
|
* @param id - The campaign's ID.
|
133
133
|
* @param headers - Headers to pass in the request
|
@@ -142,7 +142,7 @@ export declare class Campaign {
|
|
142
142
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.DeleteResponse<"campaign">>;
|
143
143
|
/**
|
144
144
|
* This method manages the promotions of a campaign to either add or remove the association between them.
|
145
|
-
* It sends a request to the [Manage Promotions](https://docs.medusajs.com/
|
145
|
+
* It sends a request to the [Manage Promotions](https://docs.medusajs.com/api/admin#campaigns_postcampaignsidpromotions)
|
146
146
|
* API route.
|
147
147
|
*
|
148
148
|
* @param id - The campaign's ID.
|
@@ -16,7 +16,7 @@ export class Campaign {
|
|
16
16
|
}
|
17
17
|
/**
|
18
18
|
* This method retrieves a campaign by its ID. It sends a request to the
|
19
|
-
* [Get Campaign](https://docs.medusajs.com/
|
19
|
+
* [Get Campaign](https://docs.medusajs.com/api/admin#campaigns_getcampaignsid) API route.
|
20
20
|
*
|
21
21
|
* @param id - The campaign's ID.
|
22
22
|
* @param query - Configure the fields to retrieve in the campaign.
|
@@ -44,7 +44,7 @@ export class Campaign {
|
|
44
44
|
* })
|
45
45
|
* ```
|
46
46
|
*
|
47
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
47
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
48
48
|
*/
|
49
49
|
retrieve(id, query, headers) {
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -56,7 +56,7 @@ export class Campaign {
|
|
56
56
|
}
|
57
57
|
/**
|
58
58
|
* This method retrieves a paginated list of campaigns. It sends a request to the
|
59
|
-
* [List Campaigns](https://docs.medusajs.com/
|
59
|
+
* [List Campaigns](https://docs.medusajs.com/api/admin#campaigns_getcampaigns) API route.
|
60
60
|
*
|
61
61
|
* @param query - Filters and pagination configurations.
|
62
62
|
* @param headers - Headers to pass in the request.
|
@@ -98,7 +98,7 @@ export class Campaign {
|
|
98
98
|
* })
|
99
99
|
* ```
|
100
100
|
*
|
101
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/
|
101
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
102
102
|
*/
|
103
103
|
list(query, headers) {
|
104
104
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -110,7 +110,7 @@ export class Campaign {
|
|
110
110
|
}
|
111
111
|
/**
|
112
112
|
* This method creates a campaign. It sends a request to the
|
113
|
-
* [Create Campaign](https://docs.medusajs.com/
|
113
|
+
* [Create Campaign](https://docs.medusajs.com/api/admin#campaigns_postcampaigns) API route.
|
114
114
|
*
|
115
115
|
* @param payload - The details of the campaign to create.
|
116
116
|
* @param headers - Headers to pass in the request
|
@@ -135,7 +135,7 @@ export class Campaign {
|
|
135
135
|
}
|
136
136
|
/**
|
137
137
|
* This method updates a campaign. It sends a request to the
|
138
|
-
* [Update Campaign](https://docs.medusajs.com/
|
138
|
+
* [Update Campaign](https://docs.medusajs.com/api/admin#campaigns_postcampaignsid) API route.
|
139
139
|
*
|
140
140
|
* @param id - The campaign's ID.
|
141
141
|
* @param payload - The data to update in the campaign.
|
@@ -161,7 +161,7 @@ export class Campaign {
|
|
161
161
|
}
|
162
162
|
/**
|
163
163
|
* This method deletes a campaign by its ID. It sends a request to the
|
164
|
-
* [Delete Campaign](https://docs.medusajs.com/
|
164
|
+
* [Delete Campaign](https://docs.medusajs.com/api/admin#campaigns_deletecampaignsid) API route.
|
165
165
|
*
|
166
166
|
* @param id - The campaign's ID.
|
167
167
|
* @param headers - Headers to pass in the request
|
@@ -183,7 +183,7 @@ export class Campaign {
|
|
183
183
|
}
|
184
184
|
/**
|
185
185
|
* This method manages the promotions of a campaign to either add or remove the association between them.
|
186
|
-
* It sends a request to the [Manage Promotions](https://docs.medusajs.com/
|
186
|
+
* It sends a request to the [Manage Promotions](https://docs.medusajs.com/api/admin#campaigns_postcampaignsidpromotions)
|
187
187
|
* API route.
|
188
188
|
*
|
189
189
|
* @param id - The campaign's ID.
|