@myparcel-dev/sdk 4.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 (107) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +15 -0
  3. package/lib/createMyParcelSdk.d.ts +14 -0
  4. package/lib/createMyParcelSdk.spec.d.ts +1 -0
  5. package/lib/createPrivateSdk.d.ts +7 -0
  6. package/lib/createPrivateSdk.spec.d.ts +1 -0
  7. package/lib/createPublicSdk.d.ts +7 -0
  8. package/lib/endpoints/endpoints.spec.d.ts +1 -0
  9. package/lib/endpoints/index.d.ts +2 -0
  10. package/lib/endpoints/private/account-messages/AccountMessages.types.d.ts +6 -0
  11. package/lib/endpoints/private/account-messages/DeleteAccountMessage.d.ts +19 -0
  12. package/lib/endpoints/private/account-messages/GetAccountMessages.d.ts +19 -0
  13. package/lib/endpoints/private/account-messages/index.d.ts +3 -0
  14. package/lib/endpoints/private/accounts/Account.types.d.ts +58 -0
  15. package/lib/endpoints/private/accounts/GetAccount.d.ts +19 -0
  16. package/lib/endpoints/private/accounts/GetAccounts.d.ts +13 -0
  17. package/lib/endpoints/private/accounts/PutAccount.d.ts +18 -0
  18. package/lib/endpoints/private/accounts/index.d.ts +4 -0
  19. package/lib/endpoints/private/api-key/ApiKey.types.d.ts +12 -0
  20. package/lib/endpoints/private/api-key/GetApiKeys.d.ts +16 -0
  21. package/lib/endpoints/private/api-key/PostApiKeys.d.ts +19 -0
  22. package/lib/endpoints/private/api-key/index.d.ts +3 -0
  23. package/lib/endpoints/private/carrier-options/CarrierOption.types.d.ts +46 -0
  24. package/lib/endpoints/private/carrier-options/DeleteCarrierOptions.d.ts +17 -0
  25. package/lib/endpoints/private/carrier-options/GetCarrierOptions.d.ts +17 -0
  26. package/lib/endpoints/private/carrier-options/PostCarrierOptions.d.ts +19 -0
  27. package/lib/endpoints/private/carrier-options/PutCarrierOptions.d.ts +21 -0
  28. package/lib/endpoints/private/carrier-options/index.d.ts +5 -0
  29. package/lib/endpoints/private/index.d.ts +13 -0
  30. package/lib/endpoints/private/locations/GetLocations.d.ts +14 -0
  31. package/lib/endpoints/private/locations/Location.types.d.ts +9 -0
  32. package/lib/endpoints/private/locations/index.d.ts +2 -0
  33. package/lib/endpoints/private/shipments/GetShipment.d.ts +19 -0
  34. package/lib/endpoints/private/shipments/GetShipments.d.ts +22 -0
  35. package/lib/endpoints/private/shipments/PatchShipment.d.ts +21 -0
  36. package/lib/endpoints/private/shipments/PostShipments.d.ts +23 -0
  37. package/lib/endpoints/private/shipments/Shipment.types.d.ts +175 -0
  38. package/lib/endpoints/private/shipments/index.d.ts +4 -0
  39. package/lib/endpoints/private/shops/GetShop.d.ts +19 -0
  40. package/lib/endpoints/private/shops/PostShop.d.ts +22 -0
  41. package/lib/endpoints/private/shops/PostShopDuplicate.d.ts +23 -0
  42. package/lib/endpoints/private/shops/PutShop.d.ts +16 -0
  43. package/lib/endpoints/private/shops/Shop.types.d.ts +80 -0
  44. package/lib/endpoints/private/shops/index.d.ts +5 -0
  45. package/lib/endpoints/private/subscription-capabilities/GetSubscriptionCapabilities.d.ts +17 -0
  46. package/lib/endpoints/private/subscription-capabilities/SubscriptionCapability.types.d.ts +23 -0
  47. package/lib/endpoints/private/subscription-capabilities/index.d.ts +2 -0
  48. package/lib/endpoints/private/subscriptions/DeleteSubscription.d.ts +16 -0
  49. package/lib/endpoints/private/subscriptions/GetSubscriptions.d.ts +17 -0
  50. package/lib/endpoints/private/subscriptions/PatchSubscriptions.d.ts +19 -0
  51. package/lib/endpoints/private/subscriptions/PostSubscriptions.d.ts +19 -0
  52. package/lib/endpoints/private/subscriptions/Subscriptions.types.d.ts +30 -0
  53. package/lib/endpoints/private/subscriptions/index.d.ts +5 -0
  54. package/lib/endpoints/private/system-country-codes/GetSystemCountryCodes.d.ts +14 -0
  55. package/lib/endpoints/private/system-country-codes/SystemCountryCodes.types.d.ts +10 -0
  56. package/lib/endpoints/private/system-country-codes/index.d.ts +2 -0
  57. package/lib/endpoints/private/system-messages/GetSystemMessages.d.ts +16 -0
  58. package/lib/endpoints/private/system-messages/SystemMessage.types.d.ts +18 -0
  59. package/lib/endpoints/private/system-messages/index.d.ts +2 -0
  60. package/lib/endpoints/private/track-traces/GetTrackAndTraceByShipment.d.ts +16 -0
  61. package/lib/endpoints/private/track-traces/TrackTraces.types.d.ts +50 -0
  62. package/lib/endpoints/private/track-traces/index.d.ts +2 -0
  63. package/lib/endpoints/private/webhook-subscriptions/DeleteWebhookSubscriptions.d.ts +16 -0
  64. package/lib/endpoints/private/webhook-subscriptions/GetWebhookSubscriptions.d.ts +14 -0
  65. package/lib/endpoints/private/webhook-subscriptions/PostWebhookSubscriptions.d.ts +19 -0
  66. package/lib/endpoints/private/webhook-subscriptions/Webhook.types.d.ts +13 -0
  67. package/lib/endpoints/private/webhook-subscriptions/index.d.ts +4 -0
  68. package/lib/endpoints/public/carriers/Carrier.types.d.ts +10 -0
  69. package/lib/endpoints/public/carriers/GetCarrier.d.ts +19 -0
  70. package/lib/endpoints/public/carriers/GetCarriers.d.ts +15 -0
  71. package/lib/endpoints/public/carriers/index.d.ts +3 -0
  72. package/lib/endpoints/public/delivery-options/DeliveryOption.types.d.ts +22 -0
  73. package/lib/endpoints/public/delivery-options/GetDeliveryOptions.d.ts +49 -0
  74. package/lib/endpoints/public/delivery-options/index.d.ts +2 -0
  75. package/lib/endpoints/public/index.d.ts +3 -0
  76. package/lib/endpoints/public/pickup-locations/GetPickupLocations.d.ts +17 -0
  77. package/lib/endpoints/public/pickup-locations/PickupLocation.types.d.ts +31 -0
  78. package/lib/endpoints/public/pickup-locations/index.d.ts +2 -0
  79. package/lib/index.cjs +1 -0
  80. package/lib/index.d.ts +6 -0
  81. package/lib/index.js +622 -0
  82. package/lib/index.spec.d.ts +1 -0
  83. package/lib/model/client/AbstractClient.d.ts +78 -0
  84. package/lib/model/client/AbstractClient.spec.d.ts +1 -0
  85. package/lib/model/client/AbstractClient.types.d.ts +49 -0
  86. package/lib/model/client/FetchClient.d.ts +6 -0
  87. package/lib/model/client/helper/addParameters.d.ts +3 -0
  88. package/lib/model/client/helper/addParameters.spec.d.ts +1 -0
  89. package/lib/model/client/helper/index.d.ts +2 -0
  90. package/lib/model/client/helper/isJson.d.ts +1 -0
  91. package/lib/model/client/helper/isJson.spec.d.ts +1 -0
  92. package/lib/model/client/index.d.ts +4 -0
  93. package/lib/model/endpoint/AbstractEndpoint.d.ts +56 -0
  94. package/lib/model/endpoint/AbstractEndpoint.types.d.ts +20 -0
  95. package/lib/model/endpoint/AbstractPrivateEndpoint.d.ts +13 -0
  96. package/lib/model/endpoint/AbstractPublicEndpoint.d.ts +5 -0
  97. package/lib/model/endpoint/index.d.ts +4 -0
  98. package/lib/model/exception/ApiException.d.ts +5 -0
  99. package/lib/model/exception/UserException.d.ts +4 -0
  100. package/lib/model/exception/index.d.ts +2 -0
  101. package/lib/model/index.d.ts +3 -0
  102. package/lib/types/common.types.d.ts +31 -0
  103. package/lib/types/data.types.d.ts +23 -0
  104. package/lib/types/global.types.d.ts +4 -0
  105. package/lib/types/index.d.ts +4 -0
  106. package/lib/types/request.types.d.ts +18 -0
  107. package/package.json +80 -0
