@commercelayer/sdk 5.19.2 → 5.21.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 (53) hide show
  1. package/lib/cjs/api.d.ts +1 -1
  2. package/lib/cjs/commercelayer.d.ts +2 -2
  3. package/lib/cjs/commercelayer.js +1 -1
  4. package/lib/cjs/resource.js +1 -1
  5. package/lib/cjs/resources/authorizations.d.ts +3 -3
  6. package/lib/cjs/resources/authorizations.js +4 -4
  7. package/lib/cjs/resources/axerve_payments.d.ts +2 -0
  8. package/lib/cjs/resources/bundles.d.ts +8 -8
  9. package/lib/cjs/resources/captures.d.ts +3 -3
  10. package/lib/cjs/resources/captures.js +4 -4
  11. package/lib/cjs/resources/customer_payment_sources.d.ts +13 -1
  12. package/lib/cjs/resources/customer_payment_sources.js +4 -0
  13. package/lib/cjs/resources/imports.d.ts +0 -2
  14. package/lib/cjs/resources/line_items.d.ts +5 -0
  15. package/lib/cjs/resources/prices.d.ts +6 -6
  16. package/lib/cjs/resources/refunds.d.ts +3 -3
  17. package/lib/cjs/resources/refunds.js +4 -4
  18. package/lib/cjs/resources/shipments.d.ts +11 -1
  19. package/lib/cjs/resources/shipments.js +7 -0
  20. package/lib/cjs/resources/stock_line_items.d.ts +1 -0
  21. package/lib/cjs/resources/stock_transfers.d.ts +1 -0
  22. package/lib/cjs/resources/transactions.d.ts +3 -0
  23. package/lib/cjs/resources/transactions.js +4 -0
  24. package/lib/cjs/resources/voids.d.ts +3 -3
  25. package/lib/cjs/resources/voids.js +4 -4
  26. package/lib/esm/api.d.ts +1 -1
  27. package/lib/esm/commercelayer.d.ts +2 -2
  28. package/lib/esm/commercelayer.js +1 -1
  29. package/lib/esm/resource.js +1 -1
  30. package/lib/esm/resources/authorizations.d.ts +3 -3
  31. package/lib/esm/resources/authorizations.js +4 -4
  32. package/lib/esm/resources/axerve_payments.d.ts +2 -0
  33. package/lib/esm/resources/bundles.d.ts +8 -8
  34. package/lib/esm/resources/captures.d.ts +3 -3
  35. package/lib/esm/resources/captures.js +4 -4
  36. package/lib/esm/resources/customer_payment_sources.d.ts +13 -1
  37. package/lib/esm/resources/customer_payment_sources.js +4 -0
  38. package/lib/esm/resources/imports.d.ts +0 -2
  39. package/lib/esm/resources/line_items.d.ts +5 -0
  40. package/lib/esm/resources/prices.d.ts +6 -6
  41. package/lib/esm/resources/refunds.d.ts +3 -3
  42. package/lib/esm/resources/refunds.js +4 -4
  43. package/lib/esm/resources/shipments.d.ts +11 -1
  44. package/lib/esm/resources/shipments.js +7 -0
  45. package/lib/esm/resources/stock_line_items.d.ts +1 -0
  46. package/lib/esm/resources/stock_transfers.d.ts +1 -0
  47. package/lib/esm/resources/transactions.d.ts +3 -0
  48. package/lib/esm/resources/transactions.js +4 -0
  49. package/lib/esm/resources/voids.d.ts +3 -3
  50. package/lib/esm/resources/voids.js +4 -4
  51. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  52. package/lib/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +9 -9
@@ -14,8 +14,8 @@ import ApiClient from './client';
14
14
  import { denormalize, normalize } from './jsonapi';
15
15
  import { generateQueryStringParams, isParamsList } from './query';
16
16
  import config from './config';
17
- import Debug from './debug';
18
17
  import { ErrorType, SdkError } from './error';
18
+ import Debug from './debug';
19
19
  const debug = Debug('resource');
