Skip to content

Latest commit

 

History

History
222 lines (146 loc) · 13.6 KB

README.md

File metadata and controls

222 lines (146 loc) · 13.6 KB

Beta.Triggers

Overview

Available Operations

create

Create Trigger

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.triggers.create(event_source_id="07adfb82-bcd1-462d-94df-cd3f8421627e", handler="spaces", action={
        "primitive_id": "<id>",
        "type": "start_workflow",
    }, owner_type="workspace", title="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
event_source_id str ✔️ ID of the event source that fires this trigger
handler models.TriggerHandler ✔️ N/A
action models.CreateTriggerAction ✔️ N/A
owner_type models.TriggersOwnerType ✔️ N/A
title str ✔️ Human-readable title of the trigger
filters OptionalNullable[str] ➖ jmespath expression to filter events, e.g. event_type == 'push' && repository.name == 'dashboard'
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Trigger

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

list

List Triggers

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.triggers.list()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
handler OptionalNullable[models.TriggerHandler] ➖ Filter by handler type
primitive_id OptionalNullable[str] ➖ Filter by primitive ID (workflow, agent, or app)
event_source_id OptionalNullable[str] ➖ Filter by event source ID (webhook id)
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

List[models.Trigger]

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get

Get Trigger

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.triggers.get(trigger_id="8a031c37-160a-4451-9fb0-960dab51da01")

    # Handle response
    print(res)

Parameters

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

Response

models.Trigger

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

delete

Delete Trigger

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    mistral.beta.triggers.delete(trigger_id="c36bea2b-c2da-4ac5-b1bf-26d98b1c90b3")

    # Use the SDK ...

Parameters

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

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

list_events

List Trigger Events

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.triggers.list_events(trigger_id="a4a77501-7106-45dd-ba40-61b80d862c18", limit=10)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
trigger_id str ✔️ N/A
limit Optional[int] ➖ Maximum number of events to return
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.TriggerEventList

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*