@revenexx/sdk 0.0.2 → 0.0.5

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 (90) hide show
  1. package/dist/cjs/sdk.js +13496 -3442
  2. package/dist/cjs/sdk.js.map +1 -1
  3. package/dist/esm/sdk.js +13467 -3443
  4. package/dist/esm/sdk.js.map +1 -1
  5. package/dist/iife/sdk.js +13496 -3442
  6. package/package.json +1 -1
  7. package/src/client.ts +1 -1
  8. package/src/enums/address-type.ts +4 -0
  9. package/src/enums/cart-export-format.ts +4 -0
  10. package/src/enums/cart-io-apply-mode.ts +5 -0
  11. package/src/enums/cart-io-direction.ts +4 -0
  12. package/src/enums/cart-io-entity.ts +4 -0
  13. package/src/enums/cart-io-format.ts +4 -0
  14. package/src/enums/cart-item-type.ts +5 -0
  15. package/src/enums/channel-status.ts +4 -0
  16. package/src/enums/channel-type.ts +7 -0
  17. package/src/enums/contact-role.ts +6 -0
  18. package/src/enums/contact-status.ts +5 -0
  19. package/src/enums/location-type.ts +6 -0
  20. package/src/enums/market-status.ts +4 -0
  21. package/src/enums/order-comment-visibility.ts +4 -0
  22. package/src/enums/order-item-type.ts +5 -0
  23. package/src/enums/order-payment-status.ts +9 -0
  24. package/src/enums/organization-status.ts +4 -0
  25. package/src/enums/page-status.ts +5 -0
  26. package/src/enums/payment-fee-type.ts +5 -0
  27. package/src/enums/payment-method-kind.ts +4 -0
  28. package/src/enums/price-entry-type.ts +4 -0
  29. package/src/enums/price-list-status.ts +4 -0
  30. package/src/enums/shipping-method-matrix-basis.ts +6 -0
  31. package/src/enums/shipping-method-pricing-type.ts +5 -0
  32. package/src/index.ts +30 -0
  33. package/src/models.ts +5628 -410
  34. package/src/services/apps.ts +154 -154
  35. package/src/services/avatars.ts +57 -57
  36. package/src/services/carts.ts +739 -104
  37. package/src/services/channels.ts +147 -19
  38. package/src/services/customers.ts +801 -69
  39. package/src/services/greetings.ts +18 -18
  40. package/src/services/inventories.ts +1278 -0
  41. package/src/services/locale.ts +16 -16
  42. package/src/services/markets.ts +373 -75
  43. package/src/services/messaging.ts +273 -273
  44. package/src/services/orders.ts +1648 -0
  45. package/src/services/pages.ts +2317 -0
  46. package/src/services/payments.ts +1334 -0
  47. package/src/services/prices.ts +1036 -0
  48. package/src/services/products.ts +1836 -272
  49. package/src/services/search.ts +24 -24
  50. package/src/services/shipping.ts +956 -0
  51. package/src/services/sites.ts +116 -116
  52. package/src/services/storage.ts +72 -72
  53. package/src/services/tokens.ts +14 -14
  54. package/types/enums/address-type.d.ts +4 -0
  55. package/types/enums/cart-export-format.d.ts +4 -0
  56. package/types/enums/cart-io-apply-mode.d.ts +5 -0
  57. package/types/enums/cart-io-direction.d.ts +4 -0
  58. package/types/enums/cart-io-entity.d.ts +4 -0
  59. package/types/enums/cart-io-format.d.ts +4 -0
  60. package/types/enums/cart-item-type.d.ts +5 -0
  61. package/types/enums/channel-status.d.ts +4 -0
  62. package/types/enums/channel-type.d.ts +7 -0
  63. package/types/enums/contact-role.d.ts +6 -0
  64. package/types/enums/contact-status.d.ts +5 -0
  65. package/types/enums/location-type.d.ts +6 -0
  66. package/types/enums/market-status.d.ts +4 -0
  67. package/types/enums/order-comment-visibility.d.ts +4 -0
  68. package/types/enums/order-item-type.d.ts +5 -0
  69. package/types/enums/order-payment-status.d.ts +9 -0
  70. package/types/enums/organization-status.d.ts +4 -0
  71. package/types/enums/page-status.d.ts +5 -0
  72. package/types/enums/payment-fee-type.d.ts +5 -0
  73. package/types/enums/payment-method-kind.d.ts +4 -0
  74. package/types/enums/price-entry-type.d.ts +4 -0
  75. package/types/enums/price-list-status.d.ts +4 -0
  76. package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
  77. package/types/enums/shipping-method-pricing-type.d.ts +5 -0
  78. package/types/index.d.ts +30 -0
  79. package/types/models.d.ts +5470 -404
  80. package/types/services/carts.d.ts +271 -12
  81. package/types/services/channels.d.ts +54 -2
  82. package/types/services/customers.d.ts +295 -12
  83. package/types/services/inventories.d.ts +440 -0
  84. package/types/services/markets.d.ts +123 -6
  85. package/types/services/orders.d.ts +590 -0
  86. package/types/services/pages.d.ts +792 -0
  87. package/types/services/payments.d.ts +480 -0
  88. package/types/services/prices.d.ts +384 -0
  89. package/types/services/products.d.ts +646 -32
  90. package/types/services/shipping.d.ts +351 -0
