activitysmith 1.10.0 → 1.12.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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +273 -254
  3. data/generated/activitysmith_openapi/api/live_activities_api.rb +10 -10
  4. data/generated/activitysmith_openapi/api/metrics_api.rb +2 -2
  5. data/generated/activitysmith_openapi/configuration.rb +7 -0
  6. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb +386 -0
  7. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +33 -11
  8. data/generated/activitysmith_openapi/models/content_state_end.rb +8 -8
  9. data/generated/activitysmith_openapi/models/content_state_start.rb +8 -8
  10. data/generated/activitysmith_openapi/models/content_state_update.rb +8 -8
  11. data/generated/activitysmith_openapi/models/live_activity_action.rb +23 -1
  12. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +64 -2
  13. data/generated/activitysmith_openapi/models/live_activity_limit_error.rb +25 -5
  14. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +33 -2
  15. data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +45 -2
  16. data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +33 -2
  17. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +64 -2
  18. data/generated/activitysmith_openapi/models/live_activity_value.rb +106 -0
  19. data/generated/activitysmith_openapi/models/metadata_value.rb +106 -0
  20. data/generated/activitysmith_openapi/models/push_notification_action.rb +23 -1
  21. data/generated/activitysmith_openapi/models/push_notification_request.rb +45 -5
  22. data/generated/activitysmith_openapi/models/rate_limit_error.rb +44 -1
  23. data/generated/activitysmith_openapi/models/stream_content_state.rb +8 -8
  24. data/generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb +105 -0
  25. data/generated/activitysmith_openapi/version.rb +1 -1
  26. data/generated/activitysmith_openapi.rb +4 -0
  27. data/generated/openapi-source.json +6 -0
  28. data/lib/activitysmith/live_activities.rb +7 -6
  29. data/lib/activitysmith/version.rb +1 -1
  30. metadata +7 -2
@@ -15,13 +15,38 @@ require 'time'
15
15
 
16
16
  module OpenapiClient
17
17
  class RateLimitError
18
+ attr_accessor :code
19
+
18
20
  attr_accessor :error
19
21
 
20
22
  attr_accessor :message
21
23
 
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
22
46
  # Attribute mapping from ruby-style variable name to JSON key.
23
47
  def self.attribute_map
24
48
  {
49
+ :'code' => :'code',
25
50
  :'error' => :'error',
26
51
  :'message' => :'message'
27
52
  }
@@ -35,6 +60,7 @@ module OpenapiClient
35
60
  # Attribute type mapping.
36
61
  def self.openapi_types
37
62
  {
63
+ :'code' => :'String',
38
64
  :'error' => :'String',
39
65
  :'message' => :'String'
40
66
  }
@@ -61,6 +87,10 @@ module OpenapiClient
61
87
  h[k.to_sym] = v
62
88
  }
63
89
 
90
+ if attributes.key?(:'code')
91
+ self.code = attributes[:'code']
92
+ end
93
+
64
94
  if attributes.key?(:'error')
65
95
  self.error = attributes[:'error']
66
96
  else
@@ -94,16 +124,29 @@ module OpenapiClient
94
124
  # @return true if the model is valid
95
125
  def valid?
96
126
  warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ code_validator = EnumAttributeValidator.new('String', ["rate_limited"])
128
+ return false unless code_validator.valid?(@code)
97
129
  return false if @error.nil?
98
130
  return false if @message.nil?
99
131
  true
100
132
  end
101
133
 
134
+ # Custom attribute writer method checking allowed values (enum).
135
+ # @param [Object] code Object to be assigned
136
+ def code=(code)
137
+ validator = EnumAttributeValidator.new('String', ["rate_limited"])
138
+ unless validator.valid?(code)
139
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
140
+ end
141
+ @code = code
142
+ end
143
+
102
144
  # Checks equality by comparing each attribute.
103
145
  # @param [Object] Object to be compared
104
146
  def ==(o)
105
147
  return true if self.equal?(o)
106
148
  self.class == o.class &&
149
+ code == o.code &&
107
150
  error == o.error &&
108
151
  message == o.message
109
152
  end
@@ -117,7 +160,7 @@ module OpenapiClient
117
160
  # Calculates hash code according to all attributes.
118
161
  # @return [Integer] Hash code
119
162
  def hash
120
- [error, message].hash
163
+ [code, error, message].hash
121
164
  end
122
165
 
123
166
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, and timer types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window.
17
+ # Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window.
18
18
  class StreamContentState
