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
28 changes: 13 additions & 15 deletions google/genai/_interactions/resources/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.webhook import Webhook
from ..types.webhook_list_response import WebhookListResponse
from ..types.webhook_ping_response import WebhookPingResponse
from ..types.webhook_create_response import WebhookCreateResponse
from ..types.webhook_delete_response import WebhookDeleteResponse
from ..types.webhook_update_response import WebhookUpdateResponse
from ..types.webhook_retrieve_response import WebhookRetrieveResponse
from ..types.webhook_rotate_signing_secret_response import WebhookRotateSigningSecretResponse

__all__ = ["WebhooksResource", "AsyncWebhooksResource"]
Expand Down Expand Up @@ -101,7 +99,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookCreateResponse:
) -> Webhook:
"""Creates a new Webhook.

Args:
Expand Down Expand Up @@ -159,7 +157,7 @@ def create(
timeout=timeout,
query=maybe_transform({"webhook_id": webhook_id}, webhook_create_params.WebhookCreateParams),
),
cast_to=WebhookCreateResponse,
cast_to=Webhook,
)

def retrieve(
Expand All @@ -173,7 +171,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookRetrieveResponse:
) -> Webhook:
"""
Gets a specific Webhook.

Expand All @@ -197,7 +195,7 @@ def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=WebhookRetrieveResponse,
cast_to=Webhook,
)

def update(
Expand Down Expand Up @@ -231,7 +229,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookUpdateResponse:
) -> Webhook:
"""Updates an existing Webhook.

Args:
Expand Down Expand Up @@ -290,7 +288,7 @@ def update(
timeout=timeout,
query=maybe_transform({"update_mask": update_mask}, webhook_update_params.WebhookUpdateParams),
),
cast_to=WebhookUpdateResponse,
cast_to=Webhook,
)

def list(
Expand Down Expand Up @@ -525,7 +523,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookCreateResponse:
) -> Webhook:
"""Creates a new Webhook.

Args:
Expand Down Expand Up @@ -585,7 +583,7 @@ async def create(
{"webhook_id": webhook_id}, webhook_create_params.WebhookCreateParams
),
),
cast_to=WebhookCreateResponse,
cast_to=Webhook,
)

async def retrieve(
Expand All @@ -599,7 +597,7 @@ async def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookRetrieveResponse:
) -> Webhook:
"""
Gets a specific Webhook.

Expand All @@ -623,7 +621,7 @@ async def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=WebhookRetrieveResponse,
cast_to=Webhook,
)

async def update(
Expand Down Expand Up @@ -657,7 +655,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookUpdateResponse:
) -> Webhook:
"""Updates an existing Webhook.

Args:
Expand Down Expand Up @@ -718,7 +716,7 @@ async def update(
{"update_mask": update_mask}, webhook_update_params.WebhookUpdateParams
),
),
cast_to=WebhookUpdateResponse,
cast_to=Webhook,
)

