@revenexx/sdk 0.0.7 → 0.0.10

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.
@@ -60,7 +60,7 @@ export class Inventories {
60
60
  const apiPath = '/v1/inventories/adjust';
61
61
  const apiPayload: Payload = {};
62
62
  if (typeof items !== 'undefined') {
63
- apiPayload['items'] = items;
63
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
64
64
  }
65
65
  if (typeof locationCode !== 'undefined') {
66
66
  apiPayload['location_code'] = locationCode;
@@ -124,7 +124,7 @@ export class Inventories {
124
124
  const apiPath = '/v1/inventories/availability';
125
125
  const apiPayload: Payload = {};
126
126
  if (typeof items !== 'undefined') {
127
- apiPayload['items'] = items;
127
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
128
128
  }
129
129
  if (typeof locationCode !== 'undefined') {
130
130
  apiPayload['location_code'] = locationCode;
@@ -668,7 +668,7 @@ export class Inventories {
668
668
  const apiPath = '/v1/inventories/receive';
669
669
  const apiPayload: Payload = {};
670
670
  if (typeof items !== 'undefined') {
671
- apiPayload['items'] = items;
671
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
672
672
  }
673
673
  if (typeof locationCode !== 'undefined') {
674
674
  apiPayload['location_code'] = locationCode;
@@ -866,7 +866,7 @@ export class Inventories {
866
866
  apiPayload['expires_at'] = expiresAt;
867
867
  }
868
868
  if (typeof items !== 'undefined') {
869
- apiPayload['items'] = items;
869
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
870
870
  }
871
871
  if (typeof orderRef !== 'undefined') {
872
872
  apiPayload['order_ref'] = orderRef;
@@ -935,7 +935,7 @@ export class Inventories {
935
935
  const apiPath = '/v1/inventories/restock';
936
936
  const apiPayload: Payload = {};
937
937
  if (typeof items !== 'undefined') {
938
- apiPayload['items'] = items;
938
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
939
939
  }
940
940
  if (typeof locationCode !== 'undefined') {
941
941
  apiPayload['location_code'] = locationCode;
@@ -105,7 +105,7 @@ export class Orderlists {
105
105
  const apiPath = '/v1/orderlists';
106
106
  const apiPayload: Payload = {};
107
107
  if (typeof items !== 'undefined') {
108
- apiPayload['items'] = items;
108
+ apiPayload['items'] = Client.toWireKeys(items, {"categorySlug":{"wire":"category_slug","children":null},"costCenterId":{"wire":"cost_center_id","children":null},"customSku":{"wire":"custom_sku","children":null},"positionTexts":{"wire":"position_texts","children":null},"productId":{"wire":"product_id","children":null},"subcategorySlug":{"wire":"subcategory_slug","children":null},"taxRate":{"wire":"tax_rate","children":null}});
109
109
  }
110
110
  if (typeof kind !== 'undefined') {
111
111
  apiPayload['kind'] = kind;
@@ -594,7 +594,7 @@ export class Orderlists {
594
594
  const apiPath = '/v1/orderlists/{list_id}/items'.replace('{list_id}', listId);
595
595
  const apiPayload: Payload = {};
596
596
  if (typeof items !== 'undefined') {
597
- apiPayload['items'] = items;
597
+ apiPayload['items'] = Client.toWireKeys(items, {"categorySlug":{"wire":"category_slug","children":null},"costCenterId":{"wire":"cost_center_id","children":null},"customSku":{"wire":"custom_sku","children":null},"positionTexts":{"wire":"position_texts","children":null},"productId":{"wire":"product_id","children":null},"subcategorySlug":{"wire":"subcategory_slug","children":null},"taxRate":{"wire":"tax_rate","children":null}});
598
598
  }
599
599
  const uri = new URL(this.client.config.endpoint + apiPath);
600
600
 
@@ -2,8 +2,10 @@ 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 { OrderCommentVisibility } from '../enums/order-comment-visibility';
5
+ import { OrderStatus } from '../enums/order-status';
6
6
  import { OrderPaymentStatus } from '../enums/order-payment-status';
7
+ import { OrderFulfillmentStatus } from '../enums/order-fulfillment-status';
8
+ import { OrderCommentVisibility } from '../enums/order-comment-visibility';
7
9
 
8
10
  export class Orders {
9
11
  client: Client;
@@ -14,13 +16,111 @@ export class Orders {
14
16
 
15
17
  /**
16
18
  *
19
+ * @param {OrderStatus} params.status - Filter by order status (exact match).
20
+ * @param {OrderPaymentStatus} params.paymentStatus - Filter by payment status (exact match).
21
+ * @param {OrderFulfillmentStatus} params.fulfillmentStatus - Filter by fulfillment status (exact match).
22
+ * @param {string} params.contactId - Filter to one ordering contact.
23
+ * @param {string} params.organizationId - Filter to one B2B organization.
24
+ * @param {string} params.channelId - Filter to one sales channel.
25
+ * @param {string} params.marketId - Filter to one market.
26
+ * @param {string} params.number - Filter by exact order number.
27
+ * @param {number} params.limit - Page size (default 50, max 200).
28
+ * @param {number} params.offset - Row offset for pagination (default 0).
29
+ * @param {string} params.order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
30
+ * @throws {RevenexxException}
31
+ * @returns {Promise<{}>}
32
+ */
33
+ ordersList(params?: { status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string }): Promise<{}>;
34
+ /**
35
+ *
36
+ * @param {OrderStatus} status - Filter by order status (exact match).
37
+ * @param {OrderPaymentStatus} paymentStatus - Filter by payment status (exact match).
38
+ * @param {OrderFulfillmentStatus} fulfillmentStatus - Filter by fulfillment status (exact match).
39
+ * @param {string} contactId - Filter to one ordering contact.
40
+ * @param {string} organizationId - Filter to one B2B organization.
41
+ * @param {string} channelId - Filter to one sales channel.
42
+ * @param {string} marketId - Filter to one market.
43
+ * @param {string} number - Filter by exact order number.
44
+ * @param {number} limit - Page size (default 50, max 200).
45
+ * @param {number} offset - Row offset for pagination (default 0).
46
+ * @param {string} order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
17
47
  * @throws {RevenexxException}
18
48
  * @returns {Promise<{}>}
49
+ * @deprecated Use the object parameter style method for a better developer experience.
19
50
  */
20
- ordersList(): Promise<{}> {
51
+ ordersList(status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string): Promise<{}>;
52
+ ordersList(
53
+ paramsOrFirst?: { status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string } | OrderStatus,
54
+ ...rest: [(OrderPaymentStatus)?, (OrderFulfillmentStatus)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (number)?, (string)?]
55
+ ): Promise<{}> {
56
+ let params: { status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string };
57
+
58
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('status' in paramsOrFirst || 'paymentStatus' in paramsOrFirst || 'fulfillmentStatus' in paramsOrFirst || 'contactId' in paramsOrFirst || 'organizationId' in paramsOrFirst || 'channelId' in paramsOrFirst || 'marketId' in paramsOrFirst || 'number' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst || 'order' in paramsOrFirst))) {
59
+ params = (paramsOrFirst || {}) as { status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string };
60
+ } else {
61
+ params = {
62
+ status: paramsOrFirst as OrderStatus,
63
+ paymentStatus: rest[0] as OrderPaymentStatus,
64
+ fulfillmentStatus: rest[1] as OrderFulfillmentStatus,
65
+ contactId: rest[2] as string,
66
+ organizationId: rest[3] as string,
67
+ channelId: rest[4] as string,
68
+ marketId: rest[5] as string,
69
+ number: rest[6] as string,
70
+ limit: rest[7] as number,
71
+ offset: rest[8] as number,
72
+ order: rest[9] as string
73
+ };
74
+ }
75
+
76
+ const status = params.status;
77
+ const paymentStatus = params.paymentStatus;
78
+ const fulfillmentStatus = params.fulfillmentStatus;
79
+ const contactId = params.contactId;
80
+ const organizationId = params.organizationId;
81
+ const channelId = params.channelId;
82
+ const marketId = params.marketId;
83
+ const number = params.number;
84
+ const limit = params.limit;
85
+ const offset = params.offset;
86
+ const order = params.order;
87
+
21
88
 
22
89
  const apiPath = '/v1/orders';
23
90
  const apiPayload: Payload = {};
91
+ if (typeof status !== 'undefined') {
92
+ apiPayload['status'] = status;
93
+ }
94
+ if (typeof paymentStatus !== 'undefined') {
95
+ apiPayload['payment_status'] = paymentStatus;
96
+ }
97
+ if (typeof fulfillmentStatus !== 'undefined') {
98
+ apiPayload['fulfillment_status'] = fulfillmentStatus;
99
+ }
100
+ if (typeof contactId !== 'undefined') {
101
+ apiPayload['contact_id'] = contactId;
102
+ }
103
+ if (typeof organizationId !== 'undefined') {
104
+ apiPayload['organization_id'] = organizationId;
105
+ }
106
+ if (typeof channelId !== 'undefined') {
107
+ apiPayload['channel_id'] = channelId;
108
+ }
109
+ if (typeof marketId !== 'undefined') {
110
+ apiPayload['market_id'] = marketId;
111
+ }
112
+ if (typeof number !== 'undefined') {
113
+ apiPayload['number'] = number;
114
+ }
115
+ if (typeof limit !== 'undefined') {
116
+ apiPayload['limit'] = limit;
117
+ }
118
+ if (typeof offset !== 'undefined') {
119
+ apiPayload['offset'] = offset;
120
+ }
121
+ if (typeof order !== 'undefined') {
122
+ apiPayload['order'] = order;
123
+ }
24
124
  const uri = new URL(this.client.config.endpoint + apiPath);
25
125
 
26
126
  const apiHeaders: { [header: string]: string } = {
@@ -526,7 +626,7 @@ export class Orders {
526
626
  apiPayload['grand_total'] = grandTotal;
527
627
  }
528
628
  if (typeof items !== 'undefined') {
529
- apiPayload['items'] = items;
629
+ apiPayload['items'] = Client.toWireKeys(items, {"costCenter":{"wire":"cost_center","children":null},"positionText":{"wire":"position_text","children":null},"productId":{"wire":"product_id","children":null},"taxAmount":{"wire":"tax_amount","children":null},"taxRate":{"wire":"tax_rate","children":null},"unitPrice":{"wire":"unit_price","children":null},"userData":{"wire":"user_data","children":null}});
530
630
  }
531
631
  if (typeof marketId !== 'undefined') {
532
632
  apiPayload['market_id'] = marketId;
@@ -1118,7 +1218,7 @@ export class Orders {
1118
1218
  apiPayload['cancelled_by'] = cancelledBy;
1119
1219
  }
1120
1220
  if (typeof positions !== 'undefined') {
1121
- apiPayload['positions'] = positions;
1221
+ apiPayload['positions'] = Client.toWireKeys(positions, {"orderItemId":{"wire":"order_item_id","children":null}});
1122
1222
  }
1123
1223
  if (typeof reason !== 'undefined') {
1124
1224
  apiPayload['reason'] = reason;
@@ -1261,7 +1361,7 @@ export class Orders {
1261
1361
  apiPayload['metadata'] = metadata;
1262
1362
  }
1263
1363
  if (typeof positions !== 'undefined') {
1264
- apiPayload['positions'] = positions;
1364
+ apiPayload['positions'] = Client.toWireKeys(positions, {"orderItemId":{"wire":"order_item_id","children":null}});
1265
1365
  }
1266
1366
  if (typeof reason !== 'undefined') {
1267
1367
  apiPayload['reason'] = reason;
@@ -1560,7 +1660,7 @@ export class Orders {
1560
1660
  apiPayload['number'] = number;
1561
1661
  }
1562
1662
  if (typeof positions !== 'undefined') {
1563
- apiPayload['positions'] = positions;
1663
+ apiPayload['positions'] = Client.toWireKeys(positions, {"orderItemId":{"wire":"order_item_id","children":null}});
1564
1664
  }
1565
1665
  if (typeof shippedAt !== 'undefined') {
1566
1666
  apiPayload['shipped_at'] = shippedAt;
@@ -687,7 +687,7 @@ export class Prices {
687
687
  const apiPath = '/v1/prices/lists/{list_id}/entries'.replace('{list_id}', listId);
688
688
  const apiPayload: Payload = {};
689
689
  if (typeof entries !== 'undefined') {
690
- apiPayload['entries'] = entries;
690
+ apiPayload['entries'] = Client.toWireKeys(entries, {"priceType":{"wire":"price_type","children":null},"productId":{"wire":"product_id","children":null},"quantityMin":{"wire":"quantity_min","children":null},"unitPrice":{"wire":"unit_price","children":null},"validFrom":{"wire":"valid_from","children":null},"validUntil":{"wire":"valid_until","children":null}});
691
691
  }
692
692
  const uri = new URL(this.client.config.endpoint + apiPath);
693
693
 
@@ -748,7 +748,7 @@ export class Prices {
748
748
  const apiPath = '/v1/prices/lists/{list_id}/entries/bulk'.replace('{list_id}', listId);
749
749
  const apiPayload: Payload = {};
750
750
  if (typeof entries !== 'undefined') {
751
- apiPayload['entries'] = entries;
751
+ apiPayload['entries'] = Client.toWireKeys(entries, {"priceType":{"wire":"price_type","children":null},"productId":{"wire":"product_id","children":null},"quantityMin":{"wire":"quantity_min","children":null},"unitPrice":{"wire":"unit_price","children":null},"validFrom":{"wire":"valid_from","children":null},"validUntil":{"wire":"valid_until","children":null}});
752
752
  }
753
753
  const uri = new URL(this.client.config.endpoint + apiPath);
754
754
 
@@ -1073,7 +1073,7 @@ export class Prices {
1073
1073
  apiPayload['currency'] = currency;
1074
1074
  }
1075
1075
  if (typeof items !== 'undefined') {
1076
- apiPayload['items'] = items;
1076
+ apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
1077
1077
  }
1078
1078
  if (typeof marketId !== 'undefined') {
1079
1079
  apiPayload['market_id'] = marketId;
@@ -328,7 +328,7 @@ export class Search {
328
328
  const apiPath = '/v1/search/multi_search';
329
329
  const apiPayload: Payload = {};
330
330
  if (typeof searches !== 'undefined') {
331
- apiPayload['searches'] = searches;
331
+ apiPayload['searches'] = Client.toWireKeys(searches, {"facetBy":{"wire":"facet_by","children":null},"filterBy":{"wire":"filter_by","children":null},"perPage":{"wire":"per_page","children":null},"queryBy":{"wire":"query_by","children":null},"sortBy":{"wire":"sort_by","children":null}});
332
332
  }
333
333
  const uri = new URL(this.client.config.endpoint + apiPath);
334
334
 
@@ -659,7 +659,7 @@ export class Shipping {
659
659
  const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
660
660
  const apiPayload: Payload = {};
661
661
  if (typeof tiers !== 'undefined') {
662
- apiPayload['tiers'] = tiers;
662
+ apiPayload['tiers'] = Client.toWireKeys(tiers, {"fromValue":{"wire":"from_value","children":null}});
663
663
  }
664
664
  const uri = new URL(this.client.config.endpoint + apiPath);
665
665
 
package/types/client.d.ts CHANGED
@@ -202,6 +202,17 @@ declare class Client {
202
202
  chunkedUpload(method: string, url: URL, headers: Headers | undefined, originalPayload: Payload | undefined, onProgress: (progress: UploadProgress) => void): Promise<any>;
203
203
  ping(): Promise<string>;
204
204
  call(method: string, url: URL, headers?: Headers, params?: Payload, responseType?: string): Promise<any>;
205
+ /**
206
+ * Recursively renames an argument's DECLARED keys to their snake_case wire
207
+ * names, using a map generated from the API contract. Free-form subtrees
208
+ * (metadata / user_data — keys absent from the map, with no `children`) are
209
+ * passed through untouched, so user data is never mangled. For arrays the
210
+ * same element map is applied to every item.
211
+ */
212
+ static toWireKeys(value: any, map: Record<string, {
213
+ wire: string;
214
+ children: any;
215
+ }>): any;
205
216
  static flatten(data: Payload, prefix?: string): Payload;
206
217
  }
207
218
  export { Client, RevenexxException };
@@ -0,0 +1,5 @@
1
+ export declare enum FulfillmentStatus {
2
+ Unfulfilled = "unfulfilled",
3
+ Partial = "partial",
4
+ Fulfilled = "fulfilled"
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum OrderFulfillmentStatus {
2
+ Unfulfilled = "unfulfilled",
3
+ Partial = "partial",
4
+ Fulfilled = "fulfilled"
5
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum OrderStatus {
2
+ Pending = "pending",
3
+ Placed = "placed",
4
+ InFulfillment = "in_fulfillment",
5
+ Completed = "completed",
6
+ Cancelled = "cancelled"
7
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum PaymentStatus {
2
+ Open = "open",
3
+ Pending = "pending",
4
+ Authorized = "authorized",
5
+ Paid = "paid",
6
+ PartiallyPaid = "partially_paid",
7
+ Refunded = "refunded",
8
+ Failed = "failed"
9
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum Status {
2
+ Pending = "pending",
3
+ Placed = "placed",
4
+ InFulfillment = "in_fulfillment",
5
+ Completed = "completed",
6
+ Cancelled = "cancelled"
7
+ }
package/types/index.d.ts CHANGED
@@ -64,8 +64,10 @@ export { LocationType } from './enums/location-type';
64
64
  export { MarketStatus } from './enums/market-status';
65
65
  export { Priority } from './enums/priority';
66
66
  export { OrderListKind } from './enums/order-list-kind';
67
- export { OrderCommentVisibility } from './enums/order-comment-visibility';
67
+ export { OrderStatus } from './enums/order-status';
68
68
  export { OrderPaymentStatus } from './enums/order-payment-status';
69
+ export { OrderFulfillmentStatus } from './enums/order-fulfillment-status';
70
+ export { OrderCommentVisibility } from './enums/order-comment-visibility';
69
71
  export { PageStatus } from './enums/page-status';
70
72
  export { PaymentFeeType } from './enums/payment-fee-type';
71
73
  export { PaymentMethodKind } from './enums/payment-method-kind';
@@ -1,16 +1,59 @@
1
1
  import { Client } from '../client';
2
2
  import type { Models } from '../models';
3
- import { OrderCommentVisibility } from '../enums/order-comment-visibility';
3
+ import { OrderStatus } from '../enums/order-status';
4
4
  import { OrderPaymentStatus } from '../enums/order-payment-status';
5
+ import { OrderFulfillmentStatus } from '../enums/order-fulfillment-status';
6
+ import { OrderCommentVisibility } from '../enums/order-comment-visibility';
5
7
  export declare class Orders {
6
8
  client: Client;
7
9
  constructor(client: Client);
8
10
  /**
9
11
  *
12
+ * @param {OrderStatus} params.status - Filter by order status (exact match).
13
+ * @param {OrderPaymentStatus} params.paymentStatus - Filter by payment status (exact match).
14
+ * @param {OrderFulfillmentStatus} params.fulfillmentStatus - Filter by fulfillment status (exact match).
15
+ * @param {string} params.contactId - Filter to one ordering contact.
16
+ * @param {string} params.organizationId - Filter to one B2B organization.
17
+ * @param {string} params.channelId - Filter to one sales channel.
18
+ * @param {string} params.marketId - Filter to one market.
19
+ * @param {string} params.number - Filter by exact order number.
20
+ * @param {number} params.limit - Page size (default 50, max 200).
21
+ * @param {number} params.offset - Row offset for pagination (default 0).
22
+ * @param {string} params.order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
23
+ * @throws {RevenexxException}
24
+ * @returns {Promise<{}>}
25
+ */
26
+ ordersList(params?: {
27
+ status?: OrderStatus;
28
+ paymentStatus?: OrderPaymentStatus;
29
+ fulfillmentStatus?: OrderFulfillmentStatus;
30
+ contactId?: string;
31
+ organizationId?: string;
32
+ channelId?: string;
33
+ marketId?: string;
34
+ number?: string;
35
+ limit?: number;
36
+ offset?: number;
37
+ order?: string;
38
+ }): Promise<{}>;
39
+ /**
40
+ *
41
+ * @param {OrderStatus} status - Filter by order status (exact match).
42
+ * @param {OrderPaymentStatus} paymentStatus - Filter by payment status (exact match).
43
+ * @param {OrderFulfillmentStatus} fulfillmentStatus - Filter by fulfillment status (exact match).
44
+ * @param {string} contactId - Filter to one ordering contact.
45
+ * @param {string} organizationId - Filter to one B2B organization.
46
+ * @param {string} channelId - Filter to one sales channel.
47
+ * @param {string} marketId - Filter to one market.
48
+ * @param {string} number - Filter by exact order number.
49
+ * @param {number} limit - Page size (default 50, max 200).
50
+ * @param {number} offset - Row offset for pagination (default 0).
51
+ * @param {string} order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
10
52
  * @throws {RevenexxException}
11
53
  * @returns {Promise<{}>}
54
+ * @deprecated Use the object parameter style method for a better developer experience.
12
55
  */
13
- ordersList(): Promise<{}>;
56
+ ordersList(status?: OrderStatus, paymentStatus?: OrderPaymentStatus, fulfillmentStatus?: OrderFulfillmentStatus, contactId?: string, organizationId?: string, channelId?: string, marketId?: string, number?: string, limit?: number, offset?: number, order?: string): Promise<{}>;
14
57
  /**
15
58
  *
16
59
  * @throws {RevenexxException}