19
19
  attr_accessor :title
20
20
 
@@ -29,7 +29,7 @@ module OpenapiClient
29
29
  # Use for progress. Takes precedence over value/upper_limit if both are provided.
30
30
  attr_accessor :percentage
31
31
 
32
- # Current progress value. Use with upper_limit for progress.
32
+ # For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For progress, a numeric progress value used with upper_limit.
33
33
  attr_accessor :value
34
34
 
35
35
  # Maximum progress value. Use with value for progress.
@@ -47,7 +47,7 @@ module OpenapiClient
47
47
  # Required on the first PUT or whenever the stream cannot infer the current activity type.
48
48
  attr_accessor :type
49
49
 
50
- # Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.
50
+ # Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.
51
51
  attr_accessor :color
52
52
 
53
53
  # Optional. Overrides color for the current step. Only applies to segmented_progress.
@@ -62,10 +62,10 @@ module OpenapiClient
62
62
  # Required for type=alert.
63
63
  attr_accessor :message
64
64
 
65
- # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer.
65
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value.
66
66
  attr_accessor :icon
67
67
 
68
- # Optional badge. Supported by alert, progress, and segmented_progress.
68
+ # Optional badge. Supported by alert, progress, segmented_progress, and value.
69
69
  attr_accessor :badge
70
70
 
71
71
  # Optional. Seconds before the ended Live Activity is dismissed.
@@ -135,7 +135,7 @@ module OpenapiClient
135
135
  :'number_of_steps' => :'Integer',
136
136
  :'current_step' => :'Integer',
137
137
  :'percentage' => :'Float',
138
- :'value' => :'Float',
138
+ :'value' => :'LiveActivityValue',
139
139
  :'upper_limit' => :'Float',
140
140
  :'duration_seconds' => :'Float',
141
141
  :'counts_down' => :'Boolean',
@@ -322,7 +322,7 @@ module OpenapiClient
322
322
  return false if !@current_step.nil? && @current_step < 0
323
323
  return false if !@percentage.nil? && @percentage > 100
324
324
  return false if !@percentage.nil? && @percentage < 0
325
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
325
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
326
326
  return false unless type_validator.valid?(@type)
327
327
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
328
328
  return false unless color_validator.valid?(@color)
@@ -385,7 +385,7 @@ module OpenapiClient
385
385
  # Custom attribute writer method checking allowed values (enum).
386
386
  # @param [Object] type Object to be assigned
387
387
  def type=(type)
388
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
388
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
389
389
  unless validator.valid?(type)
390
390
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
391
391
  end
@@ -0,0 +1,105 @@
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 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ module UpdateAppIconBadgeCount422Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'AppIconBadgeCountUpdateError',
23
+ :'NoRecipientsError'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = OpenapiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -11,5 +11,5 @@ Generator version: 7.7.0
11
11
  =end
12
12
 
13
13
  module OpenapiClient
14
- VERSION = '1.10.0'
14
+ VERSION = '1.12.0'
15
15
  end
@@ -20,6 +20,7 @@ require 'activitysmith_openapi/configuration'
20
20
  require 'activitysmith_openapi/models/activity_metric'
21
21
  require 'activitysmith_openapi/models/activity_metric_value'
22
22
  require 'activitysmith_openapi/models/alert_payload'
23
+ require 'activitysmith_openapi/models/app_icon_badge_count_update_error'
23
24
  require 'activitysmith_openapi/models/app_icon_badge_count_update_request'
24
25
  require 'activitysmith_openapi/models/app_icon_badge_count_update_response'
25
26
  require 'activitysmith_openapi/models/bad_request_error'
@@ -44,7 +45,9 @@ require 'activitysmith_openapi/models/live_activity_stream_put_response'
44
45
  require 'activitysmith_openapi/models/live_activity_stream_request'
45
46
  require 'activitysmith_openapi/models/live_activity_update_request'
46
47
  require 'activitysmith_openapi/models/live_activity_update_response'
48
+ require 'activitysmith_openapi/models/live_activity_value'
47
49
  require 'activitysmith_openapi/models/live_activity_webhook_method'
50
+ require 'activitysmith_openapi/models/metadata_value'
48
51
  require 'activitysmith_openapi/models/metric_error'
49
52
  require 'activitysmith_openapi/models/metric_value_update_request'
50
53
  require 'activitysmith_openapi/models/metric_value_update_request_value'
@@ -59,6 +62,7 @@ require 'activitysmith_openapi/models/push_notification_webhook_method'
59
62
  require 'activitysmith_openapi/models/rate_limit_error'
