@medusajs/js-sdk 0.0.2-snapshot-20241022123018 → 0.0.2-snapshot-20241022140307
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/api-key.d.ts +144 -1
- package/dist/admin/api-key.d.ts.map +1 -1
- package/dist/admin/api-key.js +143 -0
- package/dist/admin/api-key.js.map +1 -1
- package/dist/admin/campaign.d.ts +135 -0
- package/dist/admin/campaign.d.ts.map +1 -1
- package/dist/admin/campaign.js +135 -0
- package/dist/admin/campaign.js.map +1 -1
- package/dist/admin/claim.d.ts +542 -19
- package/dist/admin/claim.d.ts.map +1 -1
- package/dist/admin/claim.js +523 -0
- package/dist/admin/claim.js.map +1 -1
- package/dist/admin/currency.d.ts +80 -1
- package/dist/admin/currency.d.ts.map +1 -1
- package/dist/admin/currency.js +81 -2
- package/dist/admin/currency.js.map +1 -1
- package/dist/admin/customer-group.d.ts +152 -2
- package/dist/admin/customer-group.d.ts.map +1 -1
- package/dist/admin/customer-group.js +150 -0
- package/dist/admin/customer-group.js.map +1 -1
- package/dist/admin/customer.d.ts +135 -13
- package/dist/admin/customer.d.ts.map +1 -1
- package/dist/admin/customer.js +130 -0
- package/dist/admin/customer.js.map +1 -1
- package/dist/admin/exchange.d.ts +471 -16
- package/dist/admin/exchange.d.ts.map +1 -1
- package/dist/admin/exchange.js +455 -0
- package/dist/admin/exchange.js.map +1 -1
- package/dist/admin/fulfillment-provider.d.ts +47 -0
- package/dist/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/admin/fulfillment-provider.js +47 -0
- package/dist/admin/fulfillment-provider.js.map +1 -1
- package/dist/esm/admin/api-key.d.ts +144 -1
- package/dist/esm/admin/api-key.d.ts.map +1 -1
- package/dist/esm/admin/api-key.js +143 -0
- package/dist/esm/admin/api-key.js.map +1 -1
- package/dist/esm/admin/campaign.d.ts +135 -0
- package/dist/esm/admin/campaign.d.ts.map +1 -1
- package/dist/esm/admin/campaign.js +135 -0
- package/dist/esm/admin/campaign.js.map +1 -1
- package/dist/esm/admin/claim.d.ts +542 -19
- package/dist/esm/admin/claim.d.ts.map +1 -1
- package/dist/esm/admin/claim.js +523 -0
- package/dist/esm/admin/claim.js.map +1 -1
- package/dist/esm/admin/currency.d.ts +80 -1
- package/dist/esm/admin/currency.d.ts.map +1 -1
- package/dist/esm/admin/currency.js +81 -2
- package/dist/esm/admin/currency.js.map +1 -1
- package/dist/esm/admin/customer-group.d.ts +152 -2
- package/dist/esm/admin/customer-group.d.ts.map +1 -1
- package/dist/esm/admin/customer-group.js +150 -0
- package/dist/esm/admin/customer-group.js.map +1 -1
- package/dist/esm/admin/customer.d.ts +135 -13
- package/dist/esm/admin/customer.d.ts.map +1 -1
- package/dist/esm/admin/customer.js +130 -0
- package/dist/esm/admin/customer.js.map +1 -1
- package/dist/esm/admin/exchange.d.ts +471 -16
- package/dist/esm/admin/exchange.d.ts.map +1 -1
- package/dist/esm/admin/exchange.js +455 -0
- package/dist/esm/admin/exchange.js.map +1 -1
- package/dist/esm/admin/fulfillment-provider.d.ts +47 -0
- package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment-provider.js +47 -0
- package/dist/esm/admin/fulfillment-provider.js.map +1 -1
- package/package.json +2 -2
@@ -10,7 +10,86 @@ export declare class Currency {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a paginated list of currencies. It sends a request to the
|
15
|
+
* [List Currencies](https://docs.medusajs.com/v2/api/admin#currencies_getcurrencies)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param query - Filters and pagination configurations.
|
19
|
+
* @param headers - Headers to pass in the request.
|
20
|
+
* @returns The paginated list of currencies.
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* To retrieve the list of currencies:
|
24
|
+
*
|
25
|
+
* ```ts
|
26
|
+
* sdk.admin.currency.list()
|
27
|
+
* .then(({ currencies, count, limit, offset }) => {
|
28
|
+
* console.log(currencies)
|
29
|
+
* })
|
30
|
+
* ```
|
31
|
+
*
|
32
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
33
|
+
*
|
34
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* sdk.admin.currency.list({
|
38
|
+
* limit: 10,
|
39
|
+
* offset: 10
|
40
|
+
* })
|
41
|
+
* .then(({ currencies, count, limit, offset }) => {
|
42
|
+
* console.log(currencies)
|
43
|
+
* })
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
47
|
+
* in each currency:
|
48
|
+
*
|
49
|
+
* ```ts
|
50
|
+
* sdk.admin.currency.list({
|
51
|
+
* fields: "code,symbol"
|
52
|
+
* })
|
53
|
+
* .then(({ currencies, count, limit, offset }) => {
|
54
|
+
* console.log(currencies)
|
55
|
+
* })
|
56
|
+
* ```
|
57
|
+
*
|
58
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
59
|
+
*/
|
13
60
|
list(query?: HttpTypes.AdminCurrencyListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCurrencyListResponse>;
|
14
|
-
|
61
|
+
/**
|
62
|
+
* This method retrieves a currency by its code. It sends a request to the
|
63
|
+
* [Get Currency](https://docs.medusajs.com/v2/api/admin#currencies_getcurrenciescode) API route.
|
64
|
+
*
|
65
|
+
* @param code - The currency's code.
|
66
|
+
* @param query - Configure the fields to retrieve in the currency.
|
67
|
+
* @param headers - Headers to pass in the request
|
68
|
+
* @returns The currency's details.
|
69
|
+
*
|
70
|
+
* @example
|
71
|
+
* To retrieve a currency by its code:
|
72
|
+
*
|
73
|
+
* ```ts
|
74
|
+
* sdk.admin.currency.retrieve("usd")
|
75
|
+
* .then(({ currency }) => {
|
76
|
+
* console.log(currency)
|
77
|
+
* })
|
78
|
+
* ```
|
79
|
+
*
|
80
|
+
* To specify the fields and relations to retrieve:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.currency.retrieve("usd", {
|
84
|
+
* fields: "code,symbol"
|
85
|
+
* })
|
86
|
+
* .then(({ currency }) => {
|
87
|
+
* console.log(currency)
|
88
|
+
* })
|
89
|
+
* ```
|
90
|
+
*
|
91
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
92
|
+
*/
|
93
|
+
retrieve(code: string, query?: HttpTypes.AdminCurrencyParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCurrencyResponse>;
|
15
94
|
}
|
16
95
|
//# sourceMappingURL=currency.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/admin/currency.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,QAAQ;IACnB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/admin/currency.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,QAAQ;IACnB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,EACzC,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EACrC,OAAO,CAAC,EAAE,aAAa;CAU1B"}
|
@@ -14,6 +14,53 @@ export class Currency {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a paginated list of currencies. It sends a request to the
|
19
|
+
* [List Currencies](https://docs.medusajs.com/v2/api/admin#currencies_getcurrencies)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param query - Filters and pagination configurations.
|
23
|
+
* @param headers - Headers to pass in the request.
|
24
|
+
* @returns The paginated list of currencies.
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* To retrieve the list of currencies:
|
28
|
+
*
|
29
|
+
* ```ts
|
30
|
+
* sdk.admin.currency.list()
|
31
|
+
* .then(({ currencies, count, limit, offset }) => {
|
32
|
+
* console.log(currencies)
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
37
|
+
*
|
38
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
39
|
+
*
|
40
|
+
* ```ts
|
41
|
+
* sdk.admin.currency.list({
|
42
|
+
* limit: 10,
|
43
|
+
* offset: 10
|
44
|
+
* })
|
45
|
+
* .then(({ currencies, count, limit, offset }) => {
|
46
|
+
* console.log(currencies)
|
47
|
+
* })
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
51
|
+
* in each currency:
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* sdk.admin.currency.list({
|
55
|
+
* fields: "code,symbol"
|
56
|
+
* })
|
57
|
+
* .then(({ currencies, count, limit, offset }) => {
|
58
|
+
* console.log(currencies)
|
59
|
+
* })
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
63
|
+
*/
|
17
64
|
list(query, headers) {
|
18
65
|
return __awaiter(this, void 0, void 0, function* () {
|
19
66
|
return this.client.fetch(`/admin/currencies`, {
|
@@ -22,9 +69,41 @@ export class Currency {
|
|
22
69
|
});
|
23
70
|
});
|
24
71
|
}
|
25
|
-
|
72
|
+
/**
|
73
|
+
* This method retrieves a currency by its code. It sends a request to the
|
74
|
+
* [Get Currency](https://docs.medusajs.com/v2/api/admin#currencies_getcurrenciescode) API route.
|
75
|
+
*
|
76
|
+
* @param code - The currency's code.
|
77
|
+
* @param query - Configure the fields to retrieve in the currency.
|
78
|
+
* @param headers - Headers to pass in the request
|
79
|
+
* @returns The currency's details.
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* To retrieve a currency by its code:
|
83
|
+
*
|
84
|
+
* ```ts
|
85
|
+
* sdk.admin.currency.retrieve("usd")
|
86
|
+
* .then(({ currency }) => {
|
87
|
+
* console.log(currency)
|
88
|
+
* })
|
89
|
+
* ```
|
90
|
+
*
|
91
|
+
* To specify the fields and relations to retrieve:
|
92
|
+
*
|
93
|
+
* ```ts
|
94
|
+
* sdk.admin.currency.retrieve("usd", {
|
95
|
+
* fields: "code,symbol"
|
96
|
+
* })
|
97
|
+
* .then(({ currency }) => {
|
98
|
+
* console.log(currency)
|
99
|
+
* })
|
100
|
+
* ```
|
101
|
+
*
|
102
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
103
|
+
*/
|
104
|
+
retrieve(code, query, headers) {
|
26
105
|
return __awaiter(this, void 0, void 0, function* () {
|
27
|
-
return this.client.fetch(`/admin/currencies/${
|
106
|
+
return this.client.fetch(`/admin/currencies/${code}`, {
|
28
107
|
headers,
|
29
108
|
query,
|
30
109
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/admin/currency.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,QAAQ;IAKnB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/admin/currency.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,QAAQ;IAKnB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAAyC,EACzC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,mBAAmB,EACnB;gBACE,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,QAAQ,CACZ,IAAY,EACZ,KAAqC,EACrC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,IAAI,EAAE,EAC3B;gBACE,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|
@@ -10,11 +10,161 @@ export declare class CustomerGroup {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a customer group by its ID. It sends a request to the
|
15
|
+
* [Get Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroupsid) API route.
|
16
|
+
*
|
17
|
+
* @param id - The customer group's ID.
|
18
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
19
|
+
* @param headers - Headers to pass in the request
|
20
|
+
* @returns The group's details.
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* To retrieve a customer group by its ID:
|
24
|
+
*
|
25
|
+
* ```ts
|
26
|
+
* sdk.admin.customerGroup.retrieve("cusgroup_123")
|
27
|
+
* .then(({ customer_group }) => {
|
28
|
+
* console.log(customer_group)
|
29
|
+
* })
|
30
|
+
* ```
|
31
|
+
*
|
32
|
+
* To specify the fields and relations to retrieve:
|
33
|
+
*
|
34
|
+
* ```ts
|
35
|
+
* sdk.admin.customerGroup.retrieve("cusgroup_123", {
|
36
|
+
* fields: "id,*customer"
|
37
|
+
* })
|
38
|
+
* .then(({ customer_group }) => {
|
39
|
+
* console.log(customer_group)
|
40
|
+
* })
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
44
|
+
*/
|
13
45
|
retrieve(id: string, query?: HttpTypes.AdminGetCustomerGroupParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupResponse>;
|
46
|
+
/**
|
47
|
+
* This method retrieves a paginated list of customer groups. It sends a request to the
|
48
|
+
* [List Customer Groups](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroups)
|
49
|
+
* API route.
|
50
|
+
*
|
51
|
+
* @param query - Filters and pagination configurations.
|
52
|
+
* @param headers - Headers to pass in the request.
|
53
|
+
* @returns The paginated list of customer groups.
|
54
|
+
*
|
55
|
+
* @example
|
56
|
+
* To retrieve the list of customer groups:
|
57
|
+
*
|
58
|
+
* ```ts
|
59
|
+
* sdk.admin.customerGroup.list()
|
60
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
61
|
+
* console.log(customer_groups)
|
62
|
+
* })
|
63
|
+
* ```
|
64
|
+
*
|
65
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
66
|
+
*
|
67
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
68
|
+
*
|
69
|
+
* ```ts
|
70
|
+
* sdk.admin.customerGroup.list({
|
71
|
+
* limit: 10,
|
72
|
+
* offset: 10
|
73
|
+
* })
|
74
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
75
|
+
* console.log(customer_groups)
|
76
|
+
* })
|
77
|
+
* ```
|
78
|
+
*
|
79
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
80
|
+
* in each customer group:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.customerGroup.list({
|
84
|
+
* fields: "id,*customer"
|
85
|
+
* })
|
86
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
87
|
+
* console.log(customer_groups)
|
88
|
+
* })
|
89
|
+
* ```
|
90
|
+
*
|
91
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
92
|
+
*/
|
14
93
|
list(query?: HttpTypes.AdminGetCustomerGroupsParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupListResponse>;
|
15
|
-
|
16
|
-
|
94
|
+
/**
|
95
|
+
* This method creates a customer group. It sends a request to the
|
96
|
+
* [Create Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroups)
|
97
|
+
* API route.
|
98
|
+
*
|
99
|
+
* @param body - The customer group's details.
|
100
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
101
|
+
* @param headers - Headers to pass in the request.
|
102
|
+
* @returns The customer group's details.
|
103
|
+
*
|
104
|
+
* @example
|
105
|
+
* sdk.admin.customerGroup.create({
|
106
|
+
* name: "VIP"
|
107
|
+
* })
|
108
|
+
* .then(({ customer_group }) => {
|
109
|
+
* console.log(customer_group)
|
110
|
+
* })
|
111
|
+
*/
|
112
|
+
create(body: HttpTypes.AdminCreateCustomerGroup, query?: HttpTypes.AdminGetCustomerGroupParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupResponse>;
|
113
|
+
/**
|
114
|
+
* This method updates a customer group's details. It sends a request to the
|
115
|
+
* [Update Customer](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsid)
|
116
|
+
* API route.
|
117
|
+
*
|
118
|
+
* @param id - The customer group's ID.
|
119
|
+
* @param body - The details to update in the group.
|
120
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
121
|
+
* @param headers - Headers to pass in the request.
|
122
|
+
* @returns The customer group's details.
|
123
|
+
*
|
124
|
+
* @example
|
125
|
+
* sdk.admin.customerGroup.update("cusgroup_123", {
|
126
|
+
* name: "VIP"
|
127
|
+
* })
|
128
|
+
* .then(({ customer_group }) => {
|
129
|
+
* console.log(customer_group)
|
130
|
+
* })
|
131
|
+
*/
|
132
|
+
update(id: string, body: HttpTypes.AdminUpdateCustomerGroup, query?: HttpTypes.AdminGetCustomerGroupParams, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupResponse>;
|
133
|
+
/**
|
134
|
+
* This method deletes a customer group. This method sends a request to the
|
135
|
+
* [Delete Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_deletecustomergroupsid)
|
136
|
+
* API route.
|
137
|
+
*
|
138
|
+
* @param id - The customer group's ID.
|
139
|
+
* @param headers - Headers to pass in the request
|
140
|
+
* @returns The deletion's details.
|
141
|
+
*
|
142
|
+
* @example
|
143
|
+
* sdk.admin.customerGroup.delete("cusgroup_123")
|
144
|
+
* .then(({ deleted }) => {
|
145
|
+
* console.log(deleted)
|
146
|
+
* })
|
147
|
+
*/
|
17
148
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupDeleteResponse>;
|
149
|
+
/**
|
150
|
+
* This method manages customers of a group to add or remove them from the group.
|
151
|
+
* It sends a request to the [Manage Customers](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsidcustomers)
|
152
|
+
* API route.
|
153
|
+
*
|
154
|
+
* @param id - The group's ID.
|
155
|
+
* @param body - The customers to add or remove from the group.
|
156
|
+
* @param headers - Headers to pass in the request
|
157
|
+
* @returns The customer group's details.
|
158
|
+
*
|
159
|
+
* @example
|
160
|
+
* sdk.admin.customerGroup.batchCustomers("cusgroup_123", {
|
161
|
+
* add: ["cus_123"],
|
162
|
+
* remove: ["cus_321"]
|
163
|
+
* })
|
164
|
+
* .then(({ customer_group }) => {
|
165
|
+
* console.log(customer_group)
|
166
|
+
* })
|
167
|
+
*/
|
18
168
|
batchCustomers(id: string, body: HttpTypes.AdminBatchLink, headers?: ClientHeaders): Promise<HttpTypes.AdminCustomerGroupResponse>;
|
19
169
|
}
|
20
170
|
//# sourceMappingURL=customer-group.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"customer-group.d.ts","sourceRoot":"","sources":["../../../src/admin/customer-group.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,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"customer-group.d.ts","sourceRoot":"","sources":["../../../src/admin/customer-group.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,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,4BAA4B,EAC9C,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUhD;;;;;;;;;;;;;;;;;;OAkBG;IACG,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,cAAc,EAC9B,OAAO,CAAC,EAAE,aAAa;CAW1B"}
|
@@ -14,6 +14,38 @@ export class CustomerGroup {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a customer group by its ID. It sends a request to the
|
19
|
+
* [Get Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroupsid) API route.
|
20
|
+
*
|
21
|
+
* @param id - The customer group's ID.
|
22
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
23
|
+
* @param headers - Headers to pass in the request
|
24
|
+
* @returns The group's details.
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* To retrieve a customer group by its ID:
|
28
|
+
*
|
29
|
+
* ```ts
|
30
|
+
* sdk.admin.customerGroup.retrieve("cusgroup_123")
|
31
|
+
* .then(({ customer_group }) => {
|
32
|
+
* console.log(customer_group)
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* To specify the fields and relations to retrieve:
|
37
|
+
*
|
38
|
+
* ```ts
|
39
|
+
* sdk.admin.customerGroup.retrieve("cusgroup_123", {
|
40
|
+
* fields: "id,*customer"
|
41
|
+
* })
|
42
|
+
* .then(({ customer_group }) => {
|
43
|
+
* console.log(customer_group)
|
44
|
+
* })
|
45
|
+
* ```
|
46
|
+
*
|
47
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
48
|
+
*/
|
17
49
|
retrieve(id, query, headers) {
|
18
50
|
return __awaiter(this, void 0, void 0, function* () {
|
19
51
|
return yield this.client.fetch(`/admin/customer-groups/${id}`, {
|
@@ -23,6 +55,53 @@ export class CustomerGroup {
|
|
23
55
|
});
|
24
56
|
});
|
25
57
|
}
|
58
|
+
/**
|
59
|
+
* This method retrieves a paginated list of customer groups. It sends a request to the
|
60
|
+
* [List Customer Groups](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroups)
|
61
|
+
* API route.
|
62
|
+
*
|
63
|
+
* @param query - Filters and pagination configurations.
|
64
|
+
* @param headers - Headers to pass in the request.
|
65
|
+
* @returns The paginated list of customer groups.
|
66
|
+
*
|
67
|
+
* @example
|
68
|
+
* To retrieve the list of customer groups:
|
69
|
+
*
|
70
|
+
* ```ts
|
71
|
+
* sdk.admin.customerGroup.list()
|
72
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
73
|
+
* console.log(customer_groups)
|
74
|
+
* })
|
75
|
+
* ```
|
76
|
+
*
|
77
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
78
|
+
*
|
79
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
80
|
+
*
|
81
|
+
* ```ts
|
82
|
+
* sdk.admin.customerGroup.list({
|
83
|
+
* limit: 10,
|
84
|
+
* offset: 10
|
85
|
+
* })
|
86
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
87
|
+
* console.log(customer_groups)
|
88
|
+
* })
|
89
|
+
* ```
|
90
|
+
*
|
91
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
92
|
+
* in each customer group:
|
93
|
+
*
|
94
|
+
* ```ts
|
95
|
+
* sdk.admin.customerGroup.list({
|
96
|
+
* fields: "id,*customer"
|
97
|
+
* })
|
98
|
+
* .then(({ customer_groups, count, limit, offset }) => {
|
99
|
+
* console.log(customer_groups)
|
100
|
+
* })
|
101
|
+
* ```
|
102
|
+
*
|
103
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
104
|
+
*/
|
26
105
|
list(query, headers) {
|
27
106
|
return __awaiter(this, void 0, void 0, function* () {
|
28
107
|
return yield this.client.fetch(`/admin/customer-groups`, {
|
@@ -32,6 +111,24 @@ export class CustomerGroup {
|
|
32
111
|
});
|
33
112
|
});
|
34
113
|
}
|
114
|
+
/**
|
115
|
+
* This method creates a customer group. It sends a request to the
|
116
|
+
* [Create Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroups)
|
117
|
+
* API route.
|
118
|
+
*
|
119
|
+
* @param body - The customer group's details.
|
120
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
121
|
+
* @param headers - Headers to pass in the request.
|
122
|
+
* @returns The customer group's details.
|
123
|
+
*
|
124
|
+
* @example
|
125
|
+
* sdk.admin.customerGroup.create({
|
126
|
+
* name: "VIP"
|
127
|
+
* })
|
128
|
+
* .then(({ customer_group }) => {
|
129
|
+
* console.log(customer_group)
|
130
|
+
* })
|
131
|
+
*/
|
35
132
|
create(body, query, headers) {
|
36
133
|
return __awaiter(this, void 0, void 0, function* () {
|
37
134
|
return yield this.client.fetch(`/admin/customer-groups`, {
|
@@ -42,6 +139,25 @@ export class CustomerGroup {
|
|
42
139
|
});
|
43
140
|
});
|
44
141
|
}
|
142
|
+
/**
|
143
|
+
* This method updates a customer group's details. It sends a request to the
|
144
|
+
* [Update Customer](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsid)
|
145
|
+
* API route.
|
146
|
+
*
|
147
|
+
* @param id - The customer group's ID.
|
148
|
+
* @param body - The details to update in the group.
|
149
|
+
* @param query - Configure the fields to retrieve in the customer group.
|
150
|
+
* @param headers - Headers to pass in the request.
|
151
|
+
* @returns The customer group's details.
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* sdk.admin.customerGroup.update("cusgroup_123", {
|
155
|
+
* name: "VIP"
|
156
|
+
* })
|
157
|
+
* .then(({ customer_group }) => {
|
158
|
+
* console.log(customer_group)
|
159
|
+
* })
|
160
|
+
*/
|
45
161
|
update(id, body, query, headers) {
|
46
162
|
return __awaiter(this, void 0, void 0, function* () {
|
47
163
|
return yield this.client.fetch(`/admin/customer-groups/${id}`, {
|
@@ -52,6 +168,21 @@ export class CustomerGroup {
|
|
52
168
|
});
|
53
169
|
});
|
54
170
|
}
|
171
|
+
/**
|
172
|
+
* This method deletes a customer group. This method sends a request to the
|
173
|
+
* [Delete Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_deletecustomergroupsid)
|
174
|
+
* API route.
|
175
|
+
*
|
176
|
+
* @param id - The customer group's ID.
|
177
|
+
* @param headers - Headers to pass in the request
|
178
|
+
* @returns The deletion's details.
|
179
|
+
*
|
180
|
+
* @example
|
181
|
+
* sdk.admin.customerGroup.delete("cusgroup_123")
|
182
|
+
* .then(({ deleted }) => {
|
183
|
+
* console.log(deleted)
|
184
|
+
* })
|
185
|
+
*/
|
55
186
|
delete(id, headers) {
|
56
187
|
return __awaiter(this, void 0, void 0, function* () {
|
57
188
|
return yield this.client.fetch(`/admin/customer-groups/${id}`, {
|
@@ -60,6 +191,25 @@ export class CustomerGroup {
|
|
60
191
|
});
|
61
192
|
});
|
62
193
|
}
|
194
|
+
/**
|
195
|
+
* This method manages customers of a group to add or remove them from the group.
|
196
|
+
* It sends a request to the [Manage Customers](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsidcustomers)
|
197
|
+
* API route.
|
198
|
+
*
|
199
|
+
* @param id - The group's ID.
|
200
|
+
* @param body - The customers to add or remove from the group.
|
201
|
+
* @param headers - Headers to pass in the request
|
202
|
+
* @returns The customer group's details.
|
203
|
+
*
|
204
|
+
* @example
|
205
|
+
* sdk.admin.customerGroup.batchCustomers("cusgroup_123", {
|
206
|
+
* add: ["cus_123"],
|
207
|
+
* remove: ["cus_321"]
|
208
|
+
* })
|
209
|
+
* .then(({ customer_group }) => {
|
210
|
+
* console.log(customer_group)
|
211
|
+
* })
|
212
|
+
*/
|
63
213
|
batchCustomers(id, body, headers) {
|
64
214
|
return __awaiter(this, void 0, void 0, function* () {
|
65
215
|
return yield this.client.fetch(`/admin/customer-groups/${id}/customers`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"customer-group.js","sourceRoot":"","sources":["../../../src/admin/customer-group.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"customer-group.js","sourceRoot":"","sources":["../../../src/admin/customer-group.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,QAAQ,CACZ,EAAU,EACV,KAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,0BAA0B,EAAE,EAAE,EAC9B;gBACE,MAAM,EAAE,KAAK;gBACb,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAA8C,EAC9C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wBAAwB,EACxB;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAwC,EACxC,KAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,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,KAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,0BAA0B,EAAE,EAAE,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,0BAA0B,EAAE,EAAE,EAC9B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,cAAc,CAClB,EAAU,EACV,IAA8B,EAC9B,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,0BAA0B,EAAE,YAAY,EACxC;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;aACL,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|