@myparcel-dev/sdk 5.0.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 (109) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +15 -0
  3. package/lib/createMyParcelSdk.d.ts +18 -0
  4. package/lib/createMyParcelSdk.spec.d.ts +1 -0
  5. package/lib/createPrivateSdk.d.ts +8 -0
  6. package/lib/createPrivateSdk.spec.d.ts +1 -0
  7. package/lib/createPublicSdk.d.ts +8 -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 +20 -0
  12. package/lib/endpoints/private/account-messages/GetAccountMessages.d.ts +20 -0
  13. package/lib/endpoints/private/account-messages/index.d.ts +3 -0
  14. package/lib/endpoints/private/accounts/Account.types.d.ts +59 -0
  15. package/lib/endpoints/private/accounts/GetAccount.d.ts +20 -0
  16. package/lib/endpoints/private/accounts/GetAccounts.d.ts +14 -0
  17. package/lib/endpoints/private/accounts/PutAccount.d.ts +19 -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 +17 -0
  21. package/lib/endpoints/private/api-key/PostApiKeys.d.ts +20 -0
  22. package/lib/endpoints/private/api-key/index.d.ts +3 -0
  23. package/lib/endpoints/private/carrier-options/CarrierOption.types.d.ts +47 -0
  24. package/lib/endpoints/private/carrier-options/DeleteCarrierOptions.d.ts +18 -0
  25. package/lib/endpoints/private/carrier-options/GetCarrierOptions.d.ts +18 -0
  26. package/lib/endpoints/private/carrier-options/PostCarrierOptions.d.ts +20 -0
  27. package/lib/endpoints/private/carrier-options/PutCarrierOptions.d.ts +22 -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 +15 -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 +20 -0
  34. package/lib/endpoints/private/shipments/GetShipments.d.ts +23 -0
  35. package/lib/endpoints/private/shipments/PostShipments.d.ts +24 -0
  36. package/lib/endpoints/private/shipments/Shipment.types.d.ts +175 -0
  37. package/lib/endpoints/private/shipments/index.d.ts +4 -0
  38. package/lib/endpoints/private/shops/GetShop.d.ts +20 -0
  39. package/lib/endpoints/private/shops/PostShop.d.ts +23 -0
  40. package/lib/endpoints/private/shops/PostShopDuplicate.d.ts +24 -0
  41. package/lib/endpoints/private/shops/PutShop.d.ts +17 -0
  42. package/lib/endpoints/private/shops/Shop.types.d.ts +81 -0
  43. package/lib/endpoints/private/shops/index.d.ts +5 -0
  44. package/lib/endpoints/private/subscription-capabilities/GetSubscriptionCapabilities.d.ts +18 -0
  45. package/lib/endpoints/private/subscription-capabilities/SubscriptionCapability.types.d.ts +24 -0
  46. package/lib/endpoints/private/subscription-capabilities/index.d.ts +2 -0
  47. package/lib/endpoints/private/subscriptions/DeleteSubscription.d.ts +17 -0
  48. package/lib/endpoints/private/subscriptions/GetSubscriptions.d.ts +18 -0
  49. package/lib/endpoints/private/subscriptions/PatchSubscriptions.d.ts +20 -0
  50. package/lib/endpoints/private/subscriptions/PostSubscriptions.d.ts +20 -0
  51. package/lib/endpoints/private/subscriptions/Subscriptions.types.d.ts +30 -0
  52. package/lib/endpoints/private/subscriptions/index.d.ts +5 -0
  53. package/lib/endpoints/private/system-country-codes/GetSystemCountryCodes.d.ts +15 -0
  54. package/lib/endpoints/private/system-country-codes/SystemCountryCodes.types.d.ts +11 -0
  55. package/lib/endpoints/private/system-country-codes/index.d.ts +2 -0
  56. package/lib/endpoints/private/system-messages/GetSystemMessages.d.ts +17 -0
  57. package/lib/endpoints/private/system-messages/SystemMessage.types.d.ts +18 -0
  58. package/lib/endpoints/private/system-messages/index.d.ts +2 -0
  59. package/lib/endpoints/private/track-traces/GetTrackAndTraceByShipment.d.ts +17 -0
  60. package/lib/endpoints/private/track-traces/TrackTraces.types.d.ts +51 -0
  61. package/lib/endpoints/private/track-traces/index.d.ts +2 -0
  62. package/lib/endpoints/private/webhook-subscriptions/DeleteWebhookSubscriptions.d.ts +17 -0
  63. package/lib/endpoints/private/webhook-subscriptions/GetWebhookSubscriptions.d.ts +15 -0
  64. package/lib/endpoints/private/webhook-subscriptions/PostWebhookSubscriptions.d.ts +20 -0
  65. package/lib/endpoints/private/webhook-subscriptions/Webhook.types.d.ts +13 -0
  66. package/lib/endpoints/private/webhook-subscriptions/index.d.ts +4 -0
  67. package/lib/endpoints/public/carriers/Carrier.types.d.ts +11 -0
  68. package/lib/endpoints/public/carriers/GetCarrier.d.ts +20 -0
  69. package/lib/endpoints/public/carriers/GetCarriers.d.ts +16 -0
  70. package/lib/endpoints/public/carriers/index.d.ts +3 -0
  71. package/lib/endpoints/public/delivery-options/DeliveryOption.types.d.ts +22 -0
  72. package/lib/endpoints/public/delivery-options/GetDeliveryOptions.d.ts +50 -0
  73. package/lib/endpoints/public/delivery-options/index.d.ts +2 -0
  74. package/lib/endpoints/public/index.d.ts +3 -0
  75. package/lib/endpoints/public/pickup-locations/GetPickupLocations.d.ts +18 -0
  76. package/lib/endpoints/public/pickup-locations/PickupLocation.types.d.ts +32 -0
  77. package/lib/endpoints/public/pickup-locations/index.d.ts +2 -0
  78. package/lib/index.cjs +1 -0
  79. package/lib/index.d.ts +6 -0
  80. package/lib/index.js +660 -0
  81. package/lib/index.spec.d.ts +1 -0
  82. package/lib/model/client/AbstractClient.d.ts +89 -0
  83. package/lib/model/client/AbstractClient.spec.d.ts +1 -0
  84. package/lib/model/client/AbstractClient.types.d.ts +55 -0
  85. package/lib/model/client/FetchClient.d.ts +7 -0
  86. package/lib/model/client/helper/addParameters.d.ts +4 -0
  87. package/lib/model/client/helper/addParameters.spec.d.ts +1 -0
  88. package/lib/model/client/helper/index.d.ts +2 -0
  89. package/lib/model/client/helper/isJson.d.ts +1 -0
  90. package/lib/model/client/helper/isJson.spec.d.ts +1 -0
  91. package/lib/model/client/index.d.ts +4 -0
  92. package/lib/model/client/middleware/Interceptors.d.ts +8 -0
  93. package/lib/model/client/middleware/Interceptors.unit.spec.d.ts +1 -0
  94. package/lib/model/client/middleware/middleware.types.d.ts +1 -0
  95. package/lib/model/endpoint/AbstractEndpoint.d.ts +57 -0
  96. package/lib/model/endpoint/AbstractEndpoint.types.d.ts +21 -0
  97. package/lib/model/endpoint/AbstractPrivateEndpoint.d.ts +14 -0
  98. package/lib/model/endpoint/AbstractPublicEndpoint.d.ts +6 -0
  99. package/lib/model/endpoint/index.d.ts +4 -0
  100. package/lib/model/exception/ApiException.d.ts +6 -0
  101. package/lib/model/exception/UserException.d.ts +4 -0
  102. package/lib/model/exception/index.d.ts +2 -0
  103. package/lib/model/index.d.ts +3 -0
  104. package/lib/types/common.types.d.ts +31 -0
  105. package/lib/types/data.types.d.ts +23 -0
  106. package/lib/types/global.types.d.ts +4 -0
  107. package/lib/types/index.d.ts +4 -0
  108. package/lib/types/request.types.d.ts +18 -0
  109. package/package.json +79 -0
