Skip to content

Latest commit

 

History

History
230 lines (152 loc) · 22.3 KB

File metadata and controls

230 lines (152 loc) · 22.3 KB

Notifiers

Overview

Available Operations

  • list - List notifiers
  • create - Create a notifier
  • get - Retrieve a notifier
  • delete - Delete a notifier
  • update - Update a notifier

list

Returns notifier destinations visible to the caller, ordered by creation time with the newest notifier first.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.notifiers.list(type_=[
        "NOTIFIER_TYPE_SLACK_WEBHOOK",
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
limit Optional[int] ➖ Optional. Number of notifiers to return. Defaults to 25 and must be between 1 and 200.
starting_after Optional[str] ➖ Cursor for forward pagination. Set to the _id of the last item from the previous page.
ending_before Optional[str] ➖ Cursor for backward pagination. Set to the _id of the first item from the previous page.
project_id Optional[str] ➖ Restrict results to one project. Must be a project the caller is authorized for.
search Optional[str] ➖ Optional. Case-insensitive substring match on the notifier name.
type List[models.NotifierType] ➖ Optional. Restrict results to these notifier types.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListNotifiersResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

create

Creates a notifier destination in a project. Choose NOTIFIER_TYPE_EMAIL, NOTIFIER_TYPE_SLACK_WEBHOOK, or NOTIFIER_TYPE_WEBHOOK and provide the matching destination fields.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.notifiers.create(request={
        "type": "NOTIFIER_TYPE_UNSPECIFIED",
        "incoming_webhook_url": "https://far-wear.org/",
        "display_name": "Dennis48",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.CreateNotifierRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.CreateNotifierResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

get

Retrieves an existing notifier by ID.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.notifiers.get(notifier_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
notifier_id str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetNotifierResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

delete

Deletes an existing notifier by ID.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.notifiers.delete(notifier_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
notifier_id str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.DeleteNotifierResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

update

Partially updates an existing notifier. When changing type, provide the destination fields required by the new notifier type.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.notifiers.update(notifier_id="<id>", type_="NOTIFIER_TYPE_SLACK_WEBHOOK")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
notifier_id str ✔️ N/A
project_id Optional[str] ➖ Optional. New containing project. Workspace-scoped callers may set an empty value to make the notifier workspace-wide. Project-scoped API keys remain pinned to the API key's project.
display_name Optional[str] ➖ Optional. New human-readable notifier name.
metadata Optional[models.UpdateNotifierRequestMetadata] ➖ Optional. Replacement custom JSON metadata.
type Optional[models.NotifierType] ➖ N/A NOTIFIER_TYPE_SLACK_WEBHOOK
emails List[str] ➖ Optional replacement email recipients. Required when changing type to NOTIFIER_TYPE_EMAIL.
incoming_webhook_url Optional[str] ➖ Optional replacement Slack incoming webhook URL. Required when changing type to NOTIFIER_TYPE_SLACK_WEBHOOK.
webhook_url Optional[str] ➖ Optional replacement generic webhook URL. Required when changing type to NOTIFIER_TYPE_WEBHOOK.
headers Optional[models.Headers] ➖ Optional replacement generic webhook headers. Secret header values returned by GET or LIST are masked as an empty string; omit those entries or replace them with the real value when updating.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.UpdateNotifierResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*