Add enabled to the client

This commit is contained in:
rafid saad
2026-02-02 17:29:58 -08:00
parent 65648e2019
commit ca9b3c6ff6
+14 -2
View File
@@ -6306,6 +6306,7 @@ class SyncCronClient:
webhook: str | None = None,
multitask_strategy: str | None = None,
end_time: datetime | None = None,
enabled: bool | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> Run:
@@ -6329,6 +6330,7 @@ class SyncCronClient:
multitask_strategy: Multitask strategy to use.
Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
end_time: The time to stop running the cron job. If not provided, the cron job will run indefinitely.
enabled: Whether the cron job is enabled. By default, it is considered enabled.
headers: Optional custom headers to include with the request.
Returns:
@@ -6348,7 +6350,8 @@ class SyncCronClient:
interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
webhook="https://my.fake.webhook.com",
multitask_strategy="interrupt"
multitask_strategy="interrupt",
enabled=True
)
```
"""
@@ -6365,6 +6368,7 @@ class SyncCronClient:
"webhook": webhook,
"multitask_strategy": multitask_strategy,
"end_time": end_time.isoformat() if end_time else None,
"enabled": enabled,
}
payload = {k: v for k, v in payload.items() if v is not None}
return self.http.post(
@@ -6390,6 +6394,7 @@ class SyncCronClient:
on_run_completed: OnCompletionBehavior | None = None,
multitask_strategy: str | None = None,
end_time: datetime | None = None,
enabled: bool | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> Run:
@@ -6416,6 +6421,7 @@ class SyncCronClient:
multitask_strategy: Multitask strategy to use.
Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
end_time: The time to stop running the cron job. If not provided, the cron job will run indefinitely.
enabled: Whether the cron job is enabled. By default, it is considered enabled.
headers: Optional custom headers to include with the request.
Returns:
@@ -6435,7 +6441,8 @@ class SyncCronClient:
interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
webhook="https://my.fake.webhook.com",
multitask_strategy="interrupt"
multitask_strategy="interrupt",
enabled=True
)
```
@@ -6454,6 +6461,7 @@ class SyncCronClient:
"on_run_completed": on_run_completed,
"multitask_strategy": multitask_strategy,
"end_time": end_time.isoformat() if end_time else None,
"enabled": enabled
}
payload = {k: v for k, v in payload.items() if v is not None}
return self.http.post(
@@ -6494,6 +6502,7 @@ class SyncCronClient:
*,
assistant_id: str | None = None,
thread_id: str | None = None,
enabled: bool | None = None,
limit: int = 10,
offset: int = 0,
sort_by: CronSortBy | None = None,
@@ -6507,6 +6516,7 @@ class SyncCronClient:
Args:
assistant_id: The assistant ID or graph name to search for.
thread_id: the thread ID to search for.
enabled: Whether the cron job is enabled.
limit: The maximum number of results to return.
offset: The number of results to skip.
headers: Optional custom headers to include with the request.
@@ -6521,6 +6531,7 @@ class SyncCronClient:
cron_jobs = client.crons.search(
assistant_id="my_assistant_id",
thread_id="my_thread_id",
enabled=True,
limit=5,
offset=5,
)
@@ -6554,6 +6565,7 @@ class SyncCronClient:
payload = {
"assistant_id": assistant_id,
"thread_id": thread_id,
"enabled": enabled,
"limit": limit,
"offset": offset,
}