async def list(
Expand Down
5 changes: 2 additions & 3 deletions google/genai/_interactions/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .model import Model as Model
from .usage import Usage as Usage
from .content import Content as Content
from .webhook import Webhook as Webhook
from .function import Function as Function
from .annotation import Annotation as Annotation
from .tool_param import ToolParam as ToolParam
Expand All @@ -45,6 +46,7 @@
from .video_content import VideoContent as VideoContent
from .function_param import FunctionParam as FunctionParam
from .place_citation import PlaceCitation as PlaceCitation
from .signing_secret import SigningSecret as SigningSecret
from .thinking_level import ThinkingLevel as ThinkingLevel
from .webhook_config import WebhookConfig as WebhookConfig
from .thought_content import ThoughtContent as ThoughtContent
Expand Down Expand Up @@ -82,9 +84,7 @@
from .function_result_content import FunctionResultContent as FunctionResultContent
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
from .interaction_start_event import InteractionStartEvent as InteractionStartEvent
from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse
from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse
from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
from .google_maps_call_content import GoogleMapsCallContent as GoogleMapsCallContent
from .google_maps_result_param import GoogleMapsResultParam as GoogleMapsResultParam
Expand All @@ -93,7 +93,6 @@
from .url_context_result_param import URLContextResultParam as URLContextResultParam
from .interaction_create_params import InteractionCreateParams as InteractionCreateParams
from .interaction_status_update import InteractionStatusUpdate as InteractionStatusUpdate
from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse
from .deep_research_agent_config import DeepResearchAgentConfig as DeepResearchAgentConfig
from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentConfigParam
from .file_search_result_content import FileSearchResultContent as FileSearchResultContent
Expand Down
33 changes: 33 additions & 0 deletions google/genai/_interactions/types/signing_secret.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from datetime import datetime

from .._models import BaseModel

__all__ = ["SigningSecret"]


class SigningSecret(BaseModel):
"""Represents a signing secret used to verify webhook payloads."""

expire_time: Optional[datetime] = None
"""Output only. The expiration date of the signing secret."""

truncated_secret: Optional[str] = None
"""Output only. The truncated version of the signing secret."""
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,12 @@
from typing_extensions import Literal

from .._models import BaseModel
from .signing_secret import SigningSecret

__all__ = ["WebhookCreateResponse", "SigningSecret"]
__all__ = ["Webhook"]


class SigningSecret(BaseModel):
"""Represents a signing secret used to verify webhook payloads."""

expire_time: Optional[datetime] = None
"""Output only. The expiration date of the signing secret."""

truncated_secret: Optional[str] = None
"""Output only. The truncated version of the signing secret."""


class WebhookCreateResponse(BaseModel):
class Webhook(BaseModel):
"""A Webhook resource."""

subscribed_events: List[
Expand Down
71 changes: 3 additions & 68 deletions google/genai/_interactions/types/webhook_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,12 @@

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from typing import List, Optional

from .webhook import Webhook
from .._models import BaseModel

__all__ = ["WebhookListResponse", "Webhook", "WebhookSigningSecret"]


class WebhookSigningSecret(BaseModel):
"""Represents a signing secret used to verify webhook payloads."""

expire_time: Optional[datetime] = None
"""Output only. The expiration date of the signing secret."""

truncated_secret: Optional[str] = None
"""Output only. The truncated version of the signing secret."""


class Webhook(BaseModel):
"""A Webhook resource."""

subscribed_events: List[
Union[
Literal[
"batch.succeeded",
"batch.cancelled",
"batch.expired",
"batch.failed",
"interaction.requires_action",
"interaction.completed",
"interaction.failed",
"interaction.cancelled",
"video.generated",
],
str,
]
]
"""Required. The events that the webhook is subscribed to. Available events:

- batch.succeeded
- batch.cancelled
- batch.expired
- batch.failed
- interaction.requires_action
- interaction.completed
- interaction.failed
- interaction.cancelled
- video.generated
"""

uri: str
"""Required. The URI to which webhook events will be sent."""

create_time: Optional[datetime] = None
"""Output only. The timestamp when the webhook was created."""

name: Optional[str] = None
"""Identifier. The name of the webhook. Format: `webhooks/{webhook_id}`"""

new_signing_secret: Optional[str] = None
"""Output only. The new signing secret for the webhook. Only populated on create."""

signing_secrets: Optional[List[WebhookSigningSecret]] = None
"""Output only. The signing secrets associated with this webhook."""

state: Optional[Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"]] = None
"""The state of the webhook."""

update_time: Optional[datetime] = None
"""Output only. The timestamp when the webhook was last updated."""
__all__ = ["WebhookListResponse"]


class WebhookListResponse(BaseModel):
Expand Down
88 changes: 0 additions & 88 deletions google/genai/_interactions/types/webhook_retrieve_response.py

This file was deleted.

Loading
Loading