Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions api-report/genai-node.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,8 @@ export class GoogleGenAI {
readonly tunings: Tunings;
// (undocumented)
readonly vertexai: boolean;
// (undocumented)
get webhooks(): Webhooks;
}

// @public
Expand Down Expand Up @@ -4208,6 +4210,17 @@ export interface VoiceConfig {
replicatedVoiceConfig?: ReplicatedVoiceConfig;
}

// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class Webhooks extends BaseWebhooks {
}

// @public (undocumented)
export namespace Webhooks {
{ export type WebhookCreateResponse as WebhookCreateResponse, export type WebhookRetrieveResponse as WebhookRetrieveResponse, export type WebhookUpdateResponse as WebhookUpdateResponse, export type WebhookListResponse as WebhookListResponse, export type WebhookDeleteResponse as WebhookDeleteResponse, export type WebhookPingResponse as WebhookPingResponse, export type WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse, export type WebhookCreateParams as WebhookCreateParams, export type WebhookRetrieveParams as WebhookRetrieveParams, export type WebhookUpdateParams as WebhookUpdateParams, export type WebhookListParams as WebhookListParams, export type WebhookDeleteParams as WebhookDeleteParams, export type WebhookPingParams as WebhookPingParams, export type WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams, };
}

// @public
export interface WebSearch {
}
Expand Down
13 changes: 13 additions & 0 deletions api-report/genai-web.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,8 @@ export class GoogleGenAI {
readonly tunings: Tunings;
// (undocumented)
readonly vertexai: boolean;
// (undocumented)
get webhooks(): Webhooks;
}

// @public
Expand Down Expand Up @@ -4208,6 +4210,17 @@ export interface VoiceConfig {
replicatedVoiceConfig?: ReplicatedVoiceConfig;
}

// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class Webhooks extends BaseWebhooks {
}

// @public (undocumented)
export namespace Webhooks {
{ export type WebhookCreateResponse as WebhookCreateResponse, export type WebhookRetrieveResponse as WebhookRetrieveResponse, export type WebhookUpdateResponse as WebhookUpdateResponse, export type WebhookListResponse as WebhookListResponse, export type WebhookDeleteResponse as WebhookDeleteResponse, export type WebhookPingResponse as WebhookPingResponse, export type WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse, export type WebhookCreateParams as WebhookCreateParams, export type WebhookRetrieveParams as WebhookRetrieveParams, export type WebhookUpdateParams as WebhookUpdateParams, export type WebhookListParams as WebhookListParams, export type WebhookDeleteParams as WebhookDeleteParams, export type WebhookPingParams as WebhookPingParams, export type WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams, };
}

// @public
export interface WebSearch {
}
Expand Down
13 changes: 13 additions & 0 deletions api-report/genai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,8 @@ export class GoogleGenAI {
readonly tunings: Tunings;
// (undocumented)
readonly vertexai: boolean;
// (undocumented)
get webhooks(): Webhooks;
}

// @public
Expand Down Expand Up @@ -4208,6 +4210,17 @@ export interface VoiceConfig {
replicatedVoiceConfig?: ReplicatedVoiceConfig;
}

// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class Webhooks extends BaseWebhooks {
}

// @public (undocumented)
export namespace Webhooks {
{ export type WebhookCreateResponse as WebhookCreateResponse, export type WebhookRetrieveResponse as WebhookRetrieveResponse, export type WebhookUpdateResponse as WebhookUpdateResponse, export type WebhookListResponse as WebhookListResponse, export type WebhookDeleteResponse as WebhookDeleteResponse, export type WebhookPingResponse as WebhookPingResponse, export type WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse, export type WebhookCreateParams as WebhookCreateParams, export type WebhookRetrieveParams as WebhookRetrieveParams, export type WebhookUpdateParams as WebhookUpdateParams, export type WebhookListParams as WebhookListParams, export type WebhookDeleteParams as WebhookDeleteParams, export type WebhookPingParams as WebhookPingParams, export type WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams, };
}

