From 51d0051a09b26d4595742821ce3b7d198888321c Mon Sep 17 00:00:00 2001 From: activitysmith-bot Date: Mon, 8 Jun 2026 07:44:27 +0000 Subject: [PATCH 1/4] chore: regenerate SDK --- generated/api/openapi.yaml | 313 ++++++++++++++----- generated/api_live_activities.go | 8 +- generated/docs/ContentStateEnd.md | 82 ++++- generated/docs/ContentStateStart.md | 82 ++++- generated/docs/ContentStateUpdate.md | 82 ++++- generated/docs/LiveActivityAction.md | 2 +- generated/docs/PushNotificationAction.md | 2 +- generated/docs/PushNotificationRequest.md | 2 +- generated/docs/StreamContentState.md | 82 ++++- generated/model_content_state_end.go | 128 +++++++- generated/model_content_state_start.go | 128 +++++++- generated/model_content_state_update.go | 128 +++++++- generated/model_live_activity_action.go | 2 +- generated/model_push_notification_action.go | 2 +- generated/model_push_notification_request.go | 2 +- generated/model_stream_content_state.go | 128 +++++++- 16 files changed, 1057 insertions(+), 116 deletions(-) diff --git a/generated/api/openapi.yaml b/generated/api/openapi.yaml index 2073d9b..3a04ce5 100644 --- a/generated/api/openapi.yaml +++ b/generated/api/openapi.yaml @@ -441,7 +441,9 @@ paths: put: description: "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." + \ 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." operationId: reconcileLiveActivityStream parameters: - description: "Stable identifier for one ongoing thing. Allowed characters:\ @@ -487,6 +489,14 @@ paths: - label: MEM value: 64 unit: '%' + timer: + value: + content_state: + title: Benchmark Run + subtitle: sampling performance + type: timer + duration_seconds: 300 + color: cyan schema: $ref: '#/components/schemas/LiveActivityStreamRequest' required: true @@ -684,7 +694,7 @@ paths: \ rotation, and end state for you. This endpoint remains supported for existing\ \ integrations and advanced lifecycle control. Starts a Live Activity on devices\ \ matched by API key scope and optional target channels. Supports segmented_progress,\ - \ progress, metrics, stats, and alert activity types. For segmented_progress\ + \ progress, metrics, stats, alert, and timer activity types. For segmented_progress\ \ activities, number_of_steps can be changed later during update or end calls\ \ if the workflow changes." operationId: startLiveActivity @@ -747,6 +757,14 @@ paths: channels: - devs - ops + timer: + value: + content_state: + title: Benchmark Run + subtitle: sampling performance + type: timer + duration_seconds: 300 + color: cyan schema: $ref: '#/components/schemas/LiveActivityStartRequest' required: true @@ -949,9 +967,11 @@ paths: \ rotation, and end state for you. This endpoint remains supported for existing\ \ integrations and advanced lifecycle control. Updates an existing Live Activity.\ \ If the per-activity token is not registered yet, the update is queued. Supports\ - \ segmented_progress, progress, metrics, stats, and alert activity types.\ - \ For segmented_progress activities, you can increase or decrease number_of_steps\ - \ here as the workflow changes." + \ segmented_progress, progress, metrics, stats, alert, and timer activity\ + \ types. For segmented_progress activities, you can increase or decrease number_of_steps\ + \ here as the workflow changes. For timer activities, send duration_seconds\ + \ only when you want to reset the timer window; omit it to keep the current\ + \ timer running." operationId: updateLiveActivity requestBody: content: @@ -1003,6 +1023,21 @@ paths: job_id: reindex-2026-03-19 requested_by: activitysmith_live_activity reason: paused_from_ios_live_activity + timer_preserve_window: + value: + activity_id: pLAr-Hnq9ZFW4sxlk43Lhbuok4GLh7UW + content_state: + title: Benchmark Run + subtitle: checking p95 latency + type: timer + timer_reset_window: + value: + activity_id: pLAr-Hnq9ZFW4sxlk43Lhbuok4GLh7UW + content_state: + title: Benchmark Run + subtitle: retrying sample + type: timer + duration_seconds: 180 schema: $ref: '#/components/schemas/LiveActivityUpdateRequest' required: true @@ -1148,7 +1183,7 @@ paths: \ /live-activity/stream/{stream_key} to end a managed Live Activity stream.\ \ This endpoint remains supported for existing integrations and advanced lifecycle\ \ control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress,\ - \ progress, metrics, stats, and alert activity types. For segmented_progress\ + \ progress, metrics, stats, alert, and timer activity types. For segmented_progress\ \ activities, you can send the latest number_of_steps here if the workflow\ \ changed after start." operationId: endLiveActivity @@ -1201,6 +1236,14 @@ paths: title: Open Workflow type: open_url url: https://github.com/acme/payments-api/actions/runs/1234567890 + timer: + value: + activity_id: pLAr-Hnq9ZFW4sxlk43Lhbuok4GLh7UW + content_state: + title: Benchmark Run + subtitle: complete + type: timer + auto_dismiss_minutes: 2 schema: $ref: '#/components/schemas/LiveActivityEndRequest' required: true @@ -1368,13 +1411,8 @@ paths: requestBody: content: application/json: - examples: - number: - value: - value: 42 - string: - value: - value: healthy + example: + value: 42 schema: $ref: '#/components/schemas/MetricValueUpdateRequest' required: true @@ -1482,11 +1520,14 @@ components: description: "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 alert include message. Optional icon is supported by all Live\ - \ Activity types. Optional badge is supported by alert, progress, and segmented_progress.\ - \ For segmented_progress, number_of_steps is not locked and can be changed\ - \ in later update or end calls." + \ array. 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, and segmented_progress. For segmented_progress,\ + \ number_of_steps is not locked and can be changed in later update or end\ + \ calls." example: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -1496,9 +1537,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -1508,23 +1551,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 @@ -1557,6 +1600,21 @@ components: upper_limit: description: Maximum progress value. Use with value for type=progress. type: number + duration_seconds: + description: "Timer duration in seconds. For type=timer countdowns, required\ + \ on start when counts_down is true or omitted." + type: number + counts_down: + 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." + type: boolean + is_running: + 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: boolean metrics: description: Use for type=metrics or type=stats. items: @@ -1579,11 +1637,12 @@ components: - metrics - stats - alert + - timer type: string color: - description: "Optional. Accent color for progress, segmented_progress, and\ - \ metrics Live Activities. For Alert Live Activities, this tints the action\ - \ button when action is included." + description: "Optional. Accent color for progress, segmented_progress, metrics,\ + \ and timer Live Activities. For Alert Live Activities, this tints the\ + \ action button when action is included." enum: - lime - green @@ -1636,11 +1695,14 @@ components: description: "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 alert include message. Optional icon is supported by all Live\ - \ Activity types. Optional badge is supported by alert, progress, and segmented_progress.\ + \ array. 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, and segmented_progress.\ \ Type is optional when updating an existing activity. You can increase or\ \ decrease number_of_steps during updates." example: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -1650,9 +1712,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -1662,23 +1726,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 @@ -1710,6 +1774,22 @@ components: upper_limit: description: Maximum progress value. Use with value for type=progress. type: number + duration_seconds: + 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." + type: number + counts_down: + 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." + type: boolean + is_running: + 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: boolean metrics: description: Use for type=metrics or type=stats. items: @@ -1734,11 +1814,12 @@ components: - metrics - stats - alert + - timer type: string color: - description: "Optional. Accent color for progress, segmented_progress, and\ - \ metrics Live Activities. For Alert Live Activities, this tints the action\ - \ button when action is included." + description: "Optional. Accent color for progress, segmented_progress, metrics,\ + \ and timer Live Activities. For Alert Live Activities, this tints the\ + \ action button when action is included." enum: - lime - green @@ -1790,11 +1871,13 @@ components: description: "End 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 alert include message. Optional icon is supported by all Live Activity\ - \ types. Optional badge is supported by alert, progress, and segmented_progress.\ + \ For alert include message. For timer, omit duration_seconds to preserve\ + \ and freeze the latest timer state. Optional icon is supported by all Live\ + \ Activity types. Optional badge is supported by alert, progress, and segmented_progress.\ \ Type is optional when ending an existing activity. You can send an updated\ \ number_of_steps here if the workflow changed after start." example: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -1805,9 +1888,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -1817,23 +1902,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 @@ -1866,6 +1951,21 @@ components: upper_limit: description: Maximum progress value. Use with value for type=progress. type: number + duration_seconds: + description: "Timer duration in seconds. For type=timer, omit duration_seconds\ + \ on end to preserve and freeze the latest timer state." + type: number + counts_down: + 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." + type: boolean + is_running: + 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: boolean metrics: description: Use for type=metrics or type=stats. items: @@ -1890,11 +1990,12 @@ components: - metrics - stats - alert + - timer type: string color: - description: "Optional. Accent color for progress, segmented_progress, and\ - \ metrics Live Activities. For Alert Live Activities, this tints the action\ - \ button when action is included." + description: "Optional. Accent color for progress, segmented_progress, metrics,\ + \ and timer Live Activities. For Alert Live Activities, this tints the\ + \ action button when action is included." enum: - lime - green @@ -1952,8 +2053,11 @@ components: additionalProperties: true description: "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, and alert types." + \ Supports segmented_progress, progress, metrics, stats, alert, and timer\ + \ 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." example: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -1964,9 +2068,11 @@ components: title: title type: segmented_progress message: message + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -1976,23 +2082,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 auto_dismiss_seconds: 0 value: 5.962133916683182 @@ -2024,6 +2130,22 @@ components: upper_limit: description: Maximum progress value. Use with value for progress. type: number + duration_seconds: + 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." + type: number + counts_down: + 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." + type: boolean + is_running: + 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: boolean type: description: Required on the first PUT or whenever the stream cannot infer the current activity type. @@ -2033,11 +2155,12 @@ components: - metrics - stats - alert + - timer type: string color: - description: "Optional. Accent color for progress, segmented_progress, and\ - \ metrics Live Activities. For Alert Live Activities, this tints the action\ - \ button when action is included." + description: "Optional. Accent color for progress, segmented_progress, metrics,\ + \ and timer Live Activities. For Alert Live Activities, this tints the\ + \ action button when action is included." enum: - lime - green @@ -2113,7 +2236,7 @@ components: unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 properties: label: minLength: 1 @@ -2235,8 +2358,9 @@ components: type: $ref: '#/components/schemas/PushNotificationActionType' url: - description: "Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL.\ - \ For webhook, use an HTTPS URL called by the ActivitySmith backend." + description: "Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=...\ + \ URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS\ + \ URL called by the ActivitySmith backend." format: uri method: $ref: '#/components/schemas/PushNotificationWebhookMethod' @@ -2277,8 +2401,9 @@ components: type: $ref: '#/components/schemas/LiveActivityActionType' url: - description: "Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL.\ - \ For webhook, use an HTTPS URL called by the ActivitySmith backend." + description: "Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=...\ + \ URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS\ + \ URL called by the ActivitySmith backend." format: uri method: $ref: '#/components/schemas/LiveActivityWebhookMethod' @@ -2343,8 +2468,9 @@ components: pattern: ^https:// redirection: description: Optional HTTPS URL or shortcuts://run-shortcut?name=... URL - opened when user taps the notification body. Overrides the default tap - target from `media` when both are provided. + opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... + to run a specific iPhone Shortcut that already exists on the user's device. + Overrides the default tap target from `media` when both are provided. format: uri pattern: ^(https|shortcuts):// actions: @@ -2394,6 +2520,7 @@ components: later update and end calls. example: content_state: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -2403,9 +2530,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -2415,23 +2544,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 @@ -2500,6 +2629,7 @@ components: \ for compatibility. If both are provided, they must match." example: content_state: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -2510,9 +2640,11 @@ components: title: title type: segmented_progress message: message + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -2522,23 +2654,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 auto_dismiss_seconds: 0 value: 5.962133916683182 @@ -2635,6 +2767,7 @@ components: \ ends the stream using the latest known state when possible." example: content_state: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -2645,9 +2778,11 @@ components: title: title type: segmented_progress message: message + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -2657,23 +2792,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 auto_dismiss_seconds: 0 value: 5.962133916683182 @@ -2861,6 +2996,7 @@ components: description: Update an existing Live Activity by activity_id. example: content_state: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -2870,9 +3006,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -2882,23 +3020,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 @@ -2950,6 +3088,7 @@ components: description: End an existing Live Activity by activity_id. example: content_state: + duration_seconds: 2.3021358869347655 color: lime step_color: lime icon: @@ -2960,9 +3099,11 @@ components: title: title message: message type: segmented_progress + is_running: true badge: color: null title: title + counts_down: true step_colors: - lime - lime @@ -2972,23 +3113,23 @@ components: - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 - unit: unit color: lime label: label - value: 0.23021358869347652 + value: 0.7061401241503109 number_of_steps: 1 value: 5.962133916683182 current_step: 0 diff --git a/generated/api_live_activities.go b/generated/api_live_activities.go index 9e68c84..597ff71 100644 --- a/generated/api_live_activities.go +++ b/generated/api_live_activities.go @@ -41,7 +41,7 @@ func (r ApiEndLiveActivityRequest) Execute() (*LiveActivityEndResponse, *http.Re /* EndLiveActivity End a Live Activity (legacy manual lifecycle) -Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. +Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiEndLiveActivityRequest @@ -319,7 +319,7 @@ func (r ApiReconcileLiveActivityStreamRequest) Execute() (*LiveActivityStreamPut /* ReconcileLiveActivityStream 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. +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. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. @@ -478,7 +478,7 @@ func (r ApiStartLiveActivityRequest) Execute() (*LiveActivityStartResponse, *htt /* StartLiveActivity Start a Live Activity (legacy manual lifecycle) -Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. +Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiStartLiveActivityRequest @@ -631,7 +631,7 @@ func (r ApiUpdateLiveActivityRequest) Execute() (*LiveActivityUpdateResponse, *h /* UpdateLiveActivity Update a Live Activity (legacy manual lifecycle) -Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. +Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. For timer activities, send duration_seconds only when you want to reset the timer window; omit it to keep the current timer running. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiUpdateLiveActivityRequest diff --git a/generated/docs/ContentStateEnd.md b/generated/docs/ContentStateEnd.md index 8166d9d..60ebaf8 100644 --- a/generated/docs/ContentStateEnd.md +++ b/generated/docs/ContentStateEnd.md @@ -11,12 +11,15 @@ Name | Type | Description | Notes **Percentage** | Pointer to **float32** | Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided. | [optional] **Value** | Pointer to **float32** | Current progress value. Use with upper_limit for type=progress. | [optional] **UpperLimit** | Pointer to **float32** | Maximum progress value. Use with value for type=progress. | [optional] +**DurationSeconds** | Pointer to **float32** | Timer duration in seconds. For type=timer, omit duration_seconds on end to preserve and freeze the latest timer state. | [optional] +**CountsDown** | Pointer to **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] +**IsRunning** | Pointer to **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** | Pointer to [**[]ActivityMetric**](ActivityMetric.md) | Use for type=metrics or type=stats. | [optional] **Message** | Pointer to **string** | Alert message. Use for type=alert. | [optional] -**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. | [optional] +**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. | [optional] **Badge** | Pointer to [**LiveActivityAlertBadge**](LiveActivityAlertBadge.md) | Optional badge. Supported by alert, progress, and segmented_progress. | [optional] **Type** | Pointer to **string** | Optional. When omitted, the API uses the existing Live Activity type. | [optional] -**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] +**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] **StepColor** | Pointer to **string** | Optional. Overrides color for the current step. Only applies to type=segmented_progress. | [optional] **StepColors** | Pointer to **[]string** | Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. | [optional] **AutoDismissMinutes** | Pointer to **int32** | Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max. | [optional] [default to 3] @@ -210,6 +213,81 @@ SetUpperLimit sets UpperLimit field to given value. HasUpperLimit returns a boolean if a field has been set. +### GetDurationSeconds + +`func (o *ContentStateEnd) GetDurationSeconds() float32` + +GetDurationSeconds returns the DurationSeconds field if non-nil, zero value otherwise. + +### GetDurationSecondsOk + +`func (o *ContentStateEnd) GetDurationSecondsOk() (*float32, bool)` + +GetDurationSecondsOk returns a tuple with the DurationSeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDurationSeconds + +`func (o *ContentStateEnd) SetDurationSeconds(v float32)` + +SetDurationSeconds sets DurationSeconds field to given value. + +### HasDurationSeconds + +`func (o *ContentStateEnd) HasDurationSeconds() bool` + +HasDurationSeconds returns a boolean if a field has been set. + +### GetCountsDown + +`func (o *ContentStateEnd) GetCountsDown() bool` + +GetCountsDown returns the CountsDown field if non-nil, zero value otherwise. + +### GetCountsDownOk + +`func (o *ContentStateEnd) GetCountsDownOk() (*bool, bool)` + +GetCountsDownOk returns a tuple with the CountsDown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCountsDown + +`func (o *ContentStateEnd) SetCountsDown(v bool)` + +SetCountsDown sets CountsDown field to given value. + +### HasCountsDown + +`func (o *ContentStateEnd) HasCountsDown() bool` + +HasCountsDown returns a boolean if a field has been set. + +### GetIsRunning + +`func (o *ContentStateEnd) GetIsRunning() bool` + +GetIsRunning returns the IsRunning field if non-nil, zero value otherwise. + +### GetIsRunningOk + +`func (o *ContentStateEnd) GetIsRunningOk() (*bool, bool)` + +GetIsRunningOk returns a tuple with the IsRunning field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsRunning + +`func (o *ContentStateEnd) SetIsRunning(v bool)` + +SetIsRunning sets IsRunning field to given value. + +### HasIsRunning + +`func (o *ContentStateEnd) HasIsRunning() bool` + +HasIsRunning returns a boolean if a field has been set. + ### GetMetrics `func (o *ContentStateEnd) GetMetrics() []ActivityMetric` diff --git a/generated/docs/ContentStateStart.md b/generated/docs/ContentStateStart.md index dc20b51..fcb9018 100644 --- a/generated/docs/ContentStateStart.md +++ b/generated/docs/ContentStateStart.md @@ -11,12 +11,15 @@ Name | Type | Description | Notes **Percentage** | Pointer to **float32** | Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided. | [optional] **Value** | Pointer to **float32** | Current progress value. Use with upper_limit for type=progress. | [optional] **UpperLimit** | Pointer to **float32** | Maximum progress value. Use with value for type=progress. | [optional] +**DurationSeconds** | Pointer to **float32** | Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted. | [optional] +**CountsDown** | Pointer to **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] +**IsRunning** | Pointer to **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** | Pointer to [**[]ActivityMetric**](ActivityMetric.md) | Use for type=metrics or type=stats. | [optional] **Message** | Pointer to **string** | Required for type=alert. | [optional] -**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. | [optional] +**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. | [optional] **Badge** | Pointer to [**LiveActivityAlertBadge**](LiveActivityAlertBadge.md) | Optional badge. Supported by alert, progress, and segmented_progress. | [optional] **Type** | **string** | | -**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] +**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] **StepColor** | Pointer to **string** | Optional. Overrides color for the current step. Only applies to type=segmented_progress. | [optional] **StepColors** | Pointer to **[]string** | Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. | [optional] @@ -209,6 +212,81 @@ SetUpperLimit sets UpperLimit field to given value. HasUpperLimit returns a boolean if a field has been set. +### GetDurationSeconds + +`func (o *ContentStateStart) GetDurationSeconds() float32` + +GetDurationSeconds returns the DurationSeconds field if non-nil, zero value otherwise. + +### GetDurationSecondsOk + +`func (o *ContentStateStart) GetDurationSecondsOk() (*float32, bool)` + +GetDurationSecondsOk returns a tuple with the DurationSeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDurationSeconds + +`func (o *ContentStateStart) SetDurationSeconds(v float32)` + +SetDurationSeconds sets DurationSeconds field to given value. + +### HasDurationSeconds + +`func (o *ContentStateStart) HasDurationSeconds() bool` + +HasDurationSeconds returns a boolean if a field has been set. + +### GetCountsDown + +`func (o *ContentStateStart) GetCountsDown() bool` + +GetCountsDown returns the CountsDown field if non-nil, zero value otherwise. + +### GetCountsDownOk + +`func (o *ContentStateStart) GetCountsDownOk() (*bool, bool)` + +GetCountsDownOk returns a tuple with the CountsDown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCountsDown + +`func (o *ContentStateStart) SetCountsDown(v bool)` + +SetCountsDown sets CountsDown field to given value. + +### HasCountsDown + +`func (o *ContentStateStart) HasCountsDown() bool` + +HasCountsDown returns a boolean if a field has been set. + +### GetIsRunning + +`func (o *ContentStateStart) GetIsRunning() bool` + +GetIsRunning returns the IsRunning field if non-nil, zero value otherwise. + +### GetIsRunningOk + +`func (o *ContentStateStart) GetIsRunningOk() (*bool, bool)` + +GetIsRunningOk returns a tuple with the IsRunning field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsRunning + +`func (o *ContentStateStart) SetIsRunning(v bool)` + +SetIsRunning sets IsRunning field to given value. + +### HasIsRunning + +`func (o *ContentStateStart) HasIsRunning() bool` + +HasIsRunning returns a boolean if a field has been set. + ### GetMetrics `func (o *ContentStateStart) GetMetrics() []ActivityMetric` diff --git a/generated/docs/ContentStateUpdate.md b/generated/docs/ContentStateUpdate.md index 6e8b198..dcee301 100644 --- a/generated/docs/ContentStateUpdate.md +++ b/generated/docs/ContentStateUpdate.md @@ -11,12 +11,15 @@ Name | Type | Description | Notes **Percentage** | Pointer to **float32** | Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided. | [optional] **Value** | Pointer to **float32** | Current progress value. Use with upper_limit for type=progress. | [optional] **UpperLimit** | Pointer to **float32** | Maximum progress value. Use with value for type=progress. | [optional] +**DurationSeconds** | Pointer to **float32** | 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] +**CountsDown** | Pointer to **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] +**IsRunning** | Pointer to **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** | Pointer to [**[]ActivityMetric**](ActivityMetric.md) | Use for type=metrics or type=stats. | [optional] **Message** | Pointer to **string** | Alert message. Use for type=alert. | [optional] -**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. | [optional] +**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. | [optional] **Badge** | Pointer to [**LiveActivityAlertBadge**](LiveActivityAlertBadge.md) | Optional badge. Supported by alert, progress, and segmented_progress. | [optional] **Type** | Pointer to **string** | Optional. When omitted, the API uses the existing Live Activity type. | [optional] -**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] +**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] **StepColor** | Pointer to **string** | Optional. Overrides color for the current step. Only applies to type=segmented_progress. | [optional] **StepColors** | Pointer to **[]string** | Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. | [optional] @@ -209,6 +212,81 @@ SetUpperLimit sets UpperLimit field to given value. HasUpperLimit returns a boolean if a field has been set. +### GetDurationSeconds + +`func (o *ContentStateUpdate) GetDurationSeconds() float32` + +GetDurationSeconds returns the DurationSeconds field if non-nil, zero value otherwise. + +### GetDurationSecondsOk + +`func (o *ContentStateUpdate) GetDurationSecondsOk() (*float32, bool)` + +GetDurationSecondsOk returns a tuple with the DurationSeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDurationSeconds + +`func (o *ContentStateUpdate) SetDurationSeconds(v float32)` + +SetDurationSeconds sets DurationSeconds field to given value. + +### HasDurationSeconds + +`func (o *ContentStateUpdate) HasDurationSeconds() bool` + +HasDurationSeconds returns a boolean if a field has been set. + +### GetCountsDown + +`func (o *ContentStateUpdate) GetCountsDown() bool` + +GetCountsDown returns the CountsDown field if non-nil, zero value otherwise. + +### GetCountsDownOk + +`func (o *ContentStateUpdate) GetCountsDownOk() (*bool, bool)` + +GetCountsDownOk returns a tuple with the CountsDown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCountsDown + +`func (o *ContentStateUpdate) SetCountsDown(v bool)` + +SetCountsDown sets CountsDown field to given value. + +### HasCountsDown + +`func (o *ContentStateUpdate) HasCountsDown() bool` + +HasCountsDown returns a boolean if a field has been set. + +### GetIsRunning + +`func (o *ContentStateUpdate) GetIsRunning() bool` + +GetIsRunning returns the IsRunning field if non-nil, zero value otherwise. + +### GetIsRunningOk + +`func (o *ContentStateUpdate) GetIsRunningOk() (*bool, bool)` + +GetIsRunningOk returns a tuple with the IsRunning field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsRunning + +`func (o *ContentStateUpdate) SetIsRunning(v bool)` + +SetIsRunning sets IsRunning field to given value. + +### HasIsRunning + +`func (o *ContentStateUpdate) HasIsRunning() bool` + +HasIsRunning returns a boolean if a field has been set. + ### GetMetrics `func (o *ContentStateUpdate) GetMetrics() []ActivityMetric` diff --git a/generated/docs/LiveActivityAction.md b/generated/docs/LiveActivityAction.md index 99fb76b..0b262b2 100644 --- a/generated/docs/LiveActivityAction.md +++ b/generated/docs/LiveActivityAction.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Title** | **string** | Button title displayed in the Live Activity UI. | **Type** | [**LiveActivityActionType**](LiveActivityActionType.md) | | -**Url** | **string** | Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL. For webhook, use an HTTPS URL called by the ActivitySmith backend. | +**Url** | **string** | Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend. | **Method** | Pointer to [**LiveActivityWebhookMethod**](LiveActivityWebhookMethod.md) | Webhook HTTP method. Used only when type=webhook. | [optional] [default to LIVEACTIVITYWEBHOOKMETHOD_POST] **Body** | Pointer to **map[string]interface{}** | Optional webhook payload body. Used only when type=webhook. | [optional] diff --git a/generated/docs/PushNotificationAction.md b/generated/docs/PushNotificationAction.md index 48c65d1..ea0baf8 100644 --- a/generated/docs/PushNotificationAction.md +++ b/generated/docs/PushNotificationAction.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Title** | **string** | Button title displayed in iOS expanded notification UI. | **Type** | [**PushNotificationActionType**](PushNotificationActionType.md) | | -**Url** | **string** | Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL. For webhook, use an HTTPS URL called by the ActivitySmith backend. | +**Url** | **string** | Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend. | **Method** | Pointer to [**PushNotificationWebhookMethod**](PushNotificationWebhookMethod.md) | Webhook HTTP method. Used only when type=webhook. | [optional] [default to PUSHNOTIFICATIONWEBHOOKMETHOD_POST] **Body** | Pointer to **map[string]interface{}** | Optional webhook payload body. Used only when type=webhook. | [optional] diff --git a/generated/docs/PushNotificationRequest.md b/generated/docs/PushNotificationRequest.md index 787a1e0..981afba 100644 --- a/generated/docs/PushNotificationRequest.md +++ b/generated/docs/PushNotificationRequest.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **Message** | Pointer to **string** | | [optional] **Subtitle** | Pointer to **string** | | [optional] **Media** | Pointer to **string** | Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`. | [optional] -**Redirection** | Pointer to **string** | Optional HTTPS URL or shortcuts://run-shortcut?name=... URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided. | [optional] +**Redirection** | Pointer to **string** | Optional HTTPS URL or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided. | [optional] **Actions** | Pointer to [**[]PushNotificationAction**](PushNotificationAction.md) | Optional interactive actions shown when users expand the notification. Cannot be combined with `media`. | [optional] **Payload** | Pointer to **map[string]interface{}** | | [optional] **Badge** | Pointer to **int32** | | [optional] diff --git a/generated/docs/StreamContentState.md b/generated/docs/StreamContentState.md index 8af6036..8a9a9d3 100644 --- a/generated/docs/StreamContentState.md +++ b/generated/docs/StreamContentState.md @@ -11,13 +11,16 @@ Name | Type | Description | Notes **Percentage** | Pointer to **float32** | Use for progress. Takes precedence over value/upper_limit if both are provided. | [optional] **Value** | Pointer to **float32** | Current progress value. Use with upper_limit for progress. | [optional] **UpperLimit** | Pointer to **float32** | Maximum progress value. Use with value for progress. | [optional] +**DurationSeconds** | Pointer to **float32** | 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] +**CountsDown** | Pointer to **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] +**IsRunning** | Pointer to **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** | Pointer to **string** | Required on the first PUT or whenever the stream cannot infer the current activity type. | [optional] -**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] +**Color** | Pointer to **string** | Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. | [optional] **StepColor** | Pointer to **string** | Optional. Overrides color for the current step. Only applies to segmented_progress. | [optional] **StepColors** | Pointer to **[]string** | Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. | [optional] **Metrics** | Pointer to [**[]ActivityMetric**](ActivityMetric.md) | Use for metrics and stats activities. | [optional] **Message** | Pointer to **string** | Required for type=alert. | [optional] -**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. | [optional] +**Icon** | Pointer to [**LiveActivityAlertIcon**](LiveActivityAlertIcon.md) | Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. | [optional] **Badge** | Pointer to [**LiveActivityAlertBadge**](LiveActivityAlertBadge.md) | Optional badge. Supported by alert, progress, and segmented_progress. | [optional] **AutoDismissSeconds** | Pointer to **int32** | Optional. Seconds before the ended Live Activity is dismissed. | [optional] **AutoDismissMinutes** | Pointer to **int32** | Optional. Minutes before the ended Live Activity is dismissed. | [optional] @@ -211,6 +214,81 @@ SetUpperLimit sets UpperLimit field to given value. HasUpperLimit returns a boolean if a field has been set. +### GetDurationSeconds + +`func (o *StreamContentState) GetDurationSeconds() float32` + +GetDurationSeconds returns the DurationSeconds field if non-nil, zero value otherwise. + +### GetDurationSecondsOk + +`func (o *StreamContentState) GetDurationSecondsOk() (*float32, bool)` + +GetDurationSecondsOk returns a tuple with the DurationSeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDurationSeconds + +`func (o *StreamContentState) SetDurationSeconds(v float32)` + +SetDurationSeconds sets DurationSeconds field to given value. + +### HasDurationSeconds + +`func (o *StreamContentState) HasDurationSeconds() bool` + +HasDurationSeconds returns a boolean if a field has been set. + +### GetCountsDown + +`func (o *StreamContentState) GetCountsDown() bool` + +GetCountsDown returns the CountsDown field if non-nil, zero value otherwise. + +### GetCountsDownOk + +`func (o *StreamContentState) GetCountsDownOk() (*bool, bool)` + +GetCountsDownOk returns a tuple with the CountsDown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCountsDown + +`func (o *StreamContentState) SetCountsDown(v bool)` + +SetCountsDown sets CountsDown field to given value. + +### HasCountsDown + +`func (o *StreamContentState) HasCountsDown() bool` + +HasCountsDown returns a boolean if a field has been set. + +### GetIsRunning + +`func (o *StreamContentState) GetIsRunning() bool` + +GetIsRunning returns the IsRunning field if non-nil, zero value otherwise. + +### GetIsRunningOk + +`func (o *StreamContentState) GetIsRunningOk() (*bool, bool)` + +GetIsRunningOk returns a tuple with the IsRunning field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsRunning + +`func (o *StreamContentState) SetIsRunning(v bool)` + +SetIsRunning sets IsRunning field to given value. + +### HasIsRunning + +`func (o *StreamContentState) HasIsRunning() bool` + +HasIsRunning returns a boolean if a field has been set. + ### GetType `func (o *StreamContentState) GetType() string` diff --git a/generated/model_content_state_end.go b/generated/model_content_state_end.go index 0ed9cc7..336bb54 100644 --- a/generated/model_content_state_end.go +++ b/generated/model_content_state_end.go @@ -18,7 +18,7 @@ import ( // checks if the ContentStateEnd type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ContentStateEnd{} -// ContentStateEnd End 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 alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. +// ContentStateEnd End 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 alert include message. For timer, omit duration_seconds to preserve and freeze the latest timer state. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. type ContentStateEnd struct { Title string `json:"title"` Subtitle *string `json:"subtitle,omitempty"` @@ -32,17 +32,23 @@ type ContentStateEnd struct { Value *float32 `json:"value,omitempty"` // Maximum progress value. Use with value for type=progress. UpperLimit *float32 `json:"upper_limit,omitempty"` + // Timer duration in seconds. For type=timer, omit duration_seconds on end to preserve and freeze the latest timer state. + DurationSeconds *float32 `json:"duration_seconds,omitempty"` + // 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. + CountsDown *bool `json:"counts_down,omitempty"` + // Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. + IsRunning *bool `json:"is_running,omitempty"` // Use for type=metrics or type=stats. Metrics []ActivityMetric `json:"metrics,omitempty"` // Alert message. Use for type=alert. Message *string `json:"message,omitempty"` - // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. + // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. Icon *LiveActivityAlertIcon `json:"icon,omitempty"` // Optional badge. Supported by alert, progress, and segmented_progress. Badge *LiveActivityAlertBadge `json:"badge,omitempty"` // Optional. When omitted, the API uses the existing Live Activity type. Type *string `json:"type,omitempty"` - // Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. + // Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. Color *string `json:"color,omitempty"` // Optional. Overrides color for the current step. Only applies to type=segmented_progress. StepColor *string `json:"step_color,omitempty"` @@ -62,6 +68,10 @@ type _ContentStateEnd ContentStateEnd func NewContentStateEnd(title string) *ContentStateEnd { this := ContentStateEnd{} this.Title = title + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning var autoDismissMinutes int32 = 3 this.AutoDismissMinutes = &autoDismissMinutes return &this @@ -72,6 +82,10 @@ func NewContentStateEnd(title string) *ContentStateEnd { // but it doesn't guarantee that properties required by API are set func NewContentStateEndWithDefaults() *ContentStateEnd { this := ContentStateEnd{} + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning var autoDismissMinutes int32 = 3 this.AutoDismissMinutes = &autoDismissMinutes return &this @@ -293,6 +307,102 @@ func (o *ContentStateEnd) SetUpperLimit(v float32) { o.UpperLimit = &v } +// GetDurationSeconds returns the DurationSeconds field value if set, zero value otherwise. +func (o *ContentStateEnd) GetDurationSeconds() float32 { + if o == nil || IsNil(o.DurationSeconds) { + var ret float32 + return ret + } + return *o.DurationSeconds +} + +// GetDurationSecondsOk returns a tuple with the DurationSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateEnd) GetDurationSecondsOk() (*float32, bool) { + if o == nil || IsNil(o.DurationSeconds) { + return nil, false + } + return o.DurationSeconds, true +} + +// HasDurationSeconds returns a boolean if a field has been set. +func (o *ContentStateEnd) HasDurationSeconds() bool { + if o != nil && !IsNil(o.DurationSeconds) { + return true + } + + return false +} + +// SetDurationSeconds gets a reference to the given float32 and assigns it to the DurationSeconds field. +func (o *ContentStateEnd) SetDurationSeconds(v float32) { + o.DurationSeconds = &v +} + +// GetCountsDown returns the CountsDown field value if set, zero value otherwise. +func (o *ContentStateEnd) GetCountsDown() bool { + if o == nil || IsNil(o.CountsDown) { + var ret bool + return ret + } + return *o.CountsDown +} + +// GetCountsDownOk returns a tuple with the CountsDown field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateEnd) GetCountsDownOk() (*bool, bool) { + if o == nil || IsNil(o.CountsDown) { + return nil, false + } + return o.CountsDown, true +} + +// HasCountsDown returns a boolean if a field has been set. +func (o *ContentStateEnd) HasCountsDown() bool { + if o != nil && !IsNil(o.CountsDown) { + return true + } + + return false +} + +// SetCountsDown gets a reference to the given bool and assigns it to the CountsDown field. +func (o *ContentStateEnd) SetCountsDown(v bool) { + o.CountsDown = &v +} + +// GetIsRunning returns the IsRunning field value if set, zero value otherwise. +func (o *ContentStateEnd) GetIsRunning() bool { + if o == nil || IsNil(o.IsRunning) { + var ret bool + return ret + } + return *o.IsRunning +} + +// GetIsRunningOk returns a tuple with the IsRunning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateEnd) GetIsRunningOk() (*bool, bool) { + if o == nil || IsNil(o.IsRunning) { + return nil, false + } + return o.IsRunning, true +} + +// HasIsRunning returns a boolean if a field has been set. +func (o *ContentStateEnd) HasIsRunning() bool { + if o != nil && !IsNil(o.IsRunning) { + return true + } + + return false +} + +// SetIsRunning gets a reference to the given bool and assigns it to the IsRunning field. +func (o *ContentStateEnd) SetIsRunning(v bool) { + o.IsRunning = &v +} + // GetMetrics returns the Metrics field value if set, zero value otherwise. func (o *ContentStateEnd) GetMetrics() []ActivityMetric { if o == nil || IsNil(o.Metrics) { @@ -610,6 +720,15 @@ func (o ContentStateEnd) ToMap() (map[string]interface{}, error) { if !IsNil(o.UpperLimit) { toSerialize["upper_limit"] = o.UpperLimit } + if !IsNil(o.DurationSeconds) { + toSerialize["duration_seconds"] = o.DurationSeconds + } + if !IsNil(o.CountsDown) { + toSerialize["counts_down"] = o.CountsDown + } + if !IsNil(o.IsRunning) { + toSerialize["is_running"] = o.IsRunning + } if !IsNil(o.Metrics) { toSerialize["metrics"] = o.Metrics } @@ -687,6 +806,9 @@ func (o *ContentStateEnd) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "percentage") delete(additionalProperties, "value") delete(additionalProperties, "upper_limit") + delete(additionalProperties, "duration_seconds") + delete(additionalProperties, "counts_down") + delete(additionalProperties, "is_running") delete(additionalProperties, "metrics") delete(additionalProperties, "message") delete(additionalProperties, "icon") diff --git a/generated/model_content_state_start.go b/generated/model_content_state_start.go index ab623b0..005dd99 100644 --- a/generated/model_content_state_start.go +++ b/generated/model_content_state_start.go @@ -18,7 +18,7 @@ import ( // checks if the ContentStateStart type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ContentStateStart{} -// 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 alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. +// 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 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, and segmented_progress. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. type ContentStateStart struct { Title string `json:"title"` Subtitle *string `json:"subtitle,omitempty"` @@ -32,16 +32,22 @@ type ContentStateStart struct { Value *float32 `json:"value,omitempty"` // Maximum progress value. Use with value for type=progress. UpperLimit *float32 `json:"upper_limit,omitempty"` + // Timer duration in seconds. For type=timer countdowns, required on start when counts_down is true or omitted. + DurationSeconds *float32 `json:"duration_seconds,omitempty"` + // 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. + CountsDown *bool `json:"counts_down,omitempty"` + // Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. + IsRunning *bool `json:"is_running,omitempty"` // Use for type=metrics or type=stats. Metrics []ActivityMetric `json:"metrics,omitempty"` // Required for type=alert. Message *string `json:"message,omitempty"` - // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. + // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. Icon *LiveActivityAlertIcon `json:"icon,omitempty"` // Optional badge. Supported by alert, progress, and segmented_progress. Badge *LiveActivityAlertBadge `json:"badge,omitempty"` Type string `json:"type"` - // Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. + // Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. Color *string `json:"color,omitempty"` // Optional. Overrides color for the current step. Only applies to type=segmented_progress. StepColor *string `json:"step_color,omitempty"` @@ -59,6 +65,10 @@ type _ContentStateStart ContentStateStart func NewContentStateStart(title string, type_ string) *ContentStateStart { this := ContentStateStart{} this.Title = title + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning this.Type = type_ return &this } @@ -68,6 +78,10 @@ func NewContentStateStart(title string, type_ string) *ContentStateStart { // but it doesn't guarantee that properties required by API are set func NewContentStateStartWithDefaults() *ContentStateStart { this := ContentStateStart{} + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning return &this } @@ -287,6 +301,102 @@ func (o *ContentStateStart) SetUpperLimit(v float32) { o.UpperLimit = &v } +// GetDurationSeconds returns the DurationSeconds field value if set, zero value otherwise. +func (o *ContentStateStart) GetDurationSeconds() float32 { + if o == nil || IsNil(o.DurationSeconds) { + var ret float32 + return ret + } + return *o.DurationSeconds +} + +// GetDurationSecondsOk returns a tuple with the DurationSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateStart) GetDurationSecondsOk() (*float32, bool) { + if o == nil || IsNil(o.DurationSeconds) { + return nil, false + } + return o.DurationSeconds, true +} + +// HasDurationSeconds returns a boolean if a field has been set. +func (o *ContentStateStart) HasDurationSeconds() bool { + if o != nil && !IsNil(o.DurationSeconds) { + return true + } + + return false +} + +// SetDurationSeconds gets a reference to the given float32 and assigns it to the DurationSeconds field. +func (o *ContentStateStart) SetDurationSeconds(v float32) { + o.DurationSeconds = &v +} + +// GetCountsDown returns the CountsDown field value if set, zero value otherwise. +func (o *ContentStateStart) GetCountsDown() bool { + if o == nil || IsNil(o.CountsDown) { + var ret bool + return ret + } + return *o.CountsDown +} + +// GetCountsDownOk returns a tuple with the CountsDown field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateStart) GetCountsDownOk() (*bool, bool) { + if o == nil || IsNil(o.CountsDown) { + return nil, false + } + return o.CountsDown, true +} + +// HasCountsDown returns a boolean if a field has been set. +func (o *ContentStateStart) HasCountsDown() bool { + if o != nil && !IsNil(o.CountsDown) { + return true + } + + return false +} + +// SetCountsDown gets a reference to the given bool and assigns it to the CountsDown field. +func (o *ContentStateStart) SetCountsDown(v bool) { + o.CountsDown = &v +} + +// GetIsRunning returns the IsRunning field value if set, zero value otherwise. +func (o *ContentStateStart) GetIsRunning() bool { + if o == nil || IsNil(o.IsRunning) { + var ret bool + return ret + } + return *o.IsRunning +} + +// GetIsRunningOk returns a tuple with the IsRunning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateStart) GetIsRunningOk() (*bool, bool) { + if o == nil || IsNil(o.IsRunning) { + return nil, false + } + return o.IsRunning, true +} + +// HasIsRunning returns a boolean if a field has been set. +func (o *ContentStateStart) HasIsRunning() bool { + if o != nil && !IsNil(o.IsRunning) { + return true + } + + return false +} + +// SetIsRunning gets a reference to the given bool and assigns it to the IsRunning field. +func (o *ContentStateStart) SetIsRunning(v bool) { + o.IsRunning = &v +} + // GetMetrics returns the Metrics field value if set, zero value otherwise. func (o *ContentStateStart) GetMetrics() []ActivityMetric { if o == nil || IsNil(o.Metrics) { @@ -564,6 +674,15 @@ func (o ContentStateStart) ToMap() (map[string]interface{}, error) { if !IsNil(o.UpperLimit) { toSerialize["upper_limit"] = o.UpperLimit } + if !IsNil(o.DurationSeconds) { + toSerialize["duration_seconds"] = o.DurationSeconds + } + if !IsNil(o.CountsDown) { + toSerialize["counts_down"] = o.CountsDown + } + if !IsNil(o.IsRunning) { + toSerialize["is_running"] = o.IsRunning + } if !IsNil(o.Metrics) { toSerialize["metrics"] = o.Metrics } @@ -637,6 +756,9 @@ func (o *ContentStateStart) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "percentage") delete(additionalProperties, "value") delete(additionalProperties, "upper_limit") + delete(additionalProperties, "duration_seconds") + delete(additionalProperties, "counts_down") + delete(additionalProperties, "is_running") delete(additionalProperties, "metrics") delete(additionalProperties, "message") delete(additionalProperties, "icon") diff --git a/generated/model_content_state_update.go b/generated/model_content_state_update.go index bf51989..afb212b 100644 --- a/generated/model_content_state_update.go +++ b/generated/model_content_state_update.go @@ -18,7 +18,7 @@ import ( // checks if the ContentStateUpdate type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ContentStateUpdate{} -// ContentStateUpdate 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 alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. +// ContentStateUpdate 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 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, and segmented_progress. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. type ContentStateUpdate struct { Title string `json:"title"` Subtitle *string `json:"subtitle,omitempty"` @@ -32,17 +32,23 @@ type ContentStateUpdate struct { Value *float32 `json:"value,omitempty"` // Maximum progress value. Use with value for type=progress. UpperLimit *float32 `json:"upper_limit,omitempty"` + // 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. + DurationSeconds *float32 `json:"duration_seconds,omitempty"` + // 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. + CountsDown *bool `json:"counts_down,omitempty"` + // Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. + IsRunning *bool `json:"is_running,omitempty"` // Use for type=metrics or type=stats. Metrics []ActivityMetric `json:"metrics,omitempty"` // Alert message. Use for type=alert. Message *string `json:"message,omitempty"` - // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. + // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. Icon *LiveActivityAlertIcon `json:"icon,omitempty"` // Optional badge. Supported by alert, progress, and segmented_progress. Badge *LiveActivityAlertBadge `json:"badge,omitempty"` // Optional. When omitted, the API uses the existing Live Activity type. Type *string `json:"type,omitempty"` - // Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. + // Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. Color *string `json:"color,omitempty"` // Optional. Overrides color for the current step. Only applies to type=segmented_progress. StepColor *string `json:"step_color,omitempty"` @@ -60,6 +66,10 @@ type _ContentStateUpdate ContentStateUpdate func NewContentStateUpdate(title string) *ContentStateUpdate { this := ContentStateUpdate{} this.Title = title + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning return &this } @@ -68,6 +78,10 @@ func NewContentStateUpdate(title string) *ContentStateUpdate { // but it doesn't guarantee that properties required by API are set func NewContentStateUpdateWithDefaults() *ContentStateUpdate { this := ContentStateUpdate{} + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning return &this } @@ -287,6 +301,102 @@ func (o *ContentStateUpdate) SetUpperLimit(v float32) { o.UpperLimit = &v } +// GetDurationSeconds returns the DurationSeconds field value if set, zero value otherwise. +func (o *ContentStateUpdate) GetDurationSeconds() float32 { + if o == nil || IsNil(o.DurationSeconds) { + var ret float32 + return ret + } + return *o.DurationSeconds +} + +// GetDurationSecondsOk returns a tuple with the DurationSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateUpdate) GetDurationSecondsOk() (*float32, bool) { + if o == nil || IsNil(o.DurationSeconds) { + return nil, false + } + return o.DurationSeconds, true +} + +// HasDurationSeconds returns a boolean if a field has been set. +func (o *ContentStateUpdate) HasDurationSeconds() bool { + if o != nil && !IsNil(o.DurationSeconds) { + return true + } + + return false +} + +// SetDurationSeconds gets a reference to the given float32 and assigns it to the DurationSeconds field. +func (o *ContentStateUpdate) SetDurationSeconds(v float32) { + o.DurationSeconds = &v +} + +// GetCountsDown returns the CountsDown field value if set, zero value otherwise. +func (o *ContentStateUpdate) GetCountsDown() bool { + if o == nil || IsNil(o.CountsDown) { + var ret bool + return ret + } + return *o.CountsDown +} + +// GetCountsDownOk returns a tuple with the CountsDown field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateUpdate) GetCountsDownOk() (*bool, bool) { + if o == nil || IsNil(o.CountsDown) { + return nil, false + } + return o.CountsDown, true +} + +// HasCountsDown returns a boolean if a field has been set. +func (o *ContentStateUpdate) HasCountsDown() bool { + if o != nil && !IsNil(o.CountsDown) { + return true + } + + return false +} + +// SetCountsDown gets a reference to the given bool and assigns it to the CountsDown field. +func (o *ContentStateUpdate) SetCountsDown(v bool) { + o.CountsDown = &v +} + +// GetIsRunning returns the IsRunning field value if set, zero value otherwise. +func (o *ContentStateUpdate) GetIsRunning() bool { + if o == nil || IsNil(o.IsRunning) { + var ret bool + return ret + } + return *o.IsRunning +} + +// GetIsRunningOk returns a tuple with the IsRunning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContentStateUpdate) GetIsRunningOk() (*bool, bool) { + if o == nil || IsNil(o.IsRunning) { + return nil, false + } + return o.IsRunning, true +} + +// HasIsRunning returns a boolean if a field has been set. +func (o *ContentStateUpdate) HasIsRunning() bool { + if o != nil && !IsNil(o.IsRunning) { + return true + } + + return false +} + +// SetIsRunning gets a reference to the given bool and assigns it to the IsRunning field. +func (o *ContentStateUpdate) SetIsRunning(v bool) { + o.IsRunning = &v +} + // GetMetrics returns the Metrics field value if set, zero value otherwise. func (o *ContentStateUpdate) GetMetrics() []ActivityMetric { if o == nil || IsNil(o.Metrics) { @@ -572,6 +682,15 @@ func (o ContentStateUpdate) ToMap() (map[string]interface{}, error) { if !IsNil(o.UpperLimit) { toSerialize["upper_limit"] = o.UpperLimit } + if !IsNil(o.DurationSeconds) { + toSerialize["duration_seconds"] = o.DurationSeconds + } + if !IsNil(o.CountsDown) { + toSerialize["counts_down"] = o.CountsDown + } + if !IsNil(o.IsRunning) { + toSerialize["is_running"] = o.IsRunning + } if !IsNil(o.Metrics) { toSerialize["metrics"] = o.Metrics } @@ -646,6 +765,9 @@ func (o *ContentStateUpdate) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "percentage") delete(additionalProperties, "value") delete(additionalProperties, "upper_limit") + delete(additionalProperties, "duration_seconds") + delete(additionalProperties, "counts_down") + delete(additionalProperties, "is_running") delete(additionalProperties, "metrics") delete(additionalProperties, "message") delete(additionalProperties, "icon") diff --git a/generated/model_live_activity_action.go b/generated/model_live_activity_action.go index 439b384..cdcc1d6 100644 --- a/generated/model_live_activity_action.go +++ b/generated/model_live_activity_action.go @@ -23,7 +23,7 @@ type LiveActivityAction struct { // Button title displayed in the Live Activity UI. Title string `json:"title"` Type LiveActivityActionType `json:"type"` - // Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL. For webhook, use an HTTPS URL called by the ActivitySmith backend. + // Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend. Url string `json:"url"` // Webhook HTTP method. Used only when type=webhook. Method *LiveActivityWebhookMethod `json:"method,omitempty"` diff --git a/generated/model_push_notification_action.go b/generated/model_push_notification_action.go index 5703771..9705f5c 100644 --- a/generated/model_push_notification_action.go +++ b/generated/model_push_notification_action.go @@ -23,7 +23,7 @@ type PushNotificationAction struct { // Button title displayed in iOS expanded notification UI. Title string `json:"title"` Type PushNotificationActionType `json:"type"` - // Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL. For webhook, use an HTTPS URL called by the ActivitySmith backend. + // Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend. Url string `json:"url"` // Webhook HTTP method. Used only when type=webhook. Method *PushNotificationWebhookMethod `json:"method,omitempty"` diff --git a/generated/model_push_notification_request.go b/generated/model_push_notification_request.go index c8e876d..b36e921 100644 --- a/generated/model_push_notification_request.go +++ b/generated/model_push_notification_request.go @@ -25,7 +25,7 @@ type PushNotificationRequest struct { Subtitle *string `json:"subtitle,omitempty"` // Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`. Media *string `json:"media,omitempty" validate:"regexp=^https:\\/\\/"` - // Optional HTTPS URL or shortcuts://run-shortcut?name=... URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided. + // Optional HTTPS URL or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided. Redirection *string `json:"redirection,omitempty" validate:"regexp=^(https|shortcuts):\\/\\/"` // Optional interactive actions shown when users expand the notification. Cannot be combined with `media`. Actions []PushNotificationAction `json:"actions,omitempty"` diff --git a/generated/model_stream_content_state.go b/generated/model_stream_content_state.go index 8fff055..83aa55a 100644 --- a/generated/model_stream_content_state.go +++ b/generated/model_stream_content_state.go @@ -18,7 +18,7 @@ import ( // checks if the StreamContentState type satisfies the MappedNullable interface at compile time var _ MappedNullable = &StreamContentState{} -// 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, and alert types. +// 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, and timer 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. type StreamContentState struct { Title string `json:"title"` Subtitle *string `json:"subtitle,omitempty"` @@ -32,9 +32,15 @@ type StreamContentState struct { Value *float32 `json:"value,omitempty"` // Maximum progress value. Use with value for progress. UpperLimit *float32 `json:"upper_limit,omitempty"` + // 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. + DurationSeconds *float32 `json:"duration_seconds,omitempty"` + // 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. + CountsDown *bool `json:"counts_down,omitempty"` + // Use with type=timer. Defaults to true. Set false to pause/freeze via API; set true on a paused timer to resume. + IsRunning *bool `json:"is_running,omitempty"` // Required on the first PUT or whenever the stream cannot infer the current activity type. Type *string `json:"type,omitempty"` - // Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included. + // Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints the action button when action is included. Color *string `json:"color,omitempty"` // Optional. Overrides color for the current step. Only applies to segmented_progress. StepColor *string `json:"step_color,omitempty"` @@ -44,7 +50,7 @@ type StreamContentState struct { Metrics []ActivityMetric `json:"metrics,omitempty"` // Required for type=alert. Message *string `json:"message,omitempty"` - // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats. + // Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. Icon *LiveActivityAlertIcon `json:"icon,omitempty"` // Optional badge. Supported by alert, progress, and segmented_progress. Badge *LiveActivityAlertBadge `json:"badge,omitempty"` @@ -64,6 +70,10 @@ type _StreamContentState StreamContentState func NewStreamContentState(title string) *StreamContentState { this := StreamContentState{} this.Title = title + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning return &this } @@ -72,6 +82,10 @@ func NewStreamContentState(title string) *StreamContentState { // but it doesn't guarantee that properties required by API are set func NewStreamContentStateWithDefaults() *StreamContentState { this := StreamContentState{} + var countsDown bool = true + this.CountsDown = &countsDown + var isRunning bool = true + this.IsRunning = &isRunning return &this } @@ -291,6 +305,102 @@ func (o *StreamContentState) SetUpperLimit(v float32) { o.UpperLimit = &v } +// GetDurationSeconds returns the DurationSeconds field value if set, zero value otherwise. +func (o *StreamContentState) GetDurationSeconds() float32 { + if o == nil || IsNil(o.DurationSeconds) { + var ret float32 + return ret + } + return *o.DurationSeconds +} + +// GetDurationSecondsOk returns a tuple with the DurationSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StreamContentState) GetDurationSecondsOk() (*float32, bool) { + if o == nil || IsNil(o.DurationSeconds) { + return nil, false + } + return o.DurationSeconds, true +} + +// HasDurationSeconds returns a boolean if a field has been set. +func (o *StreamContentState) HasDurationSeconds() bool { + if o != nil && !IsNil(o.DurationSeconds) { + return true + } + + return false +} + +// SetDurationSeconds gets a reference to the given float32 and assigns it to the DurationSeconds field. +func (o *StreamContentState) SetDurationSeconds(v float32) { + o.DurationSeconds = &v +} + +// GetCountsDown returns the CountsDown field value if set, zero value otherwise. +func (o *StreamContentState) GetCountsDown() bool { + if o == nil || IsNil(o.CountsDown) { + var ret bool + return ret + } + return *o.CountsDown +} + +// GetCountsDownOk returns a tuple with the CountsDown field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StreamContentState) GetCountsDownOk() (*bool, bool) { + if o == nil || IsNil(o.CountsDown) { + return nil, false + } + return o.CountsDown, true +} + +// HasCountsDown returns a boolean if a field has been set. +func (o *StreamContentState) HasCountsDown() bool { + if o != nil && !IsNil(o.CountsDown) { + return true + } + + return false +} + +// SetCountsDown gets a reference to the given bool and assigns it to the CountsDown field. +func (o *StreamContentState) SetCountsDown(v bool) { + o.CountsDown = &v +} + +// GetIsRunning returns the IsRunning field value if set, zero value otherwise. +func (o *StreamContentState) GetIsRunning() bool { + if o == nil || IsNil(o.IsRunning) { + var ret bool + return ret + } + return *o.IsRunning +} + +// GetIsRunningOk returns a tuple with the IsRunning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StreamContentState) GetIsRunningOk() (*bool, bool) { + if o == nil || IsNil(o.IsRunning) { + return nil, false + } + return o.IsRunning, true +} + +// HasIsRunning returns a boolean if a field has been set. +func (o *StreamContentState) HasIsRunning() bool { + if o != nil && !IsNil(o.IsRunning) { + return true + } + + return false +} + +// SetIsRunning gets a reference to the given bool and assigns it to the IsRunning field. +func (o *StreamContentState) SetIsRunning(v bool) { + o.IsRunning = &v +} + // GetType returns the Type field value if set, zero value otherwise. func (o *StreamContentState) GetType() string { if o == nil || IsNil(o.Type) { @@ -640,6 +750,15 @@ func (o StreamContentState) ToMap() (map[string]interface{}, error) { if !IsNil(o.UpperLimit) { toSerialize["upper_limit"] = o.UpperLimit } + if !IsNil(o.DurationSeconds) { + toSerialize["duration_seconds"] = o.DurationSeconds + } + if !IsNil(o.CountsDown) { + toSerialize["counts_down"] = o.CountsDown + } + if !IsNil(o.IsRunning) { + toSerialize["is_running"] = o.IsRunning + } if !IsNil(o.Type) { toSerialize["type"] = o.Type } @@ -720,6 +839,9 @@ func (o *StreamContentState) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "percentage") delete(additionalProperties, "value") delete(additionalProperties, "upper_limit") + delete(additionalProperties, "duration_seconds") + delete(additionalProperties, "counts_down") + delete(additionalProperties, "is_running") delete(additionalProperties, "type") delete(additionalProperties, "color") delete(additionalProperties, "step_color") From cad2506ad89daa590c5245eda2ac3f49a6e0a615 Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 8 Jun 2026 19:23:20 +0700 Subject: [PATCH 2/4] feat: add timer live activity DX wrappers --- README.md | 23 +++- inputs.go | 329 +++++++++++++++++++++++++++++++++-------------- services_test.go | 62 +++++++++ 3 files changed, 319 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index db889cf..528ba78 100644 --- a/README.md +++ b/README.md @@ -149,10 +149,11 @@ if err != nil { ## Live Activities -There are five types of Live Activities: +There are six types of Live Activities: - `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance - `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate +- `timer`: best for countdowns and elapsed timers, like benchmark runs, cooking timers, workouts, soak windows, and long-running jobs - `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs - `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states @@ -260,6 +261,24 @@ activitysmith.LiveActivities.Stream( ) ``` +#### Timer + +Use `WithDurationSeconds` for a countdown. Omit `WithCountsDown` for the default countdown behavior, or call `WithCountsDown(false)` for an elapsed timer. + +```go +activitysmith.LiveActivities.Stream( + "benchmark-run", + activitysmithsdk.LiveActivityStreamInput{ + Title: "Benchmark Run", + Subtitle: "sampling performance", + Type: activitysmithsdk.LiveActivityTypeTimer, + Color: "cyan", + }.WithDurationSeconds(300), +) +``` + +Later updates can change the title, subtitle, color, icon, or action without resetting the timer. Include `WithDurationSeconds` again only when you want to restart the timer window from that update. + #### Alert

