@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
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 MyParcel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @myparcel/sdk
2
+
3
+ [![npm](https://img.shields.io/npm/v/@myparcel/sdk?labelColor=27272A&logoColor=FFFFFF&style=for-the-badge&color=CC3534&logo=npm)](https://www.npmjs.com/package/@myparcel/sdk/)
4
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/myparcelnl/js-sdk?labelColor=27272A&style=for-the-badge)](https://github.com/myparcelnl/js-sdk/releases)
5
+ [![codecov](https://codecov.io/gh/myparcelnl/js-sdk/graph/badge.svg?token=sdNcLRMAEn)](https://codecov.io/gh/myparcelnl/js-sdk)
6
+
7
+ Official JavaScript SDK to connect to the MyParcel API via Node.js or browser.
8
+
9
+ ## Documentation
10
+
11
+ To the [documentation](https://developer.myparcel.nl/documentation/51.javascript-sdk.html).
12
+
13
+ ## Contributing
14
+
15
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
@@ -0,0 +1,14 @@
1
+ import { type AbstractEndpoint } from './model/endpoint/AbstractEndpoint';
2
+ import { type EndpointResponse, type Options } from './model/client/AbstractClient.types';
3
+ import { type AbstractClient } from './model/client/AbstractClient';
4
+ type EndpointMethod<E extends AbstractEndpoint> = (options?: Options<E>) => Promise<EndpointResponse<E>>;
5
+ export type MyParcelSdk<E extends AbstractEndpoint> = {
6
+ [K in E['name']]: EndpointMethod<Extract<E, {
7
+ name: K;
8
+ }>>;
9
+ };
10
+ /**
11
+ * Create a sdk instance with a client and given endpoints.
12
+ */
13
+ export declare function createMyParcelSdk<E extends AbstractEndpoint>(client: AbstractClient, endpoints: E[]): MyParcelSdk<E>;
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type AbstractPrivateEndpoint } from './model/endpoint/AbstractPrivateEndpoint';
2
+ import { type AbstractClient } from './model/client/AbstractClient';
3
+ import { type MyParcelSdk } from './createMyParcelSdk';
4
+ /**
5
+ * Create a private SDK which requires an Authorization header on all its endpoints.
6
+ */
7
+ export declare const createPrivateSdk: <E extends AbstractPrivateEndpoint<import("./model").EndpointDefinition>>(client: AbstractClient, endpoints: E[]) => MyParcelSdk<E>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type AbstractPublicEndpoint } from './model/endpoint/AbstractPublicEndpoint';
2
+ import { type AbstractClient } from './model/client/AbstractClient';
3
+ import { type MyParcelSdk } from './createMyParcelSdk';
4
+ /**
5
+ * Create a public SDK which does not require Authorization headers and can be used in a browser.
6
+ */
7
+ export declare const createPublicSdk: <E extends AbstractPublicEndpoint<import("./model").EndpointDefinition>>(client: AbstractClient, endpoints: E[]) => MyParcelSdk<E>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './private';
2
+ export * from './public';
@@ -0,0 +1,6 @@
1
+ export interface MyParcelAccountMessage {
2
+ id: number;
3
+ account_id: number;
4
+ code: number;
5
+ message: string;
6
+ }
@@ -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
+ type DeleteAccountMessageDefinition = CreateDefinition<{
5
+ name: typeof DeleteAccountMessage.name;
6
+ path: {
7
+ id: number;
8
+ };
9
+ }>;
10
+ /**
11
+ * Deletes one system message by ID.
12
+ */
13
+ export declare class DeleteAccountMessage extends AbstractPrivateEndpoint<DeleteAccountMessageDefinition> {
14
+ readonly method: HttpMethod;
15
+ readonly name = "deleteAccountMessage";
16
+ readonly path = "account_messages/:id";
17
+ readonly property = "messages";
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 MyParcelAccountMessage } from './AccountMessages.types';
4
+ type GetAccountMessagesDefinition = CreateDefinition<{
5
+ name: typeof GetAccountMessages.name;
6
+ parameters: {
7
+ account_id: number;
8
+ };
9
+ response: MyParcelAccountMessage[];
10
+ }>;
11
+ /**
12
+ * Retrieve system messages.
13
+ */
14
+ export declare class GetAccountMessages extends AbstractPrivateEndpoint<GetAccountMessagesDefinition> {
15
+ readonly name = "getAccountMessages";
16
+ readonly path = "account_messages";
17
+ readonly property = "messages";
18
+ }
19
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './AccountMessages.types';
2
+ export * from './DeleteAccountMessage';
3
+ export * from './GetAccountMessages';
@@ -0,0 +1,58 @@
1
+ import { type PlatformId } from '@myparcel/constants';
2
+ import { type Address } from '../../../types/common.types';
3
+ import { type PaginationParameters, type IntBoolean, type Price } from '../../../types';
4
+ import { type MyParcelShop } from '../shops/Shop.types';
5
+ export interface AccountAdditionalInfo {
6
+ ecommerce_platform: string;
7
+ phone: string;
8
+ coupon: string;
9
+ }
10
+ export interface AccountSettings {
11
+ affiliate_bcc: IntBoolean;
12
+ affiliate_fee: Price;
13
+ is_test: IntBoolean;
14
+ order_mode: IntBoolean;
15
+ order_feature: boolean;
16
+ order_Settings: {
17
+ shipment_label: 'apart' | 'nested' | 'none';
18
+ };
19
+ show_cumulio_dashboard: IntBoolean;
20
+ has_carrier_contract: IntBoolean;
21
+ has_carrier_mail_contract: IntBoolean;
22
+ has_carrier_small_package_contract: IntBoolean;
23
+ use_mfa: IntBoolean;
24
+ postnl_weight_unit_grams: IntBoolean;
25
+ allow_printerless_return: IntBoolean;
26
+ }
27
+ export type AccountStatus = 1 | 2 | 3 | 4;
28
+ export interface MyParcelAccount {
29
+ additional_info: AccountAdditionalInfo;
30
+ carrier_references: [];
31
+ contact_id: number;
32
+ contact: Record<string, string>;
33
+ created: string;
34
+ delivery_address: null | Address;
35
+ email: string;
36
+ first_name: string;
37
+ gender: string;
38
+ general_Settings: AccountSettings;
39
+ id: number;
40
+ last_name: string;
41
+ modified: string;
42
+ origin_id: number;
43
+ phone: string;
44
+ platform_id: number;
45
+ shipment_estimates: Record<string, unknown>;
46
+ shops: MyParcelShop[];
47
+ status: AccountStatus;
48
+ terms_agreed: boolean;
49
+ username: string;
50
+ users: Record<string, unknown>;
51
+ }
52
+ export type GetAccountsParams = PaginationParameters & {
53
+ status?: AccountStatus;
54
+ from?: string;
55
+ to?: string;
56
+ q?: string;
57
+ platform_id?: PlatformId;
58
+ };
@@ -0,0 +1,19 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type MyParcelAccount } from './Account.types';
4
+ type GetAccountDefinition = CreateDefinition<{
5
+ name: typeof GetAccount.name;
6
+ path: {
7
+ id: number;
8
+ };
9
+ response: [MyParcelAccount];
10
+ }>;
11
+ /**
12
+ * Retrieve a single account object by ID.
13
+ */
14
+ export declare class GetAccount extends AbstractPrivateEndpoint<GetAccountDefinition> {
15
+ readonly name = "getAccount";
16
+ readonly path = "accounts/:id";
17
+ readonly property = "accounts";
18
+ }
19
+ export {};
@@ -0,0 +1,13 @@
1
+ import { type GetAccountsParams, type MyParcelAccount } from './Account.types';
2
+ import { AbstractPrivateEndpoint, type CreateDefinition, type PaginatedResponse } from '../../../model';
3
+ type GetAccountsDefinition = CreateDefinition<{
4
+ name: typeof GetAccounts.name;
5
+ parameters: GetAccountsParams;
6
+ response: PaginatedResponse<MyParcelAccount[]>;
7
+ }>;
8
+ export declare class GetAccounts extends AbstractPrivateEndpoint<GetAccountsDefinition> {
9
+ readonly name = "getAccounts";
10
+ readonly path = "accounts";
11
+ readonly property = "accounts";
12
+ }
13
+ export {};
@@ -0,0 +1,18 @@
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 MyParcelAccount } from './Account.types';
5
+ type PutAccountDefinition = CreateDefinition<{
6
+ name: typeof PutAccount.name;
7
+ path: {
8
+ id: number;
9
+ };
10
+ response: MyParcelAccount[];
11
+ }>;
12
+ export declare class PutAccount extends AbstractPrivateEndpoint<PutAccountDefinition> {
13
+ readonly method: HttpMethod;
14
+ readonly name = "putAccount";
15
+ readonly path = "accounts";
16
+ readonly property = "accounts";
17
+ }
18
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './Account.types';
2
+ export * from './GetAccount';
3
+ export * from './GetAccounts';
4
+ export * from './PutAccount';
@@ -0,0 +1,12 @@
1
+ export interface MyParcelApiKey {
2
+ id: number;
3
+ account_id: number;
4
+ shop_id: number;
5
+ status: number;
6
+ username: string;
7
+ key: string;
8
+ }
9
+ export interface ApiKeyPostData {
10
+ account_id: number;
11
+ shop_id: number;
12
+ }
@@ -0,0 +1,16 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type MyParcelApiKey } from './ApiKey.types';
4
+ type GetApiKeysDefinition = CreateDefinition<{
5
+ name: typeof GetApiKeys.name;
6
+ response: MyParcelApiKey[];
7
+ }>;
8
+ /**
9
+ * Retrieve all API keys.
10
+ */
11
+ export declare class GetApiKeys extends AbstractPrivateEndpoint<GetApiKeysDefinition> {
12
+ readonly name = "getApiKeys";
13
+ readonly path = "keys";
14
+ readonly property = "api_keys";
15
+ }
16
+ export {};
@@ -0,0 +1,19 @@
1
+ import { type ApiKeyPostData, type MyParcelApiKey } from './ApiKey.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ import { type HttpMethod } from '../../../types';
5
+ type PostApiKeyDefinition = CreateDefinition<{
6
+ name: typeof PostApiKeys.name;
7
+ body: ApiKeyPostData[];
8
+ response: MyParcelApiKey[];
9
+ }>;
10
+ /**
11
+ * Submit a single new key.
12
+ */
13
+ export declare class PostApiKeys extends AbstractPrivateEndpoint<PostApiKeyDefinition> {
14
+ readonly method: HttpMethod;
15
+ readonly name = "postApiKeys";
16
+ readonly path = "keys";
17
+ readonly property = "api_keys";
18
+ }
19
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './ApiKey.types';
2
+ export * from './GetApiKeys';
3
+ export * from './PostApiKeys';
@@ -0,0 +1,46 @@
1
+ import { type CarrierId, type CarrierName } from '@myparcel/constants';
2
+ import { type IntBoolean } from '../../../types';
3
+ export type MyParcelCarrierOption = {
4
+ api_key: string;
5
+ carrier: {
6
+ id: CarrierId;
7
+ name: CarrierName;
8
+ };
9
+ carrier_id: CarrierId;
10
+ enabled: IntBoolean;
11
+ id: number;
12
+ optional: IntBoolean;
13
+ options: {
14
+ customerCode: string;
15
+ customerNumber: string;
16
+ customerCollectionLocation: string;
17
+ serviceLevels: number;
18
+ barcodeOptions: {
19
+ gpType: string;
20
+ gpRange: string;
21
+ };
22
+ };
23
+ password: string;
24
+ primary: IntBoolean;
25
+ type: 'main' | 'custom';
26
+ username: string;
27
+ subscription_id?: number;
28
+ label?: string;
29
+ };
30
+ export type CarrierOptionPostData = {
31
+ carrier_id: CarrierId;
32
+ username?: string;
33
+ password?: string;
34
+ options?: Record<string, unknown>;
35
+ api_key?: string;
36
+ };
37
+ export type CarrierOptionPutData = {
38
+ carrier_id: CarrierId;
39
+ enabled: IntBoolean;
40
+ };
41
+ export type CarrierOptionsParameters = {
42
+ enabled?: IntBoolean;
43
+ carrier_id?: CarrierId | string;
44
+ subscription_id?: number;
45
+ type: 'main' | 'custom';
46
+ };
@@ -0,0 +1,17 @@
1
+ import { type HttpMethod } from '../../../types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type DeleteCarrierOptionsDefinition = CreateDefinition<{
5
+ name: typeof DeleteCarrierOptions.name;
6
+ path: {
7
+ contract_id: number;
8
+ account_id: number;
9
+ };
10
+ }>;
11
+ export declare class DeleteCarrierOptions extends AbstractPrivateEndpoint<DeleteCarrierOptionsDefinition> {
12
+ readonly method: HttpMethod;
13
+ readonly name = "deleteCarrierOption";
14
+ readonly path = "accounts/:account_id/carrier_options/:contract_id";
15
+ readonly property = "carrier_options";
16
+ }
17
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type MyParcelCarrierOption, type CarrierOptionsParameters } from './CarrierOption.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type GetCarrierOptionsDefinition = CreateDefinition<{
5
+ name: typeof GetCarrierOptions.name;
6
+ path: {
7
+ account_id: number;
8
+ };
9
+ parameters: CarrierOptionsParameters;
10
+ response: MyParcelCarrierOption[];
11
+ }>;
12
+ export declare class GetCarrierOptions extends AbstractPrivateEndpoint<GetCarrierOptionsDefinition> {
13
+ readonly name = "getCarrierOptions";
14
+ readonly path = "carrier_management/accounts/:account_id/carrier_options";
15
+ readonly property = "carrier_options";
16
+ }
17
+ export {};
@@ -0,0 +1,19 @@
1
+ import { type HttpMethod } from '../../../types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CarrierOptionPostData } from './CarrierOption.types';
4
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+ type PostCarrierOptionsDefinition = CreateDefinition<{
6
+ name: typeof PostCarrierOptions.name;
7
+ body: CarrierOptionPostData[];
8
+ response: {
9
+ id: number;
10
+ }[];
11
+ }>;
12
+ export declare class PostCarrierOptions extends AbstractPrivateEndpoint<PostCarrierOptionsDefinition> {
13
+ readonly method: HttpMethod;
14
+ readonly name = "postCarrierOptions";
15
+ readonly path = "accounts/:account_id/carrier_options";
16
+ readonly property = "carrier_options";
17
+ readonly responseProperty = "ids";
18
+ }
19
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type CarrierOptionPutData } from './CarrierOption.types';
2
+ import { type HttpMethod } from '../../../types';
3
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
4
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
5
+ type PutCarrierOptionsDefinition = CreateDefinition<{
6
+ name: typeof PutCarrierOptions.name;
7
+ path: {
8
+ account_id: number;
9
+ };
10
+ body: CarrierOptionPutData[];
11
+ }>;
12
+ /**
13
+ * Retrieve carrier options for an account
14
+ */
15
+ export declare class PutCarrierOptions extends AbstractPrivateEndpoint<PutCarrierOptionsDefinition> {
16
+ readonly name = "putCarrierOptions";
17
+ readonly path = "carrier_management/accounts/:account_id/carrier_options";
18
+ readonly property = "carrier_options";
19
+ readonly method: HttpMethod;
20
+ }
21
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from './CarrierOption.types';
2
+ export * from './DeleteCarrierOptions';
3
+ export * from './GetCarrierOptions';
4
+ export * from './PostCarrierOptions';
5
+ export * from './PutCarrierOptions';
@@ -0,0 +1,13 @@
1
+ export * from './account-messages';
2
+ export * from './accounts';
3
+ export * from './api-key';
4
+ export * from './carrier-options';
5
+ export * from './locations';
6
+ export * from './shipments';
7
+ export * from './shops';
8
+ export * from './subscription-capabilities';
9
+ export * from './subscriptions';
10
+ export * from './system-country-codes';
11
+ export * from './system-messages';
12
+ export * from './track-traces';
13
+ export * from './webhook-subscriptions';
@@ -0,0 +1,14 @@
1
+ import { type LocationParameters, type MyParcelLocation } from './Location.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ type GetLocationsDefinition = CreateDefinition<{
5
+ name: typeof GetLocations.name;
6
+ parameters: LocationParameters;
7
+ response: MyParcelLocation[];
8
+ }>;
9
+ export declare class GetLocations extends AbstractPrivateEndpoint<GetLocationsDefinition> {
10
+ readonly name = "getLocations";
11
+ readonly path = "locations";
12
+ readonly property = "locations";
13
+ }
14
+ export {};
@@ -0,0 +1,9 @@
1
+ export type LocationParameters = {
2
+ cc: string;
3
+ postal_code: string;
4
+ number: string;
5
+ };
6
+ export interface MyParcelLocation {
7
+ street: string;
8
+ city: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from './GetLocations';
2
+ export * from './Location.types';
@@ -0,0 +1,19 @@
1
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
2
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
3
+ import { type MyParcelShipment } from '../..';
4
+ type GetShipmentDefinition = CreateDefinition<{
5
+ name: typeof GetShipment.name;
6
+ path: {
7
+ id: number;
8
+ };
9
+ response: [MyParcelShipment];
10
+ }>;
11
+ /**
12
+ * Retrieve a single shipment by ID.
13
+ */
14
+ export declare class GetShipment extends AbstractPrivateEndpoint<GetShipmentDefinition> {
15
+ readonly name = "getShipment";
16
+ readonly path = "shipments/:id";
17
+ readonly property = "shipments";
18
+ }
19
+ export {};
@@ -0,0 +1,22 @@
1
+ import { type PaginationParameters } from '../../../types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition, type PaginatedResponse } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ import { type MyParcelShipment } from '../..';
5
+ type Parameters = PaginationParameters & {
6
+ carrier?: number;
7
+ hidden?: boolean;
8
+ };
9
+ type GetShipmentsDefinition = CreateDefinition<{
10
+ name: typeof GetShipments.name;
11
+ parameters: Parameters;
12
+ response: PaginatedResponse<MyParcelShipment[]>;
13
+ }>;
14
+ /**
15
+ * Retrieve all shipments, or a paginated subset.
16
+ */
17
+ export declare class GetShipments extends AbstractPrivateEndpoint<GetShipmentsDefinition> {
18
+ readonly name = "getShipments";
19
+ readonly path = "shipments";
20
+ readonly property = "shipments";
21
+ }
22
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type HttpMethod, type RequestHeaders } from '../../../types/request.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ import { type ShipmentPatchData } from './Shipment.types';
5
+ type PatchShipmentsDefinition = CreateDefinition<{
6
+ name: typeof PatchShipments.name;
7
+ body: ShipmentPatchData[];
8
+ }>;
9
+ /**
10
+ * Patch an existing shipment.
11
+ *
12
+ * @see https://developer.myparcel.nl/api-reference/06.shipments.html
13
+ */
14
+ export declare class PatchShipments extends AbstractPrivateEndpoint<PatchShipmentsDefinition> {
15
+ readonly method: HttpMethod;
16
+ readonly name = "patchShipments";
17
+ readonly path = "shipments";
18
+ readonly property = "shipments";
19
+ getHeaders(): RequestHeaders;
20
+ }
21
+ export {};
@@ -0,0 +1,23 @@
1
+ import { type HttpMethod, type RequestHeaders } from '../../../types/request.types';
2
+ import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
3
+ import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
4
+ import { type PostedShipmentReference, type ShipmentPostData } from './Shipment.types';
5
+ type PostShipmentsDefinition = CreateDefinition<{
6
+ name: typeof PostShipments.name;
7
+ body: ShipmentPostData[];
8
+ response: PostedShipmentReference[];
9
+ }>;
10
+ /**
11
+ * Create a shipment.
12
+ *
13
+ * @see https://developer.myparcel.nl/api-reference/06.shipments.html
14
+ */
15
+ export declare class PostShipments extends AbstractPrivateEndpoint<PostShipmentsDefinition> {
16
+ readonly method: HttpMethod;
17
+ readonly name = "postShipments";
18
+ readonly path = "shipments";
19
+ readonly property = "shipments";
20
+ readonly responseProperty = "ids";
21
+ getHeaders(): RequestHeaders;
22
+ }
23
+ export {};