Skip to content

Commit 894bc93

Browse files
MarkDaoustcopybara-github
authored andcommitted
feat: Add webhook_config to batches.create() and models.generate_videos()
For dynamic per-request webhook notifications on batch jobs and video generation LROs. PiperOrigin-RevId: 899099328
1 parent b6c5d18 commit 894bc93

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

api-report/genai-node.api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ export interface CreateBatchJobConfig {
584584
dest?: BatchJobDestinationUnion;
585585
displayName?: string;
586586
httpOptions?: HttpOptions;
587+
webhookConfig?: WebhookConfig;
587588
}
588589

589590
// @public
@@ -1580,6 +1581,7 @@ export interface GenerateVideosConfig {
15801581
referenceImages?: VideoGenerationReferenceImage[];
15811582
resolution?: string;
15821583
seed?: number;
1584+
webhookConfig?: WebhookConfig;
15831585
}
15841586

15851587
// @public
@@ -4210,6 +4212,12 @@ export interface VoiceConfig {
42104212
replicatedVoiceConfig?: ReplicatedVoiceConfig;
42114213
}
42124214

4215+
// @public
4216+
export interface WebhookConfig {
4217+
uris?: string[];
4218+
userMetadata?: Record<string, unknown>;
4219+
}
4220+
42134221
// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
42144222
//
42154223
// @public (undocumented)

api-report/genai-web.api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ export interface CreateBatchJobConfig {
584584
dest?: BatchJobDestinationUnion;
585585
displayName?: string;
586586
httpOptions?: HttpOptions;
587+
webhookConfig?: WebhookConfig;
587588
}
588589

589590
// @public
@@ -1580,6 +1581,7 @@ export interface GenerateVideosConfig {
15801581
referenceImages?: VideoGenerationReferenceImage[];
15811582
resolution?: string;
15821583
seed?: number;
1584+
webhookConfig?: WebhookConfig;
15831585
}
15841586

15851587
// @public
@@ -4210,6 +4212,12 @@ export interface VoiceConfig {
42104212
replicatedVoiceConfig?: ReplicatedVoiceConfig;
42114213
}
42124214

4215+
// @public
4216+
export interface WebhookConfig {
4217+
uris?: string[];
4218+
userMetadata?: Record<string, unknown>;
4219+
}
4220+
42134221
// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
42144222
//
42154223
// @public (undocumented)

api-report/genai.api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ export interface CreateBatchJobConfig {
584584
dest?: BatchJobDestinationUnion;
585585
displayName?: string;
586586
httpOptions?: HttpOptions;
587+
webhookConfig?: WebhookConfig;
587588
}
588589

589590
// @public
@@ -1580,6 +1581,7 @@ export interface GenerateVideosConfig {
15801581
referenceImages?: VideoGenerationReferenceImage[];
15811582
resolution?: string;
15821583
seed?: number;
1584+
webhookConfig?: WebhookConfig;
15831585
}
15841586

15851587
// @public
@@ -4210,6 +4212,12 @@ export interface VoiceConfig {
42104212
replicatedVoiceConfig?: ReplicatedVoiceConfig;
42114213
}
42124214

4215+
// @public
4216+
export interface WebhookConfig {
4217+
uris?: string[];
4218+
userMetadata?: Record<string, unknown>;
4219+
}
4220+
42134221
// Warning: (ae-forgotten-export) The symbol "BaseWebhooks" needs to be exported by the entry point index.d.ts
42144222
//
42154223
// @public (undocumented)

src/converters/_batches_converters.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,17 @@ export function createBatchJobConfigToMldev(
623623
throw new Error('dest parameter is not supported in Gemini API.');
624624
}
625625

626+
const fromWebhookConfig = common.getValueByPath(fromObject, [
627+
'webhookConfig',
628+
]);
629+
if (parentObject !== undefined && fromWebhookConfig != null) {
630+
common.setValueByPath(
631+
parentObject,
632+
['batch', 'webhookConfig'],
633+
fromWebhookConfig,
634+
);
635+
}
636+
626637
return toObject;
627638
}
628639

@@ -646,6 +657,10 @@ export function createBatchJobConfigToVertex(
646657
);
647658
}
648659

660+
if (common.getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
661+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
662+
}
663+
649664
return toObject;
650665
}
651666

src/converters/_models_converters.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,6 +2771,13 @@ export function generateVideosConfigToMldev(
27712771
throw new Error('labels parameter is not supported in Gemini API.');
27722772
}
27732773

2774+
const fromWebhookConfig = common.getValueByPath(fromObject, [
2775+
'webhookConfig',
2776+
]);
2777+
if (parentObject !== undefined && fromWebhookConfig != null) {
2778+
common.setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
2779+
}
2780+
27742781
return toObject;
27752782
}
27762783

@@ -2944,6 +2951,10 @@ export function generateVideosConfigToVertex(
29442951
common.setValueByPath(parentObject, ['labels'], fromLabels);
29452952
}
29462953

2954+
if (common.getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
2955+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
2956+
}
2957+
29472958
return toObject;
29482959
}
29492960

src/types.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4476,6 +4476,20 @@ export declare interface VideoGenerationMask {
44764476
maskMode?: VideoGenerationMaskMode;
44774477
}
44784478

4479+
/** Configuration for webhook notifications.
4480+
4481+
Used to configure webhook endpoints that will receive notifications
4482+
when long-running operations (e.g., batch jobs, video generation) complete. */
4483+
export declare interface WebhookConfig {
4484+
/** The webhook URIs to receive notifications. If set, these
4485+
webhook URIs will be used instead of the registered webhooks. */
4486+
uris?: string[];
4487+
/** User metadata that will be included in each webhook event
4488+
notification. Use this to attach custom key-value data to correlate
4489+
webhook events with your internal systems. */
4490+
userMetadata?: Record<string, unknown>;
4491+
}
4492+
44794493
/** Configuration for generating videos. */
44804494
export declare interface GenerateVideosConfig {
44814495
/** Used to override HTTP request options. */
@@ -4534,6 +4548,9 @@ export declare interface GenerateVideosConfig {
45344548
compressionQuality?: VideoCompressionQuality;
45354549
/** User specified labels to track billing usage. */
45364550
labels?: Record<string, string>;
4551+
/** Webhook configuration for receiving notifications when the
4552+
video generation operation completes. */
4553+
webhookConfig?: WebhookConfig;
45374554
}
45384555

45394556
/** Class that represents the parameters for generating videos. */
@@ -6248,6 +6265,10 @@ export declare interface CreateBatchJobConfig {
62486265
"gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
62496266
*/
62506267
dest?: BatchJobDestinationUnion;
6268+
/** Webhook configuration for receiving notifications when the batch
6269+
operation completes.
6270+
*/
6271+
webhookConfig?: WebhookConfig;
62516272
}
62526273

62536274
/** Config for batches.create parameters. */

0 commit comments

Comments
 (0)