@@ -70,6 +70,26 @@ export class ChannelAccessTokenClient {
70
70
clientAssertionType : string ,
71
71
clientAssertion : string ,
72
72
) : Promise < ChannelAccessTokenKeyIdsResponse > {
73
+ return (
74
+ await this . getsAllValidChannelAccessTokenKeyIdsWithHttpInfo (
75
+ clientAssertionType ,
76
+ clientAssertion ,
77
+ )
78
+ ) [ 1 ] ;
79
+ }
80
+
81
+ /**
82
+ * Gets all valid channel access token key IDs..
83
+ * This method includes HttpInfo object to return additional information.
84
+ * @param clientAssertionType `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`
85
+ * @param clientAssertion A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key.
86
+ *
87
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1"> Documentation</a>
88
+ */
89
+ public async getsAllValidChannelAccessTokenKeyIdsWithHttpInfo (
90
+ clientAssertionType : string ,
91
+ clientAssertion : string ,
92
+ ) : Promise < [ Response , ChannelAccessTokenKeyIdsResponse ] > {
73
93
const queryParams = {
74
94
clientAssertionType : clientAssertionType ,
75
95
clientAssertion : clientAssertion ,
@@ -79,10 +99,7 @@ export class ChannelAccessTokenClient {
79
99
"/oauth2/v2.1/tokens/kid" ,
80
100
queryParams ,
81
101
) ;
82
- const result = ( await this . parseHTTPResponse (
83
- res ,
84
- ) ) as ChannelAccessTokenKeyIdsResponse ;
85
- return ensureJSON ( result ) ;
102
+ return [ res , await res . json ( ) ] ;
86
103
}
87
104
/**
88
105
* Issue short-lived channel access token
@@ -97,6 +114,29 @@ export class ChannelAccessTokenClient {
97
114
clientId ?: string ,
98
115
clientSecret ?: string ,
99
116
) : Promise < IssueShortLivedChannelAccessTokenResponse > {
117
+ return (
118
+ await this . issueChannelTokenWithHttpInfo (
119
+ grantType ,
120
+ clientId ,
121
+ clientSecret ,
122
+ )
123
+ ) [ 1 ] ;
124
+ }
125
+
126
+ /**
127
+ * Issue short-lived channel access token.
128
+ * This method includes HttpInfo object to return additional information.
129
+ * @param grantType `client_credentials`
130
+ * @param clientId Channel ID.
131
+ * @param clientSecret Channel secret.
132
+ *
133
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token"> Documentation</a>
134
+ */
135
+ public async issueChannelTokenWithHttpInfo (
136
+ grantType ?: string ,
137
+ clientId ?: string ,
138
+ clientSecret ?: string ,
139
+ ) : Promise < [ Response , IssueShortLivedChannelAccessTokenResponse ] > {
100
140
const formParams = {
101
141
grant_type : grantType ,
102
142
client_id : clientId ,
@@ -112,10 +152,7 @@ export class ChannelAccessTokenClient {
112
152
"/v2/oauth/accessToken" ,
113
153
formParams ,
114
154
) ;
115
- const result = ( await this . parseHTTPResponse (
116
- res ,
117
- ) ) as IssueShortLivedChannelAccessTokenResponse ;
118
- return ensureJSON ( result ) ;
155
+ return [ res , await res . json ( ) ] ;
119
156
}
120
157
/**
121
158
* Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication.
@@ -130,6 +167,29 @@ export class ChannelAccessTokenClient {
130
167
clientAssertionType ?: string ,
131
168
clientAssertion ?: string ,
132
169
) : Promise < IssueChannelAccessTokenResponse > {
170
+ return (
171
+ await this . issueChannelTokenByJWTWithHttpInfo (
172
+ grantType ,
173
+ clientAssertionType ,
174
+ clientAssertion ,
175
+ )
176
+ ) [ 1 ] ;
177
+ }
178
+
179
+ /**
180
+ * Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication..
181
+ * This method includes HttpInfo object to return additional information.
182
+ * @param grantType client_credentials
183
+ * @param clientAssertionType urn:ietf:params:oauth:client-assertion-type:jwt-bearer
184
+ * @param clientAssertion A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
185
+ *
186
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1"> Documentation</a>
187
+ */
188
+ public async issueChannelTokenByJWTWithHttpInfo (
189
+ grantType ?: string ,
190
+ clientAssertionType ?: string ,
191
+ clientAssertion ?: string ,
192
+ ) : Promise < [ Response , IssueChannelAccessTokenResponse ] > {
133
193
const formParams = {
134
194
grant_type : grantType ,
135
195
client_assertion_type : clientAssertionType ,
@@ -145,10 +205,7 @@ export class ChannelAccessTokenClient {
145
205
"/oauth2/v2.1/token" ,
146
206
formParams ,
147
207
) ;
148
- const result = ( await this . parseHTTPResponse (
149
- res ,
150
- ) ) as IssueChannelAccessTokenResponse ;
151
- return ensureJSON ( result ) ;
208
+ return [ res , await res . json ( ) ] ;
152
209
}
153
210
/**
154
211
* 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.
@@ -167,6 +224,35 @@ export class ChannelAccessTokenClient {
167
224
clientId ?: string ,
168
225
clientSecret ?: string ,
169
226
) : Promise < IssueStatelessChannelAccessTokenResponse > {
227
+ return (
228
+ await this . issueStatelessChannelTokenWithHttpInfo (
229
+ grantType ,
230
+ clientAssertionType ,
231
+ clientAssertion ,
232
+ clientId ,
233
+ clientSecret ,
234
+ )
235
+ ) [ 1 ] ;
236
+ }
237
+
238
+ /**
239
+ * 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. .
240
+ * This method includes HttpInfo object to return additional information.
241
+ * @param grantType `client_credentials`
242
+ * @param clientAssertionType URL-encoded value of `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`
243
+ * @param clientAssertion A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
244
+ * @param clientId Channel ID.
245
+ * @param clientSecret Channel secret.
246
+ *
247
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token"> Documentation</a>
248
+ */
249
+ public async issueStatelessChannelTokenWithHttpInfo (
250
+ grantType ?: string ,
251
+ clientAssertionType ?: string ,
252
+ clientAssertion ?: string ,
253
+ clientId ?: string ,
254
+ clientSecret ?: string ,
255
+ ) : Promise < [ Response , IssueStatelessChannelAccessTokenResponse ] > {
170
256
const formParams = {
171
257
grant_type : grantType ,
172
258
client_assertion_type : clientAssertionType ,
@@ -181,10 +267,7 @@ export class ChannelAccessTokenClient {
181
267
} ) ;
182
268
183
269
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 ) ;
270
+ return [ res , await res . json ( ) ] ;
188
271
}
189
272
/**
190
273
* Revoke short-lived or long-lived channel access token
@@ -195,6 +278,19 @@ export class ChannelAccessTokenClient {
195
278
public async revokeChannelToken (
196
279
accessToken ?: string ,
197
280
) : Promise < Types . MessageAPIResponseBase > {
281
+ return ( await this . revokeChannelTokenWithHttpInfo ( accessToken ) ) [ 1 ] ;
282
+ }
283
+
284
+ /**
285
+ * Revoke short-lived or long-lived channel access token.
286
+ * This method includes HttpInfo object to return additional information.
287
+ * @param accessToken Channel access token
288
+ *
289
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#revoke-longlived-or-shortlived-channel-access-token"> Documentation</a>
290
+ */
291
+ public async revokeChannelTokenWithHttpInfo (
292
+ accessToken ?: string ,
293
+ ) : Promise < [ Response , Types . MessageAPIResponseBase ] > {
198
294
const formParams = {
199
295
access_token : accessToken ,
200
296
} ;
@@ -205,10 +301,7 @@ export class ChannelAccessTokenClient {
205
301
} ) ;
206
302
207
303
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 ) ;
304
+ return [ res , await res . json ( ) ] ;
212
305
}
213
306
/**
214
307
* Revoke channel access token v2.1
@@ -223,6 +316,29 @@ export class ChannelAccessTokenClient {
223
316
clientSecret ?: string ,
224
317
accessToken ?: string ,
225
318
) : Promise < Types . MessageAPIResponseBase > {
319
+ return (
320
+ await this . revokeChannelTokenByJWTWithHttpInfo (
321
+ clientId ,
322
+ clientSecret ,
323
+ accessToken ,
324
+ )
325
+ ) [ 1 ] ;
326
+ }
327
+
328
+ /**
329
+ * Revoke channel access token v2.1.
330
+ * This method includes HttpInfo object to return additional information.
331
+ * @param clientId Channel ID
332
+ * @param clientSecret Channel Secret
333
+ * @param accessToken Channel access token
334
+ *
335
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token-v2-1"> Documentation</a>
336
+ */
337
+ public async revokeChannelTokenByJWTWithHttpInfo (
338
+ clientId ?: string ,
339
+ clientSecret ?: string ,
340
+ accessToken ?: string ,
341
+ ) : Promise < [ Response , Types . MessageAPIResponseBase ] > {
226
342
const formParams = {
227
343
client_id : clientId ,
228
344
client_secret : clientSecret ,
@@ -238,10 +354,7 @@ export class ChannelAccessTokenClient {
238
354
"/oauth2/v2.1/revoke" ,
239
355
formParams ,
240
356
) ;
241
- const result = ( await this . parseHTTPResponse (
242
- res ,
243
- ) ) as Types . MessageAPIResponseBase ;
244
- return ensureJSON ( result ) ;
357
+ return [ res , await res . json ( ) ] ;
245
358
}
246
359
/**
247
360
* Verify the validity of short-lived and long-lived channel access tokens
@@ -252,6 +365,19 @@ export class ChannelAccessTokenClient {
252
365
public async verifyChannelToken (
253
366
accessToken ?: string ,
254
367
) : Promise < VerifyChannelAccessTokenResponse > {
368
+ return ( await this . verifyChannelTokenWithHttpInfo ( accessToken ) ) [ 1 ] ;
369
+ }
370
+
371
+ /**
372
+ * Verify the validity of short-lived and long-lived channel access tokens.
373
+ * This method includes HttpInfo object to return additional information.
374
+ * @param accessToken A short-lived or long-lived channel access token.
375
+ *
376
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token"> Documentation</a>
377
+ */
378
+ public async verifyChannelTokenWithHttpInfo (
379
+ accessToken ?: string ,
380
+ ) : Promise < [ Response , VerifyChannelAccessTokenResponse ] > {
255
381
const formParams = {
256
382
access_token : accessToken ,
257
383
} ;
@@ -262,10 +388,7 @@ export class ChannelAccessTokenClient {
262
388
} ) ;
263
389
264
390
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 ) ;
391
+ return [ res , await res . json ( ) ] ;
269
392
}
270
393
/**
271
394
* You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.
@@ -276,14 +399,24 @@ export class ChannelAccessTokenClient {
276
399
public async verifyChannelTokenByJWT (
277
400
accessToken : string ,
278
401
) : Promise < VerifyChannelAccessTokenResponse > {
402
+ return ( await this . verifyChannelTokenByJWTWithHttpInfo ( accessToken ) ) [ 1 ] ;
403
+ }
404
+
405
+ /**
406
+ * You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid..
407
+ * This method includes HttpInfo object to return additional information.
408
+ * @param accessToken Channel access token with a user-specified expiration (Channel Access Token v2.1).
409
+ *
410
+ * @see <a href="https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1"> Documentation</a>
411
+ */
412
+ public async verifyChannelTokenByJWTWithHttpInfo (
413
+ accessToken : string ,
414
+ ) : Promise < [ Response , VerifyChannelAccessTokenResponse ] > {
279
415
const queryParams = {
280
416
accessToken : accessToken ,
281
417
} ;
282
418
283
419
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 ) ;
420
+ return [ res , await res . json ( ) ] ;
288
421
}
289
422
}
0 commit comments