Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
feat: subscription update endpoint (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
rostyk-kanafotskyy authored Jun 3, 2024
1 parent 39135f4 commit bb83044
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/endpoints/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
11 changes: 9 additions & 2 deletions src/types/subscriptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -129,11 +136,11 @@ export interface SubscriptionsEndpoint
extends Omit<CrudQueryableResource<
Subscription,
SubscriptionCreate,
never,
SubscriptionUpdate,
SubscriptionFilter,
never,
SubscriptionsInclude
>, "All" | "Limit" | "Offset" | "Sort" | "Attributes" | "Update" | "Link" > {
>, "All" | "Attributes" | "Link" > {
endpoint: 'subscriptions'

All(token?: string): Promise<ResourcePage<Subscription, SubscriptionsIncluded>>
Expand Down

0 comments on commit bb83044

Please sign in to comment.