Skip to content

Commit

Permalink
feat: add reactivate subscription method (#122)
Browse files Browse the repository at this point in the history
* add reactivate subscription method

* set runtype
  • Loading branch information
Xillians authored Feb 7, 2024
1 parent 9d82b05 commit e31e323
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/calls/event/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createSubscriptionResponseRt,
getSubscriptionResponseRt,
listSubscriptionResponseRt,
reactivateSubscriptionResponseRt,
} from './models/subscription';
import { CreateSubscriptionInput, ListSubscriptionsInput } from './types';
export * from './types';
Expand All @@ -21,6 +22,21 @@ export class TripletexEvent extends TripletexBase {
return this.performRequest(sessionToken => call({ id, sessionToken }));
}

reactivateSubscription(id: number) {
const requestBody = {
status: "ACTIVE",
}
const call = this.authenticatedCall()
.args<{ id: number }>()
.path(({ id }) => `/v2/event/subscription/${id}`)
.method('put')
.body(requestBody)
.parseJson(withRuntype(reactivateSubscriptionResponseRt))
.build();

return this.performRequest(sessionToken => call({ id, sessionToken }));
}

deleteSubscription(id: number) {
const call = this.authenticatedCall() //
.args<{ id: number }>()
Expand Down
1 change: 1 addition & 0 deletions src/calls/event/models/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export type Subscription = rt.Static<typeof subscriptionRt>;
export const listSubscriptionResponseRt = multipleValuesEnvelope(subscriptionRt);
export const createSubscriptionResponseRt = singleValueEnvelope(subscriptionRt);
export const getSubscriptionResponseRt = singleValueEnvelope(subscriptionRt);
export const reactivateSubscriptionResponseRt = singleValueEnvelope(subscriptionRt);

0 comments on commit e31e323

Please sign in to comment.