activitysmith 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -9
  3. data/generated/activitysmith_openapi/api/app_icon_badges_api.rb +4 -4
  4. data/generated/activitysmith_openapi/api/devices_api.rb +100 -0
  5. data/generated/activitysmith_openapi/api/live_activities_api.rb +2 -2
  6. data/generated/activitysmith_openapi/api/metrics_api.rb +87 -4
  7. data/generated/activitysmith_openapi/api/push_notifications_api.rb +147 -2
  8. data/generated/activitysmith_openapi/models/account_device.rb +367 -0
  9. data/generated/activitysmith_openapi/models/account_device_list_response.rb +239 -0
  10. data/generated/activitysmith_openapi/models/account_device_list_response_meta.rb +299 -0
  11. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +35 -5
  12. data/generated/activitysmith_openapi/models/live_activity_end_response.rb +64 -4
  13. data/generated/activitysmith_openapi/models/live_activity_start_response.rb +35 -4
  14. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +64 -4
  15. data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +54 -4
  16. data/generated/activitysmith_openapi/models/live_activity_update_response.rb +76 -4
  17. data/generated/activitysmith_openapi/models/metric.rb +411 -0
  18. data/generated/activitysmith_openapi/models/metric_response.rb +221 -0
  19. data/generated/activitysmith_openapi/models/metric_upsert_request.rb +370 -0
  20. data/generated/activitysmith_openapi/models/metric_value_update_response.rb +14 -4
  21. data/generated/activitysmith_openapi/models/no_recipients_error.rb +21 -1
  22. data/generated/activitysmith_openapi/models/push_notification_dismiss_response.rb +257 -0
  23. data/generated/activitysmith_openapi/models/push_notification_replace_request.rb +434 -0
  24. data/generated/activitysmith_openapi/models/push_notification_replace_response.rb +298 -0
  25. data/generated/activitysmith_openapi/models/push_notification_response.rb +63 -4
  26. data/generated/activitysmith_openapi/version.rb +1 -1
  27. data/generated/activitysmith_openapi.rb +10 -0
  28. data/generated/openapi-source.json +2 -2
  29. data/lib/activitysmith/client.rb +3 -1
  30. data/lib/activitysmith/devices.rb +30 -0
  31. data/lib/activitysmith/metrics.rb +15 -1
  32. data/lib/activitysmith/notifications.rb +23 -0
  33. data/lib/activitysmith/version.rb +1 -1
  34. data/lib/activitysmith.rb +1 -0
  35. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a34b4cbdf040d39ac1a0ffbce791601bfb02037c65200e601c69cc3b25483014
4
- data.tar.gz: 50c856c221b5027091facf351b5f29b5e95c57e0db869eaea87aad5d06b628eb
3
+ metadata.gz: 38c99467adcdd35937257d15c32365b171875e14dcb67a2a04b13967b625f0ee
4
+ data.tar.gz: cebd4d745dd77c361b4439b73c45134e2f5b5acb4e8730433340cabcf1c35d3e
5
5
  SHA512:
6
- metadata.gz: c7ae076e9a17173a9aca6901be21bf2d4b600a80fd2f897b646ac1ead519eccf001fc72adc69aebccdda471679a8d81606f0ab54e0ceb8e7931b420705ef72f5
7
- data.tar.gz: fcf3e1e4d7fb15faa8fdfaeefe7062ecd16f94d60e1b737cdf2a1904911354c65db6a60c620aba8bc980dbabc80ae17310fde700b4b3b948bd40a19ff5aeb4a0
6
+ metadata.gz: a28a6af882071fa0a679c193bc733e9d8c7e9fde32b159a148af1e246ba9e6e03770b5ae9f48150f996f2d93f987817684149ddd06047a26145d8a3af58f8365
7
+ data.tar.gz: c782a13c6cc81d2fa85482e4a15e5f6b3f5793b3719e2c32e69df32d840578b38257bf6a7f5c63568d78f2dace13f2f8fb119f9d4a512d79ce4d64897e2dc3dd
data/README.md CHANGED
@@ -44,14 +44,14 @@ activitysmith.notifications.send(
44
44
 
45
45
  ![Push Notifications with custom icons](https://cdn.activitysmith.com/features/push-notifications-with-custom-icons.png)
46
46
 
47
- Set `icon` to a publicly accessible HTTPS image URL to show an avatar or service logo alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit the subtitle from the notification.
47
+ Set `icon` to a publicly accessible HTTPS image URL to show a logo or avatar alongside a smaller ActivitySmith app icon. Host the image anywhere, such as on your own website or CDN. With a custom icon, iOS may omit the subtitle from the notification.
48
48
 
49
49
  ```ruby
50
50
  activitysmith.notifications.send(
51
51
  {
52
52
  title: "MRR just crossed $10,000 🎉",
53
53
  message: "Up 18% this month from 31 new subscriptions.",
54
- icon: "https://cdn.activitysmith.com/integrations/icons/stripe.png"
54
+ icon: "https://example.com/icons/stripe.png"
55
55
  }
56
56
  )
57
57
  ```
@@ -206,6 +206,29 @@ activitysmith.notifications.send(
206
206
  )
207
207
  ```
208
208
 
209
+ ### Replace a Push Notification
210
+
211
+ Every send returns a `notification_id`. Pass it to `replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original.
212
+
213
+ Omit `metadata` or `tags` to keep their stored values.
214
+
215
+ ```ruby
216
+ sent = activitysmith.notifications.send(
217
+ {
218
+ title: "🚨 checkout-api is down",
219
+ message: "500 errors on 62% of requests."
220
+ }
221
+ )
222
+
223
+ activitysmith.notifications.replace(
224
+ sent.notification_id,
225
+ {
226
+ title: "✅ checkout-api recovered",
227
+ message: "Error rate is back to normal. Incident resolved."
228
+ }
229
+ )
230
+ ```
231
+
209
232
  ## Live Activities
210
233
 
211
234
  Choose the Live Activity type that matches what you want to show:
@@ -242,6 +265,9 @@ Choose the Live Activity type that matches what you want to show:
242
265
 
243
266
  Use a stable `stream_key` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `stream_key` update it.
244
267
 
268
+ > [!WARNING]
269
+ > iOS limits how often a Live Activity can update. Short bursts that end, like deployment steps, are fine. If one Live Activity keeps updating more often than every couple of minutes, iOS throttles it until the budget refills, roughly an hour, even though the API still returns `200`. [Learn more](https://activitysmith.com/docs/live-activity-stream#update-frequency-and-ios-limits)
270
+
245
271
  #### Value
246
272
 
247
273
  ![Value Live Activity stream example](https://cdn.activitysmith.com/features/value-live-activity.png)
@@ -625,12 +651,14 @@ String metric values work too.
625
651
  activitysmith.metrics.update("prod.status", "healthy")
626
652
  ```
627
653
 
628
- ## App Icon Badge Count
654
+ ## App Icon Badge
629
655
 
630
- ![ActivitySmith app icon with an App Icon Badge Count](https://cdn.activitysmith.com/features/badge-count.png)
656
+ ![ActivitySmith app icon with an App Icon Badge](https://cdn.activitysmith.com/features/badge-count.png)
631
657
 
632
658
  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.
633
659
 
660
+ App Icon Badge requires Push Notifications enabled. On your iPhone, open Settings > ActivitySmith > Notifications and turn on Allow Notifications.
661
+
634
662
  ### Set or update the badge value
635
663
 
636
664
  ```ruby
@@ -703,7 +731,7 @@ activitysmith.live_activities.update(
703
731
 
704
732
  ## Channels
705
733
 
706
- 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.
734
+ Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge updates. Omit it for account-wide delivery.
707
735
 
708
736
  ```ruby
709
737
  activitysmith.notifications.send(
@@ -749,7 +777,3 @@ end
749
777
  ### [RubyGems Package](https://rubygems.org/gems/activitysmith)
750
778
 
751
779
  Install the ActivitySmith Ruby SDK from RubyGems
752
-
753
- ### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-ruby)
754
-
755
- View the Ruby SDK source on GitHub
@@ -19,8 +19,8 @@ module OpenapiClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Set App Icon Badge Count
23
- # Shows a number on the ActivitySmith app icon.
22
+ # Set App Icon Badge
23
+ # Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
24
24
  # @param app_icon_badge_count_update_request [AppIconBadgeCountUpdateRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [AppIconBadgeCountUpdateResponse]
@@ -29,8 +29,8 @@ module OpenapiClient
29
29
  data
30
30
  end
31
31
 
32
- # Set App Icon Badge Count
33
- # Shows a number on the ActivitySmith app icon.
32
+ # Set App Icon Badge
33
+ # Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
34
34
  # @param app_icon_badge_count_update_request [AppIconBadgeCountUpdateRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(AppIconBadgeCountUpdateResponse, Integer, Hash)>] AppIconBadgeCountUpdateResponse data, response status code and response headers
@@ -0,0 +1,100 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class DevicesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List paired devices
23
+ # Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Integer] :limit Maximum devices to return, 1 to 100. Defaults to 100. (default to 100)
26
+ # @option opts [Integer] :offset Devices to skip. Use meta.next_offset from the previous page. (default to 0)
27
+ # @option opts [Boolean] :include_inactive Include devices that can no longer receive deliveries, such as unpaired phones. (default to false)
28
+ # @return [AccountDeviceListResponse]
29
+ def list_account_devices(opts = {})
30
+ data, _status_code, _headers = list_account_devices_with_http_info(opts)
31
+ data
32
+ end
33
+
34
+ # List paired devices
35
+ # Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [Integer] :limit Maximum devices to return, 1 to 100. Defaults to 100. (default to 100)
38
+ # @option opts [Integer] :offset Devices to skip. Use meta.next_offset from the previous page. (default to 0)
39
+ # @option opts [Boolean] :include_inactive Include devices that can no longer receive deliveries, such as unpaired phones. (default to false)
40
+ # @return [Array<(AccountDeviceListResponse, Integer, Hash)>] AccountDeviceListResponse data, response status code and response headers
41
+ def list_account_devices_with_http_info(opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DevicesApi.list_account_devices ...'
44
+ end
45
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
46
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DevicesApi.list_account_devices, must be smaller than or equal to 100.'
47
+ end
48
+
49
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
50
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DevicesApi.list_account_devices, must be greater than or equal to 1.'
51
+ end
52
+
53
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
54
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling DevicesApi.list_account_devices, must be greater than or equal to 0.'
55
+ end
56
+
57
+ # resource path
58
+ local_var_path = '/account/devices'
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
63
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
64
+ query_params[:'include_inactive'] = opts[:'include_inactive'] if !opts[:'include_inactive'].nil?
65
+
66
+ # header parameters
67
+ header_params = opts[:header_params] || {}
68
+ # HTTP header 'Accept' (if needed)
69
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
70
+
71
+ # form parameters
72
+ form_params = opts[:form_params] || {}
73
+
74
+ # http body (model)
75
+ post_body = opts[:debug_body]
76
+
77
+ # return_type
78
+ return_type = opts[:debug_return_type] || 'AccountDeviceListResponse'
79
+
80
+ # auth_names
81
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
82
+
83
+ new_options = opts.merge(
84
+ :operation => :"DevicesApi.list_account_devices",
85
+ :header_params => header_params,
86
+ :query_params => query_params,
87
+ :form_params => form_params,
88
+ :body => post_body,
89
+ :auth_names => auth_names,
90
+ :return_type => return_type
91
+ )
92
+
93
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug "API called: DevicesApi#list_account_devices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
96
+ end
97
+ return data, status_code, headers
98
+ end
99
+ end
100
+ end
@@ -20,7 +20,7 @@ module OpenapiClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # End a Live Activity (legacy manual lifecycle)
23
- # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
23
+ # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
24
24
  # @param live_activity_end_request [LiveActivityEndRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [LiveActivityEndResponse]
@@ -30,7 +30,7 @@ module OpenapiClient
30
30
  end
31
31
 
32
32
  # End a Live Activity (legacy manual lifecycle)
33
- # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
33
+ # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
34
34
  # @param live_activity_end_request [LiveActivityEndRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
@@ -20,8 +20,8 @@ module OpenapiClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # Update a widget metric value
23
- # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
24
- # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
23
+ # Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
24
+ # @param key [String] Metric key. A key that has never been used creates the metric. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
25
25
  # @param metric_value_update_request [MetricValueUpdateRequest]
26
26
  # @param [Hash] opts the optional parameters
27
27
  # @return [MetricValueUpdateResponse]
@@ -31,8 +31,8 @@ module OpenapiClient
31
31
  end
32
32
 
33
33
  # Update a widget metric value
34
- # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
35
- # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
34
+ # Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
35
+ # @param key [String] Metric key. A key that has never been used creates the metric. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
36
36
  # @param metric_value_update_request [MetricValueUpdateRequest]
37
37
  # @param [Hash] opts the optional parameters
38
38
  # @return [Array<(MetricValueUpdateResponse, Integer, Hash)>] MetricValueUpdateResponse data, response status code and response headers
@@ -105,5 +105,88 @@ module OpenapiClient
105
105
  end
106
106
  return data, status_code, headers
107
107
  end
108
+
109
+ # Create or update a widget metric
110
+ # Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
111
+ # @param key [String] Metric key. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
112
+ # @param [Hash] opts the optional parameters
113
+ # @option opts [MetricUpsertRequest] :metric_upsert_request
114
+ # @return [MetricResponse]
115
+ def upsert_metric(key, opts = {})
116
+ data, _status_code, _headers = upsert_metric_with_http_info(key, opts)
117
+ data
118
+ end
119
+
120
+ # Create or update a widget metric
121
+ # Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
122
+ # @param key [String] Metric key. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
123
+ # @param [Hash] opts the optional parameters
124
+ # @option opts [MetricUpsertRequest] :metric_upsert_request
125
+ # @return [Array<(MetricResponse, Integer, Hash)>] MetricResponse data, response status code and response headers
126
+ def upsert_metric_with_http_info(key, opts = {})
127
+ if @api_client.config.debugging
128
+ @api_client.config.logger.debug 'Calling API: MetricsApi.upsert_metric ...'
129
+ end
130
+ # verify the required parameter 'key' is set
131
+ if @api_client.config.client_side_validation && key.nil?
132
+ fail ArgumentError, "Missing the required parameter 'key' when calling MetricsApi.upsert_metric"
133
+ end
134
+ if @api_client.config.client_side_validation && key.to_s.length > 64
135
+ fail ArgumentError, 'invalid value for "key" when calling MetricsApi.upsert_metric, the character length must be smaller than or equal to 64.'
136
+ end
137
+
138
+ if @api_client.config.client_side_validation && key.to_s.length < 1
139
+ fail ArgumentError, 'invalid value for "key" when calling MetricsApi.upsert_metric, the character length must be great than or equal to 1.'
140
+ end
141
+
142
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9_.-]{0,63}$/)
143
+ if @api_client.config.client_side_validation && key !~ pattern
144
+ fail ArgumentError, "invalid value for 'key' when calling MetricsApi.upsert_metric, must conform to the pattern #{pattern}."
145
+ end
146
+
147
+ # resource path
148
+ local_var_path = '/metrics/{key}'.sub('{' + 'key' + '}', CGI.escape(key.to_s))
149
+
150
+ # query parameters
151
+ query_params = opts[:query_params] || {}
152
+
153
+ # header parameters
154
+ header_params = opts[:header_params] || {}
155
+ # HTTP header 'Accept' (if needed)
156
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
157
+ # HTTP header 'Content-Type'
158
+ content_type = @api_client.select_header_content_type(['application/json'])
159
+ if !content_type.nil?
160
+ header_params['Content-Type'] = content_type
161
+ end
162
+
163
+ # form parameters
164
+ form_params = opts[:form_params] || {}
165
+
166
+ # http body (model)
167
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'metric_upsert_request'])
168
+
169
+ # return_type
170
+ return_type = opts[:debug_return_type] || 'MetricResponse'
171
+
172
+ # auth_names
173
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
174
+
175
+ new_options = opts.merge(
176
+ :operation => :"MetricsApi.upsert_metric",
177
+ :header_params => header_params,
178
+ :query_params => query_params,
179
+ :form_params => form_params,
180
+ :body => post_body,
181
+ :auth_names => auth_names,
182
+ :return_type => return_type
183
+ )
184
+
185
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
186
+ if @api_client.config.debugging
187
+ @api_client.config.logger.debug "API called: MetricsApi#upsert_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
188
+ end
189
+ return data, status_code, headers
190
+ end
108
191
  end
109
192
  end
@@ -19,8 +19,153 @@ module OpenapiClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Dismiss a push notification
23
+ # Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the `notification_id` from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \"Push Notification dismissed\" in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
24
+ # @param notification_id [String] The &#x60;notification_id&#x60; returned when the Push Notification was sent.
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [PushNotificationDismissResponse]
27
+ def dismiss_push_notification(notification_id, opts = {})
28
+ data, _status_code, _headers = dismiss_push_notification_with_http_info(notification_id, opts)
29
+ data
30
+ end
31
+
32
+ # Dismiss a push notification
33
+ # Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the &#x60;notification_id&#x60; from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \&quot;Push Notification dismissed\&quot; in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
34
+ # @param notification_id [String] The &#x60;notification_id&#x60; returned when the Push Notification was sent.
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(PushNotificationDismissResponse, Integer, Hash)>] PushNotificationDismissResponse data, response status code and response headers
37
+ def dismiss_push_notification_with_http_info(notification_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: PushNotificationsApi.dismiss_push_notification ...'
40
+ end
41
+ # verify the required parameter 'notification_id' is set
42
+ if @api_client.config.client_side_validation && notification_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling PushNotificationsApi.dismiss_push_notification"
44
+ end
45
+ if @api_client.config.client_side_validation && notification_id.to_s.length < 1
46
+ fail ArgumentError, 'invalid value for "notification_id" when calling PushNotificationsApi.dismiss_push_notification, the character length must be great than or equal to 1.'
47
+ end
48
+
49
+ # resource path
50
+ local_var_path = '/push-notification/{notification_id}/dismiss'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
59
+
60
+ # form parameters
61
+ form_params = opts[:form_params] || {}
62
+
63
+ # http body (model)
64
+ post_body = opts[:debug_body]
65
+
66
+ # return_type
67
+ return_type = opts[:debug_return_type] || 'PushNotificationDismissResponse'
68
+
69
+ # auth_names
70
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
71
+
72
+ new_options = opts.merge(
73
+ :operation => :"PushNotificationsApi.dismiss_push_notification",
74
+ :header_params => header_params,
75
+ :query_params => query_params,
76
+ :form_params => form_params,
77
+ :body => post_body,
78
+ :auth_names => auth_names,
79
+ :return_type => return_type
80
+ )
81
+
82
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: PushNotificationsApi#dismiss_push_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+
89
+ # Replace a push notification
90
+ # Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original's place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
91
+ # @param notification_id [String] The &#x60;notification_id&#x60; returned when the Push Notification was sent.
92
+ # @param push_notification_replace_request [PushNotificationReplaceRequest]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [PushNotificationReplaceResponse]
95
+ def replace_push_notification(notification_id, push_notification_replace_request, opts = {})
96
+ data, _status_code, _headers = replace_push_notification_with_http_info(notification_id, push_notification_replace_request, opts)
97
+ data
98
+ end
99
+
100
+ # Replace a push notification
101
+ # Replaces a Push Notification you already sent, using the &#x60;notification_id&#x60; from the send response. The replacement takes the original&#39;s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
102
+ # @param notification_id [String] The &#x60;notification_id&#x60; returned when the Push Notification was sent.
103
+ # @param push_notification_replace_request [PushNotificationReplaceRequest]
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [Array<(PushNotificationReplaceResponse, Integer, Hash)>] PushNotificationReplaceResponse data, response status code and response headers
106
+ def replace_push_notification_with_http_info(notification_id, push_notification_replace_request, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug 'Calling API: PushNotificationsApi.replace_push_notification ...'
109
+ end
110
+ # verify the required parameter 'notification_id' is set
111
+ if @api_client.config.client_side_validation && notification_id.nil?
112
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling PushNotificationsApi.replace_push_notification"
113
+ end
114
+ if @api_client.config.client_side_validation && notification_id.to_s.length < 1
115
+ fail ArgumentError, 'invalid value for "notification_id" when calling PushNotificationsApi.replace_push_notification, the character length must be great than or equal to 1.'
116
+ end
117
+
118
+ # verify the required parameter 'push_notification_replace_request' is set
119
+ if @api_client.config.client_side_validation && push_notification_replace_request.nil?
120
+ fail ArgumentError, "Missing the required parameter 'push_notification_replace_request' when calling PushNotificationsApi.replace_push_notification"
121
+ end
122
+ # resource path
123
+ local_var_path = '/push-notification/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
124
+
125
+ # query parameters
126
+ query_params = opts[:query_params] || {}
127
+
128
+ # header parameters
129
+ header_params = opts[:header_params] || {}
130
+ # HTTP header 'Accept' (if needed)
131
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
132
+ # HTTP header 'Content-Type'
133
+ content_type = @api_client.select_header_content_type(['application/json'])
134
+ if !content_type.nil?
135
+ header_params['Content-Type'] = content_type
136
+ end
137
+
138
+ # form parameters
139
+ form_params = opts[:form_params] || {}
140
+
141
+ # http body (model)
142
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(push_notification_replace_request)
143
+
144
+ # return_type
145
+ return_type = opts[:debug_return_type] || 'PushNotificationReplaceResponse'
146
+
147
+ # auth_names
148
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
149
+
150
+ new_options = opts.merge(
151
+ :operation => :"PushNotificationsApi.replace_push_notification",
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :form_params => form_params,
155
+ :body => post_body,
156
+ :auth_names => auth_names,
157
+ :return_type => return_type
158
+ )
159
+
160
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "API called: PushNotificationsApi#replace_push_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
163
+ end
164
+ return data, status_code, headers
165
+ end
166
+
22
167
  # Send a push notification
23
- # Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
168
+ # Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
24
169
  # @param push_notification_request [PushNotificationRequest]
25
170
  # @param [Hash] opts the optional parameters
26
171
  # @return [PushNotificationResponse]
@@ -30,7 +175,7 @@ module OpenapiClient
30
175
  end
31
176
 
32
177
  # Send a push notification
33
- # Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. &#x60;media&#x60; cannot be combined with &#x60;actions&#x60;. Optional &#x60;icon&#x60; shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional &#x60;interruption_level&#x60; sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
178
+ # Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. &#x60;media&#x60; cannot be combined with &#x60;actions&#x60;. Optional &#x60;icon&#x60; shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional &#x60;interruption_level&#x60; sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
34
179
  # @param push_notification_request [PushNotificationRequest]
35
180
  # @param [Hash] opts the optional parameters
36
181
  # @return [Array<(PushNotificationResponse, Integer, Hash)>] PushNotificationResponse data, response status code and response headers