@@ -2,6 +2,8 @@ import { Service } from '../service';
2
2
  import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
3
3
  import type { Models } from '../models';
4
4
 
5
+ import { ChannelStatus } from '../enums/channel-status';
6
+ import { ChannelType } from '../enums/channel-type';
5
7
 
6
8
  export class Channels {
7
9
  client: Client;
@@ -18,7 +20,7 @@ export class Channels {
18
20
  channelsList(): Promise<{}> {
19
21
 
20
22
  const apiPath = '/v1/channels';
21
- const payload: Payload = {};
23
+ const apiPayload: Payload = {};
22
24
  const uri = new URL(this.client.config.endpoint + apiPath);
23
25
 
24
26
  const apiHeaders: { [header: string]: string } = {
@@ -28,19 +30,95 @@ export class Channels {
28
30
  'get',
29
31
  uri,
30
32
  apiHeaders,
31
- payload
33
+ apiPayload
32
34
  );
33
35
  }
34
36
 
35
37
  /**
36
38
  *
39
+ * @param {string} params.code - Stable channel code, unique per tenant (e.g. shop, punchout-acme).
40
+ * @param {string} params.name - Display name.
41
+ * @param {boolean} params.isDefault - Mark as the default channel (default false).
42
+ * @param {object} params.labels - Localized display names keyed by locale.
43
+ * @param {number} params.position - Sort position (default 0).
44
+ * @param {ChannelStatus} params.status - Lifecycle status (default 'active').
45
+ * @param {ChannelType} params.type - Where business happens (default 'storefront').
37
46
  * @throws {RevenexxException}
38
47
  * @returns {Promise<Models.Channel>}
39
48
  */
40
- channelsCreate(): Promise<Models.Channel> {
49
+ channelsCreate(params: { code: string, name: string, isDefault?: boolean, labels?: object, position?: number, status?: ChannelStatus, type?: ChannelType }): Promise<Models.Channel>;
50
+ /**
51
+ *
52
+ * @param {string} code - Stable channel code, unique per tenant (e.g. shop, punchout-acme).
53
+ * @param {string} name - Display name.
54
+ * @param {boolean} isDefault - Mark as the default channel (default false).
55
+ * @param {object} labels - Localized display names keyed by locale.
56
+ * @param {number} position - Sort position (default 0).
57
+ * @param {ChannelStatus} status - Lifecycle status (default 'active').
58
+ * @param {ChannelType} type - Where business happens (default 'storefront').
59
+ * @throws {RevenexxException}
60
+ * @returns {Promise<Models.Channel>}
61
+ * @deprecated Use the object parameter style method for a better developer experience.
62
+ */
63
+ channelsCreate(code: string, name: string, isDefault?: boolean, labels?: object, position?: number, status?: ChannelStatus, type?: ChannelType): Promise<Models.Channel>;
64
+ channelsCreate(
65
+ paramsOrFirst: { code: string, name: string, isDefault?: boolean, labels?: object, position?: number, status?: ChannelStatus, type?: ChannelType } | string,
66
+ ...rest: [(string)?, (boolean)?, (object)?, (number)?, (ChannelStatus)?, (ChannelType)?]
67
+ ): Promise<Models.Channel> {
68
+ let params: { code: string, name: string, isDefault?: boolean, labels?: object, position?: number, status?: ChannelStatus, type?: ChannelType };
69
+
70
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
71
+ params = (paramsOrFirst || {}) as { code: string, name: string, isDefault?: boolean, labels?: object, position?: number, status?: ChannelStatus, type?: ChannelType };
72
+ } else {
73
+ params = {
74
+ code: paramsOrFirst as string,
75
+ name: rest[0] as string,
76
+ isDefault: rest[1] as boolean,
77
+ labels: rest[2] as object,
78
+ position: rest[3] as number,
79
+ status: rest[4] as ChannelStatus,
80
+ type: rest[5] as ChannelType
81
+ };
82
+ }
83
+
84
+ const code = params.code;
85
+ const name = params.name;
86
+ const isDefault = params.isDefault;
87
+ const labels = params.labels;
88
+ const position = params.position;
89
+ const status = params.status;
90
+ const type = params.type;
91
+
92
+ if (typeof code === 'undefined') {
93
+ throw new RevenexxException('Missing required parameter: "code"');
94
+ }
95
+ if (typeof name === 'undefined') {
96
+ throw new RevenexxException('Missing required parameter: "name"');
97
+ }
41
98
 
42
99
  const apiPath = '/v1/channels';
43
- const payload: Payload = {};
100
+ const apiPayload: Payload = {};
101
+ if (typeof code !== 'undefined') {
102
+ apiPayload['code'] = code;
103
+ }
104
+ if (typeof isDefault !== 'undefined') {
105
+ apiPayload['is_default'] = isDefault;
106
+ }
107
+ if (typeof labels !== 'undefined') {
108
+ apiPayload['labels'] = labels;
109
+ }
110
+ if (typeof name !== 'undefined') {
111
+ apiPayload['name'] = name;
112
+ }
113
+ if (typeof position !== 'undefined') {
114
+ apiPayload['position'] = position;
115
+ }
116
+ if (typeof status !== 'undefined') {
117
+ apiPayload['status'] = status;
118
+ }
119
+ if (typeof type !== 'undefined') {
120
+ apiPayload['type'] = type;
121
+ }
44
122
  const uri = new URL(this.client.config.endpoint + apiPath);
45
123
 
46
124
  const apiHeaders: { [header: string]: string } = {
@@ -51,7 +129,7 @@ export class Channels {
51
129
  'post',
52
130
  uri,
53
131
  apiHeaders,
54
- payload
132
+ apiPayload
55
133
  );
56
134
  }
57
135
 
@@ -63,7 +141,7 @@ export class Channels {
63
141
  channelsDefaults(): Promise<Models.ChannelDefaults> {
64
142
 
65
143
  const apiPath = '/v1/channels/defaults';
66
- const payload: Payload = {};
144
+ const apiPayload: Payload = {};
67
145
  const uri = new URL(this.client.config.endpoint + apiPath);
68
146
 
69
147
  const apiHeaders: { [header: string]: string } = {
@@ -73,7 +151,7 @@ export class Channels {
73
151
  'post',
74
152
  uri,
75
153
  apiHeaders,
76
- payload
154
+ apiPayload
77
155
  );
78
156
  }
79
157
 
@@ -112,7 +190,7 @@ export class Channels {
112
190
  }
113
191
 
114
192
  const apiPath = '/v1/channels/{id}'.replace('{id}', id);
115
- const payload: Payload = {};
193
+ const apiPayload: Payload = {};
116
194
  const uri = new URL(this.client.config.endpoint + apiPath);
117
195
 
118
196
  const apiHeaders: { [header: string]: string } = {
@@ -122,7 +200,7 @@ export class Channels {
122
200
  'delete',
123
201
  uri,
124
202
  apiHeaders,
125
- payload
203
+ apiPayload
126
204
  );
127
205
  }
128
206
 
@@ -161,7 +239,7 @@ export class Channels {
161
239
  }
162
240
 
163
241
  const apiPath = '/v1/channels/{id}'.replace('{id}', id);
164
- const payload: Payload = {};
242
+ const apiPayload: Payload = {};
165
243
  const uri = new URL(this.client.config.endpoint + apiPath);
166
244
 
167
245
  const apiHeaders: { [header: string]: string } = {
@@ -171,46 +249,96 @@ export class Channels {
171
249
  'get',
172
250
  uri,
173
251
  apiHeaders,
174
- payload
252
+ apiPayload
175
253
  );
176
254
  }
177
255
 
178
256
  /**
179
257
  *
180
258
  * @param {string} params.id -
259
+ * @param {string} params.code - Stable channel code, unique per tenant (e.g. shop, punchout-acme).
260
+ * @param {boolean} params.isDefault - Mark as the default channel (default false).
261
+ * @param {object} params.labels - Localized display names keyed by locale.
262
+ * @param {string} params.name - Display name.
263
+ * @param {number} params.position - Sort position (default 0).
264
+ * @param {ChannelStatus} params.status - Lifecycle status (default 'active').
265
+ * @param {ChannelType} params.type - Where business happens (default 'storefront').
181
266
  * @throws {RevenexxException}
182
267
  * @returns {Promise<Models.Channel>}
183
268
  */
184
- channelsUpdate(params: { id: string }): Promise<Models.Channel>;
269
+ channelsUpdate(params: { id: string, code?: string, isDefault?: boolean, labels?: object, name?: string, position?: number, status?: ChannelStatus, type?: ChannelType }): Promise<Models.Channel>;
185
270
  /**
186
271
  *
187
272
  * @param {string} id -
273
+ * @param {string} code - Stable channel code, unique per tenant (e.g. shop, punchout-acme).
274
+ * @param {boolean} isDefault - Mark as the default channel (default false).
275
+ * @param {object} labels - Localized display names keyed by locale.
276
+ * @param {string} name - Display name.
277
+ * @param {number} position - Sort position (default 0).
278
+ * @param {ChannelStatus} status - Lifecycle status (default 'active').
279
+ * @param {ChannelType} type - Where business happens (default 'storefront').
188
280
  * @throws {RevenexxException}
189
281
  * @returns {Promise<Models.Channel>}
190
282
  * @deprecated Use the object parameter style method for a better developer experience.
191
283
  */
192
- channelsUpdate(id: string): Promise<Models.Channel>;
284
+ channelsUpdate(id: string, code?: string, isDefault?: boolean, labels?: object, name?: string, position?: number, status?: ChannelStatus, type?: ChannelType): Promise<Models.Channel>;
193
285
  channelsUpdate(
194
- paramsOrFirst: { id: string } | string
286
+ paramsOrFirst: { id: string, code?: string, isDefault?: boolean, labels?: object, name?: string, position?: number, status?: ChannelStatus, type?: ChannelType } | string,
287
+ ...rest: [(string)?, (boolean)?, (object)?, (string)?, (number)?, (ChannelStatus)?, (ChannelType)?]
195
288
  ): Promise<Models.Channel> {
196
- let params: { id: string };
289
+ let params: { id: string, code?: string, isDefault?: boolean, labels?: object, name?: string, position?: number, status?: ChannelStatus, type?: ChannelType };
197
290
 
198
291
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
199
- params = (paramsOrFirst || {}) as { id: string };
292
+ params = (paramsOrFirst || {}) as { id: string, code?: string, isDefault?: boolean, labels?: object, name?: string, position?: number, status?: ChannelStatus, type?: ChannelType };
200
293
  } else {
201
294
  params = {
202
- id: paramsOrFirst as string
295
+ id: paramsOrFirst as string,
296
+ code: rest[0] as string,
297
+ isDefault: rest[1] as boolean,
298
+ labels: rest[2] as object,
299
+ name: rest[3] as string,
300
+ position: rest[4] as number,
301
+ status: rest[5] as ChannelStatus,
302
+ type: rest[6] as ChannelType
203
303
  };
204
304
  }
205
305
 
206
306
  const id = params.id;
307
+ const code = params.code;
308
+ const isDefault = params.isDefault;
309
+ const labels = params.labels;
310
+ const name = params.name;
311
+ const position = params.position;
312
+ const status = params.status;
313
+ const type = params.type;
207
314
 
208
315
  if (typeof id === 'undefined') {
209
316
  throw new RevenexxException('Missing required parameter: "id"');
210
317
  }
211
318
 
212
319
  const apiPath = '/v1/channels/{id}'.replace('{id}', id);
213
- const payload: Payload = {};
320
+ const apiPayload: Payload = {};
321
+ if (typeof code !== 'undefined') {
322
+ apiPayload['code'] = code;
323
+ }
324
+ if (typeof isDefault !== 'undefined') {
325
+ apiPayload['is_default'] = isDefault;
326
+ }
327
+ if (typeof labels !== 'undefined') {
328
+ apiPayload['labels'] = labels;
329
+ }
330
+ if (typeof name !== 'undefined') {
331
+ apiPayload['name'] = name;
332
+ }
333
+ if (typeof position !== 'undefined') {
334
+ apiPayload['position'] = position;
335
+ }
336
+ if (typeof status !== 'undefined') {
337
+ apiPayload['status'] = status;
338
+ }
339
+ if (typeof type !== 'undefined') {
340
+ apiPayload['type'] = type;
341
+ }
214
342
  const uri = new URL(this.client.config.endpoint + apiPath);
215
343
 
216
344
  const apiHeaders: { [header: string]: string } = {
@@ -221,7 +349,7 @@ export class Channels {
221
349
  'put',
222
350
  uri,
223
351
  apiHeaders,
224
- payload
352
+ apiPayload
225
353
  );
226
354
  }
227
355
  }