trophy_api_client 1.2.1 → 1.4.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/admin/points/boosts/client.rb +13 -11
  4. data/lib/trophy_api_client/admin/streaks/client.rb +10 -6
  5. data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -2
  6. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +12 -4
  7. data/lib/trophy_api_client/types/achievement_response.rb +23 -11
  8. data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
  9. data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
  10. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
  11. data/lib/trophy_api_client/types/admin_issue.rb +98 -0
  12. data/lib/trophy_api_client/types/{bulk_insert_issue_level.rb → admin_issue_severity.rb} +1 -1
  13. data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
  14. data/lib/trophy_api_client/types/create_streak_freezes_response.rb +4 -4
  15. data/lib/trophy_api_client/types/delete_points_boosts_response.rb +75 -0
  16. data/lib/trophy_api_client/types/{archive_points_boosts_response.rb → deleted_resource.rb} +15 -15
  17. data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
  18. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
  19. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
  20. data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
  21. data/lib/trophy_api_client/types/points_system_response.rb +4 -4
  22. data/lib/trophy_api_client/types/points_trigger.rb +101 -9
  23. data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
  24. data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
  25. data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
  26. data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
  27. data/lib/trophy_api_client/types/restore_streaks_response.rb +4 -4
  28. data/lib/trophy_api_client/types/streak_response.rb +4 -2
  29. data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
  30. data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
  31. data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
  32. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
  33. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
  34. data/lib/trophy_api_client/version.rb +1 -1
  35. data/lib/types_export.rb +10 -9
  36. metadata +11 -10
  37. data/lib/trophy_api_client/types/bulk_insert_issue.rb +0 -74
  38. data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
  39. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
  40. data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74ccdc4a3dcbe88ed2254ca474165644225960617b4e4498f7deec3db6e209bc
4
- data.tar.gz: 5f3cc5a4aa340463de78a5cdad7f043e56960cd5a9cdf50eb03c86934549d7e3
3
+ metadata.gz: 7604c5f6f0a271ed7eae0b4878f29932ba518ac374f61c0854a4c5afb5a58c6d
4
+ data.tar.gz: 5b8a86b550c0aba78eb4edae772cfd3799f4108727eb2acac4770e9358fc7c41
5
5
  SHA512:
6
- metadata.gz: d9176a0b52777a98068243e21bf0d891fe3035b3643cb54dc9514f359c4198186197492fef8b664e911b5dba3b8d81c2f66c11501a23270a653919fa3dd500bb
7
- data.tar.gz: 9b870ec63aa0b1cf14cd716ed095f0b252672b415f6d11ff992cb948867059794f216c8b0dd5e28d3da2c4ae33e1e569d1e31a59dc124d36159e70e00db51259
6
+ metadata.gz: f31395b433ab72efbd23a45a2e8dbda31c6ba589841e2d3eae7260f5744831948f3460d810cce0e91035c87ac112e47b1abbddc78b5ea9360c745169d364a61f
7
+ data.tar.gz: 92f5324cb1d892cacdda6303f7617d52e70eb17a3e41df09c93041dc90437eefd9637911fe3da12bc70e31e481c09800845c268084eb9bce03d195920959fae0
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.2.1"
5
+ VERSION = "1.4.0"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -3,7 +3,7 @@
3
3
  require_relative "../../../../requests"
4
4
  require_relative "types/create_points_boosts_request_boosts_item"
5
5
  require_relative "../../../types/create_points_boosts_response"
6
- require_relative "../../../types/archive_points_boosts_response"
6
+ require_relative "../../../types/delete_points_boosts_response"
7
7
  require "async"
8
8
 
9
9
  module TrophyApiClient
@@ -22,7 +22,7 @@ module TrophyApiClient
22
22
  # Create points boosts for multiple users.
23
23
  #
24
24
  # @param system_key [String] The key of the points system to create boosts for.
25
- # @param boosts [Array<Hash>] Array of boosts to create. Maximum 1,000 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
25
+ # @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
26
26
  # * :user_id (String)
27
27
  # * :name (String)
28
28
  # * :start (String)
@@ -64,7 +64,7 @@ module TrophyApiClient
64
64
  #
65
65
  # @param ids [String] A list of up to 100 boost IDs.
66
66
  # @param request_options [TrophyApiClient::RequestOptions]
67
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
67
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
68
68
  # @example
