trophy_api_client 1.0.29 → 1.0.31
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/achievements/client.rb +20 -12
- data/lib/trophy_api_client/leaderboards/client.rb +25 -11
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +194 -0
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb +12 -0
- data/lib/trophy_api_client/metrics/client.rb +2 -2
- data/lib/trophy_api_client/points/client.rb +4 -4
- data/lib/trophy_api_client/streaks/client.rb +2 -2
- data/lib/trophy_api_client/types/achievement_completion_response.rb +9 -11
- data/lib/trophy_api_client/types/achievement_completion_response_achievement.rb +171 -0
- data/lib/trophy_api_client/types/achievement_response.rb +5 -19
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +9 -23
- data/lib/trophy_api_client/types/bulk_streak_response_item.rb +4 -6
- data/lib/trophy_api_client/types/completed_achievement_response.rb +7 -21
- data/lib/trophy_api_client/types/event_response.rb +10 -10
- data/lib/trophy_api_client/types/get_user_points_response.rb +21 -4
- data/lib/trophy_api_client/types/leaderboard_response.rb +16 -16
- data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +25 -16
- data/lib/trophy_api_client/types/{leaderboard_response_status.rb → leaderboard_response_with_rankings_status.rb} +1 -1
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +29 -19
- data/lib/trophy_api_client/types/metric_event_points_response.rb +24 -8
- data/lib/trophy_api_client/types/metric_event_streak_response.rb +4 -4
- data/lib/trophy_api_client/types/points_award.rb +6 -6
- data/lib/trophy_api_client/types/points_range.rb +14 -16
- data/lib/trophy_api_client/types/points_system_response.rb +10 -1
- data/lib/trophy_api_client/types/points_trigger.rb +30 -11
- data/lib/trophy_api_client/types/points_trigger_response.rb +39 -22
- data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/points_trigger_response_type.rb +2 -0
- data/lib/trophy_api_client/types/points_trigger_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/points_trigger_type.rb +2 -0
- data/lib/trophy_api_client/types/updated_user.rb +11 -11
- data/lib/trophy_api_client/types/upserted_user.rb +12 -12
- data/lib/trophy_api_client/types/user.rb +18 -18
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +16 -28
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +216 -0
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +220 -0
- data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +78 -0
- data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +84 -0
- data/lib/trophy_api_client/users/client.rb +25 -17
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +20 -1
- metadata +21 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "metric_event_streak_response"
|
|
4
|
+
require "date"
|
|
5
|
+
require_relative "achievement_response_trigger"
|
|
6
|
+
require "ostruct"
|
|
7
|
+
require "json"
|
|
8
|
+
|
|
9
|
+
module TrophyApiClient
|
|
10
|
+
class AchievementCompletionResponseAchievement
|
|
11
|
+
# @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
12
|
+
attr_reader :current_streak
|
|
13
|
+
# @return [DateTime] The date and time the achievement was completed, in ISO 8601 format.
|
|
14
|
+
attr_reader :achieved_at
|
|
15
|
+
# @return [String] The unique ID of the achievement.
|
|
16
|
+
attr_reader :id
|
|
17
|
+
# @return [String] The name of this achievement.
|
|
18
|
+
attr_reader :name
|
|
19
|
+
# @return [TrophyApiClient::AchievementResponseTrigger] The trigger of the achievement.
|
|
20
|
+
attr_reader :trigger
|
|
21
|
+
# @return [String] The description of this achievement.
|
|
22
|
+
attr_reader :description
|
|
23
|
+
# @return [String] The URL of the badge image for the achievement, if one has been uploaded.
|
|
24
|
+
attr_reader :badge_url
|
|
25
|
+
# @return [String] The key used to reference this achievement in the API (only applicable if
|
|
26
|
+
# trigger = 'api')
|
|
27
|
+
attr_reader :key
|
|
28
|
+
# @return [Integer] The length of the streak required to complete the achievement (only applicable
|
|
29
|
+
# if trigger = 'streak')
|
|
30
|
+
attr_reader :streak_length
|
|
31
|
+
# @return [String] The ID of the metric associated with this achievement (only applicable if
|
|
32
|
+
# trigger = 'metric')
|
|
33
|
+
attr_reader :metric_id
|
|
34
|
+
# @return [Float] The value of the metric required to complete the achievement (only applicable if
|
|
35
|
+
# trigger = 'metric')
|
|
36
|
+
attr_reader :metric_value
|
|
37
|
+
# @return [String] The name of the metric associated with this achievement (only applicable if
|
|
38
|
+
# trigger = 'metric')
|
|
39
|
+
attr_reader :metric_name
|
|
40
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
41
|
+
attr_reader :additional_properties
|
|
42
|
+
# @return [Object]
|
|
43
|
+
attr_reader :_field_set
|
|
44
|
+
protected :_field_set
|
|
45
|
+
|
|
46
|
+
OMIT = Object.new
|
|
47
|
+
|
|
48
|
+
# @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
49
|
+
# @param achieved_at [DateTime] The date and time the achievement was completed, in ISO 8601 format.
|
|
50
|
+
# @param id [String] The unique ID of the achievement.
|
|
51
|
+
# @param name [String] The name of this achievement.
|
|
52
|
+
# @param trigger [TrophyApiClient::AchievementResponseTrigger] The trigger of the achievement.
|
|
53
|
+
# @param description [String] The description of this achievement.
|
|
54
|
+
# @param badge_url [String] The URL of the badge image for the achievement, if one has been uploaded.
|
|
55
|
+
# @param key [String] The key used to reference this achievement in the API (only applicable if
|
|
56
|
+
# trigger = 'api')
|
|
57
|
+
# @param streak_length [Integer] The length of the streak required to complete the achievement (only applicable
|
|
58
|
+
# if trigger = 'streak')
|
|
59
|
+
# @param metric_id [String] The ID of the metric associated with this achievement (only applicable if
|
|
60
|
+
# trigger = 'metric')
|
|
61
|
+
# @param metric_value [Float] The value of the metric required to complete the achievement (only applicable if
|
|
62
|
+
# trigger = 'metric')
|
|
63
|
+
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
64
|
+
# trigger = 'metric')
|
|
65
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
66
|
+
# @return [TrophyApiClient::AchievementCompletionResponseAchievement]
|
|
67
|
+
def initialize(achieved_at:, id:, name:, trigger:, key:, current_streak: OMIT, description: OMIT, badge_url: OMIT,
|
|
68
|
+
streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
|
|
69
|
+
@current_streak = current_streak if current_streak != OMIT
|
|
70
|
+
@achieved_at = achieved_at
|
|
71
|
+
@id = id
|
|
72
|
+
@name = name
|
|
73
|
+
@trigger = trigger
|
|
74
|
+
@description = description if description != OMIT
|
|
75
|
+
@badge_url = badge_url if badge_url != OMIT
|
|
76
|
+
@key = key
|
|
77
|
+
@streak_length = streak_length if streak_length != OMIT
|
|
78
|
+
@metric_id = metric_id if metric_id != OMIT
|
|
79
|
+
@metric_value = metric_value if metric_value != OMIT
|
|
80
|
+
@metric_name = metric_name if metric_name != OMIT
|
|
81
|
+
@additional_properties = additional_properties
|
|
82
|
+
@_field_set = {
|
|
83
|
+
"currentStreak": current_streak,
|
|
84
|
+
"achievedAt": achieved_at,
|
|
85
|
+
"id": id,
|
|
86
|
+
"name": name,
|
|
87
|
+
"trigger": trigger,
|
|
88
|
+
"description": description,
|
|
89
|
+
"badgeUrl": badge_url,
|
|
90
|
+
"key": key,
|
|
91
|
+
"streakLength": streak_length,
|
|
92
|
+
"metricId": metric_id,
|
|
93
|
+
"metricValue": metric_value,
|
|
94
|
+
"metricName": metric_name
|
|
95
|
+
}.reject do |_k, v|
|
|
96
|
+
v == OMIT
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Deserialize a JSON object to an instance of
|
|
101
|
+
# AchievementCompletionResponseAchievement
|
|
102
|
+
#
|
|
103
|
+
# @param json_object [String]
|
|
104
|
+
# @return [TrophyApiClient::AchievementCompletionResponseAchievement]
|
|
105
|
+
def self.from_json(json_object:)
|
|
106
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
107
|
+
parsed_json = JSON.parse(json_object)
|
|
108
|
+
if parsed_json["currentStreak"].nil?
|
|
109
|
+
current_streak = nil
|
|
110
|
+
else
|
|
111
|
+
current_streak = parsed_json["currentStreak"].to_json
|
|
112
|
+
current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
|
|
113
|
+
end
|
|
114
|
+
achieved_at = (DateTime.parse(parsed_json["achievedAt"]) unless parsed_json["achievedAt"].nil?)
|
|
115
|
+
id = parsed_json["id"]
|
|
116
|
+
name = parsed_json["name"]
|
|
117
|
+
trigger = parsed_json["trigger"]
|
|
118
|
+
description = parsed_json["description"]
|
|
119
|
+
badge_url = parsed_json["badgeUrl"]
|
|
120
|
+
key = parsed_json["key"]
|
|
121
|
+
streak_length = parsed_json["streakLength"]
|
|
122
|
+
metric_id = parsed_json["metricId"]
|
|
123
|
+
metric_value = parsed_json["metricValue"]
|
|
124
|
+
metric_name = parsed_json["metricName"]
|
|
125
|
+
new(
|
|
126
|
+
current_streak: current_streak,
|
|
127
|
+
achieved_at: achieved_at,
|
|
128
|
+
id: id,
|
|
129
|
+
name: name,
|
|
130
|
+
trigger: trigger,
|
|
131
|
+
description: description,
|
|
132
|
+
badge_url: badge_url,
|
|
133
|
+
key: key,
|
|
134
|
+
streak_length: streak_length,
|
|
135
|
+
metric_id: metric_id,
|
|
136
|
+
metric_value: metric_value,
|
|
137
|
+
metric_name: metric_name,
|
|
138
|
+
additional_properties: struct
|
|
139
|
+
)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Serialize an instance of AchievementCompletionResponseAchievement to a JSON
|
|
143
|
+
# object
|
|
144
|
+
#
|
|
145
|
+
# @return [String]
|
|
146
|
+
def to_json(*_args)
|
|
147
|
+
@_field_set&.to_json
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
151
|
+
# hash and check each fields type against the current object's property
|
|
152
|
+
# definitions.
|
|
153
|
+
#
|
|
154
|
+
# @param obj [Object]
|
|
155
|
+
# @return [Void]
|
|
156
|
+
def self.validate_raw(obj:)
|
|
157
|
+
obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
|
|
158
|
+
obj.achieved_at.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
|
|
159
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
160
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
161
|
+
obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
|
|
162
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
163
|
+
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
164
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
165
|
+
obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
166
|
+
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
167
|
+
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
168
|
+
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "achievement_response_trigger"
|
|
4
|
-
require_relative "metric_event_streak_response"
|
|
5
4
|
require "ostruct"
|
|
6
5
|
require "json"
|
|
7
6
|
|
|
@@ -32,8 +31,6 @@ module TrophyApiClient
|
|
|
32
31
|
# @return [String] The name of the metric associated with this achievement (only applicable if
|
|
33
32
|
# trigger = 'metric')
|
|
34
33
|
attr_reader :metric_name
|
|
35
|
-
# @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
36
|
-
attr_reader :current_streak
|
|
37
34
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
38
35
|
attr_reader :additional_properties
|
|
39
36
|
# @return [Object]
|
|
@@ -57,22 +54,20 @@ module TrophyApiClient
|
|
|
57
54
|
# trigger = 'metric')
|
|
58
55
|
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
59
56
|
# trigger = 'metric')
|
|
60
|
-
# @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
61
57
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
62
58
|
# @return [TrophyApiClient::AchievementResponse]
|
|
63
|
-
def initialize(id:, name:, trigger:, description: OMIT, badge_url: OMIT,
|
|
64
|
-
metric_id: OMIT, metric_value: OMIT, metric_name: OMIT,
|
|
59
|
+
def initialize(id:, name:, trigger:, key:, description: OMIT, badge_url: OMIT, streak_length: OMIT,
|
|
60
|
+
metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
|
|
65
61
|
@id = id
|
|
66
62
|
@name = name
|
|
67
63
|
@trigger = trigger
|
|
68
64
|
@description = description if description != OMIT
|
|
69
65
|
@badge_url = badge_url if badge_url != OMIT
|
|
70
|
-
@key = key
|
|
66
|
+
@key = key
|
|
71
67
|
@streak_length = streak_length if streak_length != OMIT
|
|
72
68
|
@metric_id = metric_id if metric_id != OMIT
|
|
73
69
|
@metric_value = metric_value if metric_value != OMIT
|
|
74
70
|
@metric_name = metric_name if metric_name != OMIT
|
|
75
|
-
@current_streak = current_streak if current_streak != OMIT
|
|
76
71
|
@additional_properties = additional_properties
|
|
77
72
|
@_field_set = {
|
|
78
73
|
"id": id,
|
|
@@ -84,8 +79,7 @@ module TrophyApiClient
|
|
|
84
79
|
"streakLength": streak_length,
|
|
85
80
|
"metricId": metric_id,
|
|
86
81
|
"metricValue": metric_value,
|
|
87
|
-
"metricName": metric_name
|
|
88
|
-
"currentStreak": current_streak
|
|
82
|
+
"metricName": metric_name
|
|
89
83
|
}.reject do |_k, v|
|
|
90
84
|
v == OMIT
|
|
91
85
|
end
|
|
@@ -108,12 +102,6 @@ module TrophyApiClient
|
|
|
108
102
|
metric_id = parsed_json["metricId"]
|
|
109
103
|
metric_value = parsed_json["metricValue"]
|
|
110
104
|
metric_name = parsed_json["metricName"]
|
|
111
|
-
if parsed_json["currentStreak"].nil?
|
|
112
|
-
current_streak = nil
|
|
113
|
-
else
|
|
114
|
-
current_streak = parsed_json["currentStreak"].to_json
|
|
115
|
-
current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
|
|
116
|
-
end
|
|
117
105
|
new(
|
|
118
106
|
id: id,
|
|
119
107
|
name: name,
|
|
@@ -125,7 +113,6 @@ module TrophyApiClient
|
|
|
125
113
|
metric_id: metric_id,
|
|
126
114
|
metric_value: metric_value,
|
|
127
115
|
metric_name: metric_name,
|
|
128
|
-
current_streak: current_streak,
|
|
129
116
|
additional_properties: struct
|
|
130
117
|
)
|
|
131
118
|
end
|
|
@@ -149,12 +136,11 @@ module TrophyApiClient
|
|
|
149
136
|
obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
|
|
150
137
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
151
138
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
152
|
-
obj.key
|
|
139
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
153
140
|
obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
154
141
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
155
142
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
156
143
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
157
|
-
obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
|
|
158
144
|
end
|
|
159
145
|
end
|
|
160
146
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require_relative "achievement_with_stats_response_user_attributes_item"
|
|
4
4
|
require_relative "achievement_with_stats_response_event_attribute"
|
|
5
5
|
require_relative "achievement_response_trigger"
|
|
6
|
-
require_relative "metric_event_streak_response"
|
|
7
6
|
require "ostruct"
|
|
8
7
|
require "json"
|
|
9
8
|
|
|
@@ -44,8 +43,6 @@ module TrophyApiClient
|
|
|
44
43
|
# @return [String] The name of the metric associated with this achievement (only applicable if
|
|
45
44
|
# trigger = 'metric')
|
|
46
45
|
attr_reader :metric_name
|
|
47
|
-
# @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
48
|
-
attr_reader :current_streak
|
|
49
46
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
50
47
|
attr_reader :additional_properties
|
|
51
48
|
# @return [Object]
|
|
@@ -75,13 +72,12 @@ module TrophyApiClient
|
|
|
75
72
|
# trigger = 'metric')
|
|
76
73
|
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
77
74
|
# trigger = 'metric')
|
|
78
|
-
# @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
79
75
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
80
76
|
# @return [TrophyApiClient::AchievementWithStatsResponse]
|
|
81
|
-
def initialize(id:, name:, trigger:,
|
|
82
|
-
description: OMIT, badge_url: OMIT,
|
|
83
|
-
@completions = completions
|
|
84
|
-
@rarity = rarity
|
|
77
|
+
def initialize(completions:, rarity:, id:, name:, trigger:, key:, user_attributes: OMIT, event_attribute: OMIT,
|
|
78
|
+
description: OMIT, badge_url: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
|
|
79
|
+
@completions = completions
|
|
80
|
+
@rarity = rarity
|
|
85
81
|
@user_attributes = user_attributes if user_attributes != OMIT
|
|
86
82
|
@event_attribute = event_attribute if event_attribute != OMIT
|
|
87
83
|
@id = id
|
|
@@ -89,12 +85,11 @@ module TrophyApiClient
|
|
|
89
85
|
@trigger = trigger
|
|
90
86
|
@description = description if description != OMIT
|
|
91
87
|
@badge_url = badge_url if badge_url != OMIT
|
|
92
|
-
@key = key
|
|
88
|
+
@key = key
|
|
93
89
|
@streak_length = streak_length if streak_length != OMIT
|
|
94
90
|
@metric_id = metric_id if metric_id != OMIT
|
|
95
91
|
@metric_value = metric_value if metric_value != OMIT
|
|
96
92
|
@metric_name = metric_name if metric_name != OMIT
|
|
97
|
-
@current_streak = current_streak if current_streak != OMIT
|
|
98
93
|
@additional_properties = additional_properties
|
|
99
94
|
@_field_set = {
|
|
100
95
|
"completions": completions,
|
|
@@ -110,8 +105,7 @@ module TrophyApiClient
|
|
|
110
105
|
"streakLength": streak_length,
|
|
111
106
|
"metricId": metric_id,
|
|
112
107
|
"metricValue": metric_value,
|
|
113
|
-
"metricName": metric_name
|
|
114
|
-
"currentStreak": current_streak
|
|
108
|
+
"metricName": metric_name
|
|
115
109
|
}.reject do |_k, v|
|
|
116
110
|
v == OMIT
|
|
117
111
|
end
|
|
@@ -146,12 +140,6 @@ module TrophyApiClient
|
|
|
146
140
|
metric_id = parsed_json["metricId"]
|
|
147
141
|
metric_value = parsed_json["metricValue"]
|
|
148
142
|
metric_name = parsed_json["metricName"]
|
|
149
|
-
if parsed_json["currentStreak"].nil?
|
|
150
|
-
current_streak = nil
|
|
151
|
-
else
|
|
152
|
-
current_streak = parsed_json["currentStreak"].to_json
|
|
153
|
-
current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
|
|
154
|
-
end
|
|
155
143
|
new(
|
|
156
144
|
completions: completions,
|
|
157
145
|
rarity: rarity,
|
|
@@ -167,7 +155,6 @@ module TrophyApiClient
|
|
|
167
155
|
metric_id: metric_id,
|
|
168
156
|
metric_value: metric_value,
|
|
169
157
|
metric_name: metric_name,
|
|
170
|
-
current_streak: current_streak,
|
|
171
158
|
additional_properties: struct
|
|
172
159
|
)
|
|
173
160
|
end
|
|
@@ -186,8 +173,8 @@ module TrophyApiClient
|
|
|
186
173
|
# @param obj [Object]
|
|
187
174
|
# @return [Void]
|
|
188
175
|
def self.validate_raw(obj:)
|
|
189
|
-
obj.completions
|
|
190
|
-
obj.rarity
|
|
176
|
+
obj.completions.is_a?(Integer) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
|
|
177
|
+
obj.rarity.is_a?(Float) != false || raise("Passed value for field obj.rarity is not the expected type, validation failed.")
|
|
191
178
|
obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
192
179
|
obj.event_attribute.nil? || TrophyApiClient::AchievementWithStatsResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
193
180
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
@@ -195,12 +182,11 @@ module TrophyApiClient
|
|
|
195
182
|
obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
|
|
196
183
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
197
184
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
198
|
-
obj.key
|
|
185
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
199
186
|
obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
200
187
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
201
188
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
202
189
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
203
|
-
obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
|
|
204
190
|
end
|
|
205
191
|
end
|
|
206
192
|
end
|
|
@@ -24,14 +24,12 @@ module TrophyApiClient
|
|
|
24
24
|
# @param extended [String] The timestamp the streak was extended, as a string.
|
|
25
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
26
|
# @return [TrophyApiClient::BulkStreakResponseItem]
|
|
27
|
-
def initialize(user_id:, streak_length:, extended
|
|
27
|
+
def initialize(user_id:, streak_length:, extended:, additional_properties: nil)
|
|
28
28
|
@user_id = user_id
|
|
29
29
|
@streak_length = streak_length
|
|
30
|
-
@extended = extended
|
|
30
|
+
@extended = extended
|
|
31
31
|
@additional_properties = additional_properties
|
|
32
|
-
@_field_set = { "userId": user_id, "streakLength": streak_length, "extended": extended }
|
|
33
|
-
v == OMIT
|
|
34
|
-
end
|
|
32
|
+
@_field_set = { "userId": user_id, "streakLength": streak_length, "extended": extended }
|
|
35
33
|
end
|
|
36
34
|
|
|
37
35
|
# Deserialize a JSON object to an instance of BulkStreakResponseItem
|
|
@@ -68,7 +66,7 @@ module TrophyApiClient
|
|
|
68
66
|
def self.validate_raw(obj:)
|
|
69
67
|
obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
|
70
68
|
obj.streak_length.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
71
|
-
obj.extended
|
|
69
|
+
obj.extended.is_a?(String) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
|
|
72
70
|
end
|
|
73
71
|
end
|
|
74
72
|
end
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "date"
|
|
4
4
|
require_relative "achievement_response_trigger"
|
|
5
|
-
require_relative "metric_event_streak_response"
|
|
6
5
|
require "ostruct"
|
|
7
6
|
require "json"
|
|
8
7
|
|
|
@@ -35,8 +34,6 @@ module TrophyApiClient
|
|
|
35
34
|
# @return [String] The name of the metric associated with this achievement (only applicable if
|
|
36
35
|
# trigger = 'metric')
|
|
37
36
|
attr_reader :metric_name
|
|
38
|
-
# @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
39
|
-
attr_reader :current_streak
|
|
40
37
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
41
38
|
attr_reader :additional_properties
|
|
42
39
|
# @return [Object]
|
|
@@ -61,23 +58,21 @@ module TrophyApiClient
|
|
|
61
58
|
# trigger = 'metric')
|
|
62
59
|
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
63
60
|
# trigger = 'metric')
|
|
64
|
-
# @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
|
|
65
61
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
66
62
|
# @return [TrophyApiClient::CompletedAchievementResponse]
|
|
67
|
-
def initialize(id:, name:, trigger:,
|
|
68
|
-
|
|
69
|
-
@achieved_at = achieved_at
|
|
63
|
+
def initialize(achieved_at:, id:, name:, trigger:, key:, description: OMIT, badge_url: OMIT, streak_length: OMIT,
|
|
64
|
+
metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
|
|
65
|
+
@achieved_at = achieved_at
|
|
70
66
|
@id = id
|
|
71
67
|
@name = name
|
|
72
68
|
@trigger = trigger
|
|
73
69
|
@description = description if description != OMIT
|
|
74
70
|
@badge_url = badge_url if badge_url != OMIT
|
|
75
|
-
@key = key
|
|
71
|
+
@key = key
|
|
76
72
|
@streak_length = streak_length if streak_length != OMIT
|
|
77
73
|
@metric_id = metric_id if metric_id != OMIT
|
|
78
74
|
@metric_value = metric_value if metric_value != OMIT
|
|
79
75
|
@metric_name = metric_name if metric_name != OMIT
|
|
80
|
-
@current_streak = current_streak if current_streak != OMIT
|
|
81
76
|
@additional_properties = additional_properties
|
|
82
77
|
@_field_set = {
|
|
83
78
|
"achievedAt": achieved_at,
|
|
@@ -90,8 +85,7 @@ module TrophyApiClient
|
|
|
90
85
|
"streakLength": streak_length,
|
|
91
86
|
"metricId": metric_id,
|
|
92
87
|
"metricValue": metric_value,
|
|
93
|
-
"metricName": metric_name
|
|
94
|
-
"currentStreak": current_streak
|
|
88
|
+
"metricName": metric_name
|
|
95
89
|
}.reject do |_k, v|
|
|
96
90
|
v == OMIT
|
|
97
91
|
end
|
|
@@ -115,12 +109,6 @@ module TrophyApiClient
|
|
|
115
109
|
metric_id = parsed_json["metricId"]
|
|
116
110
|
metric_value = parsed_json["metricValue"]
|
|
117
111
|
metric_name = parsed_json["metricName"]
|
|
118
|
-
if parsed_json["currentStreak"].nil?
|
|
119
|
-
current_streak = nil
|
|
120
|
-
else
|
|
121
|
-
current_streak = parsed_json["currentStreak"].to_json
|
|
122
|
-
current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
|
|
123
|
-
end
|
|
124
112
|
new(
|
|
125
113
|
achieved_at: achieved_at,
|
|
126
114
|
id: id,
|
|
@@ -133,7 +121,6 @@ module TrophyApiClient
|
|
|
133
121
|
metric_id: metric_id,
|
|
134
122
|
metric_value: metric_value,
|
|
135
123
|
metric_name: metric_name,
|
|
136
|
-
current_streak: current_streak,
|
|
137
124
|
additional_properties: struct
|
|
138
125
|
)
|
|
139
126
|
end
|
|
@@ -152,18 +139,17 @@ module TrophyApiClient
|
|
|
152
139
|
# @param obj [Object]
|
|
153
140
|
# @return [Void]
|
|
154
141
|
def self.validate_raw(obj:)
|
|
155
|
-
obj.achieved_at
|
|
142
|
+
obj.achieved_at.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
|
|
156
143
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
157
144
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
158
145
|
obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
|
|
159
146
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
160
147
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
161
|
-
obj.key
|
|
148
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
162
149
|
obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
163
150
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
164
151
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
165
152
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
166
|
-
obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
|
|
167
153
|
end
|
|
168
154
|
end
|
|
169
155
|
end
|
|
@@ -44,15 +44,15 @@ module TrophyApiClient
|
|
|
44
44
|
# @param idempotent_replayed [Boolean] Whether the event was replayed due to idempotency.
|
|
45
45
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
46
46
|
# @return [TrophyApiClient::EventResponse]
|
|
47
|
-
def initialize(event_id:, metric_id:, total:, achievements
|
|
48
|
-
|
|
47
|
+
def initialize(event_id:, metric_id:, total:, achievements:, current_streak:, points:, leaderboards:,
|
|
48
|
+
idempotency_key: OMIT, idempotent_replayed: OMIT, additional_properties: nil)
|
|
49
49
|
@event_id = event_id
|
|
50
50
|
@metric_id = metric_id
|
|
51
51
|
@total = total
|
|
52
|
-
@achievements = achievements
|
|
53
|
-
@current_streak = current_streak
|
|
54
|
-
@points = points
|
|
55
|
-
@leaderboards = leaderboards
|
|
52
|
+
@achievements = achievements
|
|
53
|
+
@current_streak = current_streak
|
|
54
|
+
@points = points
|
|
55
|
+
@leaderboards = leaderboards
|
|
56
56
|
@idempotency_key = idempotency_key if idempotency_key != OMIT
|
|
57
57
|
@idempotent_replayed = idempotent_replayed if idempotent_replayed != OMIT
|
|
58
58
|
@additional_properties = additional_properties
|
|
@@ -132,10 +132,10 @@ module TrophyApiClient
|
|
|
132
132
|
obj.event_id.is_a?(String) != false || raise("Passed value for field obj.event_id is not the expected type, validation failed.")
|
|
133
133
|
obj.metric_id.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
134
134
|
obj.total.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
135
|
-
obj.achievements
|
|
136
|
-
|
|
137
|
-
obj.points
|
|
138
|
-
obj.leaderboards
|
|
135
|
+
obj.achievements.is_a?(Array) != false || raise("Passed value for field obj.achievements is not the expected type, validation failed.")
|
|
136
|
+
TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
|
|
137
|
+
obj.points.is_a?(Hash) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
138
|
+
obj.leaderboards.is_a?(Hash) != false || raise("Passed value for field obj.leaderboards is not the expected type, validation failed.")
|
|
139
139
|
obj.idempotency_key&.is_a?(String) != false || raise("Passed value for field obj.idempotency_key is not the expected type, validation failed.")
|
|
140
140
|
obj.idempotent_replayed&.is_a?(Boolean) != false || raise("Passed value for field obj.idempotent_replayed is not the expected type, validation failed.")
|
|
141
141
|
end
|
|
@@ -8,13 +8,17 @@ module TrophyApiClient
|
|
|
8
8
|
class GetUserPointsResponse
|
|
9
9
|
# @return [String] The ID of the points system
|
|
10
10
|
attr_reader :id
|
|
11
|
+
# @return [String] The key of the points system
|
|
12
|
+
attr_reader :key
|
|
11
13
|
# @return [String] The name of the points system
|
|
12
14
|
attr_reader :name
|
|
13
15
|
# @return [String] The description of the points system
|
|
14
16
|
attr_reader :description
|
|
15
17
|
# @return [String] The URL of the badge image for the points system
|
|
16
18
|
attr_reader :badge_url
|
|
17
|
-
# @return [Float] The user
|
|
19
|
+
# @return [Float] The maximum number of points a user can be awarded in this points system
|
|
20
|
+
attr_reader :max_points
|
|
21
|
+
# @return [Integer] The user's total points
|
|
18
22
|
attr_reader :total
|
|
19
23
|
# @return [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
|
|
20
24
|
attr_reader :awards
|
|
@@ -27,26 +31,33 @@ module TrophyApiClient
|
|
|
27
31
|
OMIT = Object.new
|
|
28
32
|
|
|
29
33
|
# @param id [String] The ID of the points system
|
|
34
|
+
# @param key [String] The key of the points system
|
|
30
35
|
# @param name [String] The name of the points system
|
|
31
36
|
# @param description [String] The description of the points system
|
|
32
37
|
# @param badge_url [String] The URL of the badge image for the points system
|
|
33
|
-
# @param
|
|
38
|
+
# @param max_points [Float] The maximum number of points a user can be awarded in this points system
|
|
39
|
+
# @param total [Integer] The user's total points
|
|
34
40
|
# @param awards [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
|
|
35
41
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
42
|
# @return [TrophyApiClient::GetUserPointsResponse]
|
|
37
|
-
def initialize(id:, name:, total:, awards:, description: OMIT, badge_url: OMIT,
|
|
43
|
+
def initialize(id:, key:, name:, total:, awards:, description: OMIT, badge_url: OMIT, max_points: OMIT,
|
|
44
|
+
additional_properties: nil)
|
|
38
45
|
@id = id
|
|
46
|
+
@key = key
|
|
39
47
|
@name = name
|
|
40
48
|
@description = description if description != OMIT
|
|
41
49
|
@badge_url = badge_url if badge_url != OMIT
|
|
50
|
+
@max_points = max_points if max_points != OMIT
|
|
42
51
|
@total = total
|
|
43
52
|
@awards = awards
|
|
44
53
|
@additional_properties = additional_properties
|
|
45
54
|
@_field_set = {
|
|
46
55
|
"id": id,
|
|
56
|
+
"key": key,
|
|
47
57
|
"name": name,
|
|
48
58
|
"description": description,
|
|
49
59
|
"badgeUrl": badge_url,
|
|
60
|
+
"maxPoints": max_points,
|
|
50
61
|
"total": total,
|
|
51
62
|
"awards": awards
|
|
52
63
|
}.reject do |_k, v|
|
|
@@ -62,9 +73,11 @@ module TrophyApiClient
|
|
|
62
73
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
63
74
|
parsed_json = JSON.parse(json_object)
|
|
64
75
|
id = parsed_json["id"]
|
|
76
|
+
key = parsed_json["key"]
|
|
65
77
|
name = parsed_json["name"]
|
|
66
78
|
description = parsed_json["description"]
|
|
67
79
|
badge_url = parsed_json["badgeUrl"]
|
|
80
|
+
max_points = parsed_json["maxPoints"]
|
|
68
81
|
total = parsed_json["total"]
|
|
69
82
|
awards = parsed_json["awards"]&.map do |item|
|
|
70
83
|
item = item.to_json
|
|
@@ -72,9 +85,11 @@ module TrophyApiClient
|
|
|
72
85
|
end
|
|
73
86
|
new(
|
|
74
87
|
id: id,
|
|
88
|
+
key: key,
|
|
75
89
|
name: name,
|
|
76
90
|
description: description,
|
|
77
91
|
badge_url: badge_url,
|
|
92
|
+
max_points: max_points,
|
|
78
93
|
total: total,
|
|
79
94
|
awards: awards,
|
|
80
95
|
additional_properties: struct
|
|
@@ -96,10 +111,12 @@ module TrophyApiClient
|
|
|
96
111
|
# @return [Void]
|
|
97
112
|
def self.validate_raw(obj:)
|
|
98
113
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
114
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
99
115
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
100
116
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
101
117
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
102
|
-
obj.
|
|
118
|
+
obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
119
|
+
obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
103
120
|
obj.awards.is_a?(Array) != false || raise("Passed value for field obj.awards is not the expected type, validation failed.")
|
|
104
121
|
end
|
|
105
122
|
end
|