// @public
export interface WebSearch {
}
Expand Down
53 changes: 35 additions & 18 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {Files} from './files.js';
import {FileSearchStores} from './filesearchstores.js';
import GeminiNextGenAPI from './interactions/index.js';
import {Interactions as GeminiNextGenInteractions} from './interactions/resources/interactions.js';
import {Webhooks as GeminiNextGenWebhooks} from './interactions/resources/webhooks.js';
import {Live} from './live.js';
import {Models} from './models.js';
import {Operations} from './operations.js';
Expand Down Expand Up @@ -139,6 +140,32 @@ export class GoogleGenAI {
readonly tunings: Tunings;
readonly fileSearchStores: FileSearchStores;
private _interactions: GeminiNextGenInteractions | undefined;
private _webhooks: GeminiNextGenWebhooks | undefined;
private _nextGenClient: GeminiNextGenAPI | undefined;

private getNextGenClient(): GeminiNextGenAPI {
const httpOpts = this.httpOptions;
if (this._nextGenClient === undefined) {
this._nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
}

// Unsupported Options Warnings
if (httpOpts?.extraBody) {
console.warn(
'GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.',
);
}

return this._nextGenClient;
}

get interactions(): GeminiNextGenInteractions {
if (this._interactions !== undefined) {
Expand All @@ -149,27 +176,17 @@ export class GoogleGenAI {
'GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.',
);

const httpOpts = this.httpOptions;
this._interactions = this.getNextGenClient().interactions;
return this._interactions;
}

// Unsupported Options Warnings
if (httpOpts?.extraBody) {
console.warn(
'GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.',
);
get webhooks(): GeminiNextGenWebhooks {
if (this._webhooks !== undefined) {
return this._webhooks;
}

const nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
this._interactions = nextGenClient.interactions;

return this._interactions;
this._webhooks = this.getNextGenClient().webhooks;
return this._webhooks;
}

constructor(options: GoogleGenAIOptions) {
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type {GoogleGenAIOptions} from './client';
export * from './errors';
export {Files} from './files';
export type {Interactions} from './interactions/resources/interactions.js';
export type {Webhooks} from './interactions/resources/webhooks.js';
export * from './live';
export {mcpToTool} from './mcp/_mcp';
export {Models} from './models';
Expand Down
1 change: 1 addition & 0 deletions src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type {GoogleGenAIOptions} from '../client.js';
export * from '../errors.js';
export {Files} from '../files.js';
export type {Interactions} from '../interactions/resources/interactions.js';
export type {Webhooks} from '../interactions/resources/webhooks.js';
export * from '../live.js';
export {mcpToTool} from '../mcp/_mcp.js';
export {Models} from '../models.js';
Expand Down
53 changes: 35 additions & 18 deletions src/node/node_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {Files} from '../files.js';
import {FileSearchStores} from '../filesearchstores.js';
import GeminiNextGenAPI from '../interactions/index.js';
import {Interactions as GeminiNextGenInteractions} from '../interactions/resources/interactions.js';
import {Webhooks as GeminiNextGenWebhooks} from '../interactions/resources/webhooks.js';
import {Live} from '../live.js';
import {Models} from '../models.js';
import {NodeAuth} from '../node/_node_auth.js';
Expand Down Expand Up @@ -91,6 +92,32 @@ export class GoogleGenAI {
readonly tunings: Tunings;
readonly fileSearchStores: FileSearchStores;
private _interactions: GeminiNextGenInteractions | undefined;
private _webhooks: GeminiNextGenWebhooks | undefined;
private _nextGenClient: GeminiNextGenAPI | undefined;

private getNextGenClient(): GeminiNextGenAPI {
const httpOpts = this.httpOptions;
if (this._nextGenClient === undefined) {
this._nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
}

// Unsupported Options Warnings
if (httpOpts?.extraBody) {
console.warn(
'GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.',
);
}

return this._nextGenClient;
}

get interactions(): GeminiNextGenInteractions {
if (this._interactions !== undefined) {
Expand All @@ -101,27 +128,17 @@ export class GoogleGenAI {
'GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.',
);

const httpOpts = this.httpOptions;
this._interactions = this.getNextGenClient().interactions;
return this._interactions;
}

// Unsupported Options Warnings
if (httpOpts?.extraBody) {
console.warn(
'GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.',
);
get webhooks(): GeminiNextGenWebhooks {
if (this._webhooks !== undefined) {
return this._webhooks;
}

const nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
this._interactions = nextGenClient.interactions;

return this._interactions;
this._webhooks = this.getNextGenClient().webhooks;
return this._webhooks;
}
constructor(options: GoogleGenAIOptions) {
// Validate explicitly set initializer values.
Expand Down
1 change: 1 addition & 0 deletions src/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export {GoogleGenAIOptions} from '../client.js';
export * from '../errors.js';
export {Files} from '../files.js';
export type {Interactions} from '../interactions/resources/interactions.js';
export type {Webhooks} from '../interactions/resources/webhooks.js';
export * from '../live.js';
export {mcpToTool} from '../mcp/_mcp';
export {Models} from '../models.js';
Expand Down
56 changes: 38 additions & 18 deletions src/web/web_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {Files} from '../files.js';
import {FileSearchStores} from '../filesearchstores.js';
import GeminiNextGenAPI from '../interactions/index.js';
import {Interactions as GeminiNextGenInteractions} from '../interactions/resources/interactions.js';
import {Webhooks as GeminiNextGenWebhooks} from '../interactions/resources/webhooks.js';
import {Live} from '../live.js';
import {Models} from '../models.js';
import {Operations} from '../operations.js';
Expand Down Expand Up @@ -81,16 +82,23 @@ export class GoogleGenAI {
readonly tunings: Tunings;
readonly fileSearchStores: FileSearchStores;
private _interactions: GeminiNextGenInteractions | undefined;
get interactions(): GeminiNextGenInteractions {
if (this._interactions !== undefined) {
return this._interactions;
}

console.warn(
'GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.',
);
private _webhooks: GeminiNextGenWebhooks | undefined;
private _nextGenClient: GeminiNextGenAPI | undefined;

private getNextGenClient(): GeminiNextGenAPI {
const httpOpts = this.httpOptions;
if (this._nextGenClient === undefined) {
const httpOpts = this.httpOptions;
this._nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
}

// Unsupported Options Warnings
if (httpOpts?.extraBody) {
Expand All @@ -99,19 +107,31 @@ export class GoogleGenAI {
);
}

const nextGenClient = new GeminiNextGenAPI({
baseURL: this.apiClient.getBaseUrl(),
apiKey: this.apiKey,
apiVersion: this.apiClient.getApiVersion(),
clientAdapter: this.apiClient,
defaultHeaders: this.apiClient.getDefaultHeaders(),
timeout: httpOpts?.timeout,
maxRetries: httpOpts?.retryOptions?.attempts,
});
this._interactions = nextGenClient.interactions;
return this._nextGenClient;
}

get interactions(): GeminiNextGenInteractions {
if (this._interactions !== undefined) {
return this._interactions;
}

console.warn(
'GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.',
);

this._interactions = this.getNextGenClient().interactions;
return this._interactions;
}

get webhooks(): GeminiNextGenWebhooks {
if (this._webhooks !== undefined) {
return this._webhooks;
}

this._webhooks = this.getNextGenClient().webhooks;
return this._webhooks;
}

constructor(options: GoogleGenAIOptions) {
if (options.apiKey == null) {
throw new Error('An API Key must be set when running in a browser');
Expand Down
Loading