@@ -0,0 +1,175 @@
1
+ import { type CarrierId, type CustomsDeclarationContents, type DeliveryTypeId, type PackageTypeId, type ShipmentStatus } from '@myparcel/constants';
2
+ import { type Address, type AddressWithContactDetails, type RetailLocation } from '../../../types';
3
+ import { type IntBoolean, type Price, type WithRequired } from '../../../types';
4
+ export interface PostedShipmentReference {
5
+ id: number;
6
+ reference_identifier: string;
7
+ }
8
+ export interface PhysicalProperties {
9
+ height?: number;
10
+ length?: number;
11
+ volume?: number;
12
+ weight: number;
13
+ width?: number;
14
+ }
15
+ export interface ShipmentOptions {
16
+ delivery_type: DeliveryTypeId | null;
17
+ package_type: PackageTypeId;
18
+ age_check?: IntBoolean;
19
+ collect?: IntBoolean;
20
+ cooled_delivery?: IntBoolean;
21
+ delivery_date?: string | null;
22
+ drop_off_at_postal_point?: IntBoolean;
23
+ extra_assurance?: IntBoolean;
24
+ hide_sender?: IntBoolean;
25
+ insurance?: Price;
26
+ label_description?: string;
27
+ large_format?: IntBoolean;
28
+ only_recipient?: IntBoolean;
29
+ return?: IntBoolean;
30
+ same_day_delivery?: IntBoolean;
31
+ saturday_delivery?: IntBoolean;
32
+ signature?: IntBoolean;
33
+ }
34
+ export interface CustomsDeclarationItem {
35
+ amount: number;
36
+ classification: string;
37
+ country?: string;
38
+ description: string;
39
+ item_value?: Price;
40
+ weight: number;
41
+ }
42
+ export interface ShipmentCustomsDeclaration {
43
+ contents: CustomsDeclarationContents;
44
+ eori_number?: string | null;
45
+ invoice?: string | null;
46
+ items: CustomsDeclarationItem[];
47
+ vat_number?: string | null;
48
+ weight: number;
49
+ }
50
+ export interface ShipmentGeneralSettings {
51
+ delivery_notification?: IntBoolean;
52
+ delivery_notification_email?: string[];
53
+ disable_auto_detect_pickup?: IntBoolean;
54
+ printer_identifier?: string;
55
+ save_recipient_address?: IntBoolean;
56
+ tracktrace?: {
57
+ bcc: IntBoolean;
58
+ bcc_email: string;
59
+ carrier_email_basic_notification: IntBoolean;
60
+ delivery_notification: IntBoolean;
61
+ email_on_handed_to_courier: IntBoolean;
62
+ from_address_company: string;
63
+ from_address_email: string;
64
+ send_track_trace_emails: IntBoolean;
65
+ };
66
+ }
67
+ export interface ShipmentPickup {
68
+ box_number?: string;
69
+ cc?: string;
70
+ city?: string;
71
+ location_code?: string;
72
+ location_name?: string;
73
+ number?: string;
74
+ number_suffix?: string;
75
+ postal_code?: string;
76
+ region?: string;
77
+ retail_network_id?: string;
78
+ state?: string;
79
+ street?: string;
80
+ }
81
+ export interface ShipmentPostData {
82
+ account_id?: number;
83
+ carrier: CarrierId;
84
+ customs_declaration?: ShipmentCustomsDeclaration | null;
85
+ delivered?: 0;
86
+ general_settings?: ShipmentGeneralSettings;
87
+ hidden?: IntBoolean;
88
+ options?: ShipmentOptions;
89
+ physical_properties?: PhysicalProperties;
90
+ pickup?: ShipmentPickup | null;
91
+ recipient: WithRequired<Address, 'number'> | WithRequired<Address, 'street'>;
92
+ reference_identifier?: number | string;
93
+ shop_id?: number;
94
+ status?: ShipmentStatus;
95
+ }
96
+ interface ShippedItem {
97
+ order_identifier: string;
98
+ order_line: {
99
+ external_identifier: null;
100
+ instructions: null;
101
+ price: number;
102
+ price_after_vat: number;
103
+ product: {
104
+ external_identifier: string;
105
+ height: number;
106
+ length: number;
107
+ name: string;
108
+ sku: string;
109
+ weight: number;
110
+ width: number;
111
+ };
112
+ quantity: number;
113
+ shippable: boolean;
114
+ uuid: string;
115
+ vat: null;
116
+ vat_percentage: null;
117
+ };
118
+ order_line_identifier: string;
119
+ quantity: number;
120
+ }
121
+ export interface MyParcelShipment {
122
+ account_id: number;
123
+ api_key: string | null;
124
+ barcode: string | null;
125
+ carrier_id: CarrierId;
126
+ collection_contact: string | null;
127
+ contract_id: number;
128
+ created: Date;
129
+ created_by: number;
130
+ customs_declaration: ShipmentCustomsDeclaration | null;
131
+ delayed: boolean;
132
+ delivered: boolean;
133
+ drop_off_point: RetailLocation | null;
134
+ external_identifier: string | null;
135
+ external_provider: null;
136
+ external_provider_id: null;
137
+ general_settings: ShipmentGeneralSettings;
138
+ hidden: boolean;
139
+ id: number;
140
+ is_return: boolean;
141
+ link_consumer_portal: string | null;
142
+ modified: Date;
143
+ modified_by: number;
144
+ multi_collo: boolean;
145
+ multi_collo_main_shipment_id: string | null;
146
+ options: ShipmentOptions;
147
+ origin: string | null;
148
+ parent_id: number | null;
149
+ partner_track_traces: unknown[];
150
+ partner_tracktraces: unknown[];
151
+ payment_status: string;
152
+ physical_properties: PhysicalProperties | null;
153
+ pickup: RetailLocation | null;
154
+ pickup_request_number: null;
155
+ platform_id: number;
156
+ price: Price;
157
+ recipient: AddressWithContactDetails;
158
+ reference_identifier: string | null;
159
+ region: string;
160
+ secondary_shipments: unknown[];
161
+ sender: AddressWithContactDetails;
162
+ shipment_type: number | null;
163
+ shipped_items: ShippedItem[];
164
+ shop_id: number;
165
+ status: number | null;
166
+ transaction_status: string;
167
+ user_agent: string | null;
168
+ }
169
+ export interface ShipmentPatchData {
170
+ id: number;
171
+ hidden?: IntBoolean;
172
+ status?: ShipmentStatus;
173
+ delivered?: IntBoolean;
174
+ }
175
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './GetShipment';
2
+ export * from './GetShipments';
3
+ export * from './PostShipments';
4
+ export * from './Shipment.types';
@@ -0,0 +1,19 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type MyParcelShop } from './Shop.types';
4
+ type GetShopDefinition = CreateDefinition<{
5
+ name: typeof GetShop.name;
6
+ path: {
7
+ id: number;
8
+ };
9
+ response: MyParcelShop[];
10
+ }>;
11
+ /**
12
+ * Retrieve a single shop by ID.
13
+ */
14
+ export declare class GetShop extends AbstractPrivateEndpoint<GetShopDefinition> {
15
+ readonly name = "getShop";
16
+ readonly path = "shops/:id";
17
+ readonly property = "shops";
18
+ }
19
+ export {};
@@ -0,0 +1,22 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type HttpMethod } from '../../../types/request.types';
4
+ import { type MyParcelShop } from './Shop.types';
5
+ type PostShopDefinition = CreateDefinition<{
6
+ name: typeof PostShop.name;
7
+ body: MyParcelShop[];
8
+ response: {
9
+ id: number;
10
+ }[];
11
+ }>;
12
+ /**
13
+ * Create a shop.
14
+ */
15
+ export declare class PostShop extends AbstractPrivateEndpoint<PostShopDefinition> {
16
+ readonly method: HttpMethod;
17
+ readonly name = "postShop";
18
+ readonly path = "shops/duplicate";
19
+ readonly property = "shops";
20
+ readonly responseProperty = "ids";
21
+ }
22
+ export {};
@@ -0,0 +1,23 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type HttpMethod } from '../../../types/request.types';
4
+ import { type DuplicateShop } from './Shop.types';
5
+ type PostShopDuplicateDefinition = CreateDefinition<{
6
+ name: typeof PostShopDuplicate.name;
7
+ body: DuplicateShop[];
8
+ response: {
9
+ ids: [{
10
+ id: number;
11
+ }];
12
+ };
13
+ }>;
14
+ /**
15
+ * The PostShopDuplicate endpoint is used to add a new shop.
16
+ */
17
+ export declare class PostShopDuplicate extends AbstractPrivateEndpoint<PostShopDuplicateDefinition> {
18
+ readonly method: HttpMethod;
19
+ readonly name = "postShopDuplicate";
20
+ readonly path = "shops/duplicate";
21
+ readonly property = "ids";
22
+ }
23
+ export {};
@@ -0,0 +1,16 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type HttpMethod } from '../../../types/request.types';
4
+ import { type MyParcelShop } from './Shop.types';
5
+ type PutShopDefinition = CreateDefinition<{
6
+ name: typeof PutShop.name;
7
+ body: MyParcelShop[];
8
+ response: MyParcelShop[];
9
+ }>;
10
+ export declare class PutShop extends AbstractPrivateEndpoint<PutShopDefinition> {
11
+ readonly method: HttpMethod;
12
+ readonly name = "putShop";
13
+ readonly path = "shops";
14
+ readonly property = "shops";
15
+ }
16
+ export {};
@@ -0,0 +1,80 @@
1
+ import { type Address, type IntBoolean } from '../../../types';
2
+ export interface ShopBranding {
3
+ accent_color: string;
4
+ enable_returns: boolean;
5
+ enable_track_trace: boolean;
6
+ subdomain: string;
7
+ use_consumer_portal: boolean;
8
+ }
9
+ export interface ShopBilling {
10
+ address: Address;
11
+ billing_method: 1 | 2 | 3 | 4;
12
+ coc?: string;
13
+ cycle: 'monthly' | 'weekly';
14
+ eori_number?: string;
15
+ iban?: string;
16
+ reference: string;
17
+ vat_number_uk?: string;
18
+ vat_number?: string;
19
+ }
20
+ export interface ReturnReason {
21
+ human: string;
22
+ name: string;
23
+ }
24
+ export interface ShopReturnReasons {
25
+ enabled: boolean;
26
+ mandatory: boolean;
27
+ return_reasons: ReturnReason[];
28
+ }
29
+ export interface ShopReturn {
30
+ address: Address;
31
+ bcc: IntBoolean;
32
+ email_address_for_tracktrace_return_shipments: string;
33
+ from_address_name?: string;
34
+ link_expires_after?: number;
35
+ send_tracktrace_email_for_return_shipments: IntBoolean;
36
+ settle_printerless_return_cost: IntBoolean;
37
+ use_custom_description: IntBoolean;
38
+ use_printerless_return: IntBoolean;
39
+ use_shop_shipment_options: IntBoolean;
40
+ }
41
+ export interface ShopSettings {
42
+ auto_save_addresses: IntBoolean;
43
+ default_collect_address_id?: number;
44
+ label_description: string;
45
+ label_format_locked: IntBoolean;
46
+ label_format: 'A4' | 'A6';
47
+ preferred_locale?: string;
48
+ reminder_email: IntBoolean;
49
+ use_logo_label: IntBoolean;
50
+ weight: number;
51
+ }
52
+ export interface ShopTrackTrace {
53
+ bcc_email: string;
54
+ bcc: IntBoolean;
55
+ carrier_email_basic_notification: IntBoolean;
56
+ delivery_notification: IntBoolean;
57
+ email_on_handed_to_courier: IntBoolean;
58
+ from_address_company: string;
59
+ from_address_email: string;
60
+ send_track_trace_emails: IntBoolean;
61
+ }
62
+ export interface MyParcelShop {
63
+ account_id: number;
64
+ billing: ShopBilling;
65
+ branding: ShopBranding;
66
+ created: string;
67
+ general_settings: ShopSettings;
68
+ hidden: boolean;
69
+ id: number;
70
+ modified: string;
71
+ name: string;
72
+ platform_id: number;
73
+ return_reason_settings: ShopReturnReasons;
74
+ return: ShopReturn;
75
+ tracktrace: ShopTrackTrace;
76
+ }
77
+ export interface DuplicateShop {
78
+ name: string;
79
+ account_id: number;
80
+ }
@@ -0,0 +1,5 @@
1
+ export * from './GetShop';
2
+ export * from './PostShop';
3
+ export * from './PutShop';
4
+ export * from './Shop.types';
5
+ export * from './PostShopDuplicate';
@@ -0,0 +1,17 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type SubscriptionType } from '../subscriptions/Subscriptions.types';
4
+ import { type SubscriptionCapability } from './SubscriptionCapability.types';
5
+ type GetSubscriptionsCapabilitiesDefinition = CreateDefinition<{
6
+ name: typeof GetSubscriptionsCapabilities.name;
7
+ parameters: {
8
+ id: number;
9
+ };
10
+ response: Record<SubscriptionType, SubscriptionCapability[]>;
11
+ }>;
12
+ export declare class GetSubscriptionsCapabilities extends AbstractPrivateEndpoint<GetSubscriptionsCapabilitiesDefinition> {
13
+ readonly name = "getSubscriptionsCapabilities";
14
+ readonly path = "subscriptions/capabilities";
15
+ readonly property = "capabilities";
16
+ }
17
+ export {};
@@ -0,0 +1,23 @@
1
+ import { type SubscriptionProductId, type SubscriptionTier, type SubscriptionTierName, type SubscriptionType } from '../subscriptions/Subscriptions.types';
2
+ import { type Price } from '../../../types';
3
+ export type DashboardSlug = 'shipments' | 'returns' | 'webshops' | 'shipments-weekly' | 'returns-weekly' | 'webshops-weekly' | 'transit-time' | 'surcharges' | 'cases' | 'shipments-t2' | 'returns-t2' | 'webshops-t2' | 'transit-time-t2' | 'surcharges-t2' | 'cases-t2' | 'finance-t2' | 'shortcoming-t2' | 'shipments-t3' | 'returns-t3' | 'webshops-t3' | 'transit-time-t3' | 'surcharges-t3' | 'cases-t3' | 'finance-t3' | 'shortcoming-t3';
4
+ export interface SubscriptionConfiguration {
5
+ dashboard_slugs: string[];
6
+ free_shipments_per_month: number;
7
+ max_shipping_rules: number | null;
8
+ shipment_discount_price: Price;
9
+ shipment_discount_product: number;
10
+ shipment_fee_price: Price;
11
+ shipment_fee_product: number;
12
+ }
13
+ export interface SubscriptionCapability {
14
+ configuration: SubscriptionConfiguration;
15
+ features: string[];
16
+ price: Price;
17
+ tier: SubscriptionTier;
18
+ product_id: SubscriptionProductId;
19
+ product_name: string;
20
+ subscription_type_name: string;
21
+ tier_name: SubscriptionTierName;
22
+ type: SubscriptionType;
23
+ }
@@ -0,0 +1,2 @@
1
+ export * from './GetSubscriptionCapabilities';
2
+ export * from './SubscriptionCapability.types';
@@ -0,0 +1,16 @@
1
+ import { type HttpMethod } from '../../../types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type DeleteSubscriptionDefinition = CreateDefinition<{
5
+ name: typeof DeleteSubscription.name;
6
+ path: {
7
+ id: number;
8
+ };
9
+ }>;
10
+ export declare class DeleteSubscription extends AbstractPrivateEndpoint<DeleteSubscriptionDefinition> {
11
+ readonly method: HttpMethod;
12
+ readonly name = "deleteSubscription";
13
+ readonly path = "subscriptions/:id";
14
+ readonly property = "subscriptions";
15
+ }
16
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type MyParcelSubscription, type SubscriptionPostData } from './Subscriptions.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type GetSubscriptionsDefinition = CreateDefinition<{
5
+ name: typeof GetSubscriptions.name;
6
+ parameters: {
7
+ id: number;
8
+ };
9
+ body: SubscriptionPostData[];
10
+ response: MyParcelSubscription[];
11
+ }>;
12
+ export declare class GetSubscriptions extends AbstractPrivateEndpoint<GetSubscriptionsDefinition> {
13
+ readonly name = "getSubscriptions";
14
+ readonly path = "subscriptions";
15
+ readonly property = "subscriptions";
16
+ }
17
+ export {};
@@ -0,0 +1,19 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type HttpMethod } from '../../../types';
4
+ import { type SubscriptionPatchData } from './Subscriptions.types';
5
+ type PatchSubscriptionsDefinition = CreateDefinition<{
6
+ name: typeof PatchSubscriptions.name;
7
+ body: SubscriptionPatchData[];
8
+ response: {
9
+ id: number;
10
+ }[];
11
+ }>;
12
+ export declare class PatchSubscriptions extends AbstractPrivateEndpoint<PatchSubscriptionsDefinition> {
13
+ readonly method: HttpMethod;
14
+ readonly name = "patchSubscriptions";
15
+ readonly path = "subscriptions";
16
+ readonly property = "subscriptions";
17
+ readonly responseProperty = "ids";
18
+ }
19
+ export {};
@@ -0,0 +1,19 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type HttpMethod } from '../../../types';
4
+ import { SubscriptionPostData } from './Subscriptions.types';
5
+ type PostSubscriptionsDefinition = CreateDefinition<{
6
+ name: typeof PostSubscriptions.name;
7
+ body: SubscriptionPostData[];
8
+ response: {
9
+ id: number;
10
+ }[];
11
+ }>;
12
+ export declare class PostSubscriptions extends AbstractPrivateEndpoint<PostSubscriptionsDefinition> {
13
+ readonly method: HttpMethod;
14
+ readonly name = "postSubscriptions";
15
+ readonly path = "subscriptions";
16
+ readonly property = "subscriptions";
17
+ readonly responseProperty = "ids";
18
+ }
19
+ export {};
@@ -0,0 +1,30 @@
1
+ export type SubscriptionProductId = 4610 | 4611 | 4612 | 4613 | 4614 | 4615 | 4616 | 4617 | 4618 | 4700 | 4701 | 4702 | 4703 | 4800 | 4801 | 4802 | 4803;
2
+ export type SubscriptionTier = 0 | 1 | 2 | 3 | 4 | 5;
3
+ export type SubscriptionTierName = 'light' | 'start' | 'plus' | 'premium' | 'max';
4
+ export type SubscriptionType = 'my_contracts' | 'my_analytics' | 'my_orders' | 'bundle';
5
+ export type SubscriptionStatus = 'active' | 'ended' | 'pending' | 'starting_soon' | 'ending_soon' | 'trial_active' | 'trial_ended';
6
+ export type MyParcelSubscription = {
7
+ account_id: number;
8
+ billing_period_end: string;
9
+ billing_shop_id: number;
10
+ end: string | null;
11
+ id: number;
12
+ product_id: SubscriptionProductId;
13
+ start: string;
14
+ status: SubscriptionStatus;
15
+ tier: SubscriptionTier;
16
+ trial_end: string | null;
17
+ type: SubscriptionType;
18
+ };
19
+ export interface SubscriptionPostData {
20
+ account_id: number;
21
+ start: string;
22
+ billing_shop_id: number;
23
+ product_id: SubscriptionProductId;
24
+ }
25
+ export interface SubscriptionPatchData {
26
+ id: number;
27
+ billing_shop_id?: number;
28
+ trial_end?: string;
29
+ end?: string;
30
+ }
@@ -0,0 +1,5 @@
1
+ export * from './DeleteSubscription';
2
+ export * from './GetSubscriptions';
3
+ export * from './PatchSubscriptions';
4
+ export * from './PostSubscriptions';
5
+ export * from './Subscriptions.types';
@@ -0,0 +1,14 @@
1
+ import { type SystemCountryCodesPerCountry, type GetSystemCountryCodesParams } from './SystemCountryCodes.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type GetSystemCountryCodesDefinition = CreateDefinition<{
5
+ name: typeof GetSystemCountryCodes.name;
6
+ parameters: GetSystemCountryCodesParams;
7
+ response: SystemCountryCodesPerCountry;
8
+ }>;
9
+ export declare class GetSystemCountryCodes extends AbstractPrivateEndpoint<GetSystemCountryCodesDefinition> {
10
+ readonly name = "getSystemCountryCodes";
11
+ readonly path = "system_country_codes";
12
+ readonly property = "countries";
13
+ }
14
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type CarrierId } from '@myparcel/constants';
2
+ export interface SystemCountryCode {
3
+ label: string;
4
+ region: string;
5
+ }
6
+ export type SystemCountryCodesPerCountry = Record<string, SystemCountryCode>[];
7
+ export type GetSystemCountryCodesParams = {
8
+ carrier_id?: CarrierId;
9
+ unfiltered?: boolean;
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from './GetSystemCountryCodes';
2
+ export * from './SystemCountryCodes.types';
@@ -0,0 +1,16 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type MyParcelSystemMessage } from './SystemMessage.types';
4
+ type GetSystemMessagesDefinition = CreateDefinition<{
5
+ name: typeof GetSystemMessages.name;
6
+ response: MyParcelSystemMessage[];
7
+ }>;
8
+ /**
9
+ * Retrieve system messages.
10
+ */
11
+ export declare class GetSystemMessages extends AbstractPrivateEndpoint<GetSystemMessagesDefinition> {
12
+ readonly name = "getSystemMessages";
13
+ readonly path = "system_messages";
14
+ readonly property = "messages";
15
+ }
16
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface MyParcelSystemMessage {
2
+ id: number;
3
+ content: string;
4
+ active: boolean;
5
+ additional_filter: string;
6
+ message_type: 1 | 2 | 3 | 4 | 5;
7
+ create: Date;
8
+ modified: Date;
9
+ start_date: Date;
10
+ end_date: Date;
11
+ notification_type: 'alert' | 'warning' | 'success' | 'info' | 'info';
12
+ content_nl: string;
13
+ content_en: string;
14
+ content_fr: string;
15
+ platform_ids: number[];
16
+ platform_id: number;
17
+ system_message_id: number;
18
+ }
@@ -0,0 +1,2 @@
1
+ export * from './GetSystemMessages';
2
+ export * from './SystemMessage.types';
@@ -0,0 +1,16 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type TrackAndTrace } from './TrackTraces.types';
4
+ type GetTrackAndTraceDefinition = CreateDefinition<{
5
+ name: typeof GetTrackAndTrace.name;
6
+ response: TrackAndTrace[];
7
+ path: {
8
+ shipment_id: string;
9
+ };
10
+ }>;
11
+ export declare class GetTrackAndTrace extends AbstractPrivateEndpoint<GetTrackAndTraceDefinition> {
12
+ readonly name = "getTrackAndTrace";
13
+ readonly path = "tracktraces/:shipment_id";
14
+ readonly property = "tracktraces";
15
+ }
16
+ export {};
@@ -0,0 +1,50 @@
1
+ import { type Address, type AddressWithContactDetails } from '../../../types';
2
+ import { type CarrierId } from '@myparcel/constants';
3
+ import { type PickupLocation } from '../../public';
4
+ import { type ShipmentOptions } from '../shipments';
5
+ export interface PartnerTrackTraceLink {
6
+ barcode: string;
7
+ uri: string;
8
+ }
9
+ export type ShipmentStatus = 'registered' | 'handed_to_carrier' | 'sorting' | 'distribution' | 'delivered';
10
+ export interface TrackAndTraceStatus {
11
+ main: ShipmentStatus;
12
+ final: boolean;
13
+ current: number;
14
+ }
15
+ export interface TrackAndTraceLocation {
16
+ name: string;
17
+ countryCode: string;
18
+ city: string;
19
+ postalCode: string;
20
+ street: string;
21
+ number: string;
22
+ numberSuffix: string;
23
+ longitude: number;
24
+ latitude: number;
25
+ }
26
+ export interface TrackTraceHistory {
27
+ code: string;
28
+ description: string;
29
+ time: string;
30
+ delayed: boolean;
31
+ location: TrackAndTraceLocation;
32
+ }
33
+ export interface TrackAndTrace {
34
+ shipment_id: number;
35
+ carrier_id: CarrierId;
36
+ code: string;
37
+ description: string;
38
+ time: string;
39
+ link_consumer_portal: string;
40
+ link_tracktrace: string;
41
+ partner_tracktraces: PartnerTrackTraceLink[];
42
+ recipient: AddressWithContactDetails;
43
+ sender: Address;
44
+ options: ShipmentOptions;
45
+ pickup: PickupLocation | null;
46
+ delayed: boolean;
47
+ location: TrackAndTraceLocation | null;
48
+ status: TrackAndTraceStatus;
49
+ history: TrackTraceHistory[];
50
+ }
@@ -0,0 +1,2 @@
1
+ export * from './GetTrackAndTraceByShipment';
2
+ export * from './TrackTraces.types';