Skip to content

hooks

Accessed as client.user.hooks; the async client mirrors it.

UserHooks

The user.hooks namespace.

create

create(
    *,
    active: bool | None = None,
    authorization_header: str | None = None,
    branch_filter: str | None = None,
    config: CreateHookOptionConfig,
    events: list[str] | None = None,
    type: CreateHookOptionType,
) -> Hook

Create a hook.

Parameters:

Name Type Description Default
active bool | None
None
authorization_header str | None
None
branch_filter str | None
None
config CreateHookOptionConfig
required
events list[str] | None
None
type CreateHookOptionType
required

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userCreateHook

delete

delete(id: int) -> None

Delete a hook.

Parameters:

Name Type Description Default
id int

id of the hook to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userDeleteHook

get

get(id: int) -> Hook

Get a hook.

Parameters:

Name Type Description Default
id int

id of the hook to get

required

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userGetHook

list

list(*, page: int | None = None, limit: int | None = None) -> Paginated[Hook]

List the authenticated user's webhooks.

Parameters:

Name Type Description Default
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[Hook]

HookListWithoutPagination - Hooks without pagination headers.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userListHooks

update

update(
    id: int,
    *,
    active: bool | None = None,
    authorization_header: str | None = None,
    branch_filter: str | None = None,
    config: dict[str, str] | None = None,
    events: list[str] | None = None,
) -> Hook

Update a hook.

Parameters:

Name Type Description Default
id int

id of the hook to update

required
active bool | None
None
authorization_header str | None
None
branch_filter str | None
None
config dict[str, str] | None
None
events list[str] | None
None

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userEditHook

AsyncUserHooks

The user.hooks namespace.

create

create(
    *,
    active: bool | None = None,
    authorization_header: str | None = None,
    branch_filter: str | None = None,
    config: CreateHookOptionConfig,
    events: list[str] | None = None,
    type: CreateHookOptionType,
) -> Hook

Create a hook.

Parameters:

Name Type Description Default
active bool | None
None
authorization_header str | None
None
branch_filter str | None
None
config CreateHookOptionConfig
required
events list[str] | None
None
type CreateHookOptionType
required

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userCreateHook

delete

delete(id: int) -> None

Delete a hook.

Parameters:

Name Type Description Default
id int

id of the hook to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userDeleteHook

get

get(id: int) -> Hook

Get a hook.

Parameters:

Name Type Description Default
id int

id of the hook to get

required

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userGetHook

list

list(*, page: int | None = None, limit: int | None = None) -> AsyncPaginated[Hook]

List the authenticated user's webhooks.

Parameters:

Name Type Description Default
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[Hook]

HookListWithoutPagination - Hooks without pagination headers.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userListHooks

update

update(
    id: int,
    *,
    active: bool | None = None,
    authorization_header: str | None = None,
    branch_filter: str | None = None,
    config: dict[str, str] | None = None,
    events: list[str] | None = None,
) -> Hook

Update a hook.

Parameters:

Name Type Description Default
id int

id of the hook to update

required
active bool | None
None
authorization_header str | None
None
branch_filter str | None
None
config dict[str, str] | None
None
events list[str] | None
None

Returns:

Type Description
Hook

Hook.

Raises:

Type Description
UnauthorizedError
  1. APIUnauthorizedError is a unauthorized error response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.

Operation ID: userEditHook