masterypath-sdk 0.0.13 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/MasterypathSDK.d.ts +8 -8
  2. package/dist/MasterypathSDK.js +8 -8
  3. package/dist/cli/cli.d.ts +1 -1
  4. package/dist/cli/cli.d.ts.map +1 -1
  5. package/dist/cli/cli.js +1 -1
  6. package/dist/cli/cli.js.map +1 -1
  7. package/dist/cli/commands/chat.d.ts.map +1 -1
  8. package/dist/cli/commands/chat.js +10 -5
  9. package/dist/cli/commands/chat.js.map +1 -1
  10. package/dist/cli/commands/organizations.d.ts.map +1 -1
  11. package/dist/cli/commands/organizations.js +9 -70
  12. package/dist/cli/commands/organizations.js.map +1 -1
  13. package/dist/cli/commands/uploads.d.ts +2 -2
  14. package/dist/cli/commands/uploads.d.ts.map +1 -1
  15. package/dist/cli/commands/uploads.js +8 -8
  16. package/dist/cli/commands/uploads.js.map +1 -1
  17. package/dist/cli/output.d.ts.map +1 -1
  18. package/dist/cli/output.js +15 -13
  19. package/dist/cli/output.js.map +1 -1
  20. package/dist/domains/chat/ChatClient.d.ts +8 -8
  21. package/dist/domains/chat/ChatClient.d.ts.map +1 -1
  22. package/dist/domains/chat/ChatClient.js +16 -16
  23. package/dist/domains/chat/ChatClient.js.map +1 -1
  24. package/dist/domains/containers/ContainersClient.d.ts +187 -63
  25. package/dist/domains/containers/ContainersClient.js +542 -376
  26. package/dist/domains/index.d.ts +9 -9
  27. package/dist/domains/index.d.ts.map +1 -1
  28. package/dist/domains/index.js +5 -5
  29. package/dist/domains/listings/ListingsClient.d.ts +35 -12
  30. package/dist/domains/listings/ListingsClient.js +100 -84
  31. package/dist/domains/merchants/MerchantsClient.d.ts +124 -31
  32. package/dist/domains/merchants/MerchantsClient.js +420 -303
  33. package/dist/domains/mindmaps/MindmapsClient.d.ts +6 -6
  34. package/dist/domains/mindmaps/MindmapsClient.d.ts.map +1 -1
  35. package/dist/domains/mindmaps/MindmapsClient.js +12 -13
  36. package/dist/domains/mindmaps/MindmapsClient.js.map +1 -1
  37. package/dist/domains/mindmaps/types.d.ts.map +1 -1
  38. package/dist/domains/orders/OrdersClient.d.ts +327 -94
  39. package/dist/domains/orders/OrdersClient.js +934 -662
  40. package/dist/domains/orders/types.d.ts +45 -36
  41. package/dist/domains/orders/types.js +1 -1
  42. package/dist/domains/organizations/OrganizationsClient.d.ts +8 -5
  43. package/dist/domains/organizations/OrganizationsClient.d.ts.map +1 -1
  44. package/dist/domains/organizations/OrganizationsClient.js +21 -30
  45. package/dist/domains/organizations/OrganizationsClient.js.map +1 -1
  46. package/dist/domains/plants/PlantsClient.d.ts +43 -28
  47. package/dist/domains/plants/PlantsClient.js +51 -47
  48. package/dist/domains/products/ProductsClient.d.ts +34 -12
  49. package/dist/domains/products/ProductsClient.js +94 -83
  50. package/dist/domains/public-api/PublicApiClient.d.ts +22 -0
  51. package/dist/domains/public-api/PublicApiClient.d.ts.map +1 -1
  52. package/dist/domains/public-api/PublicApiClient.js +51 -0
  53. package/dist/domains/public-api/PublicApiClient.js.map +1 -1
  54. package/dist/domains/uploads/UploadsClient.d.ts.map +1 -1
  55. package/dist/domains/uploads/UploadsClient.js +1 -3
  56. package/dist/domains/uploads/UploadsClient.js.map +1 -1
  57. package/dist/domains/usdazones/UsdazonesClient.d.ts +6 -6
  58. package/dist/domains/usdazones/UsdazonesClient.js +15 -15
  59. package/dist/domains/users/UsersClient.d.ts +4 -4
  60. package/dist/domains/users/UsersClient.d.ts.map +1 -1
  61. package/dist/domains/users/UsersClient.js +24 -22
  62. package/dist/domains/users/UsersClient.js.map +1 -1
  63. package/dist/generated/graphql.d.ts +1162 -1079
  64. package/dist/generated/graphql.d.ts.map +1 -1
  65. package/dist/generated/graphql.js +5618 -84
  66. package/dist/generated/graphql.js.map +1 -1
  67. package/dist/index.d.ts +4 -4
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +3 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/shared/fulfillmentWindows.js +4 -4
  72. package/dist/utils/errors.js +3 -3
  73. package/package.json +1 -1
