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.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/admin/points/boosts/client.rb +13 -11
- data/lib/trophy_api_client/admin/streaks/client.rb +10 -6
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -2
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +12 -4
- data/lib/trophy_api_client/types/achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
- data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/admin_issue.rb +98 -0
- data/lib/trophy_api_client/types/{bulk_insert_issue_level.rb → admin_issue_severity.rb} +1 -1
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
- data/lib/trophy_api_client/types/create_streak_freezes_response.rb +4 -4
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +75 -0
- data/lib/trophy_api_client/types/{archive_points_boosts_response.rb → deleted_resource.rb} +15 -15
- data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
- data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
- data/lib/trophy_api_client/types/points_system_response.rb +4 -4
- data/lib/trophy_api_client/types/points_trigger.rb +101 -9
- data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
- data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
- data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
- data/lib/trophy_api_client/types/restore_streaks_response.rb +4 -4
- data/lib/trophy_api_client/types/streak_response.rb +4 -2
- data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +10 -9
- metadata +11 -10
- data/lib/trophy_api_client/types/bulk_insert_issue.rb +0 -74
- data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
- data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "points_trigger_type"
|
|
4
|
+
require_relative "points_trigger_status"
|
|
4
5
|
require_relative "points_trigger_time_unit"
|
|
6
|
+
require_relative "points_trigger_user_attributes_item"
|
|
7
|
+
require_relative "points_trigger_event_attribute"
|
|
8
|
+
require_relative "points_trigger_event_attributes_item"
|
|
9
|
+
require "date"
|
|
5
10
|
require "ostruct"
|
|
6
11
|
require "json"
|
|
7
12
|
|
|
@@ -13,6 +18,14 @@ module TrophyApiClient
|
|
|
13
18
|
attr_reader :type
|
|
14
19
|
# @return [Integer] The points awarded by this trigger.
|
|
15
20
|
attr_reader :points
|
|
21
|
+
# @return [TrophyApiClient::PointsTriggerStatus] The status of the trigger.
|
|
22
|
+
attr_reader :status
|
|
23
|
+
# @return [String] The unique ID of the achievement associated with this trigger, if the trigger is
|
|
24
|
+
# an achievement.
|
|
25
|
+
attr_reader :achievement_id
|
|
26
|
+
# @return [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
|
27
|
+
# metric.
|
|
28
|
+
attr_reader :metric_id
|
|
16
29
|
# @return [String] If the trigger has type 'metric', the name of the metric
|
|
17
30
|
attr_reader :metric_name
|
|
18
31
|
# @return [Integer] If the trigger has type 'metric', the threshold of the metric that triggers the
|
|
@@ -28,6 +41,20 @@ module TrophyApiClient
|
|
|
28
41
|
# @return [Integer] If the trigger has type 'time', the numer of units of timeUnit after which to
|
|
29
42
|
# award points
|
|
30
43
|
attr_reader :time_interval
|
|
44
|
+
# @return [Array<TrophyApiClient::PointsTriggerUserAttributesItem>] User attribute filters that must be met for this trigger to award points. Empty
|
|
45
|
+
# when the trigger has no user attribute filters configured.
|
|
46
|
+
attr_reader :user_attributes
|
|
47
|
+
# @return [TrophyApiClient::PointsTriggerEventAttribute] Deprecated. Event attribute filter that must be met for this trigger to award
|
|
48
|
+
# points. Only present if the trigger has an event filter configured.
|
|
49
|
+
attr_reader :event_attribute
|
|
50
|
+
# @return [Array<TrophyApiClient::PointsTriggerEventAttributesItem>] If the trigger has type 'metric', the event attributes that must match for the
|
|
51
|
+
# trigger to award points. Empty when the trigger is metric-based and has no event
|
|
52
|
+
# attribute filters. Omitted for non-metric triggers.
|
|
53
|
+
attr_reader :event_attributes
|
|
54
|
+
# @return [DateTime] The date and time the trigger was created, in ISO 8601 format.
|
|
55
|
+
attr_reader :created
|
|
56
|
+
# @return [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
|
|
57
|
+
attr_reader :updated
|
|
31
58
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
32
59
|
attr_reader :additional_properties
|
|
33
60
|
# @return [Object]
|
|
@@ -39,6 +66,11 @@ module TrophyApiClient
|
|
|
39
66
|
# @param id [String] The ID of the trigger
|
|
40
67
|
# @param type [TrophyApiClient::PointsTriggerType] The type of trigger
|
|
41
68
|
# @param points [Integer] The points awarded by this trigger.
|
|
69
|
+
# @param status [TrophyApiClient::PointsTriggerStatus] The status of the trigger.
|
|
70
|
+
# @param achievement_id [String] The unique ID of the achievement associated with this trigger, if the trigger is
|
|
71
|
+
# an achievement.
|
|
72
|
+
# @param metric_id [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
|
73
|
+
# metric.
|
|
42
74
|
# @param metric_name [String] If the trigger has type 'metric', the name of the metric
|
|
43
75
|
# @param metric_threshold [Integer] If the trigger has type 'metric', the threshold of the metric that triggers the
|
|
44
76
|
# points
|
|
@@ -48,30 +80,55 @@ module TrophyApiClient
|
|
|
48
80
|
# @param time_unit [TrophyApiClient::PointsTriggerTimeUnit] If the trigger has type 'time', the unit of time after which to award points
|
|
49
81
|
# @param time_interval [Integer] If the trigger has type 'time', the numer of units of timeUnit after which to
|
|
50
82
|
# award points
|
|
83
|
+
# @param user_attributes [Array<TrophyApiClient::PointsTriggerUserAttributesItem>] User attribute filters that must be met for this trigger to award points. Empty
|
|
84
|
+
# when the trigger has no user attribute filters configured.
|
|
85
|
+
# @param event_attribute [TrophyApiClient::PointsTriggerEventAttribute] Deprecated. Event attribute filter that must be met for this trigger to award
|
|
86
|
+
# points. Only present if the trigger has an event filter configured.
|
|
87
|
+
# @param event_attributes [Array<TrophyApiClient::PointsTriggerEventAttributesItem>] If the trigger has type 'metric', the event attributes that must match for the
|
|
88
|
+
# trigger to award points. Empty when the trigger is metric-based and has no event
|
|
89
|
+
# attribute filters. Omitted for non-metric triggers.
|
|
90
|
+
# @param created [DateTime] The date and time the trigger was created, in ISO 8601 format.
|
|
91
|
+
# @param updated [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
|
|
51
92
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
52
93
|
# @return [TrophyApiClient::PointsTrigger]
|
|
53
|
-
def initialize(id
|
|
54
|
-
streak_length_threshold: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, additional_properties: nil)
|
|
55
|
-
@id = id
|
|
56
|
-
@type = type
|
|
57
|
-
@points = points
|
|
94
|
+
def initialize(id:, type:, points:, status:, user_attributes:, created:, updated:, achievement_id: OMIT, metric_id: OMIT, metric_name: OMIT,
|
|
95
|
+
metric_threshold: OMIT, streak_length_threshold: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
|
|
96
|
+
@id = id
|
|
97
|
+
@type = type
|
|
98
|
+
@points = points
|
|
99
|
+
@status = status
|
|
100
|
+
@achievement_id = achievement_id if achievement_id != OMIT
|
|
101
|
+
@metric_id = metric_id if metric_id != OMIT
|
|
58
102
|
@metric_name = metric_name if metric_name != OMIT
|
|
59
103
|
@metric_threshold = metric_threshold if metric_threshold != OMIT
|
|
60
104
|
@streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
|
|
61
105
|
@achievement_name = achievement_name if achievement_name != OMIT
|
|
62
106
|
@time_unit = time_unit if time_unit != OMIT
|
|
63
107
|
@time_interval = time_interval if time_interval != OMIT
|
|
108
|
+
@user_attributes = user_attributes
|
|
109
|
+
@event_attribute = event_attribute if event_attribute != OMIT
|
|
110
|
+
@event_attributes = event_attributes if event_attributes != OMIT
|
|
111
|
+
@created = created
|
|
112
|
+
@updated = updated
|
|
64
113
|
@additional_properties = additional_properties
|
|
65
114
|
@_field_set = {
|
|
66
115
|
"id": id,
|
|
67
116
|
"type": type,
|
|
68
117
|
"points": points,
|
|
118
|
+
"status": status,
|
|
119
|
+
"achievementId": achievement_id,
|
|
120
|
+
"metricId": metric_id,
|
|
69
121
|
"metricName": metric_name,
|
|
70
122
|
"metricThreshold": metric_threshold,
|
|
71
123
|
"streakLengthThreshold": streak_length_threshold,
|
|
72
124
|
"achievementName": achievement_name,
|
|
73
125
|
"timeUnit": time_unit,
|
|
74
|
-
"timeInterval": time_interval
|
|
126
|
+
"timeInterval": time_interval,
|
|
127
|
+
"userAttributes": user_attributes,
|
|
128
|
+
"eventAttribute": event_attribute,
|
|
129
|
+
"eventAttributes": event_attributes,
|
|
130
|
+
"created": created,
|
|
131
|
+
"updated": updated
|
|
75
132
|
}.reject do |_k, v|
|
|
76
133
|
v == OMIT
|
|
77
134
|
end
|
|
@@ -87,22 +144,49 @@ module TrophyApiClient
|
|
|
87
144
|
id = parsed_json["id"]
|
|
88
145
|
type = parsed_json["type"]
|
|
89
146
|
points = parsed_json["points"]
|
|
147
|
+
status = parsed_json["status"]
|
|
148
|
+
achievement_id = parsed_json["achievementId"]
|
|
149
|
+
metric_id = parsed_json["metricId"]
|
|
90
150
|
metric_name = parsed_json["metricName"]
|
|
91
151
|
metric_threshold = parsed_json["metricThreshold"]
|
|
92
152
|
streak_length_threshold = parsed_json["streakLengthThreshold"]
|
|
93
153
|
achievement_name = parsed_json["achievementName"]
|
|
94
154
|
time_unit = parsed_json["timeUnit"]
|
|
95
155
|
time_interval = parsed_json["timeInterval"]
|
|
156
|
+
user_attributes = parsed_json["userAttributes"]&.map do |item|
|
|
157
|
+
item = item.to_json
|
|
158
|
+
TrophyApiClient::PointsTriggerUserAttributesItem.from_json(json_object: item)
|
|
159
|
+
end
|
|
160
|
+
if parsed_json["eventAttribute"].nil?
|
|
161
|
+
event_attribute = nil
|
|
162
|
+
else
|
|
163
|
+
event_attribute = parsed_json["eventAttribute"].to_json
|
|
164
|
+
event_attribute = TrophyApiClient::PointsTriggerEventAttribute.from_json(json_object: event_attribute)
|
|
165
|
+
end
|
|
166
|
+
event_attributes = parsed_json["eventAttributes"]&.map do |item|
|
|
167
|
+
item = item.to_json
|
|
168
|
+
TrophyApiClient::PointsTriggerEventAttributesItem.from_json(json_object: item)
|
|
169
|
+
end
|
|
170
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
|
171
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
|
96
172
|
new(
|
|
97
173
|
id: id,
|
|
98
174
|
type: type,
|
|
99
175
|
points: points,
|
|
176
|
+
status: status,
|
|
177
|
+
achievement_id: achievement_id,
|
|
178
|
+
metric_id: metric_id,
|
|
100
179
|
metric_name: metric_name,
|
|
101
180
|
metric_threshold: metric_threshold,
|
|
102
181
|
streak_length_threshold: streak_length_threshold,
|
|
103
182
|
achievement_name: achievement_name,
|
|
104
183
|
time_unit: time_unit,
|
|
105
184
|
time_interval: time_interval,
|
|
185
|
+
user_attributes: user_attributes,
|
|
186
|
+
event_attribute: event_attribute,
|
|
187
|
+
event_attributes: event_attributes,
|
|
188
|
+
created: created,
|
|
189
|
+
updated: updated,
|
|
106
190
|
additional_properties: struct
|
|
107
191
|
)
|
|
108
192
|
end
|
|
@@ -121,15 +205,23 @@ module TrophyApiClient
|
|
|
121
205
|
# @param obj [Object]
|
|
122
206
|
# @return [Void]
|
|
123
207
|
def self.validate_raw(obj:)
|
|
124
|
-
obj.id
|
|
125
|
-
obj.type
|
|
126
|
-
obj.points
|
|
208
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
209
|
+
obj.type.is_a?(TrophyApiClient::PointsTriggerType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
210
|
+
obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
211
|
+
obj.status.is_a?(TrophyApiClient::PointsTriggerStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
212
|
+
obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
|
|
213
|
+
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
127
214
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
128
215
|
obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
|
|
129
216
|
obj.streak_length_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
|
|
130
217
|
obj.achievement_name&.is_a?(String) != false || raise("Passed value for field obj.achievement_name is not the expected type, validation failed.")
|
|
131
218
|
obj.time_unit&.is_a?(TrophyApiClient::PointsTriggerTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
|
|
132
219
|
obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
|
|
220
|
+
obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
221
|
+
obj.event_attribute.nil? || TrophyApiClient::PointsTriggerEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
222
|
+
obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
|
|
223
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
224
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
133
225
|
end
|
|
134
226
|
end
|
|
135
227
|
end
|
|
@@ -4,9 +4,9 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
|
-
# Event attribute filter that must be met for this trigger to
|
|
8
|
-
# present if the trigger has an event filter configured.
|
|
9
|
-
class
|
|
7
|
+
# Deprecated. Event attribute filter that must be met for this trigger to award
|
|
8
|
+
# points. Only present if the trigger has an event filter configured.
|
|
9
|
+
class PointsTriggerEventAttribute
|
|
10
10
|
# @return [String] The key of the event attribute.
|
|
11
11
|
attr_reader :key
|
|
12
12
|
# @return [String] The required value of the event attribute.
|
|
@@ -22,7 +22,7 @@ module TrophyApiClient
|
|
|
22
22
|
# @param key [String] The key of the event attribute.
|
|
23
23
|
# @param value [String] The required value of the event attribute.
|
|
24
24
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
|
-
# @return [TrophyApiClient::
|
|
25
|
+
# @return [TrophyApiClient::PointsTriggerEventAttribute]
|
|
26
26
|
def initialize(key:, value:, additional_properties: nil)
|
|
27
27
|
@key = key
|
|
28
28
|
@value = value
|
|
@@ -30,10 +30,10 @@ module TrophyApiClient
|
|
|
30
30
|
@_field_set = { "key": key, "value": value }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# Deserialize a JSON object to an instance of
|
|
33
|
+
# Deserialize a JSON object to an instance of PointsTriggerEventAttribute
|
|
34
34
|
#
|
|
35
35
|
# @param json_object [String]
|
|
36
|
-
# @return [TrophyApiClient::
|
|
36
|
+
# @return [TrophyApiClient::PointsTriggerEventAttribute]
|
|
37
37
|
def self.from_json(json_object:)
|
|
38
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
39
39
|
parsed_json = JSON.parse(json_object)
|
|
@@ -46,7 +46,7 @@ module TrophyApiClient
|
|
|
46
46
|
)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
# Serialize an instance of
|
|
49
|
+
# Serialize an instance of PointsTriggerEventAttribute to a JSON object
|
|
50
50
|
#
|
|
51
51
|
# @return [String]
|
|
52
52
|
def to_json(*_args)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class PointsTriggerEventAttributesItem
|
|
8
|
+
# @return [String] The key of the event attribute.
|
|
9
|
+
attr_reader :key
|
|
10
|
+
# @return [String] The required 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 required value of the event attribute.
|
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
# @return [TrophyApiClient::PointsTriggerEventAttributesItem]
|
|
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 PointsTriggerEventAttributesItem
|
|
32
|
+
#
|
|
33
|
+
# @param json_object [String]
|
|
34
|
+
# @return [TrophyApiClient::PointsTriggerEventAttributesItem]
|
|
35
|
+
def self.from_json(json_object:)
|
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
37
|
+
parsed_json = JSON.parse(json_object)
|
|
38
|
+
key = parsed_json["key"]
|
|
39
|
+
value = parsed_json["value"]
|
|
40
|
+
new(
|
|
41
|
+
key: key,
|
|
42
|
+
value: value,
|
|
43
|
+
additional_properties: struct
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Serialize an instance of PointsTriggerEventAttributesItem to a JSON object
|
|
48
|
+
#
|
|
49
|
+
# @return [String]
|
|
50
|
+
def to_json(*_args)
|
|
51
|
+
@_field_set&.to_json
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
55
|
+
# hash and check each fields type against the current object's property
|
|
56
|
+
# definitions.
|
|
57
|
+
#
|
|
58
|
+
# @param obj [Object]
|
|
59
|
+
# @return [Void]
|
|
60
|
+
def self.validate_raw(obj:)
|
|
61
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
62
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -4,10 +4,10 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
|
-
class
|
|
7
|
+
class PointsTriggerUserAttributesItem
|
|
8
8
|
# @return [String] The key of the user attribute.
|
|
9
9
|
attr_reader :key
|
|
10
|
-
# @return [String] The value of the user attribute.
|
|
10
|
+
# @return [String] The required value of the user attribute.
|
|
11
11
|
attr_reader :value
|
|
12
12
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
13
13
|
attr_reader :additional_properties
|
|
@@ -18,9 +18,9 @@ module TrophyApiClient
|
|
|
18
18
|
OMIT = Object.new
|
|
19
19
|
|
|
20
20
|
# @param key [String] The key of the user attribute.
|
|
21
|
-
# @param value [String] The value of the user attribute.
|
|
21
|
+
# @param value [String] The required value of the user attribute.
|
|
22
22
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
-
# @return [TrophyApiClient::
|
|
23
|
+
# @return [TrophyApiClient::PointsTriggerUserAttributesItem]
|
|
24
24
|
def initialize(key:, value:, additional_properties: nil)
|
|
25
25
|
@key = key
|
|
26
26
|
@value = value
|
|
@@ -28,11 +28,10 @@ module TrophyApiClient
|
|
|
28
28
|
@_field_set = { "key": key, "value": value }
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# Deserialize a JSON object to an instance of
|
|
32
|
-
# PointsTriggerResponseUserAttributesItem
|
|
31
|
+
# Deserialize a JSON object to an instance of PointsTriggerUserAttributesItem
|
|
33
32
|
#
|
|
34
33
|
# @param json_object [String]
|
|
35
|
-
# @return [TrophyApiClient::
|
|
34
|
+
# @return [TrophyApiClient::PointsTriggerUserAttributesItem]
|
|
36
35
|
def self.from_json(json_object:)
|
|
37
36
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
38
37
|
parsed_json = JSON.parse(json_object)
|
|
@@ -45,8 +44,7 @@ module TrophyApiClient
|
|
|
45
44
|
)
|
|
46
45
|
end
|
|
47
46
|
|
|
48
|
-
# Serialize an instance of
|
|
49
|
-
# object
|
|
47
|
+
# Serialize an instance of PointsTriggerUserAttributesItem to a JSON object
|
|
50
48
|
#
|
|
51
49
|
# @return [String]
|
|
52
50
|
def to_json(*_args)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "admin_issue"
|
|
4
4
|
require "ostruct"
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ module TrophyApiClient
|
|
|
9
9
|
class RestoreStreaksResponse
|
|
10
10
|
# @return [Array<String>] Array of user IDs whose streaks were successfully restored.
|
|
11
11
|
attr_reader :restored_users
|
|
12
|
-
# @return [Array<TrophyApiClient::
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
|
|
13
13
|
attr_reader :issues
|
|
14
14
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
15
15
|
attr_reader :additional_properties
|
|
@@ -20,7 +20,7 @@ module TrophyApiClient
|
|
|
20
20
|
OMIT = Object.new
|
|
21
21
|
|
|
22
22
|
# @param restored_users [Array<String>] Array of user IDs whose streaks were successfully restored.
|
|
23
|
-
# @param issues [Array<TrophyApiClient::
|
|
23
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
|
|
24
24
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
25
|
# @return [TrophyApiClient::RestoreStreaksResponse]
|
|
26
26
|
def initialize(restored_users:, issues:, additional_properties: nil)
|
|
@@ -40,7 +40,7 @@ module TrophyApiClient
|
|
|
40
40
|
restored_users = parsed_json["restoredUsers"]
|
|
41
41
|
issues = parsed_json["issues"]&.map do |item|
|
|
42
42
|
item = item.to_json
|
|
43
|
-
TrophyApiClient::
|
|
43
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
44
44
|
end
|
|
45
45
|
new(
|
|
46
46
|
restored_users: restored_users,
|
|
@@ -11,7 +11,8 @@ module TrophyApiClient
|
|
|
11
11
|
# @return [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
|
|
12
12
|
# period includes the start and end dates and the length of the streak.
|
|
13
13
|
attr_reader :streak_history
|
|
14
|
-
# @return [Integer] The user's rank across all users. Null if the user has no active
|
|
14
|
+
# @return [Integer] Deprecated. The user's rank across all users. Null if the user has no active
|
|
15
|
+
# streak.
|
|
15
16
|
attr_reader :rank
|
|
16
17
|
# @return [Integer] The length of the user's current streak.
|
|
17
18
|
attr_reader :length
|
|
@@ -47,7 +48,8 @@ module TrophyApiClient
|
|
|
47
48
|
|
|
48
49
|
# @param streak_history [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
|
|
49
50
|
# period includes the start and end dates and the length of the streak.
|
|
50
|
-
# @param rank [Integer] The user's rank across all users. Null if the user has no active
|
|
51
|
+
# @param rank [Integer] Deprecated. The user's rank across all users. Null if the user has no active
|
|
52
|
+
# streak.
|
|
51
53
|
# @param length [Integer] The length of the user's current streak.
|
|
52
54
|
# @param frequency [TrophyApiClient::StreakFrequency] The frequency of the streak.
|
|
53
55
|
# @param started [String] The date the streak started.
|
|
@@ -4,6 +4,7 @@ require "date"
|
|
|
4
4
|
require_relative "achievement_response_trigger"
|
|
5
5
|
require_relative "achievement_response_user_attributes_item"
|
|
6
6
|
require_relative "achievement_response_event_attribute"
|
|
7
|
+
require_relative "achievement_response_event_attributes_item"
|
|
7
8
|
require "ostruct"
|
|
8
9
|
require "json"
|
|
9
10
|
|
|
@@ -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
|
|
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
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
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::UserAchievementResponse]
|
|
82
|
-
def initialize(id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT, key: OMIT,
|
|
83
|
-
streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT,
|
|
86
|
+
def initialize(id:, name:, trigger:, user_attributes:, achieved_at: OMIT, 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
|
@achieved_at = achieved_at if achieved_at != OMIT
|
|
85
89
|
@id = id
|
|
86
90
|
@name = name
|
|
@@ -93,8 +97,9 @@ module TrophyApiClient
|
|
|
93
97
|
@metric_id = metric_id if metric_id != OMIT
|
|
94
98
|
@metric_value = metric_value if metric_value != OMIT
|
|
95
99
|
@metric_name = metric_name if metric_name != OMIT
|
|
96
|
-
@user_attributes = user_attributes
|
|
100
|
+
@user_attributes = user_attributes
|
|
97
101
|
@event_attribute = event_attribute if event_attribute != OMIT
|
|
102
|
+
@event_attributes = event_attributes if event_attributes != OMIT
|
|
98
103
|
@additional_properties = additional_properties
|
|
99
104
|
@_field_set = {
|
|
100
105
|
"achievedAt": achieved_at,
|
|
@@ -110,7 +115,8 @@ module TrophyApiClient
|
|
|
110
115
|
"metricValue": metric_value,
|
|
111
116
|
"metricName": metric_name,
|
|
112
117
|
"userAttributes": user_attributes,
|
|
113
|
-
"eventAttribute": event_attribute
|
|
118
|
+
"eventAttribute": event_attribute,
|
|
119
|
+
"eventAttributes": event_attributes
|
|
114
120
|
}.reject do |_k, v|
|
|
115
121
|
v == OMIT
|
|
116
122
|
end
|
|
@@ -145,6 +151,10 @@ module TrophyApiClient
|
|
|
145
151
|
event_attribute = parsed_json["eventAttribute"].to_json
|
|
146
152
|
event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
|
|
147
153
|
end
|
|
154
|
+
event_attributes = parsed_json["eventAttributes"]&.map do |item|
|
|
155
|
+
item = item.to_json
|
|
156
|
+
TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
|
|
157
|
+
end
|
|
148
158
|
new(
|
|
149
159
|
achieved_at: achieved_at,
|
|
150
160
|
id: id,
|
|
@@ -160,6 +170,7 @@ module TrophyApiClient
|
|
|
160
170
|
metric_name: metric_name,
|
|
161
171
|
user_attributes: user_attributes,
|
|
162
172
|
event_attribute: event_attribute,
|
|
173
|
+
event_attributes: event_attributes,
|
|
163
174
|
additional_properties: struct
|
|
164
175
|
)
|
|
165
176
|
end
|
|
@@ -190,8 +201,9 @@ module TrophyApiClient
|
|
|
190
201
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
191
202
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
192
203
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
193
|
-
obj.user_attributes
|
|
204
|
+
obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
194
205
|
obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
206
|
+
obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
|
|
195
207
|
end
|
|
196
208
|
end
|
|
197
209
|
end
|
|
@@ -4,6 +4,7 @@ require "date"
|
|
|
4
4
|
require_relative "achievement_response_trigger"
|
|
5
5
|
require_relative "achievement_response_user_attributes_item"
|
|
6
6
|
require_relative "achievement_response_event_attribute"
|
|
7
|
+
require_relative "achievement_response_event_attributes_item"
|
|
7
8
|
require "ostruct"
|
|
8
9
|
require "json"
|
|
9
10
|
|
|
@@ -45,11 +46,13 @@ module TrophyApiClient
|
|
|
45
46
|
# trigger = 'metric')
|
|
46
47
|
attr_reader :metric_name
|
|
47
48
|
# @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
|
|
48
|
-
# Only present if the achievement has user attribute filters configured.
|
|
49
49
|
attr_reader :user_attributes
|
|
50
|
-
# @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be
|
|
51
|
-
# Only present if the achievement has an event filter configured.
|
|
50
|
+
# @return [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
|
|
51
|
+
# completed. Only present if the achievement has an event filter configured.
|
|
52
52
|
attr_reader :event_attribute
|
|
53
|
+
# @return [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
|
|
54
|
+
# Omitted for non-metric achievements.
|
|
55
|
+
attr_reader :event_attributes
|
|
53
56
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
54
57
|
attr_reader :additional_properties
|
|
55
58
|
# @return [Object]
|
|
@@ -80,13 +83,14 @@ module TrophyApiClient
|
|
|
80
83
|
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
81
84
|
# trigger = 'metric')
|
|
82
85
|
# @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
+
# @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
|
|
87
|
+
# completed. Only present if the achievement has an event filter configured.
|
|
88
|
+
# @param event_attributes [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
|
|
89
|
+
# Omitted for non-metric achievements.
|
|
86
90
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
87
91
|
# @return [TrophyApiClient::UserAchievementWithStatsResponse]
|
|
88
|
-
def initialize(completions:, rarity:, id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT,
|
|
89
|
-
key: OMIT, streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT,
|
|
92
|
+
def initialize(completions:, rarity:, id:, name:, trigger:, user_attributes:, achieved_at: OMIT, description: OMIT, badge_url: OMIT,
|
|
93
|
+
key: OMIT, streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
|
|
90
94
|
@achieved_at = achieved_at if achieved_at != OMIT
|
|
91
95
|
@completions = completions
|
|
92
96
|
@rarity = rarity
|
|
@@ -101,8 +105,9 @@ module TrophyApiClient
|
|
|
101
105
|
@metric_id = metric_id if metric_id != OMIT
|
|
102
106
|
@metric_value = metric_value if metric_value != OMIT
|
|
103
107
|
@metric_name = metric_name if metric_name != OMIT
|
|
104
|
-
@user_attributes = user_attributes
|
|
108
|
+
@user_attributes = user_attributes
|
|
105
109
|
@event_attribute = event_attribute if event_attribute != OMIT
|
|
110
|
+
@event_attributes = event_attributes if event_attributes != OMIT
|
|
106
111
|
@additional_properties = additional_properties
|
|
107
112
|
@_field_set = {
|
|
108
113
|
"achievedAt": achieved_at,
|
|
@@ -120,7 +125,8 @@ module TrophyApiClient
|
|
|
120
125
|
"metricValue": metric_value,
|
|
121
126
|
"metricName": metric_name,
|
|
122
127
|
"userAttributes": user_attributes,
|
|
123
|
-
"eventAttribute": event_attribute
|
|
128
|
+
"eventAttribute": event_attribute,
|
|
129
|
+
"eventAttributes": event_attributes
|
|
124
130
|
}.reject do |_k, v|
|
|
125
131
|
v == OMIT
|
|
126
132
|
end
|
|
@@ -157,6 +163,10 @@ module TrophyApiClient
|
|
|
157
163
|
event_attribute = parsed_json["eventAttribute"].to_json
|
|
158
164
|
event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
|
|
159
165
|
end
|
|
166
|
+
event_attributes = parsed_json["eventAttributes"]&.map do |item|
|
|
167
|
+
item = item.to_json
|
|
168
|
+
TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
|
|
169
|
+
end
|
|
160
170
|
new(
|
|
161
171
|
achieved_at: achieved_at,
|
|
162
172
|
completions: completions,
|
|
@@ -174,6 +184,7 @@ module TrophyApiClient
|
|
|
174
184
|
metric_name: metric_name,
|
|
175
185
|
user_attributes: user_attributes,
|
|
176
186
|
event_attribute: event_attribute,
|
|
187
|
+
event_attributes: event_attributes,
|
|
177
188
|
additional_properties: struct
|
|
178
189
|
)
|
|
179
190
|
end
|
|
@@ -206,8 +217,9 @@ module TrophyApiClient
|
|
|
206
217
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
207
218
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
208
219
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
209
|
-
obj.user_attributes
|
|
220
|
+
obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
210
221
|
obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
222
|
+
obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
|
|
211
223
|
end
|
|
212
224
|
end
|
|
213
225
|
end
|