69
69
  # api = TrophyApiClient::Client.new(
70
70
  # base_url: "https://api.example.com",
@@ -87,14 +87,14 @@ module TrophyApiClient
87
87
  end
88
88
  req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
89
89
  end
90
- TrophyApiClient::ArchivePointsBoostsResponse.from_json(json_object: response.body)
90
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
91
91
  end
92
92
 
93
93
  # Archive a points boost by ID.
94
94
  #
95
95
  # @param id [String] The UUID of the points boost to archive
96
96
  # @param request_options [TrophyApiClient::RequestOptions]
97
- # @return [Void]
97
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
98
98
  # @example
99
99
  # api = TrophyApiClient::Client.new(
100
100
  # base_url: "https://api.example.com",
@@ -103,7 +103,7 @@ module TrophyApiClient
103
103
  # )
104
104
  # api.admin.points.boosts.archive(id: "id")
105
105
  def archive(id:, request_options: nil)
106
- @request_client.conn.delete do |req|
106
+ response = @request_client.conn.delete do |req|
107
107
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
108
108
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
109
109
  req.headers = {
@@ -120,6 +120,7 @@ module TrophyApiClient
120
120
  req.url "#{@request_client.get_url(environment: admin,
121
121
  request_options: request_options)}/points/boosts/#{id}"
122
122
  end
123
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
123
124
  end
124
125
  end
125
126
 
@@ -136,7 +137,7 @@ module TrophyApiClient
136
137
  # Create points boosts for multiple users.
137
138
  #
138
139
  # @param system_key [String] The key of the points system to create boosts for.
139
- # @param boosts [Array<Hash>] Array of boosts to create. Maximum 1,000 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
140
+ # @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
140
141
  # * :user_id (String)
141
142
  # * :name (String)
142
143
  # * :start (String)
@@ -180,7 +181,7 @@ module TrophyApiClient
180
181
  #
181
182
  # @param ids [String] A list of up to 100 boost IDs.
182
183
  # @param request_options [TrophyApiClient::RequestOptions]
183
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
184
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
184
185
  # @example
185
186
  # api = TrophyApiClient::Client.new(
186
187
  # base_url: "https://api.example.com",
@@ -204,7 +205,7 @@ module TrophyApiClient
204
205
  end
205
206
  req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
206
207
  end
207
- TrophyApiClient::ArchivePointsBoostsResponse.from_json(json_object: response.body)
208
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
208
209
  end
209
210
  end
210
211
 
@@ -212,7 +213,7 @@ module TrophyApiClient
212
213
  #
213
214
  # @param id [String] The UUID of the points boost to archive
214
215
  # @param request_options [TrophyApiClient::RequestOptions]
215
- # @return [Void]
216
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
216
217
  # @example
217
218
  # api = TrophyApiClient::Client.new(
218
219
  # base_url: "https://api.example.com",
@@ -222,7 +223,7 @@ module TrophyApiClient
222
223
  # api.admin.points.boosts.archive(id: "id")
223
224
  def archive(id:, request_options: nil)
224
225
  Async do
225
- @request_client.conn.delete do |req|
226
+ response = @request_client.conn.delete do |req|
226
227
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
227
228
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
228
229
  req.headers = {
@@ -239,6 +240,7 @@ module TrophyApiClient
239
240
  req.url "#{@request_client.get_url(environment: admin,
240
241
  request_options: request_options)}/points/boosts/#{id}"
241
242
  end
243
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
242
244
  end
243
245
  end
244
246
  end
@@ -17,9 +17,11 @@ module TrophyApiClient
17
17
  @request_client = request_client
18
18
  end
19
19
 
20
- # Restore streaks for multiple users to the maximum length in the last 90 days (in
21
- # the case of daily streaks), one year (in the case of weekly streaks), or two
22
- # years (in the case of monthly streaks).
20
+ # Restore streaks for multiple users to the maximum previously achieved streak
21
+ # length found within the current restore window: the last 90 days for daily
22
+ # streaks, weekly periods starting with the week containing the start of the
23
+ # current calendar year for weekly streaks, and monthly periods starting at the
24
+ # beginning of the previous calendar year for monthly streaks.
23
25
  #
24
26
  # @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
25
27
  # * :id (String)
@@ -61,9 +63,11 @@ module TrophyApiClient
61
63
  @request_client = request_client
62
64
  end
63
65
 
