Skip to content

Webhooks

get_webhook_jobs(project_name_or_id, policy_id, status=None, query=None, sort=None, page=1, page_size=10, limit=None) async

List project webhook jobs for a given policy.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project to list webhook jobs for. String arguments are treated as project names. Integer arguments are treated as project IDs.

required
policy_id int

The ID of the policy to list webhook jobs for.

required
status Optional[List[str]]

A list of job statuses to filter by.

None
query Optional[str]

Query string to filter the logs.

Supported query patterns are:

* exact match(`"k=v"`)
* fuzzy match(`"k=~v"`)
* range(`"k=[min~max]"`)
* list with union releationship(`"k={v1 v2 v3}"`)
* list with intersection relationship(`"k=(v1 v2 v3)"`).

The value of range and list can be:

* string(enclosed by `"` or `'`)
* integer
* time(in format `"2020-04-09 02:36:00"`)

All of these query patterns should be put in the query string and separated by ",". e.g. "k1=v1,k2=~v2,k3=[min~max]"

None
sort Optional[str]

Comma-separated string of fields to sort by. Prefix with - to sort descending. E.g. "update_time,-event_type"

None
page int

The page number to start iterating from, by default 1

1
page_size int

Number of results to retrieve per page, by default 10

10
limit Optional[int]

The maximum number of webhook jobs to return.

None

Returns:

Type Description
List[WebhookJob]

A list of webhook jobs matching the query.

get_webhook_policies(project_name_or_id, query=None, sort=None, page=1, page_size=10, limit=None) async

get_webhook_policy(project_name_or_id, webhook_policy_id) async

Get webhook policy of a project.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required
webhook_policy_id int

The ID of the webhook policy

required

Returns:

Type Description
WebhookPolicy

The webhook policy of a project.

create_webhook_policy(project_name_or_id, policy) async

Create webhook policy of a project.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required
policy WebhookPolicy

The webhook policy to create

required

Returns:

Type Description
str

The location of the created webhook policy

update_webhook_policy(project_name_or_id, webhook_policy_id, policy) async

Update webhook policy of a project.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required
webhook_policy_id int

The ID of the webhook policy

required
policy WebhookPolicy

The new webhook policy definition.

required

delete_webhook_policy(project_name_or_id, webhook_policy_id) async

Delete webhook policy of a project.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required
webhook_policy_id int

The ID of the webhook policy

required

get_webhook_policy_last_trigger(project_name_or_id, limit=None) async

Get a list of the last webhook policy triggers.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required
limit Optional[int]

The maximum number of triggers to return.

None

Returns:

Type Description
List[WebhookLastTrigger]

A list of the last webhook policy triggers.

get_webhook_supported_events(project_name_or_id) async

Get supported event types and notify types of webhooks for a project.

Parameters:

Name Type Description Default
project_name_or_id Union[str, int]

The name or ID of the project String arguments are treated as project names. Integer arguments are treated as project IDs.

required

Returns:

Type Description
SupportedWebhookEventTypes

The supported event types and notify types of webhooks for a project.