Skip to content
Open
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
30 changes: 15 additions & 15 deletions google/genai/_interactions/resources/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
webhook_rotate_signing_secret_params,
)
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._utils import path_template, maybe_transform, async_maybe_transform
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand Down Expand Up @@ -129,7 +129,7 @@ def create(
if not api_version:
raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
return self._post(
path_template("/{api_version}/webhooks", api_version=api_version),
self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'),
body=maybe_transform(
{
"subscribed_events": subscribed_events,
Expand Down Expand Up @@ -214,7 +214,7 @@ def update(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._patch(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
body=maybe_transform(
{
"name": name,
Expand Down Expand Up @@ -272,7 +272,7 @@ def list(
if not api_version:
raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
return self._get(
path_template("/{api_version}/webhooks", api_version=api_version),
self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -320,7 +320,7 @@ def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._delete(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -358,7 +358,7 @@ def get(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._get(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -399,7 +399,7 @@ def ping(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
path_template("/{api_version}/webhooks/{id}:ping", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:ping'),
body=maybe_transform(body, webhook_ping_params.WebhookPingParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
Expand Down Expand Up @@ -442,7 +442,7 @@ def rotate_signing_secret(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
path_template("/{api_version}/webhooks/{id}:rotateSigningSecret", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:rotateSigningSecret'),
body=maybe_transform(
{"revocation_behavior": revocation_behavior},
webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams,
Expand Down Expand Up @@ -534,7 +534,7 @@ async def create(
if not api_version:
raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
return await self._post(
path_template("/{api_version}/webhooks", api_version=api_version),
self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'),
body=await async_maybe_transform(
{
"subscribed_events": subscribed_events,
Expand Down Expand Up @@ -619,7 +619,7 @@ async def update(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._patch(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
body=await async_maybe_transform(
{
"name": name,
Expand Down Expand Up @@ -679,7 +679,7 @@ async def list(
if not api_version:
raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
return await self._get(
path_template("/{api_version}/webhooks", api_version=api_version),
self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -727,7 +727,7 @@ async def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._delete(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -765,7 +765,7 @@ async def get(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._get(
path_template("/{api_version}/webhooks/{id}", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -806,7 +806,7 @@ async def ping(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
path_template("/{api_version}/webhooks/{id}:ping", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:ping'),
body=await async_maybe_transform(body, webhook_ping_params.WebhookPingParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
Expand Down Expand Up @@ -849,7 +849,7 @@ async def rotate_signing_secret(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
path_template("/{api_version}/webhooks/{id}:rotateSigningSecret", api_version=api_version, id=id),
self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:rotateSigningSecret'),
body=await async_maybe_transform(
{"revocation_behavior": revocation_behavior},
webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams,
Expand Down
Loading