From 8f0f07f75325a8553243e2248855aed0a5b863ea Mon Sep 17 00:00:00 2001 From: Remco Horters Date: Wed, 10 Apr 2024 09:33:16 +0200 Subject: [PATCH] feat: add DeleteSubscription endpoint --- src/__snapshots__/index.spec.ts.snap | 1 + .../private/subscriptions/DeleteSubscription.ts | 17 +++++++++++++++++ src/endpoints/private/subscriptions/index.ts | 1 + 3 files changed, 19 insertions(+) create mode 100644 src/endpoints/private/subscriptions/DeleteSubscription.ts diff --git a/src/__snapshots__/index.spec.ts.snap b/src/__snapshots__/index.spec.ts.snap index 8d6a18f..67be2ac 100644 --- a/src/__snapshots__/index.spec.ts.snap +++ b/src/__snapshots__/index.spec.ts.snap @@ -10,6 +10,7 @@ exports[`module exports > exposes the correct data from index.ts 1`] = ` "BASE_URL": "https://api.myparcel.nl", "DeleteAccountMessage": [Function], "DeleteCarrierOptions": [Function], + "DeleteSubscription": [Function], "DeleteWebhookSubscriptions": [Function], "FetchClient": [Function], "GetAccount": [Function], diff --git a/src/endpoints/private/subscriptions/DeleteSubscription.ts b/src/endpoints/private/subscriptions/DeleteSubscription.ts new file mode 100644 index 0000000..4bc2229 --- /dev/null +++ b/src/endpoints/private/subscriptions/DeleteSubscription.ts @@ -0,0 +1,17 @@ +import {type HttpMethod} from '@/types'; +import {AbstractPrivateEndpoint} from '@/model/endpoint/AbstractPrivateEndpoint'; +import {type CreateDefinition} from '@/model/endpoint/AbstractEndpoint.types'; + +type DeleteSubscriptionDefinition = CreateDefinition<{ + name: typeof DeleteSubscription.name; + path: { + id: number; + }; +}>; + +export class DeleteSubscription extends AbstractPrivateEndpoint { + public readonly method: HttpMethod = 'DELETE'; + public readonly name = 'deleteSubscription'; + public readonly path = 'subscriptions/:id'; + public readonly property = 'subscriptions'; +} diff --git a/src/endpoints/private/subscriptions/index.ts b/src/endpoints/private/subscriptions/index.ts index b35d9cd..5aaa0b3 100644 --- a/src/endpoints/private/subscriptions/index.ts +++ b/src/endpoints/private/subscriptions/index.ts @@ -1,3 +1,4 @@ +export * from './DeleteSubscription'; export * from './GetSubscriptions'; export * from './PatchSubscriptions'; export * from './PostSubscriptions';