Skip to content

Commit add084c

Browse files
yyyu-googlecopybara-github
authored andcommitted
fix: remove any type in token signature
PiperOrigin-RevId: 615514694
1 parent 396bdf5 commit add084c

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/functions/count_tokens.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function countTokens(
3636
location: string,
3737
project: string,
3838
publisherModelEndpoint: string,
39-
token: Promise<any>,
39+
token: Promise<string | null | undefined>,
4040
request: CountTokensRequest,
4141
apiEndpoint?: string,
4242
requestOptions?: RequestOptions

src/functions/generate_content.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function generateContent(
4949
location: string,
5050
project: string,
5151
publisherModelEndpoint: string,
52-
token: Promise<any>,
52+
token: Promise<string | null | undefined>,
5353
request: GenerateContentRequest | string,
5454
apiEndpoint?: string,
5555
generationConfig?: GenerationConfig,
@@ -102,7 +102,7 @@ export async function generateContentStream(
102102
location: string,
103103
project: string,
104104
publisherModelEndpoint: string,
105-
token: Promise<any>,
105+
token: Promise<string | null | undefined>,
106106
request: GenerateContentRequest | string,
107107
apiEndpoint?: string,
108108
generationConfig?: GenerationConfig,

src/functions/post_request.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function postRequest({
4343
project: string;
4444
resourcePath: string;
4545
resourceMethod: string;
46-
token: string;
46+
token: string | null | undefined;
4747
data: GenerateContentRequest | CountTokensRequest;
4848
apiEndpoint?: string;
4949
requestOptions?: RequestOptions;

src/models/chat_session.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class ChatSession {
9090
* fails.
9191
* @returns Promise of token.
9292
*/
93-
get token(): Promise<any> {
93+
get token(): Promise<string | null | undefined> {
9494
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
9595
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
9696
});
@@ -309,7 +309,7 @@ export class ChatSessionPreview {
309309
* Gets access token from GoogleAuth. Throws GoogleAuthError when fails.
310310
* @returns Promise of token.
311311
*/
312-
get token(): Promise<any> {
312+
get token(): Promise<string | null | undefined> {
313313
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
314314
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
315315
});

src/models/generative_models.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class GenerativeModel {
8585
* fails.
8686
* @returns Promise of token
8787
*/
88-
get token(): Promise<any> {
88+
get token(): Promise<string | null | undefined> {
8989
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
9090
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
9191
});
@@ -285,7 +285,7 @@ export class GenerativeModelPreview {
285285
* Gets access token from GoogleAuth. Throws GoogleAuthError when fails.
286286
* @returns Promise of token.
287287
*/
288-
get token(): Promise<any> {
288+
get token(): Promise<string | null | undefined> {
289289
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
290290
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
291291
});

0 commit comments

Comments
 (0)