@@ -0,0 +1,175 @@
1
+ import { CarrierId, CustomsDeclarationContents, DeliveryTypeId, PackageTypeId, ShipmentStatus } from '@myparcel-dev/constants';
2
+ import { AddressWithContactDetails, RetailLocation, IntBoolean, Price, WithRequired } from '../../../types';
3
+
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<AddressWithContactDetails, 'number'> | WithRequired<AddressWithContactDetails, '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,20 @@
1
+ import { MyParcelShop } from './Shop.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type GetShopDefinition = CreateDefinition<{
6
+ name: typeof GetShop.name;
7
+ path: {
8
+ id: number;
9
+ };
10
+ response: MyParcelShop[];
11
+ }>;
12
+ /**
13
+ * Retrieve a single shop by ID.
14
+ */
15
+ export declare class GetShop extends AbstractPrivateEndpoint<GetShopDefinition> {
16
+ readonly name = "getShop";
17
+ readonly path = "shops/:id";
18
+ readonly property = "shops";
19
+ }
20
+ export {};
@@ -0,0 +1,23 @@
1
+ import { MyParcelShop } from './Shop.types';
2
+ import { HttpMethod } from '../../../types/request.types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+
6
+ type PostShopDefinition = CreateDefinition<{
7
+ name: typeof PostShop.name;
8
+ body: MyParcelShop[];
9
+ response: {
10
+ id: number;
11
+ }[];
12
+ }>;
13
+ /**
14
+ * Create a shop.
15
+ */
16
+ export declare class PostShop extends AbstractPrivateEndpoint<PostShopDefinition> {
17
+ readonly method: HttpMethod;
18
+ readonly name = "postShop";
19
+ readonly path = "shops/duplicate";
20
+ readonly property = "shops";
21
+ readonly responseProperty = "ids";
22
+ }
23
+ export {};
@@ -0,0 +1,24 @@
1
+ import { DuplicateShop } from './Shop.types';
2
+ import { HttpMethod } from '../../../types/request.types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+
6
+ type PostShopDuplicateDefinition = CreateDefinition<{
7
+ name: typeof PostShopDuplicate.name;
8
+ body: DuplicateShop[];
9
+ response: {
10
+ ids: [{
11
+ id: number;
12
+ }];
13
+ };
14
+ }>;
15
+ /**
16
+ * The PostShopDuplicate endpoint is used to add a new shop.
17
+ */
18
+ export declare class PostShopDuplicate extends AbstractPrivateEndpoint<PostShopDuplicateDefinition> {
19
+ readonly method: HttpMethod;
20
+ readonly name = "postShopDuplicate";
21
+ readonly path = "shops/duplicate";
22
+ readonly property = "ids";
23
+ }
24
+ export {};
@@ -0,0 +1,17 @@
1
+ import { MyParcelShop } from './Shop.types';
2
+ import { HttpMethod } from '../../../types/request.types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+
6
+ type PutShopDefinition = CreateDefinition<{
7
+ name: typeof PutShop.name;
8
+ body: MyParcelShop[];
9
+ response: MyParcelShop[];
10
+ }>;
11
+ export declare class PutShop extends AbstractPrivateEndpoint<PutShopDefinition> {
12
+ readonly method: HttpMethod;
13
+ readonly name = "putShop";
14
+ readonly path = "shops";
15
+ readonly property = "shops";
16
+ }
17
+ export {};
@@ -0,0 +1,81 @@
1
+ import { Address, IntBoolean } from '../../../types';
2
+
3
+ export interface ShopBranding {
4
+ accent_color: string;
5
+ enable_returns: boolean;
6
+ enable_track_trace: boolean;
7
+ subdomain: string;
8
+ use_consumer_portal: boolean;
9
+ }
10
+ export interface ShopBilling {
11
+ address: Address;
12
+ billing_method: 1 | 2 | 3 | 4;
13
+ coc?: string;
14
+ cycle: 'monthly' | 'weekly';
15
+ eori_number?: string;
16
+ iban?: string;
17
+ reference: string;
18
+ vat_number_uk?: string;
19
+ vat_number?: string;
20
+ }
21
+ export interface ReturnReason {
22
+ human: string;
23
+ name: string;
24
+ }
25
+ export interface ShopReturnReasons {
26
+ enabled: boolean;
27
+ mandatory: boolean;
28
+ return_reasons: ReturnReason[];
29
+ }
30
+ export interface ShopReturn {
31
+ address: Address;
32
+ bcc: IntBoolean;
33
+ email_address_for_tracktrace_return_shipments: string;
34
+ from_address_name?: string;
35
+ link_expires_after?: number;
36
+ send_tracktrace_email_for_return_shipments: IntBoolean;
37
+ settle_printerless_return_cost: IntBoolean;
38
+ use_custom_description: IntBoolean;
39
+ use_printerless_return: IntBoolean;
40
+ use_shop_shipment_options: IntBoolean;
41
+ }
42
+ export interface ShopSettings {
43
+ auto_save_addresses: IntBoolean;
44
+ default_collect_address_id?: number;
45
+ label_description: string;
46
+ label_format_locked: IntBoolean;
47
+ label_format: 'A4' | 'A6';
48
+ preferred_locale?: string;
49
+ reminder_email: IntBoolean;
50
+ use_logo_label: IntBoolean;
51
+ weight: number;
52
+ }
53
+ export interface ShopTrackTrace {
54
+ bcc_email: string;
55
+ bcc: IntBoolean;
56
+ carrier_email_basic_notification: IntBoolean;
57
+ delivery_notification: IntBoolean;
58
+ email_on_handed_to_courier: IntBoolean;
59
+ from_address_company: string;
60
+ from_address_email: string;
61
+ send_track_trace_emails: IntBoolean;
62
+ }
63
+ export interface MyParcelShop {
64
+ account_id: number;
65
+ billing: ShopBilling;
66
+ branding: ShopBranding;
67
+ created: string;
68
+ general_settings: ShopSettings;
69
+ hidden: boolean;
70
+ id: number;
71
+ modified: string;
72
+ name: string;
73
+ platform_id: number;
74
+ return_reason_settings: ShopReturnReasons;
75
+ return: ShopReturn;
76
+ tracktrace: ShopTrackTrace;
77
+ }
78
+ export interface DuplicateShop {
79
+ name: string;
80
+ account_id: number;
81
+ }
@@ -0,0 +1,5 @@
1
+ export * from './GetShop';
2
+ export * from './PostShop';
3
+ export * from './PostShopDuplicate';
4
+ export * from './PutShop';
5
+ export * from './Shop.types';
@@ -0,0 +1,18 @@
1
+ import { SubscriptionCapability } from './SubscriptionCapability.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ import { SubscriptionType } from '../subscriptions/Subscriptions.types';
5
+
6
+ type GetSubscriptionsCapabilitiesDefinition = CreateDefinition<{
7
+ name: typeof GetSubscriptionsCapabilities.name;
8
+ parameters: {
9
+ id: number;
10
+ };
11
+ response: Record<SubscriptionType, SubscriptionCapability[]>;
12
+ }>;
13
+ export declare class GetSubscriptionsCapabilities extends AbstractPrivateEndpoint<GetSubscriptionsCapabilitiesDefinition> {
14
+ readonly name = "getSubscriptionsCapabilities";
15
+ readonly path = "subscriptions/capabilities";
16
+ readonly property = "capabilities";
17
+ }
18
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Price } from '../../../types';
2
+ import { SubscriptionProductId, SubscriptionTier, SubscriptionTierName, SubscriptionType } from '../subscriptions/Subscriptions.types';
3
+
4
+ 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';
5
+ export interface SubscriptionConfiguration {
6
+ dashboard_slugs: string[];
7
+ free_shipments_per_month: number;
8
+ max_shipping_rules: number | null;
9
+ shipment_discount_price: Price;
10
+ shipment_discount_product: number;
11
+ shipment_fee_price: Price;
12
+ shipment_fee_product: number;
13
+ }
14
+ export interface SubscriptionCapability {
15
+ configuration: SubscriptionConfiguration;
16
+ features: string[];
17
+ price: Price;
18
+ tier: SubscriptionTier;
19
+ product_id: SubscriptionProductId;
20
+ product_name: string;
21
+ subscription_type_name: string;
22
+ tier_name: SubscriptionTierName;
23
+ type: SubscriptionType;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './GetSubscriptionCapabilities';
2
+ export * from './SubscriptionCapability.types';
@@ -0,0 +1,17 @@
1
+ import { HttpMethod } from '../../../types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type DeleteSubscriptionDefinition = CreateDefinition<{
6
+ name: typeof DeleteSubscription.name;
7
+ path: {
8
+ id: number;
9
+ };
10
+ }>;
11
+ export declare class DeleteSubscription extends AbstractPrivateEndpoint<DeleteSubscriptionDefinition> {
12
+ readonly method: HttpMethod;
13
+ readonly name = "deleteSubscription";
14
+ readonly path = "subscriptions/:id";
15
+ readonly property = "subscriptions";
16
+ }
17
+ export {};
@@ -0,0 +1,18 @@
1
+ import { MyParcelSubscription, SubscriptionPostData } from './Subscriptions.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type GetSubscriptionsDefinition = CreateDefinition<{
6
+ name: typeof GetSubscriptions.name;
7
+ parameters: {
8
+ id: number;
9
+ };
10
+ body: SubscriptionPostData[];
11
+ response: MyParcelSubscription[];
12
+ }>;
13
+ export declare class GetSubscriptions extends AbstractPrivateEndpoint<GetSubscriptionsDefinition> {
14
+ readonly name = "getSubscriptions";
15
+ readonly path = "subscriptions";
16
+ readonly property = "subscriptions";
17
+ }
18
+ export {};
@@ -0,0 +1,20 @@
1
+ import { SubscriptionPatchData } from './Subscriptions.types';
2
+ import { HttpMethod } from '../../../types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+
6
+ type PatchSubscriptionsDefinition = CreateDefinition<{
7
+ name: typeof PatchSubscriptions.name;
8
+ body: SubscriptionPatchData[];
9
+ response: {
10
+ id: number;
11
+ }[];
12
+ }>;
13
+ export declare class PatchSubscriptions extends AbstractPrivateEndpoint<PatchSubscriptionsDefinition> {
14
+ readonly method: HttpMethod;
15
+ readonly name = "patchSubscriptions";
16
+ readonly path = "subscriptions";
17
+ readonly property = "subscriptions";
18
+ readonly responseProperty = "ids";
19
+ }
20
+ export {};
@@ -0,0 +1,20 @@
1
+ import { SubscriptionPostData } from './Subscriptions.types';
2
+ import { HttpMethod } from '../../../types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+
6
+ type PostSubscriptionsDefinition = CreateDefinition<{
7
+ name: typeof PostSubscriptions.name;
8
+ body: SubscriptionPostData[];
9
+ response: {
10
+ id: number;
11
+ }[];
12
+ }>;
13
+ export declare class PostSubscriptions extends AbstractPrivateEndpoint<PostSubscriptionsDefinition> {
14
+ readonly method: HttpMethod;
15
+ readonly name = "postSubscriptions";
16
+ readonly path = "subscriptions";
17
+ readonly property = "subscriptions";
18
+ readonly responseProperty = "ids";
19
+ }
20
+ 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,15 @@
1
+ import { SystemCountryCodesPerCountry, GetSystemCountryCodesParams } from './SystemCountryCodes.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type GetSystemCountryCodesDefinition = CreateDefinition<{
6
+ name: typeof GetSystemCountryCodes.name;
7
+ parameters: GetSystemCountryCodesParams;
8
+ response: SystemCountryCodesPerCountry;
9
+ }>;
10
+ export declare class GetSystemCountryCodes extends AbstractPrivateEndpoint<GetSystemCountryCodesDefinition> {
11
+ readonly name = "getSystemCountryCodes";
12
+ readonly path = "system_country_codes";
13
+ readonly property = "countries";
14
+ }
15
+ export {};
@@ -0,0 +1,11 @@
1
+ import { CarrierId } from '@myparcel-dev/constants';
2
+
3
+ export interface SystemCountryCode {
4
+ label: string;
5
+ region: string;
6
+ }
7
+ export type SystemCountryCodesPerCountry = Record<string, SystemCountryCode>[];
8
+ export type GetSystemCountryCodesParams = {
9
+ carrier_id?: CarrierId;
10
+ unfiltered?: boolean;
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './GetSystemCountryCodes';
2
+ export * from './SystemCountryCodes.types';
@@ -0,0 +1,17 @@
1
+ import { MyParcelSystemMessage } from './SystemMessage.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type GetSystemMessagesDefinition = CreateDefinition<{
6
+ name: typeof GetSystemMessages.name;
7
+ response: MyParcelSystemMessage[];
8
+ }>;
9
+ /**
10
+ * Retrieve system messages.
11
+ */
12
+ export declare class GetSystemMessages extends AbstractPrivateEndpoint<GetSystemMessagesDefinition> {
13
+ readonly name = "getSystemMessages";
14
+ readonly path = "system_messages";
15
+ readonly property = "messages";
16
+ }
17
+ 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,17 @@
1
+ import { TrackAndTrace } from './TrackTraces.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+
5
+ type GetTrackAndTraceDefinition = CreateDefinition<{
6
+ name: typeof GetTrackAndTrace.name;
7
+ response: TrackAndTrace[];
8
+ path: {
9
+ shipment_id: string;
10
+ };
11
+ }>;
12
+ export declare class GetTrackAndTrace extends AbstractPrivateEndpoint<GetTrackAndTraceDefinition> {
13
+ readonly name = "getTrackAndTrace";
14
+ readonly path = "tracktraces/:shipment_id";
15
+ readonly property = "tracktraces";
16
+ }
17
+ export {};
@@ -0,0 +1,51 @@
1
+ import { CarrierId } from '@myparcel-dev/constants';
2
+ import { ShipmentOptions } from '../shipments';
3
+ import { Address, AddressWithContactDetails } from '../../../types';
4
+ import { PickupLocation } from '../../public';
5
+
6
+ export interface PartnerTrackTraceLink {
7
+ barcode: string;
8
+ uri: string;
9
+ }
10
+ export type ShipmentStatus = 'registered' | 'handed_to_carrier' | 'sorting' | 'distribution' | 'delivered';
11
+ export interface TrackAndTraceStatus {
12
+ main: ShipmentStatus;
13
+ final: boolean;
14
+ current: number;
15
+ }
16
+ export interface TrackAndTraceLocation {
17
+ name: string;
18
+ countryCode: string;
19
+ city: string;
20
+ postalCode: string;
21
+ street: string;
22
+ number: string;
23
+ numberSuffix: string;
24
+ longitude: number;
25
+ latitude: number;
26
+ }
27
+ export interface TrackTraceHistory {
28
+ code: string;
29
+ description: string;
30
+ time: string;
31
+ delayed: boolean;
32
+ location: TrackAndTraceLocation;
33
+ }
34
+ export interface TrackAndTrace {
35
+ shipment_id: number;
36
+ carrier_id: CarrierId;
37
+ code: string;
38
+ description: string;
39
+ time: string;
40
+ link_consumer_portal: string;
41
+ link_tracktrace: string;
42
+ partner_tracktraces: PartnerTrackTraceLink[];
43
+ recipient: AddressWithContactDetails;
44
+ sender: Address;
45
+ options: ShipmentOptions;
46
+ pickup: PickupLocation | null;
47
+ delayed: boolean;
48
+ location: TrackAndTraceLocation | null;
49
+ status: TrackAndTraceStatus;
50
+ history: TrackTraceHistory[];
51
+ }