diff --git a/activitysmith_openapi/api/live_activities_api.py b/activitysmith_openapi/api/live_activities_api.py index 8b971ea..43b389f 100644 --- a/activitysmith_openapi/api/live_activities_api.py +++ b/activitysmith_openapi/api/live_activities_api.py @@ -642,7 +642,7 @@ def reconcile_live_activity_stream( ) -> LiveActivityStreamPutResponse: """Start a new Live Activity or update an existing one - Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. + Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer, and timer_start_at when the timer started earlier, for example to show time already gone in the progress bar. Omit them on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. :param stream_key: Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) :type stream_key: str @@ -718,7 +718,7 @@ def reconcile_live_activity_stream_with_http_info( ) -> ApiResponse[LiveActivityStreamPutResponse]: """Start a new Live Activity or update an existing one - Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. + Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer, and timer_start_at when the timer started earlier, for example to show time already gone in the progress bar. Omit them on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. :param stream_key: Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) :type stream_key: str @@ -794,7 +794,7 @@ def reconcile_live_activity_stream_without_preload_content( ) -> RESTResponseType: """Start a new Live Activity or update an existing one - Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. + Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer, and timer_start_at when the timer started earlier, for example to show time already gone in the progress bar. Omit them on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. :param stream_key: Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) :type stream_key: str diff --git a/activitysmith_openapi/docs/ContentStateStart.md b/activitysmith_openapi/docs/ContentStateStart.md index 2a8422f..baedd53 100644 --- a/activitysmith_openapi/docs/ContentStateStart.md +++ b/activitysmith_openapi/docs/ContentStateStart.md @@ -1,19 +1,21 @@ # ContentStateStart -Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. +Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds or timer_end_at for countdowns, or set counts_down false without them for an open-ended elapsed timer. Add timer_start_at for a timer that started earlier. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**title** | **str** | | +**title** | **str** | Title shown on the Live Activity. Send an empty string to show no title. | **subtitle** | **str** | | [optional] **number_of_steps** | **int** | Total number of steps. Use for type=segmented_progress. This value can be increased or decreased later when updating or ending the same activity. | [optional] **current_step** | **int** | Current completed step count. Use for type=segmented_progress. Set 0 when the activity has started but no segment is complete yet. Must be less than or equal to number_of_steps. | [optional] **percentage** | **float** | Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided. | [optional] **value** | [**LiveActivityValue**](LiveActivityValue.md) | For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit. | [optional] **upper_limit** | **float** | Maximum progress value. Use with value for type=progress. | [optional] -**duration_seconds** | **float** | Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted. | [optional] +**duration_seconds** | **float** | Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted, unless you send timer_end_at. Counts from timer_start_at when you send it. | [optional] +**timer_start_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future. | [optional] +**timer_end_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. | [optional] **counts_down** | **bool** | Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer. | [optional] [default to True] **is_running** | **bool** | Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. | [optional] [default to True] **metrics** | [**List[ActivityMetric]**](ActivityMetric.md) | Use for type=metrics or type=stats. | [optional] diff --git a/activitysmith_openapi/docs/ContentStateUpdate.md b/activitysmith_openapi/docs/ContentStateUpdate.md index 2eafb72..68accb8 100644 --- a/activitysmith_openapi/docs/ContentStateUpdate.md +++ b/activitysmith_openapi/docs/ContentStateUpdate.md @@ -6,14 +6,16 @@ Update payload requires title. For segmented_progress include current_step and o Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**title** | **str** | | +**title** | **str** | Title shown on the Live Activity. Send an empty string to show no title. | **subtitle** | **str** | | [optional] **number_of_steps** | **int** | Total number of steps. Use for type=segmented_progress. Optional on update, and safe to change if the workflow gains or loses steps. | [optional] **current_step** | **int** | Current completed step count. Use for type=segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided. | [optional] **percentage** | **float** | Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided. | [optional] **value** | [**LiveActivityValue**](LiveActivityValue.md) | For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit. | [optional] **upper_limit** | **float** | Maximum progress value. Use with value for type=progress. | [optional] -**duration_seconds** | **float** | Timer duration in seconds. For type=timer, sending duration_seconds resets the timer window from the update request time; omit it to preserve the existing timer window. | [optional] +**duration_seconds** | **float** | Timer duration in seconds. For type=timer, sending duration_seconds resets the timer window from the update request time, or from timer_start_at when you send it. Omit it to preserve the existing timer window. | [optional] +**timer_start_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future. | [optional] +**timer_end_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. Send timer_end_at alone to move the end and keep the current start. | [optional] **counts_down** | **bool** | Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer. | [optional] [default to True] **is_running** | **bool** | Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. | [optional] [default to True] **metrics** | [**List[ActivityMetric]**](ActivityMetric.md) | Use for type=metrics or type=stats. | [optional] diff --git a/activitysmith_openapi/docs/LiveActivitiesApi.md b/activitysmith_openapi/docs/LiveActivitiesApi.md index 32004df..7e030f1 100644 --- a/activitysmith_openapi/docs/LiveActivitiesApi.md +++ b/activitysmith_openapi/docs/LiveActivitiesApi.md @@ -181,7 +181,7 @@ Name | Type | Description | Notes Start a new Live Activity or update an existing one -Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. +Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer, and timer_start_at when the timer started earlier, for example to show time already gone in the progress bar. Omit them on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Optional tags to organize and filter notification history. On later stream updates, omit tags to keep the current tags, send tags again to replace them, or send an empty array to clear them. ### Example diff --git a/activitysmith_openapi/docs/StreamContentState.md b/activitysmith_openapi/docs/StreamContentState.md index 60730c6..4fc8e9f 100644 --- a/activitysmith_openapi/docs/StreamContentState.md +++ b/activitysmith_openapi/docs/StreamContentState.md @@ -1,19 +1,21 @@ # StreamContentState -Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window. +Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds or timer_end_at to start or reset a bounded timer, and timer_start_at for a timer that started earlier. Omit them on later updates to preserve the existing timer window. ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**title** | **str** | | +**title** | **str** | Title shown on the Live Activity. Send an empty string to show no title. | **subtitle** | **str** | | [optional] **number_of_steps** | **int** | Use for segmented_progress. | [optional] **current_step** | **int** | Use for segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided. | [optional] **percentage** | **float** | Use for progress. Takes precedence over value/upper_limit if both are provided. | [optional] **value** | [**LiveActivityValue**](LiveActivityValue.md) | For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For progress, a numeric progress value used with upper_limit. | [optional] **upper_limit** | **float** | Maximum progress value. Use with value for progress. | [optional] -**duration_seconds** | **float** | Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window; omit it on later stream updates to preserve the existing timer window. | [optional] +**duration_seconds** | **float** | Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window, counted from timer_start_at when you send it. Omit it on later stream updates to preserve the existing timer window. | [optional] +**timer_start_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future. | [optional] +**timer_end_at** | **datetime** | Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. On later stream updates, send timer_end_at alone to move the end and keep the current start. | [optional] **counts_down** | **bool** | Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer. | [optional] [default to True] **is_running** | **bool** | Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. | [optional] [default to True] **type** | **str** | Required on the first PUT or whenever the stream cannot infer the current activity type. | [optional] diff --git a/activitysmith_openapi/models/content_state_start.py b/activitysmith_openapi/models/content_state_start.py index 568b5b3..f5ca440 100644 --- a/activitysmith_openapi/models/content_state_start.py +++ b/activitysmith_openapi/models/content_state_start.py @@ -17,6 +17,7 @@ import re # noqa: F401 import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional, Union from typing_extensions import Annotated @@ -29,16 +30,18 @@ class ContentStateStart(BaseModel): """ - Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. + Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds or timer_end_at for countdowns, or set counts_down false without them for an open-ended elapsed timer. Add timer_start_at for a timer that started earlier. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. """ # noqa: E501 - title: StrictStr + title: StrictStr = Field(description="Title shown on the Live Activity. Send an empty string to show no title.") subtitle: Optional[StrictStr] = None number_of_steps: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Total number of steps. Use for type=segmented_progress. This value can be increased or decreased later when updating or ending the same activity.") current_step: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Current completed step count. Use for type=segmented_progress. Set 0 when the activity has started but no segment is complete yet. Must be less than or equal to number_of_steps.") percentage: Optional[Union[Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)]]] = Field(default=None, description="Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.") value: Optional[LiveActivityValue] = Field(default=None, description="For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit.") upper_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum progress value. Use with value for type=progress.") - duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted.") + duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted, unless you send timer_end_at. Counts from timer_start_at when you send it.") + timer_start_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future.") + timer_end_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both.") counts_down: Optional[StrictBool] = Field(default=True, description="Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer.") is_running: Optional[StrictBool] = Field(default=True, description="Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume.") metrics: Optional[Annotated[List[ActivityMetric], Field(min_length=1, max_length=8)]] = Field(default=None, description="Use for type=metrics or type=stats.") @@ -49,7 +52,7 @@ class ContentStateStart(BaseModel): color: Optional[StrictStr] = Field(default=None, description="Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.") step_color: Optional[StrictStr] = Field(default=None, description="Optional. Overrides color for the current step. Only applies to type=segmented_progress.") step_colors: Optional[List[StrictStr]] = Field(default=None, description="Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.") - __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "counts_down", "is_running", "metrics", "message", "icon", "badge", "type", "color", "step_color", "step_colors"] + __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "timer_start_at", "timer_end_at", "counts_down", "is_running", "metrics", "message", "icon", "badge", "type", "color", "step_color", "step_colors"] @field_validator('type') def type_validate_enum(cls, value): @@ -164,6 +167,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": LiveActivityValue.from_dict(obj["value"]) if obj.get("value") is not None else None, "upper_limit": obj.get("upper_limit"), "duration_seconds": obj.get("duration_seconds"), + "timer_start_at": obj.get("timer_start_at"), + "timer_end_at": obj.get("timer_end_at"), "counts_down": obj.get("counts_down") if obj.get("counts_down") is not None else True, "is_running": obj.get("is_running") if obj.get("is_running") is not None else True, "metrics": [ActivityMetric.from_dict(_item) for _item in obj["metrics"]] if obj.get("metrics") is not None else None, diff --git a/activitysmith_openapi/models/content_state_update.py b/activitysmith_openapi/models/content_state_update.py index 2b5ea94..805f881 100644 --- a/activitysmith_openapi/models/content_state_update.py +++ b/activitysmith_openapi/models/content_state_update.py @@ -17,6 +17,7 @@ import re # noqa: F401 import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional, Union from typing_extensions import Annotated @@ -31,14 +32,16 @@ class ContentStateUpdate(BaseModel): """ Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer, omit duration_seconds to preserve the current timer window or send duration_seconds to reset the timer from the update request time. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. """ # noqa: E501 - title: StrictStr + title: StrictStr = Field(description="Title shown on the Live Activity. Send an empty string to show no title.") subtitle: Optional[StrictStr] = None number_of_steps: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Total number of steps. Use for type=segmented_progress. Optional on update, and safe to change if the workflow gains or loses steps.") current_step: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Current completed step count. Use for type=segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.") percentage: Optional[Union[Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)]]] = Field(default=None, description="Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.") value: Optional[LiveActivityValue] = Field(default=None, description="For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit.") upper_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum progress value. Use with value for type=progress.") - duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer, sending duration_seconds resets the timer window from the update request time; omit it to preserve the existing timer window.") + duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer, sending duration_seconds resets the timer window from the update request time, or from timer_start_at when you send it. Omit it to preserve the existing timer window.") + timer_start_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future.") + timer_end_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. Send timer_end_at alone to move the end and keep the current start.") counts_down: Optional[StrictBool] = Field(default=True, description="Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer.") is_running: Optional[StrictBool] = Field(default=True, description="Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume.") metrics: Optional[Annotated[List[ActivityMetric], Field(min_length=1, max_length=8)]] = Field(default=None, description="Use for type=metrics or type=stats.") @@ -49,7 +52,7 @@ class ContentStateUpdate(BaseModel): color: Optional[StrictStr] = Field(default=None, description="Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.") step_color: Optional[StrictStr] = Field(default=None, description="Optional. Overrides color for the current step. Only applies to type=segmented_progress.") step_colors: Optional[List[StrictStr]] = Field(default=None, description="Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.") - __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "counts_down", "is_running", "metrics", "message", "icon", "badge", "type", "color", "step_color", "step_colors"] + __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "timer_start_at", "timer_end_at", "counts_down", "is_running", "metrics", "message", "icon", "badge", "type", "color", "step_color", "step_colors"] @field_validator('type') def type_validate_enum(cls, value): @@ -167,6 +170,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": LiveActivityValue.from_dict(obj["value"]) if obj.get("value") is not None else None, "upper_limit": obj.get("upper_limit"), "duration_seconds": obj.get("duration_seconds"), + "timer_start_at": obj.get("timer_start_at"), + "timer_end_at": obj.get("timer_end_at"), "counts_down": obj.get("counts_down") if obj.get("counts_down") is not None else True, "is_running": obj.get("is_running") if obj.get("is_running") is not None else True, "metrics": [ActivityMetric.from_dict(_item) for _item in obj["metrics"]] if obj.get("metrics") is not None else None, diff --git a/activitysmith_openapi/models/stream_content_state.py b/activitysmith_openapi/models/stream_content_state.py index e1e903a..47302fb 100644 --- a/activitysmith_openapi/models/stream_content_state.py +++ b/activitysmith_openapi/models/stream_content_state.py @@ -17,6 +17,7 @@ import re # noqa: F401 import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional, Union from typing_extensions import Annotated @@ -29,16 +30,18 @@ class StreamContentState(BaseModel): """ - Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window. + Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds or timer_end_at to start or reset a bounded timer, and timer_start_at for a timer that started earlier. Omit them on later updates to preserve the existing timer window. """ # noqa: E501 - title: StrictStr + title: StrictStr = Field(description="Title shown on the Live Activity. Send an empty string to show no title.") subtitle: Optional[StrictStr] = None number_of_steps: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Use for segmented_progress.") current_step: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Use for segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.") percentage: Optional[Union[Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)]]] = Field(default=None, description="Use for progress. Takes precedence over value/upper_limit if both are provided.") value: Optional[LiveActivityValue] = Field(default=None, description="For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For progress, a numeric progress value used with upper_limit.") upper_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum progress value. Use with value for progress.") - duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window; omit it on later stream updates to preserve the existing timer window.") + duration_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window, counted from timer_start_at when you send it. Omit it on later stream updates to preserve the existing timer window.") + timer_start_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future.") + timer_end_at: Optional[datetime] = Field(default=None, description="Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. On later stream updates, send timer_end_at alone to move the end and keep the current start.") counts_down: Optional[StrictBool] = Field(default=True, description="Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer.") is_running: Optional[StrictBool] = Field(default=True, description="Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume.") type: Optional[StrictStr] = Field(default=None, description="Required on the first PUT or whenever the stream cannot infer the current activity type.") @@ -51,7 +54,7 @@ class StreamContentState(BaseModel): badge: Optional[LiveActivityAlertBadge] = Field(default=None, description="Optional badge. Supported by alert, progress, segmented_progress, and value.") auto_dismiss_seconds: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Optional. Seconds before the ended Live Activity is dismissed.") auto_dismiss_minutes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Optional. Minutes before the ended Live Activity is dismissed.") - __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "counts_down", "is_running", "type", "color", "step_color", "step_colors", "metrics", "message", "icon", "badge", "auto_dismiss_seconds", "auto_dismiss_minutes"] + __properties: ClassVar[List[str]] = ["title", "subtitle", "number_of_steps", "current_step", "percentage", "value", "upper_limit", "duration_seconds", "timer_start_at", "timer_end_at", "counts_down", "is_running", "type", "color", "step_color", "step_colors", "metrics", "message", "icon", "badge", "auto_dismiss_seconds", "auto_dismiss_minutes"] @field_validator('type') def type_validate_enum(cls, value): @@ -169,6 +172,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": LiveActivityValue.from_dict(obj["value"]) if obj.get("value") is not None else None, "upper_limit": obj.get("upper_limit"), "duration_seconds": obj.get("duration_seconds"), + "timer_start_at": obj.get("timer_start_at"), + "timer_end_at": obj.get("timer_end_at"), "counts_down": obj.get("counts_down") if obj.get("counts_down") is not None else True, "is_running": obj.get("is_running") if obj.get("is_running") is not None else True, "type": obj.get("type"), diff --git a/activitysmith_openapi/openapi-source.json b/activitysmith_openapi/openapi-source.json index 6150a4d..bba4174 100644 --- a/activitysmith_openapi/openapi-source.json +++ b/activitysmith_openapi/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "15ba559268fc8a9faa46ac73ed6c5fdc96f7e4f7", + "commit": "b94943aee5de9d2c386a3fe164cd585666cc3907", "path": "openapi.json", - "sha256": "1964b1e64ee810e2dd4cadb41916e59b836720b8607ef60c298e3f990aeb9cb8" + "sha256": "5491f8ab50edb32b94813dd77adcb09d289aef69f29008ec9117e05af6eaed28" } diff --git a/activitysmith_openapi/test/test_content_state_start.py b/activitysmith_openapi/test/test_content_state_start.py index 4a1a68c..e7adf88 100644 --- a/activitysmith_openapi/test/test_content_state_start.py +++ b/activitysmith_openapi/test/test_content_state_start.py @@ -43,6 +43,8 @@ def make_instance(self, include_optional) -> ContentStateStart: value = None, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ diff --git a/activitysmith_openapi/test/test_content_state_update.py b/activitysmith_openapi/test/test_content_state_update.py index 11412f4..98125c1 100644 --- a/activitysmith_openapi/test/test_content_state_update.py +++ b/activitysmith_openapi/test/test_content_state_update.py @@ -43,6 +43,8 @@ def make_instance(self, include_optional) -> ContentStateUpdate: value = None, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ diff --git a/activitysmith_openapi/test/test_live_activity_start_request.py b/activitysmith_openapi/test/test_live_activity_start_request.py index 9e3b610..3669bca 100644 --- a/activitysmith_openapi/test/test_live_activity_start_request.py +++ b/activitysmith_openapi/test/test_live_activity_start_request.py @@ -47,6 +47,8 @@ def make_instance(self, include_optional) -> LiveActivityStartRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ @@ -96,6 +98,8 @@ def make_instance(self, include_optional) -> LiveActivityStartRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ diff --git a/activitysmith_openapi/test/test_live_activity_stream_delete_request.py b/activitysmith_openapi/test/test_live_activity_stream_delete_request.py index fc63177..67e27eb 100644 --- a/activitysmith_openapi/test/test_live_activity_stream_delete_request.py +++ b/activitysmith_openapi/test/test_live_activity_stream_delete_request.py @@ -50,6 +50,8 @@ def make_instance(self, include_optional) -> LiveActivityStreamDeleteRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, type = 'segmented_progress', diff --git a/activitysmith_openapi/test/test_live_activity_stream_request.py b/activitysmith_openapi/test/test_live_activity_stream_request.py index 85398f6..ad343d4 100644 --- a/activitysmith_openapi/test/test_live_activity_stream_request.py +++ b/activitysmith_openapi/test/test_live_activity_stream_request.py @@ -47,6 +47,8 @@ def make_instance(self, include_optional) -> LiveActivityStreamRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, type = 'segmented_progress', @@ -101,6 +103,8 @@ def make_instance(self, include_optional) -> LiveActivityStreamRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, type = 'segmented_progress', diff --git a/activitysmith_openapi/test/test_live_activity_update_request.py b/activitysmith_openapi/test/test_live_activity_update_request.py index 88f37d6..160db36 100644 --- a/activitysmith_openapi/test/test_live_activity_update_request.py +++ b/activitysmith_openapi/test/test_live_activity_update_request.py @@ -51,6 +51,8 @@ def make_instance(self, include_optional) -> LiveActivityUpdateRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ @@ -91,6 +93,8 @@ def make_instance(self, include_optional) -> LiveActivityUpdateRequest: value = null, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, metrics = [ diff --git a/activitysmith_openapi/test/test_stream_content_state.py b/activitysmith_openapi/test/test_stream_content_state.py index f36eb8b..f521f64 100644 --- a/activitysmith_openapi/test/test_stream_content_state.py +++ b/activitysmith_openapi/test/test_stream_content_state.py @@ -43,6 +43,8 @@ def make_instance(self, include_optional) -> StreamContentState: value = None, upper_limit = 1.337, duration_seconds = 1.337, + timer_start_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + timer_end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), counts_down = True, is_running = True, type = 'segmented_progress',