diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0118f44..d6bf11e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.11.0
+
+This version adds support for Metadata and iOS deep links, and expands Tags support when updating or ending Live Activities.
+
## 1.10.0
### New Features
diff --git a/README.md b/README.md
index f2aefbb..8adcc76 100644
--- a/README.md
+++ b/README.md
@@ -1,51 +1,35 @@
# ActivitySmith Ruby SDK
-The ActivitySmith Ruby SDK provides convenient access to the ActivitySmith API from Ruby applications.
-
-## Documentation
-
-See [API reference](https://activitysmith.com/docs/api-reference/introduction).
-
-## Table of Contents
-
-- [Installation](#installation)
-- [Setup](#setup)
-- [Push Notifications](#push-notifications)
- - [Send a Push Notification](#send-a-push-notification)
- - [Rich Push Notifications with Media](#rich-push-notifications-with-media)
- - [Actionable Push Notifications](#actionable-push-notifications)
-- [Live Activities](#live-activities)
- - [Start & Update Live Activity](#start--update-live-activity)
- - [End Live Activity](#end-live-activity)
- - [Live Activity Action](#live-activity-action)
- - [Icons and Badges](#icons-and-badges)
- - [Live Activity Colors](#live-activity-colors)
-- [Widgets](#widgets)
-- [App Icon Badge Count](#app-icon-badge-count)
-- [Channels](#channels)
-- [Tags](#tags)
+[Documentation](https://activitysmith.com/docs/sdks/ruby)
## Installation
-```sh
+Install the ActivitySmith Ruby SDK with RubyGems:
+
+```bash
gem install activitysmith
```
-## Setup
+## Quickstart
+
+1. [Create an API key](https://activitysmith.com/app/keys)
+2. Set `ACTIVITYSMITH_API_KEY` or pass it directly to `ActivitySmith::Client`.
```ruby
require "activitysmith"
-activitysmith = ActivitySmith::Client.new(api_key: ENV.fetch("ACTIVITYSMITH_API_KEY"))
+activitysmith = ActivitySmith::Client.new(
+ api_key: ENV["ACTIVITYSMITH_API_KEY"]
+)
```
## Push Notifications
### Send a Push Notification
-
-
-
+Send an immediate notification for a completed task or event.
+
+
```ruby
activitysmith.notifications.send(
@@ -58,26 +42,21 @@ activitysmith.notifications.send(
### Rich Push Notifications with Media
-
-
-
+
```ruby
activitysmith.notifications.send(
{
title: "Homepage ready",
message: "Your agent finished the redesign.",
- media: "https://cdn.example.com/output/homepage-v2.png",
- redirection: "https://github.com/acme/web/pull/482"
+ media: "https://cdn.example.com/output/homepage-v2.png"
}
)
```
-Send images, videos, or audio with your push notifications, press and hold to preview media directly from the notification, then tap through to open the linked content.
+Attach images, videos, or audio to your Push Notifications. Press and hold the notification to preview the media.
-
-
-
+
What will work:
@@ -86,24 +65,54 @@ What will work:
- direct video file URL: `.mp4`, `.mov`, etc.
- URL that responds with a proper media `Content-Type`, even if the path has no extension
+`media` cannot be combined with `actions`.
+
+### Push Notifications with Redirection
+
+Open a web page, run an iOS Shortcut, or open an app when someone taps the notification. `redirection` supports:
+
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+- **App deep links:** Installed apps or specific content within them
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
+ - **Termius:** `termius://` to open the app
+ - **Claude:** `claude://code` to open the Code tab
+ - **ChatGPT:** `chatgpt://` to open the app
+
+```ruby
+activitysmith.notifications.send(
+ {
+ title: "Homepage ready",
+ message: "Your agent finished the redesign.",
+ redirection: "https://github.com/acme/web/pull/482"
+ }
+)
+```
+
### Actionable Push Notifications
-
-
-
+
+
+`open_url` actions open a web page, run an iOS Shortcut, or open an app when someone taps the button. Supported links:
-Push notification `redirection` and `actions` are optional. Use them to open HTTPS URLs, run a specific iPhone Shortcut with `shortcuts://run-shortcut?name=...`, or trigger backend webhook workflows.
-Webhooks are executed by the ActivitySmith backend.
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+- **App deep links:** Installed apps or specific content within them
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
+ - **Termius:** `termius://` to open the app
+ - **Claude:** `claude://code` to open the Code tab
+ - **ChatGPT:** `chatgpt://` to open the app
+
+Webhooks are executed by the ActivitySmith backend and must use HTTPS.
```ruby
activitysmith.notifications.send(
{
title: "New subscription 💸",
message: "Customer upgraded to Pro plan",
- redirection: "https://crm.example.com/customers/cus_9f3a1d", # Optional
- actions: [ # Optional (max 4)
+ actions: [
{
- title: "Open CRM Profile",
+ title: "Open CRM",
type: "open_url",
url: "https://crm.example.com/customers/cus_9f3a1d"
},
@@ -129,14 +138,31 @@ activitysmith.notifications.send(
## Live Activities
-There are six types of Live Activities:
+Choose the Live Activity type that matches what you want to show:
+
+
+
+**Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
+
+
+
+**Metrics**: Track two related values with segmented bars, such as CPU and memory.
+
+
-- `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
-- `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
+**Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
+
+
+
+**Progress**: Show percentage progress for jobs that move continuously toward completion.
+
+
+
+**Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
+
+
+
+**Timer**: Count down from a duration, or count up from 00:00 while a job runs.
### Start & Update Live Activity
@@ -144,13 +170,7 @@ Use a stable `stream_key` to identify the metric, job, deployment, or system you
#### Stats
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -175,13 +195,7 @@ activitysmith.live_activities.stream(
#### Metrics
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -202,13 +216,7 @@ activitysmith.live_activities.stream(
#### Segmented Progress
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -227,13 +235,7 @@ activitysmith.live_activities.stream(
#### Progress
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -251,13 +253,7 @@ activitysmith.live_activities.stream(
#### Alert
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -276,13 +272,7 @@ activitysmith.live_activities.stream(
#### Timer
-
-
-
+
```ruby
activitysmith.live_activities.stream(
@@ -305,7 +295,7 @@ To start at 00:00 and count up, set `counts_down: false` and leave out `duration
### End Live Activity
-Call `end_stream(...)` with the same `stream_key` 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 `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
+Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. Set `auto_dismiss_seconds` to dismiss it after a delay in seconds, or `auto_dismiss_minutes` for minutes. Use `0` for immediate dismissal. Seconds take precedence if both are set.
```ruby
activitysmith.live_activities.end_stream(
@@ -319,30 +309,89 @@ activitysmith.live_activities.end_stream(
{ label: "CPU", value: 7, unit: "%" },
{ label: "MEM", value: 38, unit: "%" }
],
- auto_dismiss_minutes: 2
+ auto_dismiss_seconds: 30
}
}
)
```
+### Icons and Badges
+
+Add more context to Live Activities with icons and badges.
+
+#### Icon
+
+Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
+
+
+
+```ruby
+activitysmith.live_activities.stream(
+ "prod-web-1",
+ {
+ content_state: ActivitySmith::LiveActivities.content_state(
+ title: "Server Health",
+ subtitle: "prod-web-1",
+ type: "metrics",
+ icon: ActivitySmith::LiveActivities.alert_icon("server.rack", color: "blue"),
+ metrics: [
+ { label: "CPU", value: 18, unit: "%" },
+ { label: "MEM", value: 42, unit: "%" }
+ ]
+ )
+ }
+)
+```
+
+The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
+
+- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
+- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
+- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
+
+#### Badge
+
+Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
+
+
+
+```ruby
+activitysmith.live_activities.stream(
+ "nightly-database-backup",
+ {
+ content_state: ActivitySmith::LiveActivities.content_state(
+ title: "Nightly Database Backup",
+ subtitle: "verify restore",
+ type: "progress",
+ badge: ActivitySmith::LiveActivities.alert_badge("S3", color: "cyan"),
+ percentage: 62
+ )
+ }
+)
+```
+
+### Live Activity Colors
+
+Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
+
+`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
+
### Live Activity Action
-Live Activities can include an action button.
+
-- `open_url`: open an HTTPS URL.
-- `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
-- `webhook`: trigger a backend GET/POST workflow.
+Live Activities can include an action button.
-
-
-
+- `open_url`: Open a web page or run an iOS Shortcut
+- `webhook`: Trigger a backend GET/POST workflow
#### Open URL action
+Open a web page or run an iOS Shortcut when someone taps the button. Supported links:
+
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+
```ruby
activitysmith.live_activities.stream(
"prod-web-1",
@@ -359,7 +408,7 @@ activitysmith.live_activities.stream(
action: {
title: "Dashboard",
type: "open_url",
- url: "https://ops.example.com/servers/prod-web-1"
+ url: "https://status.example.com/servers/prod-web-1"
}
}
)
@@ -369,14 +418,16 @@ activitysmith.live_activities.stream(
```ruby
activitysmith.live_activities.stream(
- "deploy-payments-api",
+ "prod-web-1",
{
content_state: {
- title: "Deploying payments-api",
- subtitle: "Running database migrations",
- type: "segmented_progress",
- number_of_steps: 5,
- current_step: 3
+ title: "Server Health",
+ subtitle: "prod-web-1",
+ type: "metrics",
+ metrics: [
+ { label: "CPU", value: 76, unit: "%" },
+ { label: "MEM", value: 52, unit: "%" }
+ ]
},
action: {
title: "Chat with Jarvis",
@@ -416,13 +467,7 @@ activitysmith.live_activities.stream(
#### Secondary action
-
-
-
+
Use `secondary_action` when you want a second button beside the primary `action`.
@@ -464,90 +509,15 @@ activitysmith.live_activities.stream(
)
```
-### Icons and Badges
-
-Add more context to Live Activities with icons and badges.
-
-#### Icon
-
-Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
-
-
-
-
-
-```ruby
-activitysmith.live_activities.stream(
- "prod-web-1",
- {
- content_state: ActivitySmith::LiveActivities.content_state(
- title: "Server Health",
- subtitle: "prod-web-1",
- type: "metrics",
- icon: ActivitySmith::LiveActivities.alert_icon("server.rack", color: "blue"),
- metrics: [
- { label: "CPU", value: 18, unit: "%" },
- { label: "MEM", value: 42, unit: "%" }
- ]
- )
- }
-)
-```
-
-The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
-
-- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
-- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
-- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
-
-#### Badge
-
-Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
-
-
-
-
-
-```ruby
-activitysmith.live_activities.stream(
- "nightly-database-backup",
- {
- content_state: ActivitySmith::LiveActivities.content_state(
- title: "Nightly Database Backup",
- subtitle: "verify restore",
- type: "progress",
- badge: ActivitySmith::LiveActivities.alert_badge("S3", color: "cyan"),
- percentage: 62
- )
- }
-)
-```
+## Lock Screen Widgets
-### Live Activity Colors
-
-Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
+
-`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
+ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the [web app](https://activitysmith.com/app/widgets), then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
-## Widgets
+
-
-
-
-
-ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
-
-
-
-
+Use the metric key to update its value.
```ruby
activitysmith.metrics.update("deploy.success_rate", 99.9)
@@ -561,92 +531,125 @@ activitysmith.metrics.update("prod.status", "healthy")
## App Icon Badge Count
-
-
-
+
Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
-Set or update the badge value.
+### Set or update the badge value
```ruby
activitysmith.badge_count(8333)
```
-To clear the badge, set its value to 0.
+### Clear the badge
+
+Pass `0` to clear the badge.
```ruby
activitysmith.badge_count(0)
```
-## Channels
-
-Use `channels` to target specific team members or devices
+## Metadata
-### Push Notifications
+Metadata adds extra information to Push Notification and Live Activity details in ActivitySmith. It does not appear in the notification or Live Activity on your device.
```ruby
activitysmith.notifications.send(
- {
- title: "New subscription 💸",
- message: "Customer upgraded to Pro plan",
- channels: ["sales", "customer-success"]
+ title: "New subscription 💸",
+ message: "Customer upgraded to Pro plan",
+ metadata: {
+ customer_id: "382",
+ plan: "Pro",
+ amount: 29,
+ trial: false,
+ }
+)
+
+activitysmith.live_activities.stream(
+ "customer-import",
+ content_state: {
+ title: "Customer Import",
+ type: "progress",
+ percentage: 60,
+ },
+ metadata: {
+ job_id: "import-382",
+ records: 1200,
}
)
```
-### Live Activities
+Values can be strings, numbers, or booleans. Metadata supports up to 50 entries and 16 KB of JSON, with keys up to 100 characters and strings up to 4,000 characters. Nested objects, arrays, and null values are not supported.
+
+## Tags
+
+Use `tags` to organize and filter your Push Notification and Live Activity history. Tags are created automatically when you first use them.
```ruby
-activitysmith.live_activities.start(
+activitysmith.notifications.send(
{
- content_state: {
- title: "Nightly Database Backup",
- subtitle: "verify restore",
- type: "progress",
- percentage: 62
- },
- channels: ["sales", "customer-success"]
+ title: "New subscription 💸",
+ message: "Customer upgraded to Pro plan",
+ tags: ["user:382", "billing"]
}
)
```
-### App Icon Badge Count
+On Live Activity stream updates and legacy `update` or `end` calls, omit `tags` to keep existing Tags, supply a list to replace them, or pass `tags: []` to clear them.
```ruby
-activitysmith.badge_count(3, channels: ["sales", "customer-success"])
+activitysmith.live_activities.update(
+ activity_id: "YOUR_ACTIVITY_ID",
+ content_state: { title: "Customer Import", percentage: 60 },
+ tags: []
+)
```
-## Tags
+## Channels
-Use `tags` to organize and filter your Push Notification and Live Activity history. Tags are created automatically when you first use them.
+Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge Count updates. Omit it for account-wide delivery.
```ruby
activitysmith.notifications.send(
{
title: "New subscription 💸",
message: "Customer upgraded to Pro plan",
- tags: ["user:382", "billing"]
+ channels: ["sales", "customer-success"]
}
)
+
+activitysmith.live_activities.stream(
+ "nightly-backup",
+ {
+ channels: ["ios-builds"],
+ content_state: {
+ title: "Nightly database backup",
+ number_of_steps: 3,
+ current_step: 1,
+ type: "segmented_progress"
+ }
+ }
+)
+
+activitysmith.badge_count(3, channels: ["sales", "customer-success"])
```
## Error Handling
+Handle API errors with `begin/rescue` around SDK calls:
+
```ruby
begin
activitysmith.notifications.send(
- { title: "New subscription 💸" }
+ { title: "Hello" }
)
rescue OpenapiClient::ApiError => err
puts "Request failed: #{err.code} #{err.message}"
end
```
-## Requirements
-
-- Ruby 3.0+
+## Additional Resources
-## License
+### [RubyGems Package](https://rubygems.org/gems/activitysmith)
-MIT
+Install the ActivitySmith Ruby SDK from RubyGems
diff --git a/generated/activitysmith_openapi.rb b/generated/activitysmith_openapi.rb
index 9928336..87bdaa3 100644
--- a/generated/activitysmith_openapi.rb
+++ b/generated/activitysmith_openapi.rb
@@ -20,6 +20,7 @@
require 'activitysmith_openapi/models/activity_metric'
require 'activitysmith_openapi/models/activity_metric_value'
require 'activitysmith_openapi/models/alert_payload'
+require 'activitysmith_openapi/models/app_icon_badge_count_update_error'
require 'activitysmith_openapi/models/app_icon_badge_count_update_request'
require 'activitysmith_openapi/models/app_icon_badge_count_update_response'
require 'activitysmith_openapi/models/bad_request_error'
@@ -45,6 +46,7 @@
require 'activitysmith_openapi/models/live_activity_update_request'
require 'activitysmith_openapi/models/live_activity_update_response'
require 'activitysmith_openapi/models/live_activity_webhook_method'
+require 'activitysmith_openapi/models/metadata_value'
require 'activitysmith_openapi/models/metric_error'
require 'activitysmith_openapi/models/metric_value_update_request'
require 'activitysmith_openapi/models/metric_value_update_request_value'
@@ -59,6 +61,7 @@
require 'activitysmith_openapi/models/rate_limit_error'
require 'activitysmith_openapi/models/send_push_notification429_response'
require 'activitysmith_openapi/models/stream_content_state'
+require 'activitysmith_openapi/models/update_app_icon_badge_count422_response'
# APIs
require 'activitysmith_openapi/api/app_icon_badges_api'
diff --git a/generated/activitysmith_openapi/configuration.rb b/generated/activitysmith_openapi/configuration.rb
index da0dc73..4333dc1 100644
--- a/generated/activitysmith_openapi/configuration.rb
+++ b/generated/activitysmith_openapi/configuration.rb
@@ -252,6 +252,13 @@ def auth_settings
key: 'Authorization',
value: "Bearer #{access_token_with_refresh}"
},
+ 'mcpOAuth' =>
+ {
+ type: 'oauth2',
+ in: 'header',
+ key: 'Authorization',
+ value: "Bearer #{access_token_with_refresh}"
+ },
}
end
diff --git a/generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb b/generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb
new file mode 100644
index 0000000..5cc0896
--- /dev/null
+++ b/generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb
@@ -0,0 +1,386 @@
+=begin
+#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
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.7.0
+
+=end
+
+require 'date'
+require 'time'
+
+module OpenapiClient
+ class AppIconBadgeCountUpdateError
+ attr_accessor :error
+
+ attr_accessor :code
+
+ attr_accessor :message
+
+ attr_accessor :badge
+
+ attr_accessor :devices_targeted
+
+ attr_accessor :devices_updated
+
+ attr_accessor :users_updated
+
+ # Deprecated compatibility alias for devices_updated.
+ attr_accessor :devices_notified
+
+ attr_accessor :effective_channel_slugs
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'error' => :'error',
+ :'code' => :'code',
+ :'message' => :'message',
+ :'badge' => :'badge',
+ :'devices_targeted' => :'devices_targeted',
+ :'devices_updated' => :'devices_updated',
+ :'users_updated' => :'users_updated',
+ :'devices_notified' => :'devices_notified',
+ :'effective_channel_slugs' => :'effective_channel_slugs'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'error' => :'String',
+ :'code' => :'String',
+ :'message' => :'String',
+ :'badge' => :'Integer',
+ :'devices_targeted' => :'Integer',
+ :'devices_updated' => :'Integer',
+ :'users_updated' => :'Integer',
+ :'devices_notified' => :'Integer',
+ :'effective_channel_slugs' => :'Array'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AppIconBadgeCountUpdateError` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AppIconBadgeCountUpdateError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'error')
+ self.error = attributes[:'error']
+ else
+ self.error = nil
+ end
+
+ if attributes.key?(:'code')
+ self.code = attributes[:'code']
+ else
+ self.code = nil
+ end
+
+ if attributes.key?(:'message')
+ self.message = attributes[:'message']
+ else
+ self.message = nil
+ end
+
+ if attributes.key?(:'badge')
+ self.badge = attributes[:'badge']
+ else
+ self.badge = nil
+ end
+
+ if attributes.key?(:'devices_targeted')
+ self.devices_targeted = attributes[:'devices_targeted']
+ end
+
+ if attributes.key?(:'devices_updated')
+ self.devices_updated = attributes[:'devices_updated']
+ else
+ self.devices_updated = nil
+ end
+
+ if attributes.key?(:'users_updated')
+ self.users_updated = attributes[:'users_updated']
+ end
+
+ if attributes.key?(:'devices_notified')
+ self.devices_notified = attributes[:'devices_notified']
+ end
+
+ if attributes.key?(:'effective_channel_slugs')
+ if (value = attributes[:'effective_channel_slugs']).is_a?(Array)
+ self.effective_channel_slugs = value
+ end
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
+ invalid_properties = Array.new
+ if @error.nil?
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
+ end
+
+ if @code.nil?
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
+ end
+
+ if @message.nil?
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
+ end
+
+ if @badge.nil?
+ invalid_properties.push('invalid value for "badge", badge cannot be nil.')
+ end
+
+ if @badge > 2147483647
+ invalid_properties.push('invalid value for "badge", must be smaller than or equal to 2147483647.')
+ end
+
+ if @badge < 0
+ invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
+ end
+
+ if @devices_updated.nil?
+ invalid_properties.push('invalid value for "devices_updated", devices_updated cannot be nil.')
+ end
+
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if @error.nil?
+ return false if @code.nil?
+ code_validator = EnumAttributeValidator.new('String', ["badge_device_disconnected", "badge_update_failed"])
+ return false unless code_validator.valid?(@code)
+ return false if @message.nil?
+ return false if @badge.nil?
+ return false if @badge > 2147483647
+ return false if @badge < 0
+ return false if @devices_updated.nil?
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] code Object to be assigned
+ def code=(code)
+ validator = EnumAttributeValidator.new('String', ["badge_device_disconnected", "badge_update_failed"])
+ unless validator.valid?(code)
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
+ end
+ @code = code
+ end
+
+ # Custom attribute writer method with validation
+ # @param [Object] badge Value to be assigned
+ def badge=(badge)
+ if badge.nil?
+ fail ArgumentError, 'badge cannot be nil'
+ end
+
+ if badge > 2147483647
+ fail ArgumentError, 'invalid value for "badge", must be smaller than or equal to 2147483647.'
+ end
+
+ if badge < 0
+ fail ArgumentError, 'invalid value for "badge", must be greater than or equal to 0.'
+ end
+
+ @badge = badge
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ error == o.error &&
+ code == o.code &&
+ message == o.message &&
+ badge == o.badge &&
+ devices_targeted == o.devices_targeted &&
+ devices_updated == o.devices_updated &&
+ users_updated == o.users_updated &&
+ devices_notified == o.devices_notified &&
+ effective_channel_slugs == o.effective_channel_slugs
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [error, code, message, badge, devices_targeted, devices_updated, users_updated, devices_notified, effective_channel_slugs].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ transformed_hash = {}
+ openapi_types.each_pair do |key, type|
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = nil
+ elsif type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[attribute_map[key]].is_a?(Array)
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
+ end
+ elsif !attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
+ end
+ end
+ new(transformed_hash)
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def self._deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = OpenapiClient.const_get(type)
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb b/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb
index 9faa31c..4482afc 100644
--- a/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb
+++ b/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb
@@ -19,8 +19,16 @@ class AppIconBadgeCountUpdateResponse
attr_accessor :badge
+ # Number of devices whose App Icon Badge Count was updated.
+ attr_accessor :devices_updated
+
+ # Number of account users with at least one updated device.
+ attr_accessor :users_updated
+
+ # Deprecated compatibility alias for devices_updated.
attr_accessor :devices_notified
+ # Deprecated compatibility alias for users_updated.
attr_accessor :users_notified
attr_accessor :effective_channel_slugs
@@ -32,6 +40,8 @@ def self.attribute_map
{
:'success' => :'success',
:'badge' => :'badge',
+ :'devices_updated' => :'devices_updated',
+ :'users_updated' => :'users_updated',
:'devices_notified' => :'devices_notified',
:'users_notified' => :'users_notified',
:'effective_channel_slugs' => :'effective_channel_slugs',
@@ -49,6 +59,8 @@ def self.openapi_types
{
:'success' => :'Boolean',
:'badge' => :'Integer',
+ :'devices_updated' => :'Integer',
+ :'users_updated' => :'Integer',
:'devices_notified' => :'Integer',
:'users_notified' => :'Integer',
:'effective_channel_slugs' => :'Array',
@@ -89,16 +101,24 @@ def initialize(attributes = {})
self.badge = nil
end
+ if attributes.key?(:'devices_updated')
+ self.devices_updated = attributes[:'devices_updated']
+ else
+ self.devices_updated = nil
+ end
+
+ if attributes.key?(:'users_updated')
+ self.users_updated = attributes[:'users_updated']
+ else
+ self.users_updated = nil
+ end
+
if attributes.key?(:'devices_notified')
self.devices_notified = attributes[:'devices_notified']
- else
- self.devices_notified = nil
end
if attributes.key?(:'users_notified')
self.users_notified = attributes[:'users_notified']
- else
- self.users_notified = nil
end
if attributes.key?(:'effective_channel_slugs')
@@ -137,12 +157,12 @@ def list_invalid_properties
invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
end
- if @devices_notified.nil?
- invalid_properties.push('invalid value for "devices_notified", devices_notified cannot be nil.')
+ if @devices_updated.nil?
+ invalid_properties.push('invalid value for "devices_updated", devices_updated cannot be nil.')
end
- if @users_notified.nil?
- invalid_properties.push('invalid value for "users_notified", users_notified cannot be nil.')
+ if @users_updated.nil?
+ invalid_properties.push('invalid value for "users_updated", users_updated cannot be nil.')
end
if @effective_channel_slugs.nil?
@@ -164,8 +184,8 @@ def valid?
return false if @badge.nil?
return false if @badge > 2147483647
return false if @badge < 0
- return false if @devices_notified.nil?
- return false if @users_notified.nil?
+ return false if @devices_updated.nil?
+ return false if @users_updated.nil?
return false if @effective_channel_slugs.nil?
return false if @timestamp.nil?
true
@@ -196,6 +216,8 @@ def ==(o)
self.class == o.class &&
success == o.success &&
badge == o.badge &&
+ devices_updated == o.devices_updated &&
+ users_updated == o.users_updated &&
devices_notified == o.devices_notified &&
users_notified == o.users_notified &&
effective_channel_slugs == o.effective_channel_slugs &&
@@ -211,7 +233,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [success, badge, devices_notified, users_notified, effective_channel_slugs, timestamp].hash
+ [success, badge, devices_updated, users_updated, devices_notified, users_notified, effective_channel_slugs, timestamp].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_end_request.rb b/generated/activitysmith_openapi/models/live_activity_end_request.rb
index 40b43c2..d8877d0 100644
--- a/generated/activitysmith_openapi/models/live_activity_end_request.rb
+++ b/generated/activitysmith_openapi/models/live_activity_end_request.rb
@@ -16,8 +16,14 @@
module OpenapiClient
# End an existing Live Activity by activity_id.
class LiveActivityEndRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
attr_accessor :activity_id
+ # Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
+ attr_accessor :tags
+
attr_accessor :content_state
attr_accessor :action
@@ -28,7 +34,9 @@ class LiveActivityEndRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
:'activity_id' => :'activity_id',
+ :'tags' => :'tags',
:'content_state' => :'content_state',
:'action' => :'action',
:'secondary_action' => :'secondary_action'
@@ -43,7 +51,9 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
:'activity_id' => :'String',
+ :'tags' => :'Array',
:'content_state' => :'ContentStateEnd',
:'action' => :'LiveActivityAction',
:'secondary_action' => :'LiveActivityAction'
@@ -71,12 +81,24 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
if attributes.key?(:'activity_id')
self.activity_id = attributes[:'activity_id']
else
self.activity_id = nil
end
+ if attributes.key?(:'tags')
+ if (value = attributes[:'tags']).is_a?(Array)
+ self.tags = value
+ end
+ end
+
if attributes.key?(:'content_state')
self.content_state = attributes[:'content_state']
else
@@ -97,10 +119,18 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
if @activity_id.nil?
invalid_properties.push('invalid value for "activity_id", activity_id cannot be nil.')
end
+ if !@tags.nil? && @tags.length > 20
+ invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 20.')
+ end
+
if @content_state.nil?
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
end
@@ -112,17 +142,49 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
return false if @activity_id.nil?
+ return false if !@tags.nil? && @tags.length > 20
return false if @content_state.nil?
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
+ # Custom attribute writer method with validation
+ # @param [Object] tags Value to be assigned
+ def tags=(tags)
+ if tags.nil?
+ fail ArgumentError, 'tags cannot be nil'
+ end
+
+ if tags.length > 20
+ fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 20.'
+ end
+
+ @tags = tags
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
activity_id == o.activity_id &&
+ tags == o.tags &&
content_state == o.content_state &&
action == o.action &&
secondary_action == o.secondary_action
@@ -137,7 +199,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [activity_id, content_state, action, secondary_action].hash
+ [metadata, activity_id, tags, content_state, action, secondary_action].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_limit_error.rb b/generated/activitysmith_openapi/models/live_activity_limit_error.rb
index c10f24d..52f964c 100644
--- a/generated/activitysmith_openapi/models/live_activity_limit_error.rb
+++ b/generated/activitysmith_openapi/models/live_activity_limit_error.rb
@@ -21,16 +21,24 @@ class LiveActivityLimitError
attr_accessor :limit
- # Current number of active Live Activities.
+ # Highest number of active Live Activities among the targeted devices.
attr_accessor :active
+ # Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity.
+ attr_accessor :blocked_devices
+
+ # Total number of targeted devices. Included only when targeted devices have mixed capacity.
+ attr_accessor :targeted_devices
+
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'error' => :'error',
:'message' => :'message',
:'limit' => :'limit',
- :'active' => :'active'
+ :'active' => :'active',
+ :'blocked_devices' => :'blocked_devices',
+ :'targeted_devices' => :'targeted_devices'
}
end
@@ -45,7 +53,9 @@ def self.openapi_types
:'error' => :'String',
:'message' => :'String',
:'limit' => :'Integer',
- :'active' => :'Integer'
+ :'active' => :'Integer',
+ :'blocked_devices' => :'Integer',
+ :'targeted_devices' => :'Integer'
}
end
@@ -93,6 +103,14 @@ def initialize(attributes = {})
else
self.active = nil
end
+
+ if attributes.key?(:'blocked_devices')
+ self.blocked_devices = attributes[:'blocked_devices']
+ end
+
+ if attributes.key?(:'targeted_devices')
+ self.targeted_devices = attributes[:'targeted_devices']
+ end
end
# Show invalid properties with the reasons. Usually used together with valid?
@@ -138,7 +156,9 @@ def ==(o)
error == o.error &&
message == o.message &&
limit == o.limit &&
- active == o.active
+ active == o.active &&
+ blocked_devices == o.blocked_devices &&
+ targeted_devices == o.targeted_devices
end
# @see the `==` method
@@ -150,7 +170,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [error, message, limit, active].hash
+ [error, message, limit, active, blocked_devices, targeted_devices].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_start_request.rb b/generated/activitysmith_openapi/models/live_activity_start_request.rb
index 7297a28..135006f 100644
--- a/generated/activitysmith_openapi/models/live_activity_start_request.rb
+++ b/generated/activitysmith_openapi/models/live_activity_start_request.rb
@@ -16,6 +16,9 @@
module OpenapiClient
# Start a new Live Activity. The response includes activity_id for later update and end calls.
class LiveActivityStartRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
attr_accessor :content_state
attr_accessor :action
@@ -33,6 +36,7 @@ class LiveActivityStartRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
:'content_state' => :'content_state',
:'action' => :'action',
:'secondary_action' => :'secondary_action',
@@ -50,6 +54,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
:'content_state' => :'ContentStateStart',
:'action' => :'LiveActivityAction',
:'secondary_action' => :'LiveActivityAction',
@@ -80,6 +85,12 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
if attributes.key?(:'content_state')
self.content_state = attributes[:'content_state']
else
@@ -114,6 +125,10 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
if @content_state.nil?
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
end
@@ -125,15 +140,31 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
return false if @content_state.nil?
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
content_state == o.content_state &&
action == o.action &&
secondary_action == o.secondary_action &&
@@ -151,7 +182,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [content_state, action, secondary_action, alert, target, tags].hash
+ [metadata, content_state, action, secondary_action, alert, target, tags].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb b/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb
index 97f1dd2..0cb5d09 100644
--- a/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb
+++ b/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb
@@ -16,6 +16,12 @@
module OpenapiClient
# Optional payload for ending a managed stream. When omitted, ActivitySmith ends the stream using the latest known state when possible.
class LiveActivityStreamDeleteRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
+ # Optional tags to organize and filter notification history.
+ attr_accessor :tags
+
attr_accessor :content_state
attr_accessor :action
@@ -28,6 +34,8 @@ class LiveActivityStreamDeleteRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
+ :'tags' => :'tags',
:'content_state' => :'content_state',
:'action' => :'action',
:'secondary_action' => :'secondary_action',
@@ -43,6 +51,8 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
+ :'tags' => :'Array',
:'content_state' => :'StreamContentState',
:'action' => :'LiveActivityAction',
:'secondary_action' => :'LiveActivityAction',
@@ -71,6 +81,18 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
+ if attributes.key?(:'tags')
+ if (value = attributes[:'tags']).is_a?(Array)
+ self.tags = value
+ end
+ end
+
if attributes.key?(:'content_state')
self.content_state = attributes[:'content_state']
end
@@ -93,6 +115,10 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
invalid_properties
end
@@ -100,14 +126,31 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
+ tags == o.tags &&
content_state == o.content_state &&
action == o.action &&
secondary_action == o.secondary_action &&
@@ -123,7 +166,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [content_state, action, secondary_action, alert].hash
+ [metadata, tags, content_state, action, secondary_action, alert].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_stream_request.rb b/generated/activitysmith_openapi/models/live_activity_stream_request.rb
index d2581d7..0253e2b 100644
--- a/generated/activitysmith_openapi/models/live_activity_stream_request.rb
+++ b/generated/activitysmith_openapi/models/live_activity_stream_request.rb
@@ -16,6 +16,9 @@
module OpenapiClient
# Send the latest state for a managed Live Activity stream. channels is the streamlined form for stream targeting. target.channels is also accepted for compatibility. If both are provided, they must match.
class LiveActivityStreamRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
attr_accessor :content_state
attr_accessor :action
@@ -36,6 +39,7 @@ class LiveActivityStreamRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
:'content_state' => :'content_state',
:'action' => :'action',
:'secondary_action' => :'secondary_action',
@@ -54,6 +58,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
:'content_state' => :'StreamContentState',
:'action' => :'LiveActivityAction',
:'secondary_action' => :'LiveActivityAction',
@@ -85,6 +90,12 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
if attributes.key?(:'content_state')
self.content_state = attributes[:'content_state']
else
@@ -125,6 +136,10 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
if @content_state.nil?
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
end
@@ -140,11 +155,26 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
return false if @content_state.nil?
return false if !@channels.nil? && @channels.length < 1
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
# Custom attribute writer method with validation
# @param [Object] channels Value to be assigned
def channels=(channels)
@@ -164,6 +194,7 @@ def channels=(channels)
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
content_state == o.content_state &&
action == o.action &&
secondary_action == o.secondary_action &&
@@ -182,7 +213,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [content_state, action, secondary_action, alert, channels, target, tags].hash
+ [metadata, content_state, action, secondary_action, alert, channels, target, tags].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/live_activity_update_request.rb b/generated/activitysmith_openapi/models/live_activity_update_request.rb
index b952430..ae174e2 100644
--- a/generated/activitysmith_openapi/models/live_activity_update_request.rb
+++ b/generated/activitysmith_openapi/models/live_activity_update_request.rb
@@ -16,8 +16,14 @@
module OpenapiClient
# Update an existing Live Activity by activity_id.
class LiveActivityUpdateRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
attr_accessor :activity_id
+ # Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
+ attr_accessor :tags
+
attr_accessor :content_state
attr_accessor :action
@@ -28,7 +34,9 @@ class LiveActivityUpdateRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
:'activity_id' => :'activity_id',
+ :'tags' => :'tags',
:'content_state' => :'content_state',
:'action' => :'action',
:'secondary_action' => :'secondary_action'
@@ -43,7 +51,9 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
:'activity_id' => :'String',
+ :'tags' => :'Array',
:'content_state' => :'ContentStateUpdate',
:'action' => :'LiveActivityAction',
:'secondary_action' => :'LiveActivityAction'
@@ -71,12 +81,24 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
if attributes.key?(:'activity_id')
self.activity_id = attributes[:'activity_id']
else
self.activity_id = nil
end
+ if attributes.key?(:'tags')
+ if (value = attributes[:'tags']).is_a?(Array)
+ self.tags = value
+ end
+ end
+
if attributes.key?(:'content_state')
self.content_state = attributes[:'content_state']
else
@@ -97,10 +119,18 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
if @activity_id.nil?
invalid_properties.push('invalid value for "activity_id", activity_id cannot be nil.')
end
+ if !@tags.nil? && @tags.length > 20
+ invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 20.')
+ end
+
if @content_state.nil?
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
end
@@ -112,17 +142,49 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
return false if @activity_id.nil?
+ return false if !@tags.nil? && @tags.length > 20
return false if @content_state.nil?
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
+ # Custom attribute writer method with validation
+ # @param [Object] tags Value to be assigned
+ def tags=(tags)
+ if tags.nil?
+ fail ArgumentError, 'tags cannot be nil'
+ end
+
+ if tags.length > 20
+ fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 20.'
+ end
+
+ @tags = tags
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
activity_id == o.activity_id &&
+ tags == o.tags &&
content_state == o.content_state &&
action == o.action &&
secondary_action == o.secondary_action
@@ -137,7 +199,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [activity_id, content_state, action, secondary_action].hash
+ [metadata, activity_id, tags, content_state, action, secondary_action].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/metadata_value.rb b/generated/activitysmith_openapi/models/metadata_value.rb
new file mode 100644
index 0000000..289024c
--- /dev/null
+++ b/generated/activitysmith_openapi/models/metadata_value.rb
@@ -0,0 +1,106 @@
+=begin
+#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
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.7.0
+
+=end
+
+require 'date'
+require 'time'
+
+module OpenapiClient
+ module MetadataValue
+ class << self
+ # List of class defined in oneOf (OpenAPI v3)
+ def openapi_one_of
+ [
+ :'Boolean',
+ :'Float',
+ :'String'
+ ]
+ end
+
+ # Builds the object
+ # @param [Mixed] Data to be matched against the list of oneOf items
+ # @return [Object] Returns the model or the data itself
+ def build(data)
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
+ # Note:
+ # - We do not attempt to check whether exactly one item matches.
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
+ # - TODO: scalar values are de facto behaving as if they were nullable.
+ # - TODO: logging when debugging is set.
+ openapi_one_of.each do |klass|
+ begin
+ next if klass == :AnyType # "nullable: true"
+ typed_data = find_and_cast_into_type(klass, data)
+ return typed_data if typed_data
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
+ end
+ end
+
+ openapi_one_of.include?(:AnyType) ? data : nil
+ end
+
+ private
+
+ SchemaMismatchError = Class.new(StandardError)
+
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
+ def find_and_cast_into_type(klass, data)
+ return if data.nil?
+
+ case klass.to_s
+ when 'Boolean'
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
+ when 'Float'
+ return data if data.instance_of?(Float)
+ when 'Integer'
+ return data if data.instance_of?(Integer)
+ when 'Time'
+ return Time.parse(data)
+ when 'Date'
+ return Date.parse(data)
+ when 'String'
+ return data if data.instance_of?(String)
+ when 'Object' # "type: object"
+ return data if data.instance_of?(Hash)
+ when /\AArray<(?.+)>\z/ # "type: array"
+ if data.instance_of?(Array)
+ sub_type = Regexp.last_match[:sub_type]
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
+ end
+ when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }"
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
+ sub_type = Regexp.last_match[:sub_type]
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
+ end
+ else # model
+ const = OpenapiClient.const_get(klass)
+ if const
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
+ model = const.build(data)
+ return model if model
+ else
+ # raise if data contains keys that are not known to the model
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
+ model = const.build_from_hash(data)
+ return model if model
+ end
+ end
+ end
+
+ raise # if no match by now, raise
+ rescue
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
+ end
+ end
+ end
+
+end
diff --git a/generated/activitysmith_openapi/models/push_notification_action.rb b/generated/activitysmith_openapi/models/push_notification_action.rb
index d29eb66..a3dd68d 100644
--- a/generated/activitysmith_openapi/models/push_notification_action.rb
+++ b/generated/activitysmith_openapi/models/push_notification_action.rb
@@ -20,7 +20,7 @@ class PushNotificationAction
attr_accessor :type
- # Action URL. For open_url, use an HTTP or 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.
+ # Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend.
attr_accessor :url
# Webhook HTTP method. Used only when type=webhook.
diff --git a/generated/activitysmith_openapi/models/push_notification_request.rb b/generated/activitysmith_openapi/models/push_notification_request.rb
index cfba9e2..e500e93 100644
--- a/generated/activitysmith_openapi/models/push_notification_request.rb
+++ b/generated/activitysmith_openapi/models/push_notification_request.rb
@@ -15,6 +15,9 @@
module OpenapiClient
class PushNotificationRequest
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ attr_accessor :metadata
+
attr_accessor :title
attr_accessor :message
@@ -24,7 +27,7 @@ class PushNotificationRequest
# 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`.
attr_accessor :media
- # Optional HTTP URL, 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 HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
attr_accessor :redirection
# Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
@@ -44,6 +47,7 @@ class PushNotificationRequest
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'metadata' => :'metadata',
:'title' => :'title',
:'message' => :'message',
:'subtitle' => :'subtitle',
@@ -66,6 +70,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'metadata' => :'Hash',
:'title' => :'String',
:'message' => :'String',
:'subtitle' => :'String',
@@ -101,6 +106,12 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'metadata')
+ if (value = attributes[:'metadata']).is_a?(Hash)
+ self.metadata = value
+ end
+ end
+
if attributes.key?(:'title')
self.title = attributes[:'title']
else
@@ -157,6 +168,10 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
+ if !@metadata.nil? && @metadata.length > 50
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
+ end
+
if @title.nil?
invalid_properties.push('invalid value for "title", title cannot be nil.')
end
@@ -166,7 +181,11 @@ def list_invalid_properties
invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
end
- pattern = Regexp.new(/^(http|https|shortcuts):\/\//)
+ if !@redirection.nil? && @redirection.to_s.length > 2048
+ invalid_properties.push('invalid value for "redirection", the character length must be smaller than or equal to 2048.')
+ end
+
+ pattern = Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
if !@redirection.nil? && @redirection !~ pattern
invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
end
@@ -182,13 +201,29 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if !@metadata.nil? && @metadata.length > 50
return false if @title.nil?
return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
- return false if !@redirection.nil? && @redirection !~ Regexp.new(/^(http|https|shortcuts):\/\//)
+ return false if !@redirection.nil? && @redirection.to_s.length > 2048
+ return false if !@redirection.nil? && @redirection !~ Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
return false if !@actions.nil? && @actions.length > 4
true
end
+ # Custom attribute writer method with validation
+ # @param [Object] metadata Value to be assigned
+ def metadata=(metadata)
+ if metadata.nil?
+ fail ArgumentError, 'metadata cannot be nil'
+ end
+
+ if metadata.length > 50
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
+ end
+
+ @metadata = metadata
+ end
+
# Custom attribute writer method with validation
# @param [Object] media Value to be assigned
def media=(media)
@@ -211,7 +246,11 @@ def redirection=(redirection)
fail ArgumentError, 'redirection cannot be nil'
end
- pattern = Regexp.new(/^(http|https|shortcuts):\/\//)
+ if redirection.to_s.length > 2048
+ fail ArgumentError, 'invalid value for "redirection", the character length must be smaller than or equal to 2048.'
+ end
+
+ pattern = Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
if redirection !~ pattern
fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
end
@@ -238,6 +277,7 @@ def actions=(actions)
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ metadata == o.metadata &&
title == o.title &&
message == o.message &&
subtitle == o.subtitle &&
@@ -260,7 +300,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
+ [metadata, title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
end
# Builds the object from hash
diff --git a/generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb b/generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb
new file mode 100644
index 0000000..3cba603
--- /dev/null
+++ b/generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb
@@ -0,0 +1,105 @@
+=begin
+#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
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.7.0
+
+=end
+
+require 'date'
+require 'time'
+
+module OpenapiClient
+ module UpdateAppIconBadgeCount422Response
+ class << self
+ # List of class defined in oneOf (OpenAPI v3)
+ def openapi_one_of
+ [
+ :'AppIconBadgeCountUpdateError',
+ :'NoRecipientsError'
+ ]
+ end
+
+ # Builds the object
+ # @param [Mixed] Data to be matched against the list of oneOf items
+ # @return [Object] Returns the model or the data itself
+ def build(data)
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
+ # Note:
+ # - We do not attempt to check whether exactly one item matches.
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
+ # - TODO: scalar values are de facto behaving as if they were nullable.
+ # - TODO: logging when debugging is set.
+ openapi_one_of.each do |klass|
+ begin
+ next if klass == :AnyType # "nullable: true"
+ typed_data = find_and_cast_into_type(klass, data)
+ return typed_data if typed_data
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
+ end
+ end
+
+ openapi_one_of.include?(:AnyType) ? data : nil
+ end
+
+ private
+
+ SchemaMismatchError = Class.new(StandardError)
+
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
+ def find_and_cast_into_type(klass, data)
+ return if data.nil?
+
+ case klass.to_s
+ when 'Boolean'
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
+ when 'Float'
+ return data if data.instance_of?(Float)
+ when 'Integer'
+ return data if data.instance_of?(Integer)
+ when 'Time'
+ return Time.parse(data)
+ when 'Date'
+ return Date.parse(data)
+ when 'String'
+ return data if data.instance_of?(String)
+ when 'Object' # "type: object"
+ return data if data.instance_of?(Hash)
+ when /\AArray<(?.+)>\z/ # "type: array"
+ if data.instance_of?(Array)
+ sub_type = Regexp.last_match[:sub_type]
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
+ end
+ when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }"
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
+ sub_type = Regexp.last_match[:sub_type]
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
+ end
+ else # model
+ const = OpenapiClient.const_get(klass)
+ if const
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
+ model = const.build(data)
+ return model if model
+ else
+ # raise if data contains keys that are not known to the model
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
+ model = const.build_from_hash(data)
+ return model if model
+ end
+ end
+ end
+
+ raise # if no match by now, raise
+ rescue
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
+ end
+ end
+ end
+
+end
diff --git a/generated/activitysmith_openapi/version.rb b/generated/activitysmith_openapi/version.rb
index 77eed2b..6a445ea 100644
--- a/generated/activitysmith_openapi/version.rb
+++ b/generated/activitysmith_openapi/version.rb
@@ -11,5 +11,5 @@
=end
module OpenapiClient
- VERSION = '1.10.0'
+ VERSION = '1.11.0'
end
diff --git a/generated/openapi-source.json b/generated/openapi-source.json
new file mode 100644
index 0000000..dc05717
--- /dev/null
+++ b/generated/openapi-source.json
@@ -0,0 +1,6 @@
+{
+ "repository": "ActivitySmithHQ/activitysmith-backend",
+ "commit": "49ad7b083b50f53bc3d81edb77ca6597845160a2",
+ "path": "openapi.json",
+ "sha256": "b7e33cd485df8ddc5d7fb7b57b61106fd6f8ff3ffa7cc7bef4ac1ccbbb0cede7"
+}
diff --git a/lib/activitysmith/live_activities.rb b/lib/activitysmith/live_activities.rb
index 173ca9f..7a81805 100644
--- a/lib/activitysmith/live_activities.rb
+++ b/lib/activitysmith/live_activities.rb
@@ -47,12 +47,12 @@ def start(request = nil, opts = {}, tags: nil, **request_fields)
)
end
- def update(request, opts = {})
- @api.update_live_activity(normalize_live_activity_request(request), opts)
+ def update(request = nil, opts = {}, tags: nil, **request_fields)
+ @api.update_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
end
- def end(request, opts = {})
- @api.end_live_activity(normalize_live_activity_request(request), opts)
+ def end(request = nil, opts = {}, tags: nil, **request_fields)
+ @api.end_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
end
def stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
@@ -65,10 +65,10 @@ def stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
)
end
- def end_stream(stream_key, request = nil, opts = {})
+ def end_stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
@api.end_live_activity_stream(
stream_key,
- { live_activity_stream_delete_request: normalize_live_activity_request(request) }.merge(opts)
+ { live_activity_stream_delete_request: normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)) }.merge(opts)
)
end
diff --git a/lib/activitysmith/version.rb b/lib/activitysmith/version.rb
index 700e5aa..1937611 100644
--- a/lib/activitysmith/version.rb
+++ b/lib/activitysmith/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module ActivitySmith
- VERSION = "1.10.0"
+ VERSION = "1.11.0"
end
diff --git a/test/resources_test.rb b/test/resources_test.rb
index 31f4125..6409987 100644
--- a/test/resources_test.rb
+++ b/test/resources_test.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require_relative "test_helper"
+require "json"
require File.expand_path("../generated/activitysmith_openapi/models/live_activity_action", __dir__)
require File.expand_path("../generated/activitysmith_openapi/models/live_activity_action_type", __dir__)
require File.expand_path("../generated/activitysmith_openapi/models/push_notification_action", __dir__)
@@ -743,3 +744,65 @@ def test_passthrough_methods
assert_equal [:ok, 200, {}], live_activities.end_live_activity_with_http_info({ activity_id: "act-1" })
end
end
+
+
+require File.expand_path("../generated/activitysmith_openapi/models/live_activity_update_request", __dir__)
+require File.expand_path("../generated/activitysmith_openapi/models/live_activity_end_request", __dir__)
+
+class LegacyTagsTest < Minitest::Test
+ def test_replacement_clearing_and_omission
+ [:update, :end].each do |method|
+ [nil, ["billing"], []].each do |tags|
+ api = FakeLiveApi.new
+ resource = ActivitySmith::LiveActivities.new(api)
+ resource.public_send(method, activity_id: "activity-1", content_state: {title: "Job"}, tags: tags)
+ request = api.calls.last[1]
+ assert_equal !tags.nil?, request.key?(:tags)
+ assert_equal tags, request[:tags] unless tags.nil?
+ model_class = method == :update ? OpenapiClient::LiveActivityUpdateRequest : OpenapiClient::LiveActivityEndRequest
+ model = model_class.new(request)
+ serialized = model.to_hash
+ assert_equal !tags.nil?, serialized.key?(:tags)
+ assert_equal tags, serialized[:tags] unless tags.nil?
+ end
+ end
+ end
+end
+
+
+class MetadataSerializationTest < Minitest::Test
+ def test_metadata_keeps_scalar_values_and_empty_objects
+ [:send, :start, :update, :end, :stream, :end_stream].each do |method|
+ [nil, {}, {order: "382", ready: false, count: 0, empty: "", ratio: 1.25}].each do |metadata|
+ api = method == :send ? FakePushApi.new : FakeLiveApi.new
+ resource = method == :send ? ActivitySmith::Notifications.new(api) : ActivitySmith::LiveActivities.new(api)
+ fields = method == :send ? {title: "Job"} : {activity_id: "a", content_state: {title: "Job"}}
+ fields[:metadata] = metadata unless metadata.nil?
+ [:stream, :end_stream].include?(method) ? resource.public_send(method, "job", **fields) : resource.public_send(method, **fields)
+ request = api.calls.last[[:stream, :end_stream].include?(method) ? 2 : 1]
+ request = request[:live_activity_stream_delete_request] if method == :end_stream
+ serialized = JSON.parse(JSON.generate(request))
+ assert_equal !metadata.nil?, serialized.key?("metadata")
+ assert_equal JSON.parse(JSON.generate(metadata)), serialized["metadata"] unless metadata.nil?
+ end
+ end
+ end
+end
+
+class ExternalPushURLsTest < Minitest::Test
+ def test_custom_schemes_and_stream_end_tags
+ ["http://example.com", "https://example.com", "shortcuts://run-shortcut?name=Test", "spotify://", "spotify:track:123"].each do |url|
+ model = OpenapiClient::PushNotificationRequest.new(title: "Job", redirection: url)
+ assert model.valid?
+ assert_equal url, model.to_hash[:redirection]
+ end
+ [nil, [], ["finished"]].each do |tags|
+ api = FakeLiveApi.new
+ ActivitySmith::LiveActivities.new(api).end_stream("job", tags: tags, metadata: {})
+ request = api.calls.last[2][:live_activity_stream_delete_request]
+ assert_equal !tags.nil?, request.key?(:tags)
+ assert_equal tags, request[:tags] unless tags.nil?
+ assert_equal({}, request[:metadata])
+ end
+ end
+end