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

Commit bb83044

Browse files
feat: subscription update endpoint (#932)
1 parent 39135f4 commit bb83044

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/endpoints/subscriptions.js

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ class SubscriptionsEndpoint extends CRUDExtend {
1313
})
1414
}
1515

16+
Update(id, body, token = null) {
17+
return this.request.send(
18+
`${this.endpoint}/${id}`,
19+
'PUT',
20+
body,
21+
token
22+
)
23+
}
24+
1625
GetInvoices(id) {
1726
return this.request.send(`${this.endpoint}/${id}/invoices`, 'GET')
1827
}

src/types/subscriptions.d.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ export interface SubscriptionCreate {
5353
}
5454
}
5555

56+
export interface SubscriptionUpdate extends Identifiable {
57+
type: 'subscription'
58+
attributes: {
59+
plan_id: string
60+
}
61+
}
62+
5663
export interface SubscriptionInvoice extends Identifiable {
5764
type: "subscription-invoice",
5865
attributes: {
@@ -129,11 +136,11 @@ export interface SubscriptionsEndpoint
129136
extends Omit<CrudQueryableResource<
130137
Subscription,
131138
SubscriptionCreate,
132-
never,
139+
SubscriptionUpdate,
133140
SubscriptionFilter,
134141
never,
135142
SubscriptionsInclude
136-
>, "All" | "Limit" | "Offset" | "Sort" | "Attributes" | "Update" | "Link" > {
143+
>, "All" | "Attributes" | "Link" > {
137144
endpoint: 'subscriptions'
138145

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

0 commit comments

Comments
 (0)