trophy_api_client 1.6.0 → 1.8.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/attributes/client.rb +6 -6
- data/lib/trophy_api_client/admin/client.rb +14 -7
- data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +6 -6
- data/lib/trophy_api_client/admin/points/boosts/client.rb +258 -39
- data/lib/trophy_api_client/admin/points/client.rb +21 -0
- data/lib/trophy_api_client/admin/points/levels/client.rb +402 -0
- data/lib/trophy_api_client/admin/points/systems/client.rb +374 -0
- data/lib/trophy_api_client/admin/points/triggers/client.rb +402 -0
- data/lib/trophy_api_client/types/admin_leaderboard.rb +171 -0
- data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_status.rb +11 -0
- data/lib/trophy_api_client/types/{created_points_boost.rb → admin_points_boost.rb} +39 -23
- data/lib/trophy_api_client/types/{created_points_boost_rounding.rb → admin_points_boost_rounding.rb} +1 -1
- data/lib/trophy_api_client/types/{created_points_boost_status.rb → admin_points_boost_status.rb} +1 -1
- data/lib/trophy_api_client/types/admin_points_boost_user_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/admin_points_level.rb +109 -0
- data/lib/trophy_api_client/types/admin_points_level_badge.rb +55 -0
- data/lib/trophy_api_client/types/admin_points_system.rb +118 -0
- data/lib/trophy_api_client/types/admin_points_system_badge.rb +55 -0
- data/lib/trophy_api_client/types/admin_points_system_status.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger.rb +175 -0
- data/lib/trophy_api_client/types/admin_points_trigger_event_attributes_item.rb +66 -0
- data/lib/trophy_api_client/types/admin_points_trigger_status.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger_type.rb +12 -0
- data/lib/trophy_api_client/types/admin_points_trigger_user_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +171 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +13 -0
- data/lib/trophy_api_client/types/create_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/create_leaderboards_response.rb +74 -0
- data/lib/trophy_api_client/types/create_points_boost_request_item.rb +125 -0
- data/lib/trophy_api_client/types/create_points_boost_request_item_rounding.rb +10 -0
- data/lib/trophy_api_client/types/create_points_boost_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_boosts_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
- data/lib/trophy_api_client/types/create_points_level_request_item.rb +103 -0
- data/lib/trophy_api_client/types/create_points_level_request_item_badge.rb +56 -0
- data/lib/trophy_api_client/types/create_points_levels_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/create_points_system_request_item.rb +140 -0
- data/lib/trophy_api_client/types/create_points_system_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/create_points_systems_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_systems_response.rb +74 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item.rb +167 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_event_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_status.rb +9 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_type.rb +12 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_triggers_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_triggers_response.rb +74 -0
- data/lib/trophy_api_client/types/created_admin_points_system.rb +163 -0
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/delete_points_systems_response.rb +74 -0
- data/lib/trophy_api_client/types/delete_points_triggers_response.rb +75 -0
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_boosts_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_levels_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_systems_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_triggers_response.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item.rb +118 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_rounding.rb +10 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_boosts_response.rb +74 -0
- data/lib/trophy_api_client/types/patch_points_levels_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_levels_request_item.rb +100 -0
- data/lib/trophy_api_client/types/patch_points_levels_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/patch_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item.rb +174 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_event_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_status.rb +9 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_type.rb +13 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_triggers_response.rb +74 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +179 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +11 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +9 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +12 -0
- data/lib/trophy_api_client/types/update_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/update_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/update_points_system_request_item.rb +102 -0
- data/lib/trophy_api_client/types/update_points_system_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/update_points_systems_request.rb +7 -0
- data/lib/trophy_api_client/types/update_points_systems_response.rb +74 -0
- data/lib/trophy_api_client/users/client.rb +2 -2
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +93 -17
- metadata +87 -7
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb +0 -111
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding.rb +0 -16
- data/lib/trophy_api_client/types/notification_type.rb +0 -11
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_boost_request_item_rounding"
|
|
4
|
+
require_relative "create_points_boost_request_item_user_attributes_item"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# A points boost to create. May optionally target a specific user via `userId` or
|
|
10
|
+
# filter by user attributes via `userAttributes`. These two fields are mutually
|
|
11
|
+
# exclusive.
|
|
12
|
+
class CreatePointsBoostRequestItem
|
|
13
|
+
# @return [String] The ID of the user to create a boost for. Mutually exclusive with
|
|
14
|
+
# `userAttributes` — providing `userAttributes` when `userId` is set will result
|
|
15
|
+
# in an error. Omit for a global boost.
|
|
16
|
+
attr_reader :user_id
|
|
17
|
+
# @return [String] The name of the boost.
|
|
18
|
+
attr_reader :name
|
|
19
|
+
# @return [String] The start date of the boost (YYYY-MM-DD).
|
|
20
|
+
attr_reader :start
|
|
21
|
+
# @return [String] The end date of the boost (YYYY-MM-DD). If null, the boost has no end date.
|
|
22
|
+
attr_reader :end_
|
|
23
|
+
# @return [Float] The points multiplier. Must be greater than 0, not equal to 1, and less than
|
|
24
|
+
# 100.
|
|
25
|
+
attr_reader :multiplier
|
|
26
|
+
# @return [TrophyApiClient::CreatePointsBoostRequestItemRounding] How to round the boosted points. Defaults to 'down'.
|
|
27
|
+
attr_reader :rounding
|
|
28
|
+
# @return [Array<TrophyApiClient::CreatePointsBoostRequestItemUserAttributesItem>] User attribute filters for the boost. Cannot be provided when `userId` is set.
|
|
29
|
+
attr_reader :user_attributes
|
|
30
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
31
|
+
attr_reader :additional_properties
|
|
32
|
+
# @return [Object]
|
|
33
|
+
attr_reader :_field_set
|
|
34
|
+
protected :_field_set
|
|
35
|
+
|
|
36
|
+
OMIT = Object.new
|
|
37
|
+
|
|
38
|
+
# @param user_id [String] The ID of the user to create a boost for. Mutually exclusive with
|
|
39
|
+
# `userAttributes` — providing `userAttributes` when `userId` is set will result
|
|
40
|
+
# in an error. Omit for a global boost.
|
|
41
|
+
# @param name [String] The name of the boost.
|
|
42
|
+
# @param start [String] The start date of the boost (YYYY-MM-DD).
|
|
43
|
+
# @param end_ [String] The end date of the boost (YYYY-MM-DD). If null, the boost has no end date.
|
|
44
|
+
# @param multiplier [Float] The points multiplier. Must be greater than 0, not equal to 1, and less than
|
|
45
|
+
# 100.
|
|
46
|
+
# @param rounding [TrophyApiClient::CreatePointsBoostRequestItemRounding] How to round the boosted points. Defaults to 'down'.
|
|
47
|
+
# @param user_attributes [Array<TrophyApiClient::CreatePointsBoostRequestItemUserAttributesItem>] User attribute filters for the boost. Cannot be provided when `userId` is set.
|
|
48
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
49
|
+
# @return [TrophyApiClient::CreatePointsBoostRequestItem]
|
|
50
|
+
def initialize(name:, start:, multiplier:, user_id: OMIT, end_: OMIT, rounding: OMIT, user_attributes: OMIT,
|
|
51
|
+
additional_properties: nil)
|
|
52
|
+
@user_id = user_id if user_id != OMIT
|
|
53
|
+
@name = name
|
|
54
|
+
@start = start
|
|
55
|
+
@end_ = end_ if end_ != OMIT
|
|
56
|
+
@multiplier = multiplier
|
|
57
|
+
@rounding = rounding if rounding != OMIT
|
|
58
|
+
@user_attributes = user_attributes if user_attributes != OMIT
|
|
59
|
+
@additional_properties = additional_properties
|
|
60
|
+
@_field_set = {
|
|
61
|
+
"userId": user_id,
|
|
62
|
+
"name": name,
|
|
63
|
+
"start": start,
|
|
64
|
+
"end": end_,
|
|
65
|
+
"multiplier": multiplier,
|
|
66
|
+
"rounding": rounding,
|
|
67
|
+
"userAttributes": user_attributes
|
|
68
|
+
}.reject do |_k, v|
|
|
69
|
+
v == OMIT
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Deserialize a JSON object to an instance of CreatePointsBoostRequestItem
|
|
74
|
+
#
|
|
75
|
+
# @param json_object [String]
|
|
76
|
+
# @return [TrophyApiClient::CreatePointsBoostRequestItem]
|
|
77
|
+
def self.from_json(json_object:)
|
|
78
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
79
|
+
parsed_json = JSON.parse(json_object)
|
|
80
|
+
user_id = parsed_json["userId"]
|
|
81
|
+
name = parsed_json["name"]
|
|
82
|
+
start = parsed_json["start"]
|
|
83
|
+
end_ = parsed_json["end"]
|
|
84
|
+
multiplier = parsed_json["multiplier"]
|
|
85
|
+
rounding = parsed_json["rounding"]
|
|
86
|
+
user_attributes = parsed_json["userAttributes"]&.map do |item|
|
|
87
|
+
item = item.to_json
|
|
88
|
+
TrophyApiClient::CreatePointsBoostRequestItemUserAttributesItem.from_json(json_object: item)
|
|
89
|
+
end
|
|
90
|
+
new(
|
|
91
|
+
user_id: user_id,
|
|
92
|
+
name: name,
|
|
93
|
+
start: start,
|
|
94
|
+
end_: end_,
|
|
95
|
+
multiplier: multiplier,
|
|
96
|
+
rounding: rounding,
|
|
97
|
+
user_attributes: user_attributes,
|
|
98
|
+
additional_properties: struct
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Serialize an instance of CreatePointsBoostRequestItem to a JSON object
|
|
103
|
+
#
|
|
104
|
+
# @return [String]
|
|
105
|
+
def to_json(*_args)
|
|
106
|
+
@_field_set&.to_json
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
110
|
+
# hash and check each fields type against the current object's property
|
|
111
|
+
# definitions.
|
|
112
|
+
#
|
|
113
|
+
# @param obj [Object]
|
|
114
|
+
# @return [Void]
|
|
115
|
+
def self.validate_raw(obj:)
|
|
116
|
+
obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
|
117
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
118
|
+
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
119
|
+
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
120
|
+
obj.multiplier.is_a?(Float) != false || raise("Passed value for field obj.multiplier is not the expected type, validation failed.")
|
|
121
|
+
obj.rounding&.is_a?(TrophyApiClient::CreatePointsBoostRequestItemRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.")
|
|
122
|
+
obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class CreatePointsBoostRequestItemUserAttributesItem
|
|
8
|
+
# @return [String] The UUID of the user attribute.
|
|
9
|
+
attr_reader :attribute_id
|
|
10
|
+
# @return [String] The value to match.
|
|
11
|
+
attr_reader :attribute_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 attribute_id [String] The UUID of the user attribute.
|
|
21
|
+
# @param attribute_value [String] The value to match.
|
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
# @return [TrophyApiClient::CreatePointsBoostRequestItemUserAttributesItem]
|
|
24
|
+
def initialize(attribute_id:, attribute_value:, additional_properties: nil)
|
|
25
|
+
@attribute_id = attribute_id
|
|
26
|
+
@attribute_value = attribute_value
|
|
27
|
+
@additional_properties = additional_properties
|
|
28
|
+
@_field_set = { "attributeId": attribute_id, "attributeValue": attribute_value }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Deserialize a JSON object to an instance of
|
|
32
|
+
# CreatePointsBoostRequestItemUserAttributesItem
|
|
33
|
+
#
|
|
34
|
+
# @param json_object [String]
|
|
35
|
+
# @return [TrophyApiClient::CreatePointsBoostRequestItemUserAttributesItem]
|
|
36
|
+
def self.from_json(json_object:)
|
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
38
|
+
parsed_json = JSON.parse(json_object)
|
|
39
|
+
attribute_id = parsed_json["attributeId"]
|
|
40
|
+
attribute_value = parsed_json["attributeValue"]
|
|
41
|
+
new(
|
|
42
|
+
attribute_id: attribute_id,
|
|
43
|
+
attribute_value: attribute_value,
|
|
44
|
+
additional_properties: struct
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Serialize an instance of CreatePointsBoostRequestItemUserAttributesItem to a
|
|
49
|
+
# JSON object
|
|
50
|
+
#
|
|
51
|
+
# @return [String]
|
|
52
|
+
def to_json(*_args)
|
|
53
|
+
@_field_set&.to_json
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
57
|
+
# hash and check each fields type against the current object's property
|
|
58
|
+
# definitions.
|
|
59
|
+
#
|
|
60
|
+
# @param obj [Object]
|
|
61
|
+
# @return [Void]
|
|
62
|
+
def self.validate_raw(obj:)
|
|
63
|
+
obj.attribute_id.is_a?(String) != false || raise("Passed value for field obj.attribute_id is not the expected type, validation failed.")
|
|
64
|
+
obj.attribute_value.is_a?(String) != false || raise("Passed value for field obj.attribute_value is not the expected type, validation failed.")
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "admin_points_boost"
|
|
4
4
|
require_relative "admin_issue"
|
|
5
5
|
require "ostruct"
|
|
6
6
|
require "json"
|
|
@@ -9,7 +9,7 @@ module TrophyApiClient
|
|
|
9
9
|
# Response containing created boosts and any issues encountered while creating
|
|
10
10
|
# points boosts.
|
|
11
11
|
class CreatePointsBoostsResponse
|
|
12
|
-
# @return [Array<TrophyApiClient::
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminPointsBoost>] Array of successfully created boosts.
|
|
13
13
|
attr_reader :created
|
|
14
14
|
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
15
15
|
attr_reader :issues
|
|
@@ -21,7 +21,7 @@ module TrophyApiClient
|
|
|
21
21
|
|
|
22
22
|
OMIT = Object.new
|
|
23
23
|
|
|
24
|
-
# @param created [Array<TrophyApiClient::
|
|
24
|
+
# @param created [Array<TrophyApiClient::AdminPointsBoost>] Array of successfully created boosts.
|
|
25
25
|
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
26
26
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
27
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
@@ -41,7 +41,7 @@ module TrophyApiClient
|
|
|
41
41
|
parsed_json = JSON.parse(json_object)
|
|
42
42
|
created = parsed_json["created"]&.map do |item|
|
|
43
43
|
item = item.to_json
|
|
44
|
-
TrophyApiClient::
|
|
44
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
45
45
|
end
|
|
46
46
|
issues = parsed_json["issues"]&.map do |item|
|
|
47
47
|
item = item.to_json
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_level_request_item_badge"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A points level to create.
|
|
9
|
+
class CreatePointsLevelRequestItem
|
|
10
|
+
# @return [String] The name of the level.
|
|
11
|
+
attr_reader :name
|
|
12
|
+
# @return [String] A unique key for the level. Only alphanumeric characters, hyphens, and
|
|
13
|
+
# underscores are permitted.
|
|
14
|
+
attr_reader :key
|
|
15
|
+
# @return [Integer] The threshold points value for the level.
|
|
16
|
+
attr_reader :points
|
|
17
|
+
# @return [String] An optional description of the level.
|
|
18
|
+
attr_reader :description
|
|
19
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge] An optional badge for the level.
|
|
20
|
+
attr_reader :badge
|
|
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 name [String] The name of the level.
|
|
30
|
+
# @param key [String] A unique key for the level. Only alphanumeric characters, hyphens, and
|
|
31
|
+
# underscores are permitted.
|
|
32
|
+
# @param points [Integer] The threshold points value for the level.
|
|
33
|
+
# @param description [String] An optional description of the level.
|
|
34
|
+
# @param badge [TrophyApiClient::CreatePointsLevelRequestItemBadge] An optional badge for the level.
|
|
35
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItem]
|
|
37
|
+
def initialize(name:, key:, points:, description: OMIT, badge: OMIT, additional_properties: nil)
|
|
38
|
+
@name = name
|
|
39
|
+
@key = key
|
|
40
|
+
@points = points
|
|
41
|
+
@description = description if description != OMIT
|
|
42
|
+
@badge = badge if badge != OMIT
|
|
43
|
+
@additional_properties = additional_properties
|
|
44
|
+
@_field_set = {
|
|
45
|
+
"name": name,
|
|
46
|
+
"key": key,
|
|
47
|
+
"points": points,
|
|
48
|
+
"description": description,
|
|
49
|
+
"badge": badge
|
|
50
|
+
}.reject do |_k, v|
|
|
51
|
+
v == OMIT
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Deserialize a JSON object to an instance of CreatePointsLevelRequestItem
|
|
56
|
+
#
|
|
57
|
+
# @param json_object [String]
|
|
58
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItem]
|
|
59
|
+
def self.from_json(json_object:)
|
|
60
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
61
|
+
parsed_json = JSON.parse(json_object)
|
|
62
|
+
name = parsed_json["name"]
|
|
63
|
+
key = parsed_json["key"]
|
|
64
|
+
points = parsed_json["points"]
|
|
65
|
+
description = parsed_json["description"]
|
|
66
|
+
if parsed_json["badge"].nil?
|
|
67
|
+
badge = nil
|
|
68
|
+
else
|
|
69
|
+
badge = parsed_json["badge"].to_json
|
|
70
|
+
badge = TrophyApiClient::CreatePointsLevelRequestItemBadge.from_json(json_object: badge)
|
|
71
|
+
end
|
|
72
|
+
new(
|
|
73
|
+
name: name,
|
|
74
|
+
key: key,
|
|
75
|
+
points: points,
|
|
76
|
+
description: description,
|
|
77
|
+
badge: badge,
|
|
78
|
+
additional_properties: struct
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Serialize an instance of CreatePointsLevelRequestItem to a JSON object
|
|
83
|
+
#
|
|
84
|
+
# @return [String]
|
|
85
|
+
def to_json(*_args)
|
|
86
|
+
@_field_set&.to_json
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
90
|
+
# hash and check each fields type against the current object's property
|
|
91
|
+
# definitions.
|
|
92
|
+
#
|
|
93
|
+
# @param obj [Object]
|
|
94
|
+
# @return [Void]
|
|
95
|
+
def self.validate_raw(obj:)
|
|
96
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
97
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
98
|
+
obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
99
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
100
|
+
obj.badge.nil? || TrophyApiClient::CreatePointsLevelRequestItemBadge.validate_raw(obj: obj.badge)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
# An optional badge for the level.
|
|
8
|
+
class CreatePointsLevelRequestItemBadge
|
|
9
|
+
# @return [String] The URL of the badge image.
|
|
10
|
+
attr_reader :url
|
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
12
|
+
attr_reader :additional_properties
|
|
13
|
+
# @return [Object]
|
|
14
|
+
attr_reader :_field_set
|
|
15
|
+
protected :_field_set
|
|
16
|
+
|
|
17
|
+
OMIT = Object.new
|
|
18
|
+
|
|
19
|
+
# @param url [String] The URL of the badge image.
|
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge]
|
|
22
|
+
def initialize(url:, additional_properties: nil)
|
|
23
|
+
@url = url
|
|
24
|
+
@additional_properties = additional_properties
|
|
25
|
+
@_field_set = { "url": url }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Deserialize a JSON object to an instance of CreatePointsLevelRequestItemBadge
|
|
29
|
+
#
|
|
30
|
+
# @param json_object [String]
|
|
31
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge]
|
|
32
|
+
def self.from_json(json_object:)
|
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
34
|
+
parsed_json = JSON.parse(json_object)
|
|
35
|
+
url = parsed_json["url"]
|
|
36
|
+
new(url: url, additional_properties: struct)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Serialize an instance of CreatePointsLevelRequestItemBadge to a JSON object
|
|
40
|
+
#
|
|
41
|
+
# @return [String]
|
|
42
|
+
def to_json(*_args)
|
|
43
|
+
@_field_set&.to_json
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
47
|
+
# hash and check each fields type against the current object's property
|
|
48
|
+
# definitions.
|
|
49
|
+
#
|
|
50
|
+
# @param obj [Object]
|
|
51
|
+
# @return [Void]
|
|
52
|
+
def self.validate_raw(obj:)
|
|
53
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_points_level"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing created levels and any per-item issues.
|
|
10
|
+
class CreatePointsLevelsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminPointsLevel>] Array of successfully created levels.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during level creation.
|
|
14
|
+
attr_reader :issues
|
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
16
|
+
attr_reader :additional_properties
|
|
17
|
+
# @return [Object]
|
|
18
|
+
attr_reader :_field_set
|
|
19
|
+
protected :_field_set
|
|
20
|
+
|
|
21
|
+
OMIT = Object.new
|
|
22
|
+
|
|
23
|
+
# @param created [Array<TrophyApiClient::AdminPointsLevel>] Array of successfully created levels.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during level creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreatePointsLevelsResponse]
|
|
27
|
+
def initialize(created:, issues:, additional_properties: nil)
|
|
28
|
+
@created = created
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "created": created, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of CreatePointsLevelsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreatePointsLevelsResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
created = parsed_json["created"]&.map do |item|
|
|
42
|
+
item = item.to_json
|
|
43
|
+
TrophyApiClient::AdminPointsLevel.from_json(json_object: item)
|
|
44
|
+
end
|
|
45
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
46
|
+
item = item.to_json
|
|
47
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
48
|
+
end
|
|
49
|
+
new(
|
|
50
|
+
created: created,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of CreatePointsLevelsResponse to a JSON object
|
|
57
|
+
#
|
|
58
|
+
# @return [String]
|
|
59
|
+
def to_json(*_args)
|
|
60
|
+
@_field_set&.to_json
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
64
|
+
# hash and check each fields type against the current object's property
|
|
65
|
+
# definitions.
|
|
66
|
+
#
|
|
67
|
+
# @param obj [Object]
|
|
68
|
+
# @return [Void]
|
|
69
|
+
def self.validate_raw(obj:)
|
|
70
|
+
obj.created.is_a?(Array) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
71
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_system_request_item_badge"
|
|
4
|
+
require_relative "create_points_level_request_item"
|
|
5
|
+
require_relative "create_points_boost_request_item"
|
|
6
|
+
require_relative "create_points_trigger_request_item"
|
|
7
|
+
require "ostruct"
|
|
8
|
+
require "json"
|
|
9
|
+
|
|
10
|
+
module TrophyApiClient
|
|
11
|
+
# A points system to create. Optionally include sub-entities.
|
|
12
|
+
class CreatePointsSystemRequestItem
|
|
13
|
+
# @return [String] The points system name.
|
|
14
|
+
attr_reader :name
|
|
15
|
+
# @return [String] The points system key. Only alphanumeric characters, hyphens, and underscores
|
|
16
|
+
# are permitted.
|
|
17
|
+
attr_reader :key
|
|
18
|
+
# @return [String] A short description of the points system.
|
|
19
|
+
attr_reader :description
|
|
20
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItemBadge] An optional badge for the points system.
|
|
21
|
+
attr_reader :badge
|
|
22
|
+
# @return [Integer] Optional maximum points a user can earn.
|
|
23
|
+
attr_reader :max_points
|
|
24
|
+
# @return [Array<TrophyApiClient::CreatePointsLevelRequestItem>] Optional array of levels to create alongside the system.
|
|
25
|
+
attr_reader :levels
|
|
26
|
+
# @return [Array<TrophyApiClient::CreatePointsBoostRequestItem>] Optional array of boosts to create alongside the system.
|
|
27
|
+
attr_reader :boosts
|
|
28
|
+
# @return [Array<TrophyApiClient::CreatePointsTriggerRequestItem>] Optional array of triggers to create alongside the system.
|
|
29
|
+
attr_reader :triggers
|
|
30
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
31
|
+
attr_reader :additional_properties
|
|
32
|
+
# @return [Object]
|
|
33
|
+
attr_reader :_field_set
|
|
34
|
+
protected :_field_set
|
|
35
|
+
|
|
36
|
+
OMIT = Object.new
|
|
37
|
+
|
|
38
|
+
# @param name [String] The points system name.
|
|
39
|
+
# @param key [String] The points system key. Only alphanumeric characters, hyphens, and underscores
|
|
40
|
+
# are permitted.
|
|
41
|
+
# @param description [String] A short description of the points system.
|
|
42
|
+
# @param badge [TrophyApiClient::CreatePointsSystemRequestItemBadge] An optional badge for the points system.
|
|
43
|
+
# @param max_points [Integer] Optional maximum points a user can earn.
|
|
44
|
+
# @param levels [Array<TrophyApiClient::CreatePointsLevelRequestItem>] Optional array of levels to create alongside the system.
|
|
45
|
+
# @param boosts [Array<TrophyApiClient::CreatePointsBoostRequestItem>] Optional array of boosts to create alongside the system.
|
|
46
|
+
# @param triggers [Array<TrophyApiClient::CreatePointsTriggerRequestItem>] Optional array of triggers to create alongside the system.
|
|
47
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
48
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItem]
|
|
49
|
+
def initialize(name:, key:, description: OMIT, badge: OMIT, max_points: OMIT, levels: OMIT, boosts: OMIT,
|
|
50
|
+
triggers: OMIT, additional_properties: nil)
|
|
51
|
+
@name = name
|
|
52
|
+
@key = key
|
|
53
|
+
@description = description if description != OMIT
|
|
54
|
+
@badge = badge if badge != OMIT
|
|
55
|
+
@max_points = max_points if max_points != OMIT
|
|
56
|
+
@levels = levels if levels != OMIT
|
|
57
|
+
@boosts = boosts if boosts != OMIT
|
|
58
|
+
@triggers = triggers if triggers != OMIT
|
|
59
|
+
@additional_properties = additional_properties
|
|
60
|
+
@_field_set = {
|
|
61
|
+
"name": name,
|
|
62
|
+
"key": key,
|
|
63
|
+
"description": description,
|
|
64
|
+
"badge": badge,
|
|
65
|
+
"maxPoints": max_points,
|
|
66
|
+
"levels": levels,
|
|
67
|
+
"boosts": boosts,
|
|
68
|
+
"triggers": triggers
|
|
69
|
+
}.reject do |_k, v|
|
|
70
|
+
v == OMIT
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Deserialize a JSON object to an instance of CreatePointsSystemRequestItem
|
|
75
|
+
#
|
|
76
|
+
# @param json_object [String]
|
|
77
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItem]
|
|
78
|
+
def self.from_json(json_object:)
|
|
79
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
80
|
+
parsed_json = JSON.parse(json_object)
|
|
81
|
+
name = parsed_json["name"]
|
|
82
|
+
key = parsed_json["key"]
|
|
83
|
+
description = parsed_json["description"]
|
|
84
|
+
if parsed_json["badge"].nil?
|
|
85
|
+
badge = nil
|
|
86
|
+
else
|
|
87
|
+
badge = parsed_json["badge"].to_json
|
|
88
|
+
badge = TrophyApiClient::CreatePointsSystemRequestItemBadge.from_json(json_object: badge)
|
|
89
|
+
end
|
|
90
|
+
max_points = parsed_json["maxPoints"]
|
|
91
|
+
levels = parsed_json["levels"]&.map do |item|
|
|
92
|
+
item = item.to_json
|
|
93
|
+
TrophyApiClient::CreatePointsLevelRequestItem.from_json(json_object: item)
|
|
94
|
+
end
|
|
95
|
+
boosts = parsed_json["boosts"]&.map do |item|
|
|
96
|
+
item = item.to_json
|
|
97
|
+
TrophyApiClient::CreatePointsBoostRequestItem.from_json(json_object: item)
|
|
98
|
+
end
|
|
99
|
+
triggers = parsed_json["triggers"]&.map do |item|
|
|
100
|
+
item = item.to_json
|
|
101
|
+
TrophyApiClient::CreatePointsTriggerRequestItem.from_json(json_object: item)
|
|
102
|
+
end
|
|
103
|
+
new(
|
|
104
|
+
name: name,
|
|
105
|
+
key: key,
|
|
106
|
+
description: description,
|
|
107
|
+
badge: badge,
|
|
108
|
+
max_points: max_points,
|
|
109
|
+
levels: levels,
|
|
110
|
+
boosts: boosts,
|
|
111
|
+
triggers: triggers,
|
|
112
|
+
additional_properties: struct
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Serialize an instance of CreatePointsSystemRequestItem to a JSON object
|
|
117
|
+
#
|
|
118
|
+
# @return [String]
|
|
119
|
+
def to_json(*_args)
|
|
120
|
+
@_field_set&.to_json
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
124
|
+
# hash and check each fields type against the current object's property
|
|
125
|
+
# definitions.
|
|
126
|
+
#
|
|
127
|
+
# @param obj [Object]
|
|
128
|
+
# @return [Void]
|
|
129
|
+
def self.validate_raw(obj:)
|
|
130
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
131
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
132
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
133
|
+
obj.badge.nil? || TrophyApiClient::CreatePointsSystemRequestItemBadge.validate_raw(obj: obj.badge)
|
|
134
|
+
obj.max_points&.is_a?(Integer) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
135
|
+
obj.levels&.is_a?(Array) != false || raise("Passed value for field obj.levels is not the expected type, validation failed.")
|
|
136
|
+
obj.boosts&.is_a?(Array) != false || raise("Passed value for field obj.boosts is not the expected type, validation failed.")
|
|
137
|
+
obj.triggers&.is_a?(Array) != false || raise("Passed value for field obj.triggers is not the expected type, validation failed.")
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|