From bb830444bb71b56c0cf2ec54eed67c862a63f4d3 Mon Sep 17 00:00:00 2001 From: Rostyk <34774987+rostyk-kanafotskyy@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:43:48 +0300 Subject: [PATCH] feat: subscription update endpoint (#932) --- src/endpoints/subscriptions.js | 9 +++++++++ src/types/subscriptions.d.ts | 11 +++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/endpoints/subscriptions.js b/src/endpoints/subscriptions.js index 1e51c0b63..f55097f89 100644 --- a/src/endpoints/subscriptions.js +++ b/src/endpoints/subscriptions.js @@ -13,6 +13,15 @@ class SubscriptionsEndpoint extends CRUDExtend { }) } + Update(id, body, token = null) { + return this.request.send( + `${this.endpoint}/${id}`, + 'PUT', + body, + token + ) + } + GetInvoices(id) { return this.request.send(`${this.endpoint}/${id}/invoices`, 'GET') } diff --git a/src/types/subscriptions.d.ts b/src/types/subscriptions.d.ts index e4cb869d4..9e3c09c38 100644 --- a/src/types/subscriptions.d.ts +++ b/src/types/subscriptions.d.ts @@ -53,6 +53,13 @@ export interface SubscriptionCreate { } } +export interface SubscriptionUpdate extends Identifiable { + type: 'subscription' + attributes: { + plan_id: string + } +} + export interface SubscriptionInvoice extends Identifiable { type: "subscription-invoice", attributes: { @@ -129,11 +136,11 @@ export interface SubscriptionsEndpoint extends Omit, "All" | "Limit" | "Offset" | "Sort" | "Attributes" | "Update" | "Link" > { + >, "All" | "Attributes" | "Link" > { endpoint: 'subscriptions' All(token?: string): Promise>