@@ -392,7 +411,7 @@ Add more context to Live Activities with icons and badges. #### Icon -Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`. +Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.

0 || in.numberOfStepsSet || @@ -282,9 +288,20 @@ func (in LiveActivityContentStateInput) isSet() bool { in.percentageSet || in.valueSet || in.upperLimitSet || + in.durationSecondsSet || + in.countsDownSet || in.autoDismissMinutesSet } +func (in LiveActivityContentStateInput) applyTimerFields(properties *map[string]interface{}) { + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(properties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(properties, "counts_down", in.CountsDown) + } +} + func (in LiveActivityContentStateInput) applyAlertFields(properties *map[string]interface{}) { if in.Message != "" { setAdditionalProperty(properties, "message", in.Message) @@ -321,6 +338,7 @@ func (in LiveActivityContentStateInput) applyStart(state *generated.ContentState if len(in.Metrics) > 0 { state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...)) } + in.applyTimerFields(&state.AdditionalProperties) in.applyAlertFields(&state.AdditionalProperties) } @@ -355,6 +373,7 @@ func (in LiveActivityContentStateInput) applyUpdate(state *generated.ContentStat if len(in.Metrics) > 0 { state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...)) } + in.applyTimerFields(&state.AdditionalProperties) in.applyAlertFields(&state.AdditionalProperties) } @@ -396,6 +415,7 @@ func (in LiveActivityContentStateInput) applyEndBase(state *generated.ContentSta if len(in.Metrics) > 0 { state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...)) } + in.applyTimerFields(&state.AdditionalProperties) in.applyAlertFields(&state.AdditionalProperties) } @@ -433,6 +453,7 @@ func (in LiveActivityContentStateInput) applyStream(state *generated.StreamConte if in.AutoDismissMinutes != 0 || in.autoDismissMinutesSet { state.SetAutoDismissMinutes(in.AutoDismissMinutes) } + in.applyTimerFields(&state.AdditionalProperties) in.applyAlertFields(&state.AdditionalProperties) } @@ -466,6 +487,18 @@ func (in LiveActivityContentStateInput) WithUpperLimit(v float32) LiveActivityCo return in } +func (in LiveActivityContentStateInput) WithDurationSeconds(v float32) LiveActivityContentStateInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityContentStateInput) WithCountsDown(v bool) LiveActivityContentStateInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + func (in LiveActivityContentStateInput) WithAutoDismissMinutes(v int32) LiveActivityContentStateInput { in.AutoDismissMinutes = v in.autoDismissMinutesSet = true @@ -474,29 +507,33 @@ func (in LiveActivityContentStateInput) WithAutoDismissMinutes(v int32) LiveActi // LiveActivityStartInput is a handwritten DX input with plain optional values. type LiveActivityStartInput struct { - ContentState LiveActivityContentStateInput - Title string - NumberOfSteps int32 - CurrentStep int32 - Percentage float32 - Value float32 - UpperLimit float32 - Type string - Subtitle string - Message string - Icon LiveActivityAlertIconInput - Badge LiveActivityAlertBadgeInput - Color string - StepColor string - Metrics []generated.ActivityMetric - Action *LiveActivityActionInput - Channels []string - - numberOfStepsSet bool - currentStepSet bool - percentageSet bool - valueSet bool - upperLimitSet bool + ContentState LiveActivityContentStateInput + Title string + NumberOfSteps int32 + CurrentStep int32 + Percentage float32 + Value float32 + UpperLimit float32 + DurationSeconds float32 + CountsDown bool + Type string + Subtitle string + Message string + Icon LiveActivityAlertIconInput + Badge LiveActivityAlertBadgeInput + Color string + StepColor string + Metrics []generated.ActivityMetric + Action *LiveActivityActionInput + Channels []string + + numberOfStepsSet bool + currentStepSet bool + percentageSet bool + valueSet bool + upperLimitSet bool + durationSecondsSet bool + countsDownSet bool } func (in LiveActivityStartInput) toGenerated() generated.LiveActivityStartRequest { @@ -529,6 +566,12 @@ func (in LiveActivityStartInput) toGenerated() generated.LiveActivityStartReques if in.UpperLimit != 0 || in.upperLimitSet { req.ContentState.SetUpperLimit(in.UpperLimit) } + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown) + } if in.Subtitle != "" { req.ContentState.SetSubtitle(in.Subtitle) } @@ -589,6 +632,18 @@ func (in LiveActivityStartInput) WithUpperLimit(v float32) LiveActivityStartInpu return in } +func (in LiveActivityStartInput) WithDurationSeconds(v float32) LiveActivityStartInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityStartInput) WithCountsDown(v bool) LiveActivityStartInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + func (in LiveActivityStartInput) WithAction(v LiveActivityActionInput) LiveActivityStartInput { in.Action = &v return in @@ -596,29 +651,33 @@ func (in LiveActivityStartInput) WithAction(v LiveActivityActionInput) LiveActiv // LiveActivityUpdateInput is a handwritten DX input with plain optional values. type LiveActivityUpdateInput struct { - ActivityID string - ContentState LiveActivityContentStateInput - Title string - CurrentStep int32 - Percentage float32 - Value float32 - UpperLimit float32 - Type string - Subtitle string - Message string - Icon LiveActivityAlertIconInput - Badge LiveActivityAlertBadgeInput - Color string - StepColor string - NumberOfSteps int32 - Metrics []generated.ActivityMetric - Action *LiveActivityActionInput - - numberOfStepsSet bool - currentStepSet bool - percentageSet bool - valueSet bool - upperLimitSet bool + ActivityID string + ContentState LiveActivityContentStateInput + Title string + CurrentStep int32 + Percentage float32 + Value float32 + UpperLimit float32 + DurationSeconds float32 + CountsDown bool + Type string + Subtitle string + Message string + Icon LiveActivityAlertIconInput + Badge LiveActivityAlertBadgeInput + Color string + StepColor string + NumberOfSteps int32 + Metrics []generated.ActivityMetric + Action *LiveActivityActionInput + + numberOfStepsSet bool + currentStepSet bool + percentageSet bool + valueSet bool + upperLimitSet bool + durationSecondsSet bool + countsDownSet bool } func (in LiveActivityUpdateInput) toGenerated() generated.LiveActivityUpdateRequest { @@ -649,6 +708,12 @@ func (in LiveActivityUpdateInput) toGenerated() generated.LiveActivityUpdateRequ if in.UpperLimit != 0 || in.upperLimitSet { req.ContentState.SetUpperLimit(in.UpperLimit) } + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown) + } if in.Type != "" { req.ContentState.SetType(in.Type) } @@ -712,6 +777,18 @@ func (in LiveActivityUpdateInput) WithUpperLimit(v float32) LiveActivityUpdateIn return in } +func (in LiveActivityUpdateInput) WithDurationSeconds(v float32) LiveActivityUpdateInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityUpdateInput) WithCountsDown(v bool) LiveActivityUpdateInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + func (in LiveActivityUpdateInput) WithAction(v LiveActivityActionInput) LiveActivityUpdateInput { in.Action = &v return in @@ -726,6 +803,8 @@ type LiveActivityEndInput struct { Percentage float32 Value float32 UpperLimit float32 + DurationSeconds float32 + CountsDown bool Type string Subtitle string Message string @@ -743,6 +822,8 @@ type LiveActivityEndInput struct { percentageSet bool valueSet bool upperLimitSet bool + durationSecondsSet bool + countsDownSet bool autoDismissMinutesSet bool } @@ -774,6 +855,12 @@ func (in LiveActivityEndInput) toGenerated() generated.LiveActivityEndRequest { if in.UpperLimit != 0 || in.upperLimitSet { req.ContentState.SetUpperLimit(in.UpperLimit) } + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown) + } if in.Type != "" { req.ContentState.SetType(in.Type) } @@ -840,6 +927,18 @@ func (in LiveActivityEndInput) WithUpperLimit(v float32) LiveActivityEndInput { return in } +func (in LiveActivityEndInput) WithDurationSeconds(v float32) LiveActivityEndInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityEndInput) WithCountsDown(v bool) LiveActivityEndInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + // WithAutoDismissMinutes forces inclusion of auto_dismiss_minutes, including explicit zero. func (in LiveActivityEndInput) WithAutoDismissMinutes(v int32) LiveActivityEndInput { in.AutoDismissMinutes = v @@ -854,30 +953,34 @@ func (in LiveActivityEndInput) WithAction(v LiveActivityActionInput) LiveActivit // LiveActivityStreamInput is a handwritten DX input with plain optional values. type LiveActivityStreamInput struct { - ContentState LiveActivityContentStateInput - Title string - NumberOfSteps int32 - CurrentStep int32 - Percentage float32 - Value float32 - UpperLimit float32 - Type string - Subtitle string - Message string - Icon LiveActivityAlertIconInput - Badge LiveActivityAlertBadgeInput - Color string - StepColor string - Metrics []generated.ActivityMetric - Action *LiveActivityActionInput - Alert *generated.AlertPayload - Channels []string - - numberOfStepsSet bool - currentStepSet bool - percentageSet bool - valueSet bool - upperLimitSet bool + ContentState LiveActivityContentStateInput + Title string + NumberOfSteps int32 + CurrentStep int32 + Percentage float32 + Value float32 + UpperLimit float32 + DurationSeconds float32 + CountsDown bool + Type string + Subtitle string + Message string + Icon LiveActivityAlertIconInput + Badge LiveActivityAlertBadgeInput + Color string + StepColor string + Metrics []generated.ActivityMetric + Action *LiveActivityActionInput + Alert *generated.AlertPayload + Channels []string + + numberOfStepsSet bool + currentStepSet bool + percentageSet bool + valueSet bool + upperLimitSet bool + durationSecondsSet bool + countsDownSet bool } func (in LiveActivityStreamInput) toGenerated() generated.LiveActivityStreamRequest { @@ -910,6 +1013,12 @@ func (in LiveActivityStreamInput) toGenerated() generated.LiveActivityStreamRequ if in.UpperLimit != 0 || in.upperLimitSet { req.ContentState.SetUpperLimit(in.UpperLimit) } + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown) + } if in.Type != "" { req.ContentState.SetType(in.Type) } @@ -972,6 +1081,18 @@ func (in LiveActivityStreamInput) WithUpperLimit(v float32) LiveActivityStreamIn return in } +func (in LiveActivityStreamInput) WithDurationSeconds(v float32) LiveActivityStreamInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityStreamInput) WithCountsDown(v bool) LiveActivityStreamInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + func (in LiveActivityStreamInput) WithAction(v LiveActivityActionInput) LiveActivityStreamInput { in.Action = &v return in @@ -979,29 +1100,33 @@ func (in LiveActivityStreamInput) WithAction(v LiveActivityActionInput) LiveActi // LiveActivityStreamEndInput is an optional payload for ending a managed stream. type LiveActivityStreamEndInput struct { - ContentState LiveActivityContentStateInput - Title string - NumberOfSteps int32 - CurrentStep int32 - Percentage float32 - Value float32 - UpperLimit float32 - Type string - Subtitle string - Message string - Icon LiveActivityAlertIconInput - Badge LiveActivityAlertBadgeInput - Color string - StepColor string - Metrics []generated.ActivityMetric - Action *LiveActivityActionInput - Alert *generated.AlertPayload - - numberOfStepsSet bool - currentStepSet bool - percentageSet bool - valueSet bool - upperLimitSet bool + ContentState LiveActivityContentStateInput + Title string + NumberOfSteps int32 + CurrentStep int32 + Percentage float32 + Value float32 + UpperLimit float32 + DurationSeconds float32 + CountsDown bool + Type string + Subtitle string + Message string + Icon LiveActivityAlertIconInput + Badge LiveActivityAlertBadgeInput + Color string + StepColor string + Metrics []generated.ActivityMetric + Action *LiveActivityActionInput + Alert *generated.AlertPayload + + numberOfStepsSet bool + currentStepSet bool + percentageSet bool + valueSet bool + upperLimitSet bool + durationSecondsSet bool + countsDownSet bool } func (in LiveActivityStreamEndInput) toGenerated() generated.LiveActivityStreamDeleteRequest { @@ -1034,6 +1159,12 @@ func (in LiveActivityStreamEndInput) toGenerated() generated.LiveActivityStreamD if in.UpperLimit != 0 || in.upperLimitSet { contentState.SetUpperLimit(in.UpperLimit) } + if in.DurationSeconds != 0 || in.durationSecondsSet { + setAdditionalProperty(&contentState.AdditionalProperties, "duration_seconds", in.DurationSeconds) + } + if in.countsDownSet { + setAdditionalProperty(&contentState.AdditionalProperties, "counts_down", in.CountsDown) + } if in.Type != "" { contentState.SetType(in.Type) } @@ -1095,6 +1226,18 @@ func (in LiveActivityStreamEndInput) WithUpperLimit(v float32) LiveActivityStrea return in } +func (in LiveActivityStreamEndInput) WithDurationSeconds(v float32) LiveActivityStreamEndInput { + in.DurationSeconds = v + in.durationSecondsSet = true + return in +} + +func (in LiveActivityStreamEndInput) WithCountsDown(v bool) LiveActivityStreamEndInput { + in.CountsDown = v + in.countsDownSet = true + return in +} + func (in LiveActivityStreamEndInput) WithAction(v LiveActivityActionInput) LiveActivityStreamEndInput { in.Action = &v return in diff --git a/services_test.go b/services_test.go index c2d1116..765545a 100644 --- a/services_test.go +++ b/services_test.go @@ -706,6 +706,68 @@ func TestProgressInputsSerializeProgressFieldsWithoutSegmentedFields(t *testing. } } +func TestTimerInputsSerializeTimerFields(t *testing.T) { + server, requests := newAPITestServer(t) + defer server.Close() + + client, err := New("test-api-key") + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + overrideHostForTests(client, server.URL) + + startInput := LiveActivityStartInput{ + Title: "Benchmark Run", + Subtitle: "sampling performance", + Type: LiveActivityTypeTimer, + Color: "cyan", + }.WithDurationSeconds(300).WithCountsDown(true) + + updateInput := LiveActivityUpdateInput{ + ActivityID: "act-1", + Title: "Benchmark Run", + Type: LiveActivityTypeTimer, + Subtitle: "complete", + Color: "cyan", + } + + if _, err := client.LiveActivities.Start(startInput); err != nil { + t.Fatalf("Start returned error: %v", err) + } + if _, err := client.LiveActivities.Update(updateInput); err != nil { + t.Fatalf("Update returned error: %v", err) + } + + if len(*requests) != 2 { + t.Fatalf("expected 2 requests, got %d", len(*requests)) + } + + startBody := (*requests)[0].Body + if !strings.Contains(startBody, `"type":"timer"`) { + t.Fatalf("start body missing timer type: %s", startBody) + } + if !strings.Contains(startBody, `"duration_seconds":300`) { + t.Fatalf("start body missing duration_seconds: %s", startBody) + } + if !strings.Contains(startBody, `"counts_down":true`) { + t.Fatalf("start body missing counts_down: %s", startBody) + } + + updateBody := (*requests)[1].Body + if !strings.Contains(updateBody, `"type":"timer"`) { + t.Fatalf("update body missing timer type: %s", updateBody) + } + if !strings.Contains(updateBody, `"subtitle":"complete"`) { + t.Fatalf("update body missing subtitle: %s", updateBody) + } + if !strings.Contains(updateBody, `"color":"cyan"`) { + t.Fatalf("update body missing color: %s", updateBody) + } + if strings.Contains(updateBody, `"duration_seconds"`) { + t.Fatalf("update body should preserve timer window when duration_seconds is omitted: %s", updateBody) + } +} + func TestStatsInputsSerializeMetricValuesAndColors(t *testing.T) { server, requests := newAPITestServer(t) defer server.Close() From 4f385a9c60b5e144b59630c74dce619e792427ac Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 8 Jun 2026 19:46:44 +0700 Subject: [PATCH 3/4] docs: sync timer live activity readme --- README.md | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 528ba78..f7f4800 100644 --- a/README.md +++ b/README.md @@ -153,10 +153,10 @@ There are six types of Live Activities: - `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance - `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate -- `timer`: best for countdowns and elapsed timers, like benchmark runs, cooking timers, workouts, soak windows, and long-running jobs - `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs - `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states +- `timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs ### Start & Update Live Activity @@ -261,24 +261,6 @@ activitysmith.LiveActivities.Stream( ) ``` -#### Timer - -Use `WithDurationSeconds` for a countdown. Omit `WithCountsDown` for the default countdown behavior, or call `WithCountsDown(false)` for an elapsed timer. - -```go -activitysmith.LiveActivities.Stream( - "benchmark-run", - activitysmithsdk.LiveActivityStreamInput{ - Title: "Benchmark Run", - Subtitle: "sampling performance", - Type: activitysmithsdk.LiveActivityTypeTimer, - Color: "cyan", - }.WithDurationSeconds(300), -) -``` - -Later updates can change the title, subtitle, color, icon, or action without resetting the timer. Include `WithDurationSeconds` again only when you want to restart the timer window from that update. - #### Alert

@@ -302,6 +284,33 @@ activitysmith.LiveActivities.Stream( ) ``` +#### Timer + +

+ Timer Live Activity showing a benchmark run countdown +

+ +```go +activitysmith.LiveActivities.Stream( + "benchmark-run", + activitysmithsdk.LiveActivityStreamInput{ + Title: "Benchmark Run", + Subtitle: "sampling", + Type: "timer", + DurationSeconds: 300, + Color: "cyan", + }, +) +``` + +For a countdown, send `duration_seconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `duration_seconds` out unless you want to change the timer. + +To start at 00:00 and count up, set `counts_down: false` and leave out `duration_seconds`. + ### End Live Activity Call `EndStream(...)` with the same `streamKey` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `AutoDismissMinutes` to choose a different dismissal time, including `0` for immediate dismissal. From 54d72fd0200bdb86473837f4b619148f321c2672 Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 8 Jun 2026 19:54:22 +0700 Subject: [PATCH 4/4] chore: bump version to 1.7.0 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index d046de4..d4d044d 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package activitysmith -const Version = "1.5.0" +const Version = "1.7.0"