64
- # Restore streaks for multiple users to the maximum length in the last 90 days (in
65
- # the case of daily streaks), one year (in the case of weekly streaks), or two
66
- # years (in the case of monthly streaks).
66
+ # Restore streaks for multiple users to the maximum previously achieved streak
67
+ # length found within the current restore window: the last 90 days for daily
68
+ # streaks, weekly periods starting with the week containing the start of the
69
+ # current calendar year for weekly streaks, and monthly periods starting at the
70
+ # beginning of the previous calendar year for monthly streaks.
67
71
  #
68
72
  # @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
69
73
  # * :id (String)
@@ -20,7 +20,7 @@ module TrophyApiClient
20
20
 
21
21
  # Create streak freezes for multiple users.
22
22
  #
23
- # @param freezes [Array<Hash>] Array of freezes to create. Maximum 1,000 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
23
+ # @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
24
24
  # * :user_id (String)
25
25
  # @param request_options [TrophyApiClient::RequestOptions]
26
26
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
@@ -62,7 +62,7 @@ module TrophyApiClient
62
62
 
63
63
  # Create streak freezes for multiple users.
64
64
  #
65
- # @param freezes [Array<Hash>] Array of freezes to create. Maximum 1,000 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
65
+ # @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
66
66
  # * :user_id (String)
67
67
  # @param request_options [TrophyApiClient::RequestOptions]
68
68
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
@@ -19,8 +19,10 @@ module TrophyApiClient
19
19
  attr_reader :key
20
20
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
21
21
  attr_reader :rank_by
22
- # @return [String] The key of the attribute to break down this leaderboard by.
22
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
23
23
  attr_reader :breakdown_attribute
24
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
25
+ attr_reader :breakdown_attributes
24
26
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
25
27
  attr_reader :metric_key
26
28
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -57,7 +59,8 @@ module TrophyApiClient
57
59
  # @param name [String] The user-facing name of the leaderboard.
58
60
  # @param key [String] The unique key used to reference the leaderboard in APIs.
59
61
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
60
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
62
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
63
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
61
64
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
62
65
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
63
66
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -73,14 +76,15 @@ module TrophyApiClient
73
76
  # type. Null for one-time leaderboards.
74
77
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
75
78
  # @return [TrophyApiClient::Leaderboards::LeaderboardsAllResponseItem]
