@@ -22,7 +22,7 @@ import * as Types from "../../types";
22
22
import { ensureJSON } from "../../utils" ;
23
23
import { Readable } from "stream" ;
24
24
25
- import HTTPFetchClient from "../../http-fetch" ;
25
+ import HTTPFetchClient , { convertResponseToReadable } from "../../http-fetch" ;
26
26
27
27
// ===============================================
28
28
// This file is autogenerated - Please do not edit
@@ -42,7 +42,6 @@ export class ChannelAccessTokenClient {
42
42
}
43
43
this . httpClient = new HTTPFetchClient ( {
44
44
defaultHeaders : { } ,
45
- responseParser : this . parseHTTPResponse . bind ( this ) ,
46
45
baseURL : config . baseURL ,
47
46
} ) ;
48
47
}
@@ -76,11 +75,14 @@ export class ChannelAccessTokenClient {
76
75
clientAssertion : clientAssertion ,
77
76
} ;
78
77
79
- const res = this . httpClient . get < ChannelAccessTokenKeyIdsResponse > (
78
+ const res = await this . httpClient . get (
80
79
"/oauth2/v2.1/tokens/kid" ,
81
80
queryParams ,
82
81
) ;
83
- return ensureJSON ( res ) ;
82
+ const result = ( await this . parseHTTPResponse (
83
+ res ,
84
+ ) ) as ChannelAccessTokenKeyIdsResponse ;
85
+ return ensureJSON ( result ) ;
84
86
}
85
87
/**
86
88
* Issue short-lived channel access token
@@ -106,12 +108,14 @@ export class ChannelAccessTokenClient {
106
108
}
107
109
} ) ;
108
110
109
- const res =
110
- this . httpClient . postForm < IssueShortLivedChannelAccessTokenResponse > (
111
- "/v2/oauth/accessToken" ,
112
- formParams ,
113
- ) ;
114
- return ensureJSON ( res ) ;
111
+ const res = await this . httpClient . postForm (
112
+ "/v2/oauth/accessToken" ,
113
+ formParams ,
114
+ ) ;
115
+ const result = ( await this . parseHTTPResponse (
116
+ res ,
117
+ ) ) as IssueShortLivedChannelAccessTokenResponse ;
118
+ return ensureJSON ( result ) ;
115
119
}
116
120
/**
117
121
* Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication.
@@ -137,11 +141,14 @@ export class ChannelAccessTokenClient {
137
141
}
138
142
} ) ;
139
143
140
- const res = this . httpClient . postForm < IssueChannelAccessTokenResponse > (
144
+ const res = await this . httpClient . postForm (
141
145
"/oauth2/v2.1/token" ,
142
146
formParams ,
143
147
) ;
144
- return ensureJSON ( res ) ;
148
+ const result = ( await this . parseHTTPResponse (
149
+ res ,
150
+ ) ) as IssueChannelAccessTokenResponse ;
151
+ return ensureJSON ( result ) ;
145
152
}
146
153
/**
147
154
* Issues a new stateless channel access token, which doesn\'t have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
@@ -173,12 +180,11 @@ export class ChannelAccessTokenClient {
173
180
}
174
181
} ) ;
175
182
176
- const res =
177
- this . httpClient . postForm < IssueStatelessChannelAccessTokenResponse > (
178
- "/oauth2/v3/token" ,
179
- formParams ,
180
- ) ;
181
- return ensureJSON ( res ) ;
183
+ const res = await this . httpClient . postForm ( "/oauth2/v3/token" , formParams ) ;
184
+ const result = ( await this . parseHTTPResponse (
185
+ res ,
186
+ ) ) as IssueStatelessChannelAccessTokenResponse ;
187
+ return ensureJSON ( result ) ;
182
188
}
183
189
/**
184
190
* Revoke short-lived or long-lived channel access token
@@ -198,8 +204,11 @@ export class ChannelAccessTokenClient {
198
204
}
199
205
} ) ;
200
206
201
- const res = this . httpClient . postForm ( "/v2/oauth/revoke" , formParams ) ;
202
- return ensureJSON ( res ) ;
207
+ const res = await this . httpClient . postForm ( "/v2/oauth/revoke" , formParams ) ;
208
+ const result = ( await this . parseHTTPResponse (
209
+ res ,
210
+ ) ) as Types . MessageAPIResponseBase ;
211
+ return ensureJSON ( result ) ;
203
212
}
204
213
/**
205
214
* Revoke channel access token v2.1
@@ -225,8 +234,14 @@ export class ChannelAccessTokenClient {
225
234
}
226
235
} ) ;
227
236
228
- const res = this . httpClient . postForm ( "/oauth2/v2.1/revoke" , formParams ) ;
229
- return ensureJSON ( res ) ;
237
+ const res = await this . httpClient . postForm (
238
+ "/oauth2/v2.1/revoke" ,
239
+ formParams ,
240
+ ) ;
241
+ const result = ( await this . parseHTTPResponse (
242
+ res ,
243
+ ) ) as Types . MessageAPIResponseBase ;
244
+ return ensureJSON ( result ) ;
230
245
}
231
246
/**
232
247
* Verify the validity of short-lived and long-lived channel access tokens
@@ -246,11 +261,11 @@ export class ChannelAccessTokenClient {
246
261
}
247
262
} ) ;
248
263
249
- const res = this . httpClient . postForm < VerifyChannelAccessTokenResponse > (
250
- "/v2/oauth/verify" ,
251
- formParams ,
252
- ) ;
253
- return ensureJSON ( res ) ;
264
+ const res = await this . httpClient . postForm ( "/v2/oauth/verify" , formParams ) ;
265
+ const result = ( await this . parseHTTPResponse (
266
+ res ,
267
+ ) ) as VerifyChannelAccessTokenResponse ;
268
+ return ensureJSON ( result ) ;
254
269
}
255
270
/**
256
271
* You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.
@@ -265,10 +280,10 @@ export class ChannelAccessTokenClient {
265
280
accessToken : accessToken ,
266
281
} ;
267
282
268
- const res = this . httpClient . get < VerifyChannelAccessTokenResponse > (
269
- "/oauth2/v2.1/verify" ,
270
- queryParams ,
271
- ) ;
272
- return ensureJSON ( res ) ;
283
+ const res = await this . httpClient . get ( "/oauth2/v2.1/verify" , queryParams ) ;
284
+ const result = ( await this . parseHTTPResponse (
285
+ res ,
286
+ ) ) as VerifyChannelAccessTokenResponse ;
287
+ return ensureJSON ( result ) ;
273
288
}
274
289
}
0 commit comments