@commercelayer/sdk 5.0.0 → 5.1.0

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 (137) hide show
  1. package/lib/cjs/api.d.ts +6 -5
  2. package/lib/cjs/api.js +4 -1
  3. package/lib/cjs/commercelayer.d.ts +3 -2
  4. package/lib/cjs/commercelayer.js +2 -1
  5. package/lib/cjs/model.d.ts +1 -0
  6. package/lib/cjs/resource.d.ts +1 -1
  7. package/lib/cjs/resources/addresses.d.ts +13 -2
  8. package/lib/cjs/resources/addresses.js +8 -0
  9. package/lib/cjs/resources/adyen_payments.d.ts +8 -8
  10. package/lib/cjs/resources/axerve_payments.d.ts +3 -3
  11. package/lib/cjs/resources/braintree_payments.d.ts +4 -4
  12. package/lib/cjs/resources/bundles.d.ts +11 -0
  13. package/lib/cjs/resources/bundles.js +8 -0
  14. package/lib/cjs/resources/checkout_com_payments.d.ts +2 -2
  15. package/lib/cjs/resources/cleanups.d.ts +3 -3
  16. package/lib/cjs/resources/coupons.d.ts +15 -4
  17. package/lib/cjs/resources/coupons.js +8 -0
  18. package/lib/cjs/resources/customers.d.ts +8 -0
  19. package/lib/cjs/resources/customers.js +4 -0
  20. package/lib/cjs/resources/event_callbacks.d.ts +1 -1
  21. package/lib/cjs/resources/exports.d.ts +2 -2
  22. package/lib/cjs/resources/external_payments.d.ts +4 -4
  23. package/lib/cjs/resources/external_promotions.d.ts +8 -0
  24. package/lib/cjs/resources/external_promotions.js +4 -0
  25. package/lib/cjs/resources/fixed_amount_promotions.d.ts +8 -0
  26. package/lib/cjs/resources/fixed_amount_promotions.js +4 -0
  27. package/lib/cjs/resources/fixed_price_promotions.d.ts +8 -0
  28. package/lib/cjs/resources/fixed_price_promotions.js +4 -0
  29. package/lib/cjs/resources/free_gift_promotions.d.ts +8 -0
  30. package/lib/cjs/resources/free_gift_promotions.js +4 -0
  31. package/lib/cjs/resources/free_shipping_promotions.d.ts +8 -0
  32. package/lib/cjs/resources/free_shipping_promotions.js +4 -0
  33. package/lib/cjs/resources/gift_cards.d.ts +9 -1
  34. package/lib/cjs/resources/gift_cards.js +4 -0
  35. package/lib/cjs/resources/imports.d.ts +4 -4
  36. package/lib/cjs/resources/klarna_payments.d.ts +2 -2
  37. package/lib/cjs/resources/line_item_options.d.ts +16 -5
  38. package/lib/cjs/resources/line_item_options.js +8 -0
  39. package/lib/cjs/resources/line_items.d.ts +13 -2
  40. package/lib/cjs/resources/line_items.js +8 -0
  41. package/lib/cjs/resources/order_copies.d.ts +1 -1
  42. package/lib/cjs/resources/order_factories.d.ts +1 -1
  43. package/lib/cjs/resources/order_subscriptions.d.ts +2 -2
  44. package/lib/cjs/resources/orders.d.ts +9 -1
  45. package/lib/cjs/resources/orders.js +4 -0
  46. package/lib/cjs/resources/parcels.d.ts +3 -0
  47. package/lib/cjs/resources/paypal_payments.d.ts +1 -1
  48. package/lib/cjs/resources/percentage_discount_promotions.d.ts +8 -0
  49. package/lib/cjs/resources/percentage_discount_promotions.js +4 -0
  50. package/lib/cjs/resources/promotions.d.ts +3 -0
  51. package/lib/cjs/resources/promotions.js +4 -0
  52. package/lib/cjs/resources/recurring_order_copies.d.ts +1 -1
  53. package/lib/cjs/resources/return_line_items.d.ts +3 -3
  54. package/lib/cjs/resources/returns.d.ts +8 -0
  55. package/lib/cjs/resources/returns.js +4 -0
  56. package/lib/cjs/resources/satispay_gateways.d.ts +3 -0
  57. package/lib/cjs/resources/satispay_payments.d.ts +0 -3
  58. package/lib/cjs/resources/shipments.d.ts +2 -2
  59. package/lib/cjs/resources/sku_options.d.ts +11 -0
  60. package/lib/cjs/resources/sku_options.js +8 -0
  61. package/lib/cjs/resources/skus.d.ts +12 -1
  62. package/lib/cjs/resources/skus.js +8 -0
  63. package/lib/cjs/resources/stripe_payments.d.ts +5 -5
  64. package/lib/cjs/resources/tags.d.ts +28 -0
  65. package/lib/cjs/resources/tags.js +25 -0
  66. package/lib/cjs/resources/tax_rules.d.ts +1 -1
  67. package/lib/cjs/resources/wire_transfers.d.ts +1 -1
  68. package/lib/esm/api.d.ts +6 -5
  69. package/lib/esm/api.js +2 -0
  70. package/lib/esm/commercelayer.d.ts +3 -2
  71. package/lib/esm/commercelayer.js +2 -1
  72. package/lib/esm/model.d.ts +1 -0
  73. package/lib/esm/resource.d.ts +1 -1
  74. package/lib/esm/resources/addresses.d.ts +13 -2
  75. package/lib/esm/resources/addresses.js +8 -0
  76. package/lib/esm/resources/adyen_payments.d.ts +8 -8
  77. package/lib/esm/resources/axerve_payments.d.ts +3 -3
  78. package/lib/esm/resources/braintree_payments.d.ts +4 -4
  79. package/lib/esm/resources/bundles.d.ts +11 -0
  80. package/lib/esm/resources/bundles.js +8 -0
  81. package/lib/esm/resources/checkout_com_payments.d.ts +2 -2
  82. package/lib/esm/resources/cleanups.d.ts +3 -3
  83. package/lib/esm/resources/coupons.d.ts +15 -4
  84. package/lib/esm/resources/coupons.js +8 -0
  85. package/lib/esm/resources/customers.d.ts +8 -0
  86. package/lib/esm/resources/customers.js +4 -0
  87. package/lib/esm/resources/event_callbacks.d.ts +1 -1
  88. package/lib/esm/resources/exports.d.ts +2 -2
  89. package/lib/esm/resources/external_payments.d.ts +4 -4
  90. package/lib/esm/resources/external_promotions.d.ts +8 -0
  91. package/lib/esm/resources/external_promotions.js +4 -0
  92. package/lib/esm/resources/fixed_amount_promotions.d.ts +8 -0
  93. package/lib/esm/resources/fixed_amount_promotions.js +4 -0
  94. package/lib/esm/resources/fixed_price_promotions.d.ts +8 -0
  95. package/lib/esm/resources/fixed_price_promotions.js +4 -0
  96. package/lib/esm/resources/free_gift_promotions.d.ts +8 -0
  97. package/lib/esm/resources/free_gift_promotions.js +4 -0
  98. package/lib/esm/resources/free_shipping_promotions.d.ts +8 -0
  99. package/lib/esm/resources/free_shipping_promotions.js +4 -0
  100. package/lib/esm/resources/gift_cards.d.ts +9 -1
  101. package/lib/esm/resources/gift_cards.js +4 -0
  102. package/lib/esm/resources/imports.d.ts +4 -4
  103. package/lib/esm/resources/klarna_payments.d.ts +2 -2
  104. package/lib/esm/resources/line_item_options.d.ts +16 -5
  105. package/lib/esm/resources/line_item_options.js +8 -0
  106. package/lib/esm/resources/line_items.d.ts +13 -2
  107. package/lib/esm/resources/line_items.js +8 -0
  108. package/lib/esm/resources/order_copies.d.ts +1 -1
  109. package/lib/esm/resources/order_factories.d.ts +1 -1
  110. package/lib/esm/resources/order_subscriptions.d.ts +2 -2
  111. package/lib/esm/resources/orders.d.ts +9 -1
  112. package/lib/esm/resources/orders.js +4 -0
  113. package/lib/esm/resources/parcels.d.ts +3 -0
  114. package/lib/esm/resources/paypal_payments.d.ts +1 -1
  115. package/lib/esm/resources/percentage_discount_promotions.d.ts +8 -0
  116. package/lib/esm/resources/percentage_discount_promotions.js +4 -0
  117. package/lib/esm/resources/promotions.d.ts +3 -0
  118. package/lib/esm/resources/promotions.js +4 -0
  119. package/lib/esm/resources/recurring_order_copies.d.ts +1 -1
  120. package/lib/esm/resources/return_line_items.d.ts +3 -3
  121. package/lib/esm/resources/returns.d.ts +8 -0
  122. package/lib/esm/resources/returns.js +4 -0
  123. package/lib/esm/resources/satispay_gateways.d.ts +3 -0
  124. package/lib/esm/resources/satispay_payments.d.ts +0 -3
  125. package/lib/esm/resources/shipments.d.ts +2 -2
  126. package/lib/esm/resources/sku_options.d.ts +11 -0
  127. package/lib/esm/resources/sku_options.js +8 -0
  128. package/lib/esm/resources/skus.d.ts +12 -1
  129. package/lib/esm/resources/skus.js +8 -0
  130. package/lib/esm/resources/stripe_payments.d.ts +5 -5
  131. package/lib/esm/resources/tags.d.ts +28 -0
  132. package/lib/esm/resources/tags.js +23 -0
  133. package/lib/esm/resources/tax_rules.d.ts +1 -1
  134. package/lib/esm/resources/wire_transfers.d.ts +1 -1
  135. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  136. package/lib/tsconfig.tsbuildinfo +1 -1
  137. package/package.json +10 -10