76
- def initialize(status:, id:, name:, key:, rank_by:, start:, max_participants:, breakdown_attribute: OMIT, metric_key: OMIT,
77
- metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
79
+ def initialize(status:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, breakdown_attribute: OMIT,
80
+ metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
78
81
  @status = status
79
82
  @id = id
80
83
  @name = name
81
84
  @key = key
82
85
  @rank_by = rank_by
83
86
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
87
+ @breakdown_attributes = breakdown_attributes
84
88
  @metric_key = metric_key if metric_key != OMIT
85
89
  @metric_name = metric_name if metric_name != OMIT
86
90
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -99,6 +103,7 @@ module TrophyApiClient
99
103
  "key": key,
100
104
  "rankBy": rank_by,
101
105
  "breakdownAttribute": breakdown_attribute,
106
+ "breakdownAttributes": breakdown_attributes,
102
107
  "metricKey": metric_key,
103
108
  "metricName": metric_name,
104
109
  "pointsSystemKey": points_system_key,
@@ -127,6 +132,7 @@ module TrophyApiClient
127
132
  key = parsed_json["key"]
128
133
  rank_by = parsed_json["rankBy"]
129
134
  breakdown_attribute = parsed_json["breakdownAttribute"]
135
+ breakdown_attributes = parsed_json["breakdownAttributes"]
130
136
  metric_key = parsed_json["metricKey"]
131
137
  metric_name = parsed_json["metricName"]
132
138
  points_system_key = parsed_json["pointsSystemKey"]
@@ -144,6 +150,7 @@ module TrophyApiClient
144
150
  key: key,
145
151
  rank_by: rank_by,
146
152
  breakdown_attribute: breakdown_attribute,
153
+ breakdown_attributes: breakdown_attributes,
147
154
  metric_key: metric_key,
148
155
  metric_name: metric_name,
149
156
  points_system_key: points_system_key,
@@ -178,6 +185,7 @@ module TrophyApiClient
178
185
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
179
186
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
180
187
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
188
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
181
189
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
182
190
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
183
191
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -3,6 +3,7 @@
3
3
  require_relative "achievement_response_trigger"
4
4
  require_relative "achievement_response_user_attributes_item"
5
5
  require_relative "achievement_response_event_attribute"
6
+ require_relative "achievement_response_event_attributes_item"
6
7
  require "ostruct"
7
8
  require "json"
8
9
 
@@ -37,11 +38,13 @@ module TrophyApiClient
37
38
  # trigger = 'metric')
38
39
  attr_reader :metric_name
39
40
  # @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
40
- # Only present if the achievement has user attribute filters configured.
41
41
  attr_reader :user_attributes
42
- # @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
43
- # Only present if the achievement has an event filter configured.
42
+ # @return [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
43
+ # completed. Only present if the achievement has an event filter configured.
44
44
  attr_reader :event_attribute
45
+ # @return [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
46
+ # Omitted for non-metric achievements.
47
+ attr_reader :event_attributes
45
48
  # @return [OpenStruct] Additional properties unmapped to the current class definition
46
49
  attr_reader :additional_properties
47
50
  # @return [Object]
@@ -68,13 +71,14 @@ module TrophyApiClient
68
71
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
69
72
  # trigger = 'metric')
70
73
  # @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
71
- # Only present if the achievement has user attribute filters configured.
72
- # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
73
- # Only present if the achievement has an event filter configured.
74
+ # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
75
+ # completed. Only present if the achievement has an event filter configured.
76
+ # @param event_attributes [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
77
+ # Omitted for non-metric achievements.
74
78
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
75
79
  # @return [TrophyApiClient::AchievementResponse]
76
- def initialize(id:, name:, trigger:, description: OMIT, badge_url: OMIT, key: OMIT, streak_length: OMIT,
77
- achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
80
+ def initialize(id:, name:, trigger:, user_attributes:, description: OMIT, badge_url: OMIT, key: OMIT, streak_length: OMIT,
81
+ achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
78
82
  @id = id
79
83
  @name = name
80
84
  @trigger = trigger
@@ -86,8 +90,9 @@ module TrophyApiClient
86
90
  @metric_id = metric_id if metric_id != OMIT
87
91
  @metric_value = metric_value if metric_value != OMIT
88
92
  @metric_name = metric_name if metric_name != OMIT
89
- @user_attributes = user_attributes if user_attributes != OMIT
93
+ @user_attributes = user_attributes
90
94
  @event_attribute = event_attribute if event_attribute != OMIT
95
+ @event_attributes = event_attributes if event_attributes != OMIT
91
96
  @additional_properties = additional_properties
92
97
  @_field_set = {
93
98
  "id": id,
@@ -102,7 +107,8 @@ module TrophyApiClient
102
107
  "metricValue": metric_value,
103
108
  "metricName": metric_name,
104
109
  "userAttributes": user_attributes,
105
- "eventAttribute": event_attribute
110
+ "eventAttribute": event_attribute,
111
+ "eventAttributes": event_attributes
106
112
  }.reject do |_k, v|
107
113
  v == OMIT
108
114
  end
@@ -136,6 +142,10 @@ module TrophyApiClient
136
142
  event_attribute = parsed_json["eventAttribute"].to_json
137
143
  event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
138
144
  end
145
+ event_attributes = parsed_json["eventAttributes"]&.map do |item|
146
+ item = item.to_json
147
+ TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
148
+ end
139
149
  new(
140
150
  id: id,
141
151
  name: name,
@@ -150,6 +160,7 @@ module TrophyApiClient
150
160
  metric_name: metric_name,
151
161
  user_attributes: user_attributes,
152
162
  event_attribute: event_attribute,
163
+ event_attributes: event_attributes,
153
164
  additional_properties: struct
154
165
  )
155
166
  end
@@ -179,8 +190,9 @@ module TrophyApiClient
179
190
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
180
191
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
181
192
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
182
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
193
+ obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
183
194
  obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
195
+ obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
184
196
  end
185
197
  end
186
198
  end
@@ -4,8 +4,8 @@ require "ostruct"
4
4
  require "json"
5
5
 
6
6
  module TrophyApiClient
7
- # Event attribute filter that must be met for this achievement to be completed.
8
- # Only present if the achievement has an event filter configured.
7
+ # Deprecated. Event attribute filter that must be met for this achievement to be
8
+ # completed. Only present if the achievement has an event filter configured.
9
9
  class AchievementResponseEventAttribute
10
10
  # @return [String] The key of the event attribute.
11
11
  attr_reader :key
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ class AchievementResponseEventAttributesItem
8
+ # @return [String] The key of the event attribute.
9
+ attr_reader :key
10
+ # @return [String] The value of the event attribute.
11
+ attr_reader :value
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param key [String] The key of the event attribute.
21
+ # @param value [String] The value of the event attribute.
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [TrophyApiClient::AchievementResponseEventAttributesItem]
24
+ def initialize(key:, value:, additional_properties: nil)
25
+ @key = key
26
+ @value = value
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "key": key, "value": value }
29
+ end
30
+
31
+ # Deserialize a JSON object to an instance of
32
+ # AchievementResponseEventAttributesItem
33
+ #
34
+ # @param json_object [String]
35
+ # @return [TrophyApiClient::AchievementResponseEventAttributesItem]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ key = parsed_json["key"]
40
+ value = parsed_json["value"]
41
+ new(
42
+ key: key,
43
+ value: value,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of AchievementResponseEventAttributesItem to a JSON object
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ @_field_set&.to_json
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
63
+ obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
@@ -3,6 +3,7 @@
3
3
  require_relative "achievement_response_trigger"
4
4
  require_relative "achievement_response_user_attributes_item"
5
5
  require_relative "achievement_response_event_attribute"
6
+ require_relative "achievement_response_event_attributes_item"
6
7
  require "ostruct"
7
8
  require "json"
8
9
 
@@ -41,11 +42,13 @@ module TrophyApiClient
41
42
  # trigger = 'metric')
42
43
  attr_reader :metric_name
43
44
  # @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
44
- # Only present if the achievement has user attribute filters configured.
45
45
  attr_reader :user_attributes
46
- # @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
47
- # Only present if the achievement has an event filter configured.
46
+ # @return [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
47
+ # completed. Only present if the achievement has an event filter configured.
48
48
  attr_reader :event_attribute
49
+ # @return [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
50
+ # Omitted for non-metric achievements.
51
+ attr_reader :event_attributes
49
52
  # @return [OpenStruct] Additional properties unmapped to the current class definition
50
53
  attr_reader :additional_properties
51
54
  # @return [Object]
@@ -74,13 +77,14 @@ module TrophyApiClient
74
77
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
75
78
  # trigger = 'metric')
76
79
  # @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
77
- # Only present if the achievement has user attribute filters configured.
78
- # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
79
- # Only present if the achievement has an event filter configured.
80
+ # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
81
+ # completed. Only present if the achievement has an event filter configured.
82
+ # @param event_attributes [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
83
+ # Omitted for non-metric achievements.
80
84
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
81
85
  # @return [TrophyApiClient::AchievementWithStatsResponse]
82
- def initialize(completions:, rarity:, id:, name:, trigger:, description: OMIT, badge_url: OMIT, key: OMIT,
83
- streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
86
+ def initialize(completions:, rarity:, id:, name:, trigger:, user_attributes:, description: OMIT, badge_url: OMIT, key: OMIT,
87
+ streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
84
88
  @completions = completions
85
89
  @rarity = rarity
86
90
  @id = id
@@ -94,8 +98,9 @@ module TrophyApiClient
94
98
  @metric_id = metric_id if metric_id != OMIT
95
99
  @metric_value = metric_value if metric_value != OMIT
96
100
  @metric_name = metric_name if metric_name != OMIT
97
- @user_attributes = user_attributes if user_attributes != OMIT
101
+ @user_attributes = user_attributes
98
102
  @event_attribute = event_attribute if event_attribute != OMIT
103
+ @event_attributes = event_attributes if event_attributes != OMIT
99
104
  @additional_properties = additional_properties
100
105
  @_field_set = {
101
106
  "completions": completions,
@@ -112,7 +117,8 @@ module TrophyApiClient
112
117
  "metricValue": metric_value,
113
118
  "metricName": metric_name,
114
119
  "userAttributes": user_attributes,
115
- "eventAttribute": event_attribute
120
+ "eventAttribute": event_attribute,
121
+ "eventAttributes": event_attributes
116
122
  }.reject do |_k, v|
117
123
  v == OMIT
118
124
  end
@@ -148,6 +154,10 @@ module TrophyApiClient
148
154
  event_attribute = parsed_json["eventAttribute"].to_json
149
155
  event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
150
156
  end
157
+ event_attributes = parsed_json["eventAttributes"]&.map do |item|
158
+ item = item.to_json
159
+ TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
160
+ end
151
161
  new(
152
162
  completions: completions,
153
163
  rarity: rarity,
@@ -164,6 +174,7 @@ module TrophyApiClient
164
174
  metric_name: metric_name,
165
175
  user_attributes: user_attributes,
166
176
  event_attribute: event_attribute,
177
+ event_attributes: event_attributes,
167
178
  additional_properties: struct
168
179
  )
169
180
  end
@@ -195,8 +206,9 @@ module TrophyApiClient
195
206
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
196
207
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
197
208
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
198
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
209
+ obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
199
210
  obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
211
+ obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
200
212
  end
201
213
  end
202
214
  end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_issue_severity"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module TrophyApiClient
8
+ # An issue encountered while processing an item in an admin API request.
9
+ class AdminIssue
10
+ # @return [String] The ID of the user the issue relates to, when applicable.
11
+ attr_reader :user_id
12
+ # @return [String] The ID of the points boost the issue relates to, when applicable.
13
+ attr_reader :boost_id
14
+ # @return [Integer] The zero-based index of the item the issue relates to, when no resource ID
15
+ # exists yet.
16
+ attr_reader :index
17
+ # @return [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
18
+ attr_reader :severity
19
+ # @return [String] A human-readable description of the issue.
20
+ attr_reader :message
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param user_id [String] The ID of the user the issue relates to, when applicable.
30
+ # @param boost_id [String] The ID of the points boost the issue relates to, when applicable.
31
+ # @param index [Integer] The zero-based index of the item the issue relates to, when no resource ID
32
+ # exists yet.
33
+ # @param severity [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
34
+ # @param message [String] A human-readable description of the issue.
35
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
36
+ # @return [TrophyApiClient::AdminIssue]
37
+ def initialize(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil)
38
+ @user_id = user_id if user_id != OMIT
39
+ @boost_id = boost_id if boost_id != OMIT
40
+ @index = index if index != OMIT
41
+ @severity = severity
42
+ @message = message
43
+ @additional_properties = additional_properties
44
+ @_field_set = {
45
+ "userId": user_id,
46
+ "boostId": boost_id,
47
+ "index": index,
48
+ "severity": severity,
49
+ "message": message
50
+ }.reject do |_k, v|
51
+ v == OMIT
52
+ end
53
+ end
54
+
55
+ # Deserialize a JSON object to an instance of AdminIssue
56
+ #
57
+ # @param json_object [String]
58
+ # @return [TrophyApiClient::AdminIssue]
59
+ def self.from_json(json_object:)
60
+ struct = JSON.parse(json_object, object_class: OpenStruct)
61
+ parsed_json = JSON.parse(json_object)
62
+ user_id = parsed_json["userId"]
63
+ boost_id = parsed_json["boostId"]
64
+ index = parsed_json["index"]
65
+ severity = parsed_json["severity"]
66
+ message = parsed_json["message"]
67
+ new(
68
+ user_id: user_id,
69
+ boost_id: boost_id,
70
+ index: index,
71
+ severity: severity,
72
+ message: message,
73
+ additional_properties: struct
74
+ )
75
+ end
76
+
77
+ # Serialize an instance of AdminIssue to a JSON object
78
+ #
79
+ # @return [String]
80
+ def to_json(*_args)
81
+ @_field_set&.to_json
82
+ end
83
+
84
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
85
+ # hash and check each fields type against the current object's property
86
+ # definitions.
87
+ #
88
+ # @param obj [Object]
89
+ # @return [Void]
90
+ def self.validate_raw(obj:)
91
+ obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
92
+ obj.boost_id&.is_a?(String) != false || raise("Passed value for field obj.boost_id is not the expected type, validation failed.")
93
+ obj.index&.is_a?(Integer) != false || raise("Passed value for field obj.index is not the expected type, validation failed.")
94
+ obj.severity.is_a?(TrophyApiClient::AdminIssueSeverity) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.")
95
+ obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
96
+ end
97
+ end
98
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  # The severity level of the issue.
5
- class BulkInsertIssueLevel
5
+ class AdminIssueSeverity
6
6
  ERROR = "error"
7
7
  WARNING = "warning"
8
8
  end