20
20
  class ListResponse extends Array {
21
21
  constructor(meta, data) {
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
9
  import type { Void } from './voids';
9
- import type { Event } from './events';
10
10
  type AuthorizationType = 'authorizations';
11
11
  type AuthorizationRel = ResourceRel & {
12
12
  type: AuthorizationType;
@@ -40,10 +40,10 @@ interface Authorization extends Resource {
40
40
  formatted_void_balance?: string | null;
41
41
  order?: Order | null;
42
42
  attachments?: Attachment[] | null;
43
+ events?: Event[] | null;
43
44
  versions?: Version[] | null;
44
45
  captures?: Capture[] | null;
45
46
  voids?: Void[] | null;
46
- events?: Event[] | null;
47
47
  }
48
48
  interface AuthorizationUpdate extends ResourceUpdate {
49
49
  _capture?: boolean | null;
@@ -55,10 +55,10 @@ declare class Authorizations extends ApiResource<Authorization> {
55
55
  update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
56
56
  order(authorizationId: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
57
57
  attachments(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
58
+ events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
58
59
  versions(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
59
60
  captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
60
61
  voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
61
- events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
62
62
  _capture(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
63
63
  _capture_amount_cents(id: string | Authorization, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
64
64
  _void(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
@@ -11,6 +11,10 @@ class Authorizations extends ApiResource {
11
11
  const _authorizationId = authorizationId.id || authorizationId;
12
12
  return this.resources.fetch({ type: 'attachments' }, `authorizations/${_authorizationId}/attachments`, params, options);
13
13
  }
14
+ async events(authorizationId, params, options) {
15
+ const _authorizationId = authorizationId.id || authorizationId;
16
+ return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
17
+ }
14
18
  async versions(authorizationId, params, options) {
15
19
  const _authorizationId = authorizationId.id || authorizationId;
16
20
  return this.resources.fetch({ type: 'versions' }, `authorizations/${_authorizationId}/versions`, params, options);
@@ -23,10 +27,6 @@ class Authorizations extends ApiResource {
23
27
  const _authorizationId = authorizationId.id || authorizationId;
24
28
  return this.resources.fetch({ type: 'voids' }, `authorizations/${_authorizationId}/voids`, params, options);
25
29
  }
26
- async events(authorizationId, params, options) {
27
- const _authorizationId = authorizationId.id || authorizationId;
28
- return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
29
- }
30
30
  async _capture(id, params, options) {
31
31
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture: true }, params, options);
32
32
  }
@@ -18,6 +18,7 @@ interface AxervePayment extends Resource {
18
18
  payment_request_data?: Record<string, any> | null;
19
19
  client_ip?: string | null;
20
20
  buyer_details?: Record<string, any> | null;
21
+ request_token?: boolean | null;
21
22
  mismatched_amounts?: boolean | null;
22
23
  intent_amount_cents: number;
23
24
  intent_amount_float?: number | null;
@@ -31,6 +32,7 @@ interface AxervePaymentCreate extends ResourceCreate {
31
32
  return_url: string;
32
33
  client_ip?: string | null;
33
34
  buyer_details?: Record<string, any> | null;
35
+ request_token?: boolean | null;
34
36
  order: OrderRel;
35
37
  }
36
38
  interface AxervePaymentUpdate extends ResourceUpdate {
@@ -30,12 +30,12 @@ interface Bundle extends Resource {
30
30
  image_url?: string | null;
31
31
  do_not_ship?: boolean | null;
32
32
  do_not_track?: boolean | null;
33
- price_amount_cents: number;
34
- price_amount_float: number;
35
- formatted_price_amount: string;
36
- compare_at_amount_cents: number;
37
- compare_at_amount_float: number;
38
- formatted_compare_at_amount: string;
33
+ price_amount_cents?: number | null;
34
+ price_amount_float?: number | null;
35
+ formatted_price_amount?: string | null;
36
+ compare_at_amount_cents?: number | null;
37
+ compare_at_amount_float?: number | null;
38
+ formatted_compare_at_amount?: string | null;
39
39
  skus_count?: number | null;
40
40
  market?: Market | null;
41
41
  sku_list?: SkuList | null;
@@ -51,8 +51,8 @@ interface BundleCreate extends ResourceCreate {
51
51
  currency_code?: string | null;
52
52
  description?: string | null;
53
53
  image_url?: string | null;
54
- price_amount_cents: number;
55
- compare_at_amount_cents: number;
54
+ price_amount_cents?: number | null;
55
+ compare_at_amount_cents?: number | null;
56
56
  _compute_price_amount?: boolean | null;
57
57
  _compute_compare_at_amount?: boolean | null;
58
58
  market?: MarketRel | null;
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Authorization } from './authorizations';
8
9
  import type { Refund } from './refunds';
9
- import type { Event } from './events';
10
10
  type CaptureType = 'captures';
11
11
  type CaptureRel = ResourceRel & {
12
12
  type: CaptureType;
@@ -32,10 +32,10 @@ interface Capture extends Resource {
32
32
  formatted_refund_balance?: string | null;
33
33
  order?: Order | null;
34
34
  attachments?: Attachment[] | null;
35
+ events?: Event[] | null;
35
36
  versions?: Version[] | null;
36
37
  reference_authorization?: Authorization | null;
37
38
  refunds?: Refund[] | null;
38
- events?: Event[] | null;
39
39
  }
40
40
  interface CaptureUpdate extends ResourceUpdate {
41
41
  _refund?: boolean | null;
@@ -46,10 +46,10 @@ declare class Captures extends ApiResource<Capture> {
46
46
  update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
47
47
  order(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
48
48
  attachments(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
49
+ events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
49
50
  versions(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
50
51
  reference_authorization(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
51
52
  refunds(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
52
- events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
53
53
  _refund(id: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
54
54
  _refund_amount_cents(id: string | Capture, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
55
55
  isCapture(resource: any): resource is Capture;
@@ -11,6 +11,10 @@ class Captures extends ApiResource {
11
11
  const _captureId = captureId.id || captureId;
12
12
  return this.resources.fetch({ type: 'attachments' }, `captures/${_captureId}/attachments`, params, options);
13
13
  }
14
+ async events(captureId, params, options) {
15
+ const _captureId = captureId.id || captureId;
16
+ return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
17
+ }
14
18
  async versions(captureId, params, options) {
15
19
  const _captureId = captureId.id || captureId;
16
20
  return this.resources.fetch({ type: 'versions' }, `captures/${_captureId}/versions`, params, options);
@@ -23,10 +27,6 @@ class Captures extends ApiResource {
23
27
  const _captureId = captureId.id || captureId;
24
28
  return this.resources.fetch({ type: 'refunds' }, `captures/${_captureId}/refunds`, params, options);
25
29
  }
26
- async events(captureId, params, options) {
27
- const _captureId = captureId.id || captureId;
28
- return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
29
- }
30
30
  async _refund(id, params, options) {
31
31
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund: true }, params, options);
32
32
  }
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
2
2
  import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Customer, CustomerType } from './customers';
5
+ import type { PaymentMethod, PaymentMethodType } from './payment_methods';
5
6
  import type { AdyenPayment, AdyenPaymentType } from './adyen_payments';
6
7
  import type { AxervePayment, AxervePaymentType } from './axerve_payments';
7
8
  import type { BraintreePayment, BraintreePaymentType } from './braintree_payments';
@@ -18,6 +19,9 @@ type CustomerPaymentSourceRel = ResourceRel & {
18
19
  type CustomerRel = ResourceRel & {
19
20
  type: CustomerType;
20
21
  };
22
+ type PaymentMethodRel = ResourceRel & {
23
+ type: PaymentMethodType;
24
+ };
21
25
  type AdyenPaymentRel = ResourceRel & {
22
26
  type: AdyenPaymentType;
23
27
  };
@@ -48,15 +52,22 @@ interface CustomerPaymentSource extends Resource {
48
52
  customer_token?: string | null;
49
53
  payment_source_token?: string | null;
50
54
  customer?: Customer | null;
55
+ payment_method?: PaymentMethod | null;
51
56
  payment_source?: AdyenPayment | AxervePayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | SatispayPayment | StripePayment | null;
52
57
  versions?: Version[] | null;
53
58
  }
54
59
  interface CustomerPaymentSourceCreate extends ResourceCreate {
60
+ customer_token?: string | null;
61
+ payment_source_token?: string | null;
55
62
  customer: CustomerRel;
56
- payment_source: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel;
63
+ payment_method?: PaymentMethodRel | null;
64
+ payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel | null;
57
65
  }
58
66
  interface CustomerPaymentSourceUpdate extends ResourceUpdate {
67
+ customer_token?: string | null;
68
+ payment_source_token?: string | null;
59
69
  customer?: CustomerRel | null;
70
+ payment_method?: PaymentMethodRel | null;
60
71
  payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel | null;
61
72
  }
62
73
  declare class CustomerPaymentSources extends ApiResource<CustomerPaymentSource> {
@@ -65,6 +76,7 @@ declare class CustomerPaymentSources extends ApiResource<CustomerPaymentSource>
65
76
  update(resource: CustomerPaymentSourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerPaymentSource>;
66
77
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
67
78
  customer(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
79
+ payment_method(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
68
80
  versions(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
69
81
  isCustomerPaymentSource(resource: any): resource is CustomerPaymentSource;
70
82
  relationship(id: string | ResourceId | null): CustomerPaymentSourceRel;
@@ -13,6 +13,10 @@ class CustomerPaymentSources extends ApiResource {
13
13
  const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
14
14
  return this.resources.fetch({ type: 'customers' }, `customer_payment_sources/${_customerPaymentSourceId}/customer`, params, options);
15
15
  }
16
+ async payment_method(customerPaymentSourceId, params, options) {
17
+ const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
18
+ return this.resources.fetch({ type: 'payment_methods' }, `customer_payment_sources/${_customerPaymentSourceId}/payment_method`, params, options);
19
+ }
16
20
  async versions(customerPaymentSourceId, params, options) {
17
21
  const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
18
22
  return this.resources.fetch({ type: 'versions' }, `customer_payment_sources/${_customerPaymentSourceId}/versions`, params, options);
@@ -22,7 +22,6 @@ interface Import extends Resource {
22
22
  processed_count?: number | null;
23
23
  errors_log?: Record<string, any> | null;
24
24
  warnings_log?: Record<string, any> | null;
25
- cleanup_records?: boolean | null;
26
25
  attachment_url?: string | null;
27
26
  events?: Event[] | null;
28
27
  }
@@ -31,7 +30,6 @@ interface ImportCreate extends ResourceCreate {
31
30
  format?: string | null;
32
31
  parent_resource_id?: string | null;
33
32
  inputs: Array<Record<string, any>>;
34
- cleanup_records?: boolean | null;
35
33
  }
36
34
  declare class Imports extends ApiResource<Import> {
37
35
  static readonly TYPE: ImportType;
@@ -67,6 +67,9 @@ interface LineItem extends Resource {
67
67
  unit_amount_cents?: number | null;
68
68
  unit_amount_float?: number | null;
69
69
  formatted_unit_amount?: string | null;
70
+ compare_at_amount_cents?: number | null;
71
+ compare_at_amount_float?: number | null;
72
+ formatted_compare_at_amount?: string | null;
70
73
  options_amount_cents?: number | null;
71
74
  options_amount_float?: number | null;
72
75
  formatted_options_amount?: string | null;
@@ -110,6 +113,7 @@ interface LineItemCreate extends ResourceCreate {
110
113
  _update_quantity?: boolean | null;
111
114
  _reserve_stock?: boolean | null;
112
115
  unit_amount_cents?: number | null;
116
+ compare_at_amount_cents?: number | null;
113
117
  name?: string | null;
114
118
  image_url?: string | null;
115
119
  item_type?: 'skus' | 'bundles' | 'shipments' | 'payment_methods' | 'adjustments' | 'gift_cards' | 'percentage_discount_promotions' | 'free_shipping_promotions' | 'free_gift_promotions' | 'fixed_price_promotions' | 'external_promotions' | 'fixed_amount_promotions' | null;
@@ -126,6 +130,7 @@ interface LineItemUpdate extends ResourceUpdate {
126
130
  quantity?: number | null;
127
131
  _external_price?: boolean | null;
128
132
  _reserve_stock?: boolean | null;
133
+ compare_at_amount_cents?: number | null;
129
134
  name?: string | null;
130
135
  image_url?: string | null;
131
136
  frequency?: string | null;
@@ -26,11 +26,11 @@ interface Price extends Resource {
26
26
  currency_code?: string | null;
27
27
  sku_code?: string | null;
28
28
  amount_cents: number;
29
- amount_float: number;
30
- formatted_amount: string;
31
- compare_at_amount_cents: number;
32
- compare_at_amount_float: number;
33
- formatted_compare_at_amount: string;
29
+ amount_float?: number | null;
30
+ formatted_amount?: string | null;
31
+ compare_at_amount_cents?: number | null;
32
+ compare_at_amount_float?: number | null;
33
+ formatted_compare_at_amount?: string | null;
34
34
  price_list?: PriceList | null;
35
35
  sku?: Sku | null;
36
36
  price_tiers?: PriceTier[] | null;
@@ -42,7 +42,7 @@ interface Price extends Resource {
42
42
  interface PriceCreate extends ResourceCreate {
43
43
  sku_code?: string | null;
44
44
  amount_cents: number;
45
- compare_at_amount_cents: number;
45
+ compare_at_amount_cents?: number | null;
46
46
  price_list: PriceListRel;
47
47
  sku: SkuRel;
48
48
  price_tiers?: PriceTierRel[] | null;
@@ -3,9 +3,9 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
- import type { Event } from './events';
9
9
  type RefundType = 'refunds';
10
10
  type RefundRel = ResourceRel & {
11
11
  type: RefundType;
@@ -25,17 +25,17 @@ interface Refund extends Resource {
25
25
  gateway_transaction_id?: string | null;
26
26
  order?: Order | null;
27
27
  attachments?: Attachment[] | null;
28
+ events?: Event[] | null;
28
29
  versions?: Version[] | null;
29
30
  reference_capture?: Capture | null;
30
- events?: Event[] | null;
31
31
  }
32
32
  declare class Refunds extends ApiResource<Refund> {
33
33
  static readonly TYPE: RefundType;
34
34
  order(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
35
35
  attachments(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
36
+ events(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
36
37
  versions(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
37
38
  reference_capture(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
38
- events(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
39
39
  isRefund(resource: any): resource is Refund;
40
40
  relationship(id: string | ResourceId | null): RefundRel;
41
41
  type(): RefundType;
@@ -8,6 +8,10 @@ class Refunds extends ApiResource {
8
8
  const _refundId = refundId.id || refundId;
9
9
  return this.resources.fetch({ type: 'attachments' }, `refunds/${_refundId}/attachments`, params, options);
10
10
  }
11
+ async events(refundId, params, options) {
12
+ const _refundId = refundId.id || refundId;
13
+ return this.resources.fetch({ type: 'events' }, `refunds/${_refundId}/events`, params, options);
14
+ }
11
15
  async versions(refundId, params, options) {
12
16
  const _refundId = refundId.id || refundId;
13
17
  return this.resources.fetch({ type: 'versions' }, `refunds/${_refundId}/versions`, params, options);
@@ -16,10 +20,6 @@ class Refunds extends ApiResource {
16
20
  const _refundId = refundId.id || refundId;
17
21
  return this.resources.fetch({ type: 'captures' }, `refunds/${_refundId}/reference_capture`, params, options);
18
22
  }
19
- async events(refundId, params, options) {
20
- const _refundId = refundId.id || refundId;
21
- return this.resources.fetch({ type: 'events' }, `refunds/${_refundId}/events`, params, options);
22
- }
23
23
  isRefund(resource) {
24
24
  return resource.type && (resource.type === Refunds.TYPE);
25
25
  }
@@ -14,6 +14,7 @@ import type { CarrierAccount } from './carrier_accounts';
14
14
  import type { Parcel } from './parcels';
15
15
  import type { Attachment } from './attachments';
16
16
  import type { Event } from './events';
17
+ import type { Tag, TagType } from './tags';
17
18
  import type { Version } from './versions';
18
19
  type ShipmentType = 'shipments';
19
20
  type ShipmentRel = ResourceRel & {
@@ -34,6 +35,9 @@ type AddressRel = ResourceRel & {
34
35
  type ShippingMethodRel = ResourceRel & {
35
36
  type: ShippingMethodType;
36
37
  };
38
+ type TagRel = ResourceRel & {
39
+ type: TagType;
40
+ };
37
41
  interface Shipment extends Resource {
38
42
  readonly type: ShipmentType;
39
43
  number?: string | null;
@@ -77,16 +81,19 @@ interface Shipment extends Resource {
77
81
  parcels?: Parcel[] | null;
78
82
  attachments?: Attachment[] | null;
79
83
  events?: Event[] | null;
84
+ tags?: Tag[] | null;
80
85
  versions?: Version[] | null;
81
86
  }
82
87
  interface ShipmentCreate extends ResourceCreate {
83
88
  order: OrderRel;
84
89
  shipping_category?: ShippingCategoryRel | null;
85
- inventory_stock_location?: InventoryStockLocationRel | null;
90
+ inventory_stock_location: InventoryStockLocationRel;
86
91
  shipping_address?: AddressRel | null;
87
92
  shipping_method?: ShippingMethodRel | null;
93
+ tags?: TagRel[] | null;
88
94
  }
89
95
  interface ShipmentUpdate extends ResourceUpdate {
96
+ _upcoming?: boolean | null;
90
97
  _on_hold?: boolean | null;
91
98
  _picking?: boolean | null;
92
99
  _packing?: boolean | null;
@@ -102,6 +109,7 @@ interface ShipmentUpdate extends ResourceUpdate {
102
109
  inventory_stock_location?: InventoryStockLocationRel | null;
103
110
  shipping_address?: AddressRel | null;
104
111
  shipping_method?: ShippingMethodRel | null;
112
+ tags?: TagRel[] | null;
105
113
  }
106
114
  declare class Shipments extends ApiResource<Shipment> {
107
115
  static readonly TYPE: ShipmentType;
@@ -123,7 +131,9 @@ declare class Shipments extends ApiResource<Shipment> {
123
131
  parcels(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Parcel>>;
124
132
  attachments(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
125
133
  events(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
134
+ tags(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
126
135
  versions(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
136
+ _upcoming(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
127
137
  _on_hold(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
128
138
  _picking(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
129
139
  _packing(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
@@ -69,10 +69,17 @@ class Shipments extends ApiResource {
69
69
  const _shipmentId = shipmentId.id || shipmentId;
70
70
  return this.resources.fetch({ type: 'events' }, `shipments/${_shipmentId}/events`, params, options);
71
71
  }
72
+ async tags(shipmentId, params, options) {
73
+ const _shipmentId = shipmentId.id || shipmentId;
74
+ return this.resources.fetch({ type: 'tags' }, `shipments/${_shipmentId}/tags`, params, options);
75
+ }
72
76
  async versions(shipmentId, params, options) {
73
77
  const _shipmentId = shipmentId.id || shipmentId;
74
78
  return this.resources.fetch({ type: 'versions' }, `shipments/${_shipmentId}/versions`, params, options);
75
79
  }
80
+ async _upcoming(id, params, options) {
81
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _upcoming: true }, params, options);
82
+ }
76
83
  async _on_hold(id, params, options) {
77
84
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _on_hold: true }, params, options);
78
85
  }
@@ -25,6 +25,7 @@ type SkuRel = ResourceRel & {
25
25
  interface StockLineItem extends Resource {
26
26
  readonly type: StockLineItemType;
27
27
  sku_code?: string | null;
28
+ bundle_code?: string | null;
28
29
  quantity: number;
29
30
  shipment?: Shipment | null;
30
31
  line_item?: LineItem | null;
@@ -25,6 +25,7 @@ type LineItemRel = ResourceRel & {
25
25
  };
26
26
  interface StockTransfer extends Resource {
27
27
  readonly type: StockTransferType;
28
+ number?: number | null;
28
29
  sku_code?: string | null;
29
30
  status: 'draft' | 'upcoming' | 'on_hold' | 'picking' | 'in_transit' | 'completed' | 'cancelled';
30
31
  quantity: number;
@@ -3,6 +3,7 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  type TransactionType = 'transactions';
8
9
  type TransactionRel = ResourceRel & {
@@ -23,12 +24,14 @@ interface Transaction extends Resource {
23
24
  gateway_transaction_id?: string | null;
24
25
  order?: Order | null;
25
26
  attachments?: Attachment[] | null;
27
+ events?: Event[] | null;
26
28
  versions?: Version[] | null;
27
29
  }
28
30
  declare class Transactions extends ApiResource<Transaction> {
29
31
  static readonly TYPE: TransactionType;
30
32
  order(transactionId: string | Transaction, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
31
33
  attachments(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
34
+ events(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
32
35
  versions(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
33
36
  isTransaction(resource: any): resource is Transaction;
34
37
  relationship(id: string | ResourceId | null): TransactionRel;
@@ -8,6 +8,10 @@ class Transactions extends ApiResource {
8
8
  const _transactionId = transactionId.id || transactionId;
9
9
  return this.resources.fetch({ type: 'attachments' }, `transactions/${_transactionId}/attachments`, params, options);
10
10
  }
11
+ async events(transactionId, params, options) {
12
+ const _transactionId = transactionId.id || transactionId;
13
+ return this.resources.fetch({ type: 'events' }, `transactions/${_transactionId}/events`, params, options);
14
+ }
11
15
  async versions(transactionId, params, options) {
12
16
  const _transactionId = transactionId.id || transactionId;
13
17
  return this.resources.fetch({ type: 'versions' }, `transactions/${_transactionId}/versions`, params, options);
@@ -3,9 +3,9 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Authorization } from './authorizations';
8
- import type { Event } from './events';
9
9
  type VoidType = 'voids';
10
10
  type VoidRel = ResourceRel & {
11
11
  type: VoidType;
@@ -25,17 +25,17 @@ interface Void extends Resource {
25
25
  gateway_transaction_id?: string | null;
26
26
  order?: Order | null;
27
27
  attachments?: Attachment[] | null;
28
+ events?: Event[] | null;
28
29
  versions?: Version[] | null;
29
30
  reference_authorization?: Authorization | null;
30
- events?: Event[] | null;
31
31
  }
32
32
  declare class Voids extends ApiResource<Void> {
33
33
  static readonly TYPE: VoidType;
34
34
  order(voidId: string | Void, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
35
35
  attachments(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
36
+ events(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
36
37
  versions(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
37
38
  reference_authorization(voidId: string | Void, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
38
- events(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
39
39
  isVoid(resource: any): resource is Void;
40
40
  relationship(id: string | ResourceId | null): VoidRel;
41
41
  type(): VoidType;
@@ -8,6 +8,10 @@ class Voids extends ApiResource {
8
8
  const _voidId = voidId.id || voidId;
9
9
  return this.resources.fetch({ type: 'attachments' }, `voids/${_voidId}/attachments`, params, options);
10
10
  }
11
+ async events(voidId, params, options) {
12
+ const _voidId = voidId.id || voidId;
13
+ return this.resources.fetch({ type: 'events' }, `voids/${_voidId}/events`, params, options);
14
+ }
11
15
  async versions(voidId, params, options) {
12
16
  const _voidId = voidId.id || voidId;
13
17
  return this.resources.fetch({ type: 'versions' }, `voids/${_voidId}/versions`, params, options);
@@ -16,10 +20,6 @@ class Voids extends ApiResource {
16
20
  const _voidId = voidId.id || voidId;
17
21
  return this.resources.fetch({ type: 'authorizations' }, `voids/${_voidId}/reference_authorization`, params, options);
18
22
  }
19
- async events(voidId, params, options) {
20
- const _voidId = voidId.id || voidId;
21
- return this.resources.fetch({ type: 'events' }, `voids/${_voidId}/events`, params, options);
22
- }
23
23
  isVoid(resource) {
24
24
  return resource.type && (resource.type === Voids.TYPE);
25
25
  }