60
63
  require 'activitysmith_openapi/models/send_push_notification429_response'
61
64
  require 'activitysmith_openapi/models/stream_content_state'
65
+ require 'activitysmith_openapi/models/update_app_icon_badge_count422_response'
62
66
 
63
67
  # APIs
64
68
  require 'activitysmith_openapi/api/app_icon_badges_api'
@@ -0,0 +1,6 @@
1
+ {
2
+ "repository": "ActivitySmithHQ/activitysmith-backend",
3
+ "commit": "6832df646de7de8a6aaf0110960c37074b513c48",
4
+ "path": "openapi.json",
5
+ "sha256": "9ae85ad6127cfa2d50c33261459f5f9e85e011939d01ac4a9d507fa6ed11aa61"
6
+ }
@@ -8,6 +8,7 @@ module ActivitySmith
8
8
  TYPE_STATS = "stats"
9
9
  TYPE_ALERT = "alert"
10
10
  TYPE_TIMER = "timer"
11
+ TYPE_VALUE = "value"
11
12
 
12
13
  class << self
13
14
  def content_state(title:, type: nil, subtitle: nil, message: nil, icon: nil, badge: nil, color: nil, duration_seconds: nil, counts_down: nil, **fields)
@@ -47,12 +48,12 @@ module ActivitySmith
47
48
  )
48
49
  end
49
50
 
50
- def update(request, opts = {})
51
- @api.update_live_activity(normalize_live_activity_request(request), opts)
51
+ def update(request = nil, opts = {}, tags: nil, **request_fields)
52
+ @api.update_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
52
53
  end
53
54
 
54
- def end(request, opts = {})
55
- @api.end_live_activity(normalize_live_activity_request(request), opts)
55
+ def end(request = nil, opts = {}, tags: nil, **request_fields)
56
+ @api.end_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
56
57
  end
57
58
 
58
59
  def stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
@@ -65,10 +66,10 @@ module ActivitySmith
65
66
  )
66
67
  end
67
68
 
68
- def end_stream(stream_key, request = nil, opts = {})
69
+ def end_stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
69
70
  @api.end_live_activity_stream(
70
71
  stream_key,
71
- { live_activity_stream_delete_request: normalize_live_activity_request(request) }.merge(opts)
72
+ { live_activity_stream_delete_request: normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)) }.merge(opts)
72
73
  )
73
74
  end
74
75
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivitySmith
4
- VERSION = "1.10.0"
4
+ VERSION = "1.12.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activitysmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ActivitySmith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-25 00:00:00.000000000 Z
11
+ date: 2026-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -86,6 +86,7 @@ files:
86
86
  - generated/activitysmith_openapi/models/activity_metric.rb
87
87
  - generated/activitysmith_openapi/models/activity_metric_value.rb
88
88
  - generated/activitysmith_openapi/models/alert_payload.rb
89
+ - generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb
89
90
  - generated/activitysmith_openapi/models/app_icon_badge_count_update_request.rb
90
91
  - generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb
91
92
  - generated/activitysmith_openapi/models/bad_request_error.rb
@@ -110,7 +111,9 @@ files:
110
111
  - generated/activitysmith_openapi/models/live_activity_stream_request.rb
111
112
  - generated/activitysmith_openapi/models/live_activity_update_request.rb
112
113
  - generated/activitysmith_openapi/models/live_activity_update_response.rb
114
+ - generated/activitysmith_openapi/models/live_activity_value.rb
113
115
  - generated/activitysmith_openapi/models/live_activity_webhook_method.rb
116
+ - generated/activitysmith_openapi/models/metadata_value.rb
114
117
  - generated/activitysmith_openapi/models/metric_error.rb
115
118
  - generated/activitysmith_openapi/models/metric_value_update_request.rb
116
119
  - generated/activitysmith_openapi/models/metric_value_update_request_value.rb
@@ -125,7 +128,9 @@ files:
125
128
  - generated/activitysmith_openapi/models/rate_limit_error.rb
126
129
  - generated/activitysmith_openapi/models/send_push_notification429_response.rb
127
130
  - generated/activitysmith_openapi/models/stream_content_state.rb
131
+ - generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb
128
132
  - generated/activitysmith_openapi/version.rb
133
+ - generated/openapi-source.json
129
134
  - lib/activitysmith.rb
130
135
  - lib/activitysmith/client.rb
131
136
  - lib/activitysmith/live_activities.rb