@@ -31,6 +31,7 @@ import type { OrderCopy } from './order_copies';
31
31
  import type { RecurringOrderCopy } from './recurring_order_copies';
32
32
  import type { Attachment } from './attachments';
33
33
  import type { Event } from './events';
34
+ import type { Tag, TagType } from './tags';
34
35
  type OrderType = 'orders';
35
36
  type OrderRel = ResourceRel & {
36
37
  type: OrderType;
@@ -77,6 +78,9 @@ type StripePaymentRel = ResourceRel & {
77
78
  type WireTransferRel = ResourceRel & {
78
79
  type: WireTransferType;
79
80
  };
81
+ type TagRel = ResourceRel & {
82
+ type: TagType;
83
+ };
80
84
  interface Order extends Resource {
81
85
  readonly type: OrderType;
82
86
  number?: number | null;
@@ -162,7 +166,7 @@ interface Order extends Resource {
162
166
  line_item_options_count?: number | null;
163
167
  shipments_count?: number | null;
164
168
  tax_calculations_count?: number | null;
165
- payment_source_details?: object | null;
169
+ payment_source_details?: Record<string, any> | null;
166
170
  token?: string | null;
167
171
  cart_url?: string | null;
168
172
  return_url?: string | null;
@@ -202,6 +206,7 @@ interface Order extends Resource {
202
206
  recurring_order_copies?: RecurringOrderCopy[] | null;
203
207
  attachments?: Attachment[] | null;
204
208
  events?: Event[] | null;
209
+ tags?: Tag[] | null;
205
210
  }
206
211
  interface OrderCreate extends ResourceCreate {
207
212
  autorefresh?: boolean | null;
@@ -223,6 +228,7 @@ interface OrderCreate extends ResourceCreate {
223
228
  billing_address?: AddressRel | null;
224
229
  payment_method?: PaymentMethodRel | null;
225
230
  payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel | null;
231
+ tags?: TagRel[] | null;
226
232
  }
227
233
  interface OrderUpdate extends ResourceUpdate {
228
234
  autorefresh?: boolean | null;
@@ -269,6 +275,7 @@ interface OrderUpdate extends ResourceUpdate {
269
275
  billing_address?: AddressRel | null;
270
276
  payment_method?: PaymentMethodRel | null;
271
277
  payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel | null;
278
+ tags?: TagRel[] | null;
272
279
  }
273
280
  declare class Orders extends ApiResource<Order> {
274
281
  static readonly TYPE: OrderType;
@@ -297,6 +304,7 @@ declare class Orders extends ApiResource<Order> {
297
304
  recurring_order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
298
305
  attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
299
306
  events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
307
+ tags(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
300
308
  isOrder(resource: any): resource is Order;
301
309
  relationship(id: string | ResourceId | null): OrderRel;
302
310
  type(): OrderType;
@@ -97,6 +97,10 @@ class Orders extends ApiResource {
97
97
  const _orderId = orderId.id || orderId;
98
98
  return this.resources.fetch({ type: 'events' }, `orders/${_orderId}/events`, params, options);
99
99
  }
100
+ async tags(orderId, params, options) {
101
+ const _orderId = orderId.id || orderId;
102
+ return this.resources.fetch({ type: 'tags' }, `orders/${_orderId}/tags`, params, options);
103
+ }
100
104
  isOrder(resource) {
101
105
  return resource.type && (resource.type === Orders.TYPE);
102
106
  }
@@ -42,6 +42,7 @@ interface Parcel extends Resource {
42
42
  carrier_weight_oz?: string | null;
43
43
  signed_by?: string | null;
44
44
  incoterm?: string | null;
45
+ delivery_confirmation?: string | null;
45
46
  shipment?: Shipment | null;
46
47
  package?: Package | null;
47
48
  parcel_line_items?: ParcelLineItem[] | null;
@@ -72,6 +73,7 @@ interface ParcelCreate extends ResourceCreate {
72
73
  carrier_weight_oz?: string | null;
73
74
  signed_by?: string | null;
74
75
  incoterm?: string | null;
76
+ delivery_confirmation?: string | null;
75
77
  shipment: ShipmentRel;
76
78
  package: PackageRel;
77
79
  }
@@ -99,6 +101,7 @@ interface ParcelUpdate extends ResourceUpdate {
99
101
  carrier_weight_oz?: string | null;
100
102
  signed_by?: string | null;
101
103
  incoterm?: string | null;
104
+ delivery_confirmation?: string | null;
102
105
  shipment?: ShipmentRel | null;
103
106
  package?: PackageRel | null;
104
107
  }
@@ -24,7 +24,7 @@ interface PaypalPayment extends Resource {
24
24
  intent_amount_cents: number;
25
25
  intent_amount_float?: number | null;
26
26
  formatted_intent_amount?: string | null;
27
- payment_instrument?: object | null;
27
+ payment_instrument?: Record<string, any> | null;
28
28
  order?: Order | null;
29
29
  payment_gateway?: PaymentGateway | null;
30
30
  }
@@ -8,6 +8,7 @@ import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
9
  import type { Attachment } from './attachments';
10
10
  import type { Event } from './events';
11
+ import type { Tag, TagType } from './tags';
11
12
  import type { SkuList, SkuListType } from './sku_lists';
12
13
  import type { Sku } from './skus';
13
14
  type PercentageDiscountPromotionType = 'percentage_discount_promotions';
@@ -29,6 +30,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
29
30
  type CouponCodesPromotionRuleRel = ResourceRel & {
30
31
  type: CouponCodesPromotionRuleType;
31
32
  };
33
+ type TagRel = ResourceRel & {
34
+ type: TagType;
35
+ };
32
36
  type SkuListRel = ResourceRel & {
33
37
  type: SkuListType;
34
38
  };
@@ -49,6 +53,7 @@ interface PercentageDiscountPromotion extends Resource {
49
53
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
50
54
  attachments?: Attachment[] | null;
51
55
  events?: Event[] | null;
56
+ tags?: Tag[] | null;
52
57
  sku_list?: SkuList | null;
53
58
  skus?: Sku[] | null;
54
59
  }
@@ -64,6 +69,7 @@ interface PercentageDiscountPromotionCreate extends ResourceCreate {
64
69
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
65
70
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
66
71
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
72
+ tags?: TagRel[] | null;
67
73
  sku_list?: SkuListRel | null;
68
74
  }
69
75
  interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
@@ -78,6 +84,7 @@ interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
78
84
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
79
85
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
80
86
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
87
+ tags?: TagRel[] | null;
81
88
  sku_list?: SkuListRel | null;
82
89
  }
83
90
  declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscountPromotion> {
@@ -91,6 +98,7 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
91
98
  coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
92
99
  attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
93
100
  events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
101
+ tags(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
94
102
  sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
95
103
  skus(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
96
104
  isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion;
@@ -33,6 +33,10 @@ class PercentageDiscountPromotions extends ApiResource {
33
33
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
34
34
  return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
35
35
  }
36
+ async tags(percentageDiscountPromotionId, params, options) {
37
+ const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
38
+ return this.resources.fetch({ type: 'tags' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/tags`, params, options);
39
+ }
36
40
  async sku_list(percentageDiscountPromotionId, params, options) {
37
41
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
38
42
  return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
@@ -8,6 +8,7 @@ import type { SkuListPromotionRule } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
9
9
  import type { Attachment } from './attachments';
10
10
  import type { Event } from './events';
11
+ import type { Tag } from './tags';
11
12
  type PromotionType = 'promotions';
12
13
  type PromotionRel = ResourceRel & {
13
14
  type: PromotionType;
@@ -28,6 +29,7 @@ interface Promotion extends Resource {
28
29
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
29
30
  attachments?: Attachment[] | null;
30
31
  events?: Event[] | null;
32
+ tags?: Tag[] | null;
31
33
  }
32
34
  declare class Promotions extends ApiResource<Promotion> {
33
35
  static readonly TYPE: PromotionType;
@@ -37,6 +39,7 @@ declare class Promotions extends ApiResource<Promotion> {
37
39
  coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
38
40
  attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
39
41
  events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
42
+ tags(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
40
43
  isPromotion(resource: any): resource is Promotion;
41
44
  relationship(id: string | ResourceId | null): PromotionRel;
42
45
  type(): PromotionType;
@@ -24,6 +24,10 @@ class Promotions extends ApiResource {
24
24
  const _promotionId = promotionId.id || promotionId;
25
25
  return this.resources.fetch({ type: 'events' }, `promotions/${_promotionId}/events`, params, options);
26
26
  }
27
+ async tags(promotionId, params, options) {
28
+ const _promotionId = promotionId.id || promotionId;
29
+ return this.resources.fetch({ type: 'tags' }, `promotions/${_promotionId}/tags`, params, options);
30
+ }
27
31
  isPromotion(resource) {
28
32
  return resource.type && (resource.type === Promotions.TYPE);
29
33
  }
@@ -20,7 +20,7 @@ interface RecurringOrderCopy extends Resource {
20
20
  started_at?: string | null;
21
21
  completed_at?: string | null;
22
22
  failed_at?: string | null;
23
- errors_log?: object | null;
23
+ errors_log?: Record<string, any> | null;
24
24
  errors_count?: number | null;
25
25
  place_target_order?: boolean | null;
26
26
  reuse_wallet?: boolean | null;
@@ -19,21 +19,21 @@ interface ReturnLineItem extends Resource {
19
19
  bundle_code?: string | null;
20
20
  name?: string | null;
21
21
  quantity: number;
22
- return_reason?: object | null;
22
+ return_reason?: Record<string, any> | null;
23
23
  restocked_at?: string | null;
24
24
  return?: Return | null;
25
25
  line_item?: LineItem | null;
26
26
  }
27
27
  interface ReturnLineItemCreate extends ResourceCreate {
28
28
  quantity: number;
29
- return_reason?: object | null;
29
+ return_reason?: Record<string, any> | null;
30
30
  return: ReturnRel;
31
31
  line_item: LineItemRel;
32
32
  }
33
33
  interface ReturnLineItemUpdate extends ResourceUpdate {
34
34
  quantity?: number | null;
35
35
  _restock?: boolean | null;
36
- return_reason?: object | null;
36
+ return_reason?: Record<string, any> | null;
37
37
  }
38
38
  declare class ReturnLineItems extends ApiResource<ReturnLineItem> {
39
39
  static readonly TYPE: ReturnLineItemType;
@@ -8,6 +8,7 @@ import type { Address } from './addresses';
8
8
  import type { ReturnLineItem } from './return_line_items';
9
9
  import type { Attachment } from './attachments';
10
10
  import type { Event } from './events';
11
+ import type { Tag, TagType } from './tags';
11
12
  type ReturnType = 'returns';
12
13
  type ReturnRel = ResourceRel & {
13
14
  type: ReturnType;
@@ -18,6 +19,9 @@ type OrderRel = ResourceRel & {
18
19
  type StockLocationRel = ResourceRel & {
19
20
  type: StockLocationType;
20
21
  };
22
+ type TagRel = ResourceRel & {
23
+ type: TagType;
24
+ };
21
25
  interface Return extends Resource {
22
26
  readonly type: ReturnType;
23
27
  number?: string | null;
@@ -38,10 +42,12 @@ interface Return extends Resource {
38
42
  return_line_items?: ReturnLineItem[] | null;
39
43
  attachments?: Attachment[] | null;
40
44
  events?: Event[] | null;
45
+ tags?: Tag[] | null;
41
46
  }
42
47
  interface ReturnCreate extends ResourceCreate {
43
48
  order: OrderRel;
44
49
  stock_location?: StockLocationRel | null;
50
+ tags?: TagRel[] | null;
45
51
  }
46
52
  interface ReturnUpdate extends ResourceUpdate {
47
53
  _request?: boolean | null;
@@ -54,6 +60,7 @@ interface ReturnUpdate extends ResourceUpdate {
54
60
  _archive?: boolean | null;
55
61
  _unarchive?: boolean | null;
56
62
  stock_location?: StockLocationRel | null;
63
+ tags?: TagRel[] | null;
57
64
  }
58
65
  declare class Returns extends ApiResource<Return> {
59
66
  static readonly TYPE: ReturnType;
@@ -68,6 +75,7 @@ declare class Returns extends ApiResource<Return> {
68
75
  return_line_items(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ReturnLineItem>>;
69
76
  attachments(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
70
77
  events(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
78
+ tags(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
71
79
  isReturn(resource: any): resource is Return;
72
80
  relationship(id: string | ResourceId | null): ReturnRel;
73
81
  type(): ReturnType;
@@ -41,6 +41,10 @@ class Returns extends ApiResource {
41
41
  const _returnId = returnId.id || returnId;
42
42
  return this.resources.fetch({ type: 'events' }, `returns/${_returnId}/events`, params, options);
43
43
  }
44
+ async tags(returnId, params, options) {
45
+ const _returnId = returnId.id || returnId;
46
+ return this.resources.fetch({ type: 'tags' }, `returns/${_returnId}/tags`, params, options);
47
+ }
44
48
  isReturn(resource) {
45
49
  return resource.type && (resource.type === Returns.TYPE);
46
50
  }
@@ -13,12 +13,15 @@ type SatispayPaymentRel = ResourceRel & {
13
13
  interface SatispayGateway extends Resource {
14
14
  readonly type: SatispayGatewayType;
15
15
  name: string;
16
+ token: string;
17
+ key_id: string;
16
18
  webhook_endpoint_url?: string | null;
17
19
  payment_methods?: PaymentMethod[] | null;
18
20
  satispay_payments?: SatispayPayment[] | null;
19
21
  }
20
22
  interface SatispayGatewayCreate extends ResourceCreate {
21
23
  name: string;
24
+ token: string;
22
25
  satispay_payments?: SatispayPaymentRel[] | null;
23
26
  }
24
27
  interface SatispayGatewayUpdate extends ResourceUpdate {
@@ -12,15 +12,12 @@ type OrderRel = ResourceRel & {
12
12
  };
13
13
  interface SatispayPayment extends Resource {
14
14
  readonly type: SatispayPaymentType;
15
- token?: string | null;
16
- key_id: string;
17
15
  payment_id?: string | null;
18
16
  redirect_url?: string | null;
19
17
  order?: Order | null;
20
18
  payment_gateway?: PaymentGateway | null;
21
19
  }
22
20
  interface SatispayPaymentCreate extends ResourceCreate {
23
- token?: string | null;
24
21
  redirect_url?: string | null;
25
22
  order: OrderRel;
26
23
  }
@@ -30,10 +30,10 @@ interface Shipment extends Resource {
30
30
  formatted_cost_amount?: string | null;
31
31
  skus_count?: number | null;
32
32
  selected_rate_id?: string | null;
33
- rates?: object[] | null;
33
+ rates?: Array<Record<string, any>> | null;
34
34
  purchase_error_code?: string | null;
35
35
  purchase_error_message?: string | null;
36
- get_rates_errors?: object[] | null;
36
+ get_rates_errors?: Array<Record<string, any>> | null;
37
37
  get_rates_started_at?: string | null;
38
38
  get_rates_completed_at?: string | null;
39
39
  purchase_started_at?: string | null;
@@ -3,6 +3,8 @@ import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesCon
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Market, MarketType } from './markets';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
7
+ import type { Tag, TagType } from './tags';
6
8
  type SkuOptionType = 'sku_options';
7
9
  type SkuOptionRel = ResourceRel & {
8
10
  type: SkuOptionType;
@@ -10,6 +12,9 @@ type SkuOptionRel = ResourceRel & {
10
12
  type MarketRel = ResourceRel & {
11
13
  type: MarketType;
12
14
  };
15
+ type TagRel = ResourceRel & {
16
+ type: TagType;
17
+ };
13
18
  interface SkuOption extends Resource {
14
19
  readonly type: SkuOptionType;
15
20
  name: string;
@@ -23,6 +28,8 @@ interface SkuOption extends Resource {
23
28
  sku_code_regex?: string | null;
24
29
  market?: Market | null;
25
30
  attachments?: Attachment[] | null;
31
+ events?: Event[] | null;
32
+ tags?: Tag[] | null;
26
33
  }
27
34
  interface SkuOptionCreate extends ResourceCreate {
28
35
  name: string;
@@ -32,6 +39,7 @@ interface SkuOptionCreate extends ResourceCreate {
32
39
  delay_hours?: number | null;
33
40
  sku_code_regex?: string | null;
34
41
  market?: MarketRel | null;
42
+ tags?: TagRel[] | null;
35
43
  }
36
44
  interface SkuOptionUpdate extends ResourceUpdate {
37
45
  name?: string | null;
@@ -41,6 +49,7 @@ interface SkuOptionUpdate extends ResourceUpdate {
41
49
  delay_hours?: number | null;
42
50
  sku_code_regex?: string | null;
43
51
  market?: MarketRel | null;
52
+ tags?: TagRel[] | null;
44
53
  }
45
54
  declare class SkuOptions extends ApiResource<SkuOption> {
46
55
  static readonly TYPE: SkuOptionType;
@@ -49,6 +58,8 @@ declare class SkuOptions extends ApiResource<SkuOption> {
49
58
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
50
59
  market(skuOptionId: string | SkuOption, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
51
60
  attachments(skuOptionId: string | SkuOption, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
61
+ events(skuOptionId: string | SkuOption, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
62
+ tags(skuOptionId: string | SkuOption, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
52
63
  isSkuOption(resource: any): resource is SkuOption;
53
64
  relationship(id: string | ResourceId | null): SkuOptionRel;
54
65
  type(): SkuOptionType;
@@ -17,6 +17,14 @@ class SkuOptions extends ApiResource {
17
17
  const _skuOptionId = skuOptionId.id || skuOptionId;
18
18
  return this.resources.fetch({ type: 'attachments' }, `sku_options/${_skuOptionId}/attachments`, params, options);
19
19
  }
20
+ async events(skuOptionId, params, options) {
21
+ const _skuOptionId = skuOptionId.id || skuOptionId;
22
+ return this.resources.fetch({ type: 'events' }, `sku_options/${_skuOptionId}/events`, params, options);
23
+ }
24
+ async tags(skuOptionId, params, options) {
25
+ const _skuOptionId = skuOptionId.id || skuOptionId;
26
+ return this.resources.fetch({ type: 'tags' }, `sku_options/${_skuOptionId}/tags`, params, options);
27
+ }
20
28
  isSkuOption(resource) {
21
29
  return resource.type && (resource.type === SkuOptions.TYPE);
22
30
  }
@@ -7,6 +7,8 @@ import type { StockItem } from './stock_items';
7
7
  import type { DeliveryLeadTime } from './delivery_lead_times';
8
8
  import type { SkuOption } from './sku_options';
9
9
  import type { Attachment } from './attachments';
10
+ import type { Event } from './events';
11
+ import type { Tag, TagType } from './tags';
10
12
  type SkuType = 'skus';
11
13
  type SkuRel = ResourceRel & {
12
14
  type: SkuType;
@@ -14,6 +16,9 @@ type SkuRel = ResourceRel & {
14
16
  type ShippingCategoryRel = ResourceRel & {
15
17
  type: ShippingCategoryType;
16
18
  };
19
+ type TagRel = ResourceRel & {
20
+ type: TagType;
21
+ };
17
22
  interface Sku extends Resource {
18
23
  readonly type: SkuType;
19
24
  code: string;
@@ -26,13 +31,15 @@ interface Sku extends Resource {
26
31
  hs_tariff_number?: string | null;
27
32
  do_not_ship?: boolean | null;
28
33
  do_not_track?: boolean | null;
29
- inventory?: object | null;
34
+ inventory?: Record<string, any> | null;
30
35
  shipping_category?: ShippingCategory | null;
31
36
  prices?: Price[] | null;
32
37
  stock_items?: StockItem[] | null;
33
38
  delivery_lead_times?: DeliveryLeadTime[] | null;
34
39
  sku_options?: SkuOption[] | null;
35
40
  attachments?: Attachment[] | null;
41
+ events?: Event[] | null;
42
+ tags?: Tag[] | null;
36
43
  }
37
44
  interface SkuCreate extends ResourceCreate {
38
45
  code: string;
@@ -46,6 +53,7 @@ interface SkuCreate extends ResourceCreate {
46
53
  do_not_ship?: boolean | null;
47
54
  do_not_track?: boolean | null;
48
55
  shipping_category: ShippingCategoryRel;
56
+ tags?: TagRel[] | null;
49
57
  }
50
58
  interface SkuUpdate extends ResourceUpdate {
51
59
  code?: string | null;
@@ -59,6 +67,7 @@ interface SkuUpdate extends ResourceUpdate {
59
67
  do_not_ship?: boolean | null;
60
68
  do_not_track?: boolean | null;
61
69
  shipping_category?: ShippingCategoryRel | null;
70
+ tags?: TagRel[] | null;
62
71
  }
63
72
  declare class Skus extends ApiResource<Sku> {
64
73
  static readonly TYPE: SkuType;
@@ -71,6 +80,8 @@ declare class Skus extends ApiResource<Sku> {
71
80
  delivery_lead_times(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<DeliveryLeadTime>>;
72
81
  sku_options(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<SkuOption>>;
73
82
  attachments(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
83
+ events(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
84
+ tags(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
74
85
  isSku(resource: any): resource is Sku;
75
86
  relationship(id: string | ResourceId | null): SkuRel;
76
87
  type(): SkuType;
@@ -33,6 +33,14 @@ class Skus extends ApiResource {
33
33
  const _skuId = skuId.id || skuId;
34
34
  return this.resources.fetch({ type: 'attachments' }, `skus/${_skuId}/attachments`, params, options);
35
35
  }
36
+ async events(skuId, params, options) {
37
+ const _skuId = skuId.id || skuId;
38
+ return this.resources.fetch({ type: 'events' }, `skus/${_skuId}/events`, params, options);
39
+ }
40
+ async tags(skuId, params, options) {
41
+ const _skuId = skuId.id || skuId;
42
+ return this.resources.fetch({ type: 'tags' }, `skus/${_skuId}/tags`, params, options);
43
+ }
36
44
  isSku(resource) {
37
45
  return resource.type && (resource.type === Skus.TYPE);
38
46
  }
@@ -14,22 +14,22 @@ interface StripePayment extends Resource {
14
14
  readonly type: StripePaymentType;
15
15
  client_secret: string;
16
16
  publishable_key?: string | null;
17
- options?: object | null;
18
- payment_method?: object | null;
17
+ options?: Record<string, any> | null;
18
+ payment_method?: Record<string, any> | null;
19
19
  mismatched_amounts?: boolean | null;
20
20
  intent_amount_cents: number;
21
21
  intent_amount_float?: number | null;
22
22
  formatted_intent_amount?: string | null;
23
- payment_instrument?: object | null;
23
+ payment_instrument?: Record<string, any> | null;
24
24
  order?: Order | null;
25
25
  payment_gateway?: PaymentGateway | null;
26
26
  }
27
27
  interface StripePaymentCreate extends ResourceCreate {
28
- options?: object | null;
28
+ options?: Record<string, any> | null;
29
29
  order: OrderRel;
30
30
  }
31
31
  interface StripePaymentUpdate extends ResourceUpdate {
32
- options?: object | null;
32
+ options?: Record<string, any> | null;
33
33
  _refresh?: boolean | null;
34
34
  order?: OrderRel | null;
35
35
  }
@@ -0,0 +1,28 @@
1
+ import { ApiResource } from '../resource';
2
+ import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
3
+ import type { QueryParamsRetrieve } from '../query';
4
+ type TagType = 'tags';
5
+ type TagRel = ResourceRel & {
6
+ type: TagType;
7
+ };
8
+ interface Tag extends Resource {
9
+ readonly type: TagType;
10
+ name: string;
11
+ }
12
+ interface TagCreate extends ResourceCreate {
13
+ name: string;
14
+ }
15
+ interface TagUpdate extends ResourceUpdate {
16
+ name?: string | null;
17
+ }
18
+ declare class Tags extends ApiResource<Tag> {
19
+ static readonly TYPE: TagType;
20
+ create(resource: TagCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Tag>;
21
+ update(resource: TagUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Tag>;
22
+ delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
23
+ isTag(resource: any): resource is Tag;
24
+ relationship(id: string | ResourceId | null): TagRel;
25
+ type(): TagType;
26
+ }
27
+ export default Tags;
28
+ export type { Tag, TagCreate, TagUpdate, TagType };
@@ -0,0 +1,23 @@
1
+ import { ApiResource } from '../resource';
2
+ class Tags extends ApiResource {
3
+ async create(resource, params, options) {
4
+ return this.resources.create({ ...resource, type: Tags.TYPE }, params, options);
5
+ }
6
+ async update(resource, params, options) {
7
+ return this.resources.update({ ...resource, type: Tags.TYPE }, params, options);
8
+ }
9
+ async delete(id, options) {
10
+ await this.resources.delete((typeof id === 'string') ? { id, type: Tags.TYPE } : id, options);
11
+ }
12
+ isTag(resource) {
13
+ return resource.type && (resource.type === Tags.TYPE);
14
+ }
15
+ relationship(id) {
16
+ return ((id === null) || (typeof id === 'string')) ? { id, type: Tags.TYPE } : { id: id.id, type: Tags.TYPE };
17
+ }
18
+ type() {
19
+ return Tags.TYPE;
20
+ }
21
+ }
22
+ Tags.TYPE = 'tags';
23
+ export default Tags;
@@ -23,7 +23,7 @@ interface TaxRule extends Resource {
23
23
  payment_method_taxable?: boolean | null;
24
24
  gift_card_taxable?: boolean | null;
25
25
  adjustment_taxable?: boolean | null;
26
- breakdown?: object | null;
26
+ breakdown?: Record<string, any> | null;
27
27
  manual_tax_calculator?: ManualTaxCalculator | null;
28
28
  }
29
29
  interface TaxRuleCreate extends ResourceCreate {
@@ -11,7 +11,7 @@ type OrderRel = ResourceRel & {
11
11
  };
12
12
  interface WireTransfer extends Resource {
13
13
  readonly type: WireTransferType;
14
- payment_instrument?: object | null;
14
+ payment_instrument?: Record<string, any> | null;
15
15
  order?: Order | null;
16
16
  }
17
17
  interface WireTransferCreate extends ResourceCreate {