From 39d2358dda57029812f851aa5ee95c121f877579 Mon Sep 17 00:00:00 2001 From: activitysmith-bot Date: Sun, 3 May 2026 05:02:53 +0000 Subject: [PATCH] chore: regenerate SDK --- generated/apis/LiveActivitiesApi.ts | 12 +- generated/apis/MetricsApi.ts | 87 ++++++++++++ generated/apis/index.ts | 1 + generated/models/index.ts | 198 ++++++++++++++++++++++++---- 4 files changed, 270 insertions(+), 28 deletions(-) create mode 100644 generated/apis/MetricsApi.ts diff --git a/generated/apis/LiveActivitiesApi.ts b/generated/apis/LiveActivitiesApi.ts index dc71bad..b7297c5 100644 --- a/generated/apis/LiveActivitiesApi.ts +++ b/generated/apis/LiveActivitiesApi.ts @@ -61,7 +61,7 @@ export interface UpdateLiveActivityRequest { export class LiveActivitiesApi extends runtime.BaseAPI { /** - * Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. + * Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. * End a Live Activity */ async endLiveActivityRaw(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -98,7 +98,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI { } /** - * Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. + * Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. * End a Live Activity */ async endLiveActivity(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -206,7 +206,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI { } /** - * Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. + * Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. * Start a Live Activity */ async startLiveActivityRaw(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -243,7 +243,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI { } /** - * Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. + * Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. * Start a Live Activity */ async startLiveActivity(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -252,7 +252,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI { } /** - * Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. + * Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. * Update a Live Activity */ async updateLiveActivityRaw(requestParameters: UpdateLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -289,7 +289,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI { } /** - * Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. + * Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. * Update a Live Activity */ async updateLiveActivity(requestParameters: UpdateLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { diff --git a/generated/apis/MetricsApi.ts b/generated/apis/MetricsApi.ts new file mode 100644 index 0000000..18896da --- /dev/null +++ b/generated/apis/MetricsApi.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * ActivitySmith API + * Send push notifications and Live Activities to your own devices via a single API key. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + MetricError, + MetricValueUpdateRequest, + MetricValueUpdateResponse, + RateLimitError, +} from '../models/index'; + +export interface UpdateMetricValueRequest { + key: string; + metricValueUpdateRequest: MetricValueUpdateRequest; +} + +/** + * + */ +export class MetricsApi extends runtime.BaseAPI { + + /** + * Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters. + * Update a widget metric value + */ + async updateMetricValueRaw(requestParameters: UpdateMetricValueRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['key'] == null) { + throw new runtime.RequiredError( + 'key', + 'Required parameter "key" was null or undefined when calling updateMetricValue().' + ); + } + + if (requestParameters['metricValueUpdateRequest'] == null) { + throw new runtime.RequiredError( + 'metricValueUpdateRequest', + 'Required parameter "metricValueUpdateRequest" was null or undefined when calling updateMetricValue().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("apiKeyAuth", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/metrics/{key}/value`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: requestParameters['metricValueUpdateRequest'], + }, initOverrides); + + return new runtime.JSONApiResponse(response); + } + + /** + * Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters. + * Update a widget metric value + */ + async updateMetricValue(requestParameters: UpdateMetricValueRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.updateMetricValueRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/generated/apis/index.ts b/generated/apis/index.ts index 8b4f924..f269477 100644 --- a/generated/apis/index.ts +++ b/generated/apis/index.ts @@ -1,4 +1,5 @@ /* tslint:disable */ /* eslint-disable */ export * from './LiveActivitiesApi'; +export * from './MetricsApi'; export * from './PushNotificationsApi'; diff --git a/generated/models/index.ts b/generated/models/index.ts index 5413ad9..a62f571 100644 --- a/generated/models/index.ts +++ b/generated/models/index.ts @@ -81,7 +81,7 @@ export interface ChannelTarget { channels: Array; } /** - * 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 include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. + * 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 include a non-empty metrics array. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. * @export * @interface ContentStateEnd */ @@ -174,10 +174,7 @@ export interface ContentStateEnd { export const ContentStateEndTypeEnum = { SegmentedProgress: 'segmented_progress', Progress: 'progress', - Metrics: 'metrics', - Counter: 'counter', - Timer: 'timer', - Countdown: 'countdown' + Metrics: 'metrics' } as const; export type ContentStateEndTypeEnum = typeof ContentStateEndTypeEnum[keyof typeof ContentStateEndTypeEnum]; @@ -230,7 +227,7 @@ export const ContentStateEndStepColorsEnum = { export type ContentStateEndStepColorsEnum = typeof ContentStateEndStepColorsEnum[keyof typeof ContentStateEndStepColorsEnum]; /** - * 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 include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. + * Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. * @export * @interface ContentStateStart */ @@ -317,10 +314,7 @@ export interface ContentStateStart { export const ContentStateStartTypeEnum = { SegmentedProgress: 'segmented_progress', Progress: 'progress', - Metrics: 'metrics', - Counter: 'counter', - Timer: 'timer', - Countdown: 'countdown' + Metrics: 'metrics' } as const; export type ContentStateStartTypeEnum = typeof ContentStateStartTypeEnum[keyof typeof ContentStateStartTypeEnum]; @@ -373,7 +367,7 @@ export const ContentStateStartStepColorsEnum = { export type ContentStateStartStepColorsEnum = typeof ContentStateStartStepColorsEnum[keyof typeof ContentStateStartStepColorsEnum]; /** - * 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 include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. + * 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 include a non-empty metrics array. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. * @export * @interface ContentStateUpdate */ @@ -460,10 +454,7 @@ export interface ContentStateUpdate { export const ContentStateUpdateTypeEnum = { SegmentedProgress: 'segmented_progress', Progress: 'progress', - Metrics: 'metrics', - Counter: 'counter', - Timer: 'timer', - Countdown: 'countdown' + Metrics: 'metrics' } as const; export type ContentStateUpdateTypeEnum = typeof ContentStateUpdateTypeEnum[keyof typeof ContentStateUpdateTypeEnum]; @@ -1037,6 +1028,91 @@ export const LiveActivityWebhookMethod = { } as const; export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof typeof LiveActivityWebhookMethod]; +/** + * + * @export + * @interface MetricError + */ +export interface MetricError { + [key: string]: any | any; + /** + * + * @type {string} + * @memberof MetricError + */ + error: string; + /** + * + * @type {string} + * @memberof MetricError + */ + message?: string; +} + +/** + * + * @export + */ +export const MetricFormat = { + Number: 'number', + Currency: 'currency', + Percent: 'percent', + Unit: 'unit', + String: 'string' +} as const; +export type MetricFormat = typeof MetricFormat[keyof typeof MetricFormat]; + + +/** + * + * @export + */ +export const MetricUnitSpacing = { + None: 'none', + Space: 'space' +} as const; +export type MetricUnitSpacing = typeof MetricUnitSpacing[keyof typeof MetricUnitSpacing]; + +/** + * Latest metric value to display in widgets. + * @export + * @interface MetricValueUpdateRequest + */ +export interface MetricValueUpdateRequest { + [key: string]: any | any; + /** + * + * @type {MetricValueUpdateRequestValue} + * @memberof MetricValueUpdateRequest + */ + value: MetricValueUpdateRequestValue; + /** + * Optional ISO timestamp for when the metric value was measured. Defaults to the server receive time. + * @type {string} + * @memberof MetricValueUpdateRequest + */ + timestamp?: string; +} +/** + * @type MetricValueUpdateRequestValue + * + * @export + */ +export type MetricValueUpdateRequestValue = number | string; +/** + * + * @export + * @interface MetricValueUpdateResponse + */ +export interface MetricValueUpdateResponse { + [key: string]: any | any; + /** + * + * @type {WidgetMetric} + * @memberof MetricValueUpdateResponse + */ + metric: WidgetMetric; +} /** * * @export @@ -1276,7 +1352,7 @@ export interface RateLimitError { */ export type SendPushNotification429Response = LiveActivityLimitError | RateLimitError; /** - * 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, and the legacy counter/timer/countdown step-based types. + * 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, and metrics types. * @export * @interface StreamContentState */ @@ -1295,13 +1371,13 @@ export interface StreamContentState { */ subtitle?: string; /** - * Use for segmented_progress, counter, timer, and countdown. + * Use for segmented_progress. * @type {number} * @memberof StreamContentState */ number_of_steps?: number; /** - * Use for segmented_progress, counter, timer, and countdown. + * Use for segmented_progress. * @type {number} * @memberof StreamContentState */ @@ -1375,10 +1451,7 @@ export interface StreamContentState { export const StreamContentStateTypeEnum = { SegmentedProgress: 'segmented_progress', Progress: 'progress', - Metrics: 'metrics', - Counter: 'counter', - Timer: 'timer', - Countdown: 'countdown' + Metrics: 'metrics' } as const; export type StreamContentStateTypeEnum = typeof StreamContentStateTypeEnum[keyof typeof StreamContentStateTypeEnum]; @@ -1430,3 +1503,84 @@ export const StreamContentStateStepColorsEnum = { } as const; export type StreamContentStateStepColorsEnum = typeof StreamContentStateStepColorsEnum[keyof typeof StreamContentStateStepColorsEnum]; +/** + * A metric configured for ActivitySmith widgets. + * @export + * @interface WidgetMetric + */ +export interface WidgetMetric { + [key: string]: any | any; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + public_id: string; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + key: string; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + label: string; + /** + * Present when format is currency. + * @type {string} + * @memberof WidgetMetric + */ + currency_code: string | null; + /** + * Present when format is unit. + * @type {string} + * @memberof WidgetMetric + */ + unit: string | null; + /** + * + * @type {MetricUnitSpacing} + * @memberof WidgetMetric + */ + unit_spacing: MetricUnitSpacing; + /** + * + * @type {MetricFormat} + * @memberof WidgetMetric + */ + format: MetricFormat; + /** + * + * @type {WidgetMetricLatestValue} + * @memberof WidgetMetric + */ + latest_value: WidgetMetricLatestValue | null; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + latest_value_at: string | null; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + created_at: string; + /** + * + * @type {string} + * @memberof WidgetMetric + */ + updated_at: string; +} +/** + * Latest metric value. Numeric formats return a number. String metrics return text. + * @export + * @interface WidgetMetricLatestValue + */ +export interface WidgetMetricLatestValue { +}