@@ -1,330 +1,447 @@
1
- import { print } from 'graphql';
2
- import { GetOnboardingDocument, BeginStripeOnboardingDocument, VerifyOnboardingCompletedDocument, CreateMerchantDocument, GetMerchantDocument, GetMerchantByIdDocument, GetMerchantByHandleDocument, UpdateMerchantDocument, GetMerchantLocationsDocument, CreateLocationDocument, UpdateLocationDocument, DeleteLocationDocument, RestoreLocationDocument, GetLocationTaxJurisdictionsDocument, CreateLocationTaxJurisdictionDocument, UpdateLocationTaxJurisdictionDocument, DeleteLocationTaxJurisdictionDocument, InviteUserToMerchantDocument, AcceptInvitationDocument, DeleteInvitationDocument, RemoveUserFromMerchantDocument, ListRolesDocument, ListMerchantUsersDocument, ListLocationUsersDocument, AssignRolesToUserDocument, SetUserLocationsDocument, } from '../../generated/graphql';
1
+ import { print } from "graphql";
2
+ import {
3
+ GetOnboardingDocument,
4
+ BeginStripeOnboardingDocument,
5
+ VerifyOnboardingCompletedDocument,
6
+ CreateMerchantDocument,
7
+ GetMerchantDocument,
8
+ GetMerchantByIdDocument,
9
+ GetMerchantByHandleDocument,
10
+ UpdateMerchantDocument,
11
+ GetMerchantLocationsDocument,
12
+ CreateLocationDocument,
13
+ UpdateLocationDocument,
14
+ DeleteLocationDocument,
15
+ RestoreLocationDocument,
16
+ GetLocationTaxJurisdictionsDocument,
17
+ CreateLocationTaxJurisdictionDocument,
18
+ UpdateLocationTaxJurisdictionDocument,
19
+ DeleteLocationTaxJurisdictionDocument,
20
+ InviteUserToMerchantDocument,
21
+ AcceptInvitationDocument,
22
+ DeleteInvitationDocument,
23
+ RemoveUserFromMerchantDocument,
24
+ ListRolesDocument,
25
+ ListMerchantUsersDocument,
26
+ ListLocationUsersDocument,
27
+ AssignRolesToUserDocument,
28
+ SetUserLocationsDocument,
29
+ } from "../../generated/graphql";
3
30
  export class MerchantsClient {
4
- constructor(httpClient) {
5
- this.httpClient = httpClient;
31
+ constructor(httpClient) {
32
+ this.httpClient = httpClient;
33
+ }
34
+ async getOnboarding(merchantId) {
35
+ const response = await this.httpClient.request("/graphql-merchants", {
36
+ query: print(GetOnboardingDocument),
37
+ variables: { merchantId },
38
+ });
39
+ return response.data?.getOnboarding ?? null;
40
+ }
41
+ async beginStripeOnboarding(merchantId) {
42
+ if (!merchantId || merchantId.trim() === "") {
43
+ throw new Error("merchantId is required for beginStripeOnboarding");
6
44
  }
7
- async getOnboarding(merchantId) {
8
- const response = await this.httpClient.request('/graphql-merchants', {
9
- query: print(GetOnboardingDocument),
10
- variables: { merchantId },
11
- });
12
- return response.data?.getOnboarding ?? null;
45
+ const response = await this.httpClient.request(
46
+ "/graphql-merchants",
47
+ {
48
+ query: print(BeginStripeOnboardingDocument),
49
+ variables: {},
50
+ },
51
+ merchantId,
52
+ );
53
+ if (!response.data?.beginStripeOnboarding) {
54
+ throw new Error("Failed to begin Stripe onboarding: No data returned");
13
55
  }
14
- async beginStripeOnboarding(merchantId) {
15
- if (!merchantId || merchantId.trim() === '') {
16
- throw new Error('merchantId is required for beginStripeOnboarding');
17
- }
18
- const response = await this.httpClient.request('/graphql-merchants', {
19
- query: print(BeginStripeOnboardingDocument),
20
- variables: {},
21
- }, merchantId);
22
- if (!response.data?.beginStripeOnboarding) {
23
- throw new Error('Failed to begin Stripe onboarding: No data returned');
24
- }
25
- return response.data.beginStripeOnboarding;
56
+ return response.data.beginStripeOnboarding;
57
+ }
58
+ async verifyOnboardingCompleted(merchantId) {
59
+ if (!merchantId || merchantId.trim() === "") {
60
+ throw new Error("merchantId is required for verifyOnboardingCompleted");
26
61
  }
27
- async verifyOnboardingCompleted(merchantId) {
28
- if (!merchantId || merchantId.trim() === '') {
29
- throw new Error('merchantId is required for verifyOnboardingCompleted');
30
- }
31
- const response = await this.httpClient.request('/graphql-merchants', {
32
- query: print(VerifyOnboardingCompletedDocument),
33
- variables: {},
34
- }, merchantId);
35
- if (!response.data?.verifyOnboardingCompleted) {
36
- throw new Error('Failed to verify onboarding completion: No data returned');
37
- }
38
- return response.data.verifyOnboardingCompleted;
62
+ const response = await this.httpClient.request(
63
+ "/graphql-merchants",
64
+ {
65
+ query: print(VerifyOnboardingCompletedDocument),
66
+ variables: {},
67
+ },
68
+ merchantId,
69
+ );
70
+ if (!response.data?.verifyOnboardingCompleted) {
71
+ throw new Error(
72
+ "Failed to verify onboarding completion: No data returned",
73
+ );
39
74
  }
40
- async createMerchant(input) {
41
- const response = await this.httpClient.request('/graphql-merchants', {
42
- query: print(CreateMerchantDocument),
43
- variables: {
44
- input,
45
- },
46
- });
47
- if (!response.data?.createMerchant) {
48
- throw new Error('Failed to create merchant: No data returned');
49
- }
50
- return response.data.createMerchant;
75
+ return response.data.verifyOnboardingCompleted;
76
+ }
77
+ async createMerchant(input) {
78
+ const response = await this.httpClient.request("/graphql-merchants", {
79
+ query: print(CreateMerchantDocument),
80
+ variables: {
81
+ input,
82
+ },
83
+ });
84
+ if (!response.data?.createMerchant) {
85
+ throw new Error("Failed to create merchant: No data returned");
51
86
  }
52
- async getMerchant(merchantId) {
53
- if (!merchantId) {
54
- throw new Error('merchantId is required for getMerchant');
55
- }
56
- const response = await this.httpClient.request('/graphql-merchants', {
57
- query: print(GetMerchantDocument),
58
- variables: {},
59
- }, merchantId);
60
- return response.data?.getMerchant ?? null;
87
+ return response.data.createMerchant;
88
+ }
89
+ async getMerchant(merchantId) {
90
+ if (!merchantId) {
91
+ throw new Error("merchantId is required for getMerchant");
61
92
  }
62
- async getMerchantById(merchantId) {
63
- const response = await this.httpClient.request('/graphql-merchants', {
64
- query: print(GetMerchantByIdDocument),
65
- variables: {
66
- merchantId,
67
- },
68
- }, merchantId);
69
- return response.data?.getMerchantById ?? null;
93
+ const response = await this.httpClient.request(
94
+ "/graphql-merchants",
95
+ {
96
+ query: print(GetMerchantDocument),
97
+ variables: {},
98
+ },
99
+ merchantId,
100
+ );
101
+ return response.data?.getMerchant ?? null;
102
+ }
103
+ async getMerchantById(merchantId) {
104
+ const response = await this.httpClient.request(
105
+ "/graphql-merchants",
106
+ {
107
+ query: print(GetMerchantByIdDocument),
108
+ variables: {
109
+ merchantId,
110
+ },
111
+ },
112
+ merchantId,
113
+ );
114
+ return response.data?.getMerchantById ?? null;
115
+ }
116
+ async getMerchantByHandle(handle) {
117
+ const response = await this.httpClient.request("/graphql-merchants", {
118
+ query: print(GetMerchantByHandleDocument),
119
+ variables: {
120
+ handle,
121
+ },
122
+ });
123
+ return response.data?.getMerchantByHandle ?? null;
124
+ }
125
+ async updateMerchant(input, merchantId) {
126
+ const response = await this.httpClient.request(
127
+ "/graphql-merchants",
128
+ {
129
+ query: print(UpdateMerchantDocument),
130
+ variables: {
131
+ input,
132
+ },
133
+ },
134
+ merchantId,
135
+ );
136
+ if (!response.data?.updateMerchant) {
137
+ throw new Error("Failed to update merchant: No data returned");
70
138
  }
71
- async getMerchantByHandle(handle) {
72
- const response = await this.httpClient.request('/graphql-merchants', {
73
- query: print(GetMerchantByHandleDocument),
74
- variables: {
75
- handle,
76
- },
77
- });
78
- return response.data?.getMerchantByHandle ?? null;
139
+ return response.data.updateMerchant;
140
+ }
141
+ async getMerchantLocations(merchantId, includeDeleted) {
142
+ const response = await this.httpClient.request(
143
+ "/graphql-merchants",
144
+ {
145
+ query: print(GetMerchantLocationsDocument),
146
+ variables: {
147
+ includeDeleted: includeDeleted ?? undefined,
148
+ },
149
+ },
150
+ merchantId,
151
+ );
152
+ if (!response.data?.getMerchantLocations) {
153
+ throw new Error("Failed to get merchant locations: No data returned");
79
154
  }
80
- async updateMerchant(input, merchantId) {
81
- const response = await this.httpClient.request('/graphql-merchants', {
82
- query: print(UpdateMerchantDocument),
83
- variables: {
84
- input,
85
- },
86
- }, merchantId);
87
- if (!response.data?.updateMerchant) {
88
- throw new Error('Failed to update merchant: No data returned');
89
- }
90
- return response.data.updateMerchant;
155
+ return response.data.getMerchantLocations;
156
+ }
157
+ async createLocation(input, merchantId) {
158
+ const response = await this.httpClient.request(
159
+ "/graphql-merchants",
160
+ {
161
+ query: print(CreateLocationDocument),
162
+ variables: {
163
+ input,
164
+ },
165
+ },
166
+ merchantId,
167
+ );
168
+ if (!response.data?.createLocation) {
169
+ throw new Error("Failed to create location: No data returned");
91
170
  }
92
- async getMerchantLocations(merchantId, includeDeleted) {
93
- const response = await this.httpClient.request('/graphql-merchants', {
94
- query: print(GetMerchantLocationsDocument),
95
- variables: {
96
- includeDeleted: includeDeleted ?? undefined,
97
- },
98
- }, merchantId);
99
- if (!response.data?.getMerchantLocations) {
100
- throw new Error('Failed to get merchant locations: No data returned');
101
- }
102
- return response.data.getMerchantLocations;
171
+ return response.data.createLocation;
172
+ }
173
+ async updateLocation(id, input, merchantId) {
174
+ const response = await this.httpClient.request(
175
+ "/graphql-merchants",
176
+ {
177
+ query: print(UpdateLocationDocument),
178
+ variables: {
179
+ id,
180
+ input,
181
+ },
182
+ },
183
+ merchantId,
184
+ );
185
+ if (!response.data?.updateLocation) {
186
+ throw new Error("Failed to update location: No data returned");
103
187
  }
104
- async createLocation(input, merchantId) {
105
- const response = await this.httpClient.request('/graphql-merchants', {
106
- query: print(CreateLocationDocument),
107
- variables: {
108
- input,
109
- },
110
- }, merchantId);
111
- if (!response.data?.createLocation) {
112
- throw new Error('Failed to create location: No data returned');
113
- }
114
- return response.data.createLocation;
188
+ return response.data.updateLocation;
189
+ }
190
+ async deleteLocation(id, merchantId) {
191
+ const response = await this.httpClient.request(
192
+ "/graphql-merchants",
193
+ {
194
+ query: print(DeleteLocationDocument),
195
+ variables: {
196
+ id,
197
+ },
198
+ },
199
+ merchantId,
200
+ );
201
+ if (
202
+ response.data?.deleteLocation === undefined ||
203
+ response.data.deleteLocation === null
204
+ ) {
205
+ throw new Error("Failed to delete location: No data returned");
115
206
  }
116
- async updateLocation(id, input, merchantId) {
117
- const response = await this.httpClient.request('/graphql-merchants', {
118
- query: print(UpdateLocationDocument),
119
- variables: {
120
- id,
121
- input,
122
- },
123
- }, merchantId);
124
- if (!response.data?.updateLocation) {
125
- throw new Error('Failed to update location: No data returned');
126
- }
127
- return response.data.updateLocation;
207
+ return response.data.deleteLocation;
208
+ }
209
+ async restoreLocation(id, merchantId) {
210
+ const response = await this.httpClient.request(
211
+ "/graphql-merchants",
212
+ {
213
+ query: print(RestoreLocationDocument),
214
+ variables: {
215
+ id,
216
+ },
217
+ },
218
+ merchantId,
219
+ );
220
+ if (!response.data?.restoreLocation) {
221
+ throw new Error("Failed to restore location: No data returned");
128
222
  }
129
- async deleteLocation(id, merchantId) {
130
- const response = await this.httpClient.request('/graphql-merchants', {
131
- query: print(DeleteLocationDocument),
132
- variables: {
133
- id,
134
- },
135
- }, merchantId);
136
- if (response.data?.deleteLocation === undefined ||
137
- response.data.deleteLocation === null) {
138
- throw new Error('Failed to delete location: No data returned');
139
- }
140
- return response.data.deleteLocation;
223
+ return response.data.restoreLocation;
224
+ }
225
+ async getLocationTaxJurisdictions(locationId) {
226
+ const response = await this.httpClient.request("/graphql-merchants", {
227
+ query: print(GetLocationTaxJurisdictionsDocument),
228
+ variables: {
229
+ locationId,
230
+ },
231
+ });
232
+ if (!response.data?.getLocationTaxJurisdictions) {
233
+ throw new Error(
234
+ "Failed to get location tax jurisdictions: No data returned",
235
+ );
141
236
  }
142
- async restoreLocation(id, merchantId) {
143
- const response = await this.httpClient.request('/graphql-merchants', {
144
- query: print(RestoreLocationDocument),
145
- variables: {
146
- id,
147
- },
148
- }, merchantId);
149
- if (!response.data?.restoreLocation) {
150
- throw new Error('Failed to restore location: No data returned');
151
- }
152
- return response.data.restoreLocation;
237
+ return response.data.getLocationTaxJurisdictions;
238
+ }
239
+ async createLocationTaxJurisdiction(input) {
240
+ const response = await this.httpClient.request("/graphql-merchants", {
241
+ query: print(CreateLocationTaxJurisdictionDocument),
242
+ variables: {
243
+ input,
244
+ },
245
+ });
246
+ if (!response.data?.createLocationTaxJurisdiction) {
247
+ throw new Error(
248
+ "Failed to create location tax jurisdiction: No data returned",
249
+ );
153
250
  }
154
- async getLocationTaxJurisdictions(locationId) {
155
- const response = await this.httpClient.request('/graphql-merchants', {
156
- query: print(GetLocationTaxJurisdictionsDocument),
157
- variables: {
158
- locationId,
159
- },
160
- });
161
- if (!response.data?.getLocationTaxJurisdictions) {
162
- throw new Error('Failed to get location tax jurisdictions: No data returned');
163
- }
164
- return response.data.getLocationTaxJurisdictions;
251
+ return response.data.createLocationTaxJurisdiction;
252
+ }
253
+ async updateLocationTaxJurisdiction(id, input, merchantId) {
254
+ const response = await this.httpClient.request(
255
+ "/graphql-merchants",
256
+ {
257
+ query: print(UpdateLocationTaxJurisdictionDocument),
258
+ variables: {
259
+ id,
260
+ input,
261
+ },
262
+ },
263
+ merchantId,
264
+ );
265
+ if (!response.data?.updateLocationTaxJurisdiction) {
266
+ throw new Error(
267
+ "Failed to update location tax jurisdiction: No data returned",
268
+ );
165
269
  }
166
- async createLocationTaxJurisdiction(input) {
167
- const response = await this.httpClient.request('/graphql-merchants', {
168
- query: print(CreateLocationTaxJurisdictionDocument),
169
- variables: {
170
- input,
171
- },
172
- });
173
- if (!response.data?.createLocationTaxJurisdiction) {
174
- throw new Error('Failed to create location tax jurisdiction: No data returned');
175
- }
176
- return response.data.createLocationTaxJurisdiction;
270
+ return response.data.updateLocationTaxJurisdiction;
271
+ }
272
+ async deleteLocationTaxJurisdiction(id, merchantId) {
273
+ const response = await this.httpClient.request(
274
+ "/graphql-merchants",
275
+ {
276
+ query: print(DeleteLocationTaxJurisdictionDocument),
277
+ variables: {
278
+ id,
279
+ },
280
+ },
281
+ merchantId,
282
+ );
283
+ if (
284
+ response.data?.deleteLocationTaxJurisdiction === undefined ||
285
+ response.data.deleteLocationTaxJurisdiction === null
286
+ ) {
287
+ throw new Error(
288
+ "Failed to delete location tax jurisdiction: No data returned",
289
+ );
177
290
  }
178
- async updateLocationTaxJurisdiction(id, input, merchantId) {
179
- const response = await this.httpClient.request('/graphql-merchants', {
180
- query: print(UpdateLocationTaxJurisdictionDocument),
181
- variables: {
182
- id,
183
- input,
184
- },
185
- }, merchantId);
186
- if (!response.data?.updateLocationTaxJurisdiction) {
187
- throw new Error('Failed to update location tax jurisdiction: No data returned');
188
- }
189
- return response.data.updateLocationTaxJurisdiction;
291
+ return response.data.deleteLocationTaxJurisdiction;
292
+ }
293
+ async inviteUserToMerchant(input, merchantId) {
294
+ const response = await this.httpClient.request(
295
+ "/graphql-merchants",
296
+ {
297
+ query: print(InviteUserToMerchantDocument),
298
+ variables: {
299
+ input,
300
+ },
301
+ },
302
+ merchantId,
303
+ );
304
+ if (!response.data?.inviteUserToMerchant) {
305
+ throw new Error("Failed to invite user to merchant: No data returned");
190
306
  }
191
- async deleteLocationTaxJurisdiction(id, merchantId) {
192
- const response = await this.httpClient.request('/graphql-merchants', {
193
- query: print(DeleteLocationTaxJurisdictionDocument),
194
- variables: {
195
- id,
196
- },
197
- }, merchantId);
198
- if (response.data?.deleteLocationTaxJurisdiction === undefined ||
199
- response.data.deleteLocationTaxJurisdiction === null) {
200
- throw new Error('Failed to delete location tax jurisdiction: No data returned');
201
- }
202
- return response.data.deleteLocationTaxJurisdiction;
307
+ return response.data.inviteUserToMerchant;
308
+ }
309
+ async listMerchantUsers(merchantId) {
310
+ const response = await this.httpClient.request(
311
+ "/graphql-merchants",
312
+ {
313
+ query: print(ListMerchantUsersDocument),
314
+ variables: {
315
+ merchantId,
316
+ },
317
+ },
318
+ merchantId,
319
+ );
320
+ if (!response.data?.listMerchantUsers) {
321
+ throw new Error("Failed to list merchant users: No data returned");
203
322
  }
204
- async inviteUserToMerchant(input, merchantId) {
205
- const response = await this.httpClient.request('/graphql-merchants', {
206
- query: print(InviteUserToMerchantDocument),
207
- variables: {
208
- input,
209
- },
210
- }, merchantId);
211
- if (!response.data?.inviteUserToMerchant) {
212
- throw new Error('Failed to invite user to merchant: No data returned');
213
- }
214
- return response.data.inviteUserToMerchant;
323
+ return response.data.listMerchantUsers;
324
+ }
325
+ async listLocationUsers(locationId, merchantId) {
326
+ const response = await this.httpClient.request(
327
+ "/graphql-merchants",
328
+ {
329
+ query: print(ListLocationUsersDocument),
330
+ variables: {
331
+ locationId,
332
+ merchantId,
333
+ },
334
+ },
335
+ merchantId,
336
+ );
337
+ if (!response.data?.listLocationUsers) {
338
+ throw new Error("Failed to list location users: No data returned");
215
339
  }
216
- async listMerchantUsers(merchantId) {
217
- const response = await this.httpClient.request('/graphql-merchants', {
218
- query: print(ListMerchantUsersDocument),
219
- variables: {
220
- merchantId,
221
- },
222
- }, merchantId);
223
- if (!response.data?.listMerchantUsers) {
224
- throw new Error('Failed to list merchant users: No data returned');
225
- }
226
- return response.data.listMerchantUsers;
340
+ return response.data.listLocationUsers;
341
+ }
342
+ async listRoles() {
343
+ const response = await this.httpClient.request("/graphql-merchants", {
344
+ query: print(ListRolesDocument),
345
+ variables: {},
346
+ });
347
+ if (!response.data?.listRoles) {
348
+ throw new Error("Failed to list roles: No data returned");
227
349
  }
228
- async listLocationUsers(locationId, merchantId) {
229
- const response = await this.httpClient.request('/graphql-merchants', {
230
- query: print(ListLocationUsersDocument),
231
- variables: {
232
- locationId,
233
- merchantId,
234
- },
235
- }, merchantId);
236
- if (!response.data?.listLocationUsers) {
237
- throw new Error('Failed to list location users: No data returned');
238
- }
239
- return response.data.listLocationUsers;
350
+ return response.data.listRoles;
351
+ }
352
+ async acceptInvitation(email, merchantId) {
353
+ const response = await this.httpClient.request("/graphql-merchants", {
354
+ query: print(AcceptInvitationDocument),
355
+ variables: {
356
+ input: {
357
+ email,
358
+ merchantId,
359
+ },
360
+ },
361
+ });
362
+ if (!response.data?.acceptInvitation) {
363
+ throw new Error("Failed to accept invitation: No data returned");
240
364
  }
241
- async listRoles() {
242
- const response = await this.httpClient.request('/graphql-merchants', {
243
- query: print(ListRolesDocument),
244
- variables: {},
245
- });
246
- if (!response.data?.listRoles) {
247
- throw new Error('Failed to list roles: No data returned');
248
- }
249
- return response.data.listRoles;
365
+ return response.data.acceptInvitation;
366
+ }
367
+ async deleteInvitation(email, merchantId) {
368
+ const response = await this.httpClient.request(
369
+ "/graphql-merchants",
370
+ {
371
+ query: print(DeleteInvitationDocument),
372
+ variables: {
373
+ input: {
374
+ email,
375
+ merchantId,
376
+ },
377
+ },
378
+ },
379
+ merchantId,
380
+ );
381
+ if (response.data?.deleteInvitation === undefined) {
382
+ throw new Error("Failed to delete invitation: No data returned");
250
383
  }
251
- async acceptInvitation(email, merchantId) {
252
- const response = await this.httpClient.request('/graphql-merchants', {
253
- query: print(AcceptInvitationDocument),
254
- variables: {
255
- input: {
256
- email,
257
- merchantId,
258
- },
259
- },
260
- });
261
- if (!response.data?.acceptInvitation) {
262
- throw new Error('Failed to accept invitation: No data returned');
263
- }
264
- return response.data.acceptInvitation;
384
+ return response.data.deleteInvitation;
385
+ }
386
+ async removeUserFromMerchant(userId, merchantId) {
387
+ const response = await this.httpClient.request(
388
+ "/graphql-merchants",
389
+ {
390
+ query: print(RemoveUserFromMerchantDocument),
391
+ variables: {
392
+ input: {
393
+ userId,
394
+ merchantId,
395
+ },
396
+ },
397
+ },
398
+ merchantId,
399
+ );
400
+ if (response.data?.removeUserFromMerchant === undefined) {
401
+ throw new Error("Failed to remove user from merchant: No data returned");
265
402
  }
266
- async deleteInvitation(email, merchantId) {
267
- const response = await this.httpClient.request('/graphql-merchants', {
268
- query: print(DeleteInvitationDocument),
269
- variables: {
270
- input: {
271
- email,
272
- merchantId,
273
- },
274
- },
275
- }, merchantId);
276
- if (response.data?.deleteInvitation === undefined) {
277
- throw new Error('Failed to delete invitation: No data returned');
278
- }
279
- return response.data.deleteInvitation;
403
+ return response.data.removeUserFromMerchant;
404
+ }
405
+ async assignRolesToUser(userId, merchantId, roleNames, locationIds) {
406
+ const response = await this.httpClient.request(
407
+ "/graphql-merchants",
408
+ {
409
+ query: print(AssignRolesToUserDocument),
410
+ variables: {
411
+ input: {
412
+ userId,
413
+ merchantId,
414
+ roleNames,
415
+ locations: locationIds,
416
+ },
417
+ },
418
+ },
419
+ merchantId,
420
+ );
421
+ if (!response.data?.assignRolesToUser) {
422
+ throw new Error("Failed to assign roles to user: No data returned");
280
423
  }
281
- async removeUserFromMerchant(userId, merchantId) {
282
- const response = await this.httpClient.request('/graphql-merchants', {
283
- query: print(RemoveUserFromMerchantDocument),
284
- variables: {
285
- input: {
286
- userId,
287
- merchantId,
288
- },
289
- },
290
- }, merchantId);
291
- if (response.data?.removeUserFromMerchant === undefined) {
292
- throw new Error('Failed to remove user from merchant: No data returned');
293
- }
294
- return response.data.removeUserFromMerchant;
295
- }
296
- async assignRolesToUser(userId, merchantId, roleNames, locationIds) {
297
- const response = await this.httpClient.request('/graphql-merchants', {
298
- query: print(AssignRolesToUserDocument),
299
- variables: {
300
- input: {
301
- userId,
302
- merchantId,
303
- roleNames,
304
- locations: locationIds,
305
- },
306
- },
307
- }, merchantId);
308
- if (!response.data?.assignRolesToUser) {
309
- throw new Error('Failed to assign roles to user: No data returned');
310
- }
311
- return response.data.assignRolesToUser;
312
- }
313
- async setUserLocations(userId, merchantId, locationIds) {
314
- const response = await this.httpClient.request('/graphql-merchants', {
315
- query: print(SetUserLocationsDocument),
316
- variables: {
317
- input: {
318
- userId,
319
- merchantId,
320
- locationIds,
321
- },
322
- },
323
- }, merchantId);
324
- if (!response.data?.setUserLocations) {
325
- throw new Error('Failed to set user locations: No data returned');
326
- }
327
- return response.data.setUserLocations;
424
+ return response.data.assignRolesToUser;
425
+ }
426
+ async setUserLocations(userId, merchantId, locationIds) {
427
+ const response = await this.httpClient.request(
428
+ "/graphql-merchants",
429
+ {
430
+ query: print(SetUserLocationsDocument),
431
+ variables: {
432
+ input: {
433
+ userId,
434
+ merchantId,
435
+ locationIds,
436
+ },
437
+ },
438
+ },
439
+ merchantId,
440
+ );
441
+ if (!response.data?.setUserLocations) {
442
+ throw new Error("Failed to set user locations: No data returned");
328
443
  }
444
+ return response.data.setUserLocations;
445
+ }
329
446
  }
330
- //# sourceMappingURL=MerchantsClient.js.map
447
+ //# sourceMappingURL=MerchantsClient.js.map