(
providerName: string | undefined,
options: {
readonly oauthRef?: KimiOAuthTokenRef | undefined;
readonly baseUrl?: string | undefined;
},
run: (accessToken: string) => Promise<T>,
)
| 316 | } |
| 317 | |
| 318 | private async withAccessToken<T>( |
| 319 | providerName: string | undefined, |
| 320 | options: { |
| 321 | readonly oauthRef?: KimiOAuthTokenRef | undefined; |
| 322 | readonly baseUrl?: string | undefined; |
| 323 | }, |
| 324 | run: (accessToken: string) => Promise<T>, |
| 325 | ): Promise<T | { readonly kind: 'error'; readonly message: string }> { |
| 326 | const name = providerName ?? KIMI_CODE_PROVIDER_NAME; |
| 327 | try { |
| 328 | const accessToken = await this.ensureFresh(name, { |
| 329 | oauthRef: options.oauthRef ?? this.defaultOAuthRef(options.baseUrl), |
| 330 | }); |
| 331 | return await run(accessToken); |
| 332 | } catch (error) { |
| 333 | return { |
| 334 | kind: 'error', |
| 335 | message: error instanceof Error ? error.message : String(error), |
| 336 | }; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | async createFeedbackUploadUrl( |
| 341 | body: CreateFeedbackUploadUrlBody, |
no test coverage detected