11import {
22 HttpClient ,
33 LinkedApiError ,
4- TBillingLinkResult ,
5- TCancelResult ,
64 TLinkedApiErrorType ,
75 TSetSeatsParams ,
86 TSetSeatsResult ,
9- TSubscriptionProduct ,
107 TSubscriptionSeat ,
118 TSubscriptionStatus ,
129} from '../types' ;
@@ -40,19 +37,6 @@ export class AdminSubscription {
4037 ) ;
4138 }
4239
43- public async getPricing ( ) : Promise < { products : Array < TSubscriptionProduct > } > {
44- const response = await this . httpClient . post < { products : Array < TSubscriptionProduct > } > (
45- '/admin/subscription.getPricing' ,
46- ) ;
47- if ( response . success && response . result ) {
48- return response . result ;
49- }
50- throw new LinkedApiError (
51- ( response . error ?. type ?? 'httpError' ) as TLinkedApiErrorType ,
52- response . error ?. message ?? 'Failed to get pricing' ,
53- ) ;
54- }
55-
5640 public async setSeats ( params : TSetSeatsParams ) : Promise < TSetSeatsResult > {
5741 const response = await this . httpClient . post < TSetSeatsResult > (
5842 '/admin/subscription.setSeats' ,
@@ -66,28 +50,4 @@ export class AdminSubscription {
6650 response . error ?. message ?? 'Failed to set seats' ,
6751 ) ;
6852 }
69-
70- public async getBillingLink ( ) : Promise < TBillingLinkResult > {
71- const response = await this . httpClient . post < TBillingLinkResult > (
72- '/admin/subscription.getBillingLink' ,
73- ) ;
74- if ( response . success && response . result ) {
75- return response . result ;
76- }
77- throw new LinkedApiError (
78- ( response . error ?. type ?? 'httpError' ) as TLinkedApiErrorType ,
79- response . error ?. message ?? 'Failed to get billing link' ,
80- ) ;
81- }
82-
83- public async cancel ( ) : Promise < TCancelResult > {
84- const response = await this . httpClient . post < TCancelResult > ( '/admin/subscription.cancel' ) ;
85- if ( response . success && response . result ) {
86- return response . result ;
87- }
88- throw new LinkedApiError (
89- ( response . error ?. type ?? 'httpError' ) as TLinkedApiErrorType ,
90- response . error ?. message ?? 'Failed to cancel subscription' ,
91- ) ;
92- }
9353}
0 commit comments