trophy_api_client 1.7.0 → 1.9.1
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/requests.rb +34 -8
- data/lib/trophy_api_client/achievements/client.rb +4 -0
- data/lib/trophy_api_client/admin/attributes/client.rb +10 -0
- data/lib/trophy_api_client/admin/client.rb +7 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +10 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/boosts/client.rb +268 -39
- data/lib/trophy_api_client/admin/points/client.rb +21 -0
- data/lib/trophy_api_client/admin/points/levels/client.rb +412 -0
- data/lib/trophy_api_client/admin/points/systems/client.rb +384 -0
- data/lib/trophy_api_client/admin/points/triggers/client.rb +412 -0
- data/lib/trophy_api_client/admin/streaks/client.rb +2 -0
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -0
- data/lib/trophy_api_client/admin/tenants/client.rb +376 -0
- data/lib/trophy_api_client/leaderboards/client.rb +4 -0
- data/lib/trophy_api_client/metrics/client.rb +2 -0
- data/lib/trophy_api_client/points/client.rb +10 -0
- data/lib/trophy_api_client/streaks/client.rb +4 -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/admin_tenant.rb +103 -0
- data/lib/trophy_api_client/types/admin_tenant_status.rb +9 -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/create_tenant_request_item.rb +66 -0
- data/lib/trophy_api_client/types/create_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/create_tenants_response.rb +74 -0
- data/lib/trophy_api_client/types/created_admin_points_system.rb +163 -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/delete_tenants_response.rb +74 -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/list_tenants_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_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/types/update_tenant_request_item.rb +75 -0
- data/lib/trophy_api_client/types/update_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/update_tenants_response.rb +74 -0
- data/lib/trophy_api_client/users/client.rb +32 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/trophy_api_client.rb +12 -4
- data/lib/types_export.rb +74 -5
- metadata +80 -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
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../../../../requests"
|
|
4
|
-
require_relative "types/
|
|
4
|
+
require_relative "../../../types/list_points_boosts_response"
|
|
5
|
+
require "json"
|
|
6
|
+
require_relative "../../../types/create_points_boosts_request"
|
|
5
7
|
require_relative "../../../types/create_points_boosts_response"
|
|
6
8
|
require_relative "../../../types/delete_points_boosts_response"
|
|
9
|
+
require_relative "../../../types/patch_points_boosts_request"
|
|
10
|
+
require_relative "../../../types/patch_points_boosts_response"
|
|
11
|
+
require_relative "../../../types/admin_points_boost"
|
|
7
12
|
require "async"
|
|
8
13
|
|
|
9
14
|
module TrophyApiClient
|
|
@@ -19,16 +24,56 @@ module TrophyApiClient
|
|
|
19
24
|
@request_client = request_client
|
|
20
25
|
end
|
|
21
26
|
|
|
22
|
-
#
|
|
27
|
+
# List points boosts for a system.
|
|
23
28
|
#
|
|
24
|
-
# @param
|
|
25
|
-
# @param
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
29
|
+
# @param system_id [String] The UUID of the points system.
|
|
30
|
+
# @param limit [Integer] Maximum number of results to return (1-100, default 10).
|
|
31
|
+
# @param skip [Integer] Number of results to skip for pagination (default 0).
|
|
32
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
33
|
+
# @return [TrophyApiClient::LIST_POINTS_BOOSTS_RESPONSE]
|
|
34
|
+
# @example
|
|
35
|
+
# api = TrophyApiClient::Client.new(
|
|
36
|
+
# base_url: "https://api.example.com",
|
|
37
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
38
|
+
# api_key: "YOUR_API_KEY"
|
|
39
|
+
# )
|
|
40
|
+
# api.admin.points.boosts.list(
|
|
41
|
+
# system_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
42
|
+
# limit: 1,
|
|
43
|
+
# skip: 1
|
|
44
|
+
# )
|
|
45
|
+
def list(system_id:, limit: nil, skip: nil, request_options: nil)
|
|
46
|
+
response = @request_client.conn.get do |req|
|
|
47
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
48
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
49
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
50
|
+
req.headers = {
|
|
51
|
+
**(req.headers || {}),
|
|
52
|
+
**@request_client.get_headers,
|
|
53
|
+
**(request_options&.additional_headers || {})
|
|
54
|
+
}.compact
|
|
55
|
+
req.params = {
|
|
56
|
+
**(request_options&.additional_query_parameters || {}),
|
|
57
|
+
"limit": limit,
|
|
58
|
+
"skip": skip
|
|
59
|
+
}.compact
|
|
60
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
61
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
62
|
+
end
|
|
63
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
64
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
65
|
+
end
|
|
66
|
+
parsed_json = JSON.parse(response.body)
|
|
67
|
+
parsed_json&.map do |item|
|
|
68
|
+
item = item.to_json
|
|
69
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Create points boosts.
|
|
74
|
+
#
|
|
75
|
+
# @param system_id [String] The UUID of the points system.
|
|
76
|
+
# @param request [TrophyApiClient::CREATE_POINTS_BOOSTS_REQUEST]
|
|
32
77
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
33
78
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
34
79
|
# @example
|
|
@@ -37,11 +82,12 @@ module TrophyApiClient
|
|
|
37
82
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
38
83
|
# api_key: "YOUR_API_KEY"
|
|
39
84
|
# )
|
|
40
|
-
# api.admin.points.boosts.create(
|
|
41
|
-
def create(
|
|
85
|
+
# api.admin.points.boosts.create(system_id: "550e8400-e29b-41d4-a716-446655440000", request: [{ user_id: "user-123", name: "Double XP Weekend", start: "2024-01-01", end_: "2024-01-03", multiplier: 2 }])
|
|
86
|
+
def create(system_id:, request:, request_options: nil)
|
|
42
87
|
response = @request_client.conn.post do |req|
|
|
43
88
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
44
89
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
90
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
45
91
|
req.headers = {
|
|
46
92
|
**(req.headers || {}),
|
|
47
93
|
**@request_client.get_headers,
|
|
@@ -50,18 +96,16 @@ module TrophyApiClient
|
|
|
50
96
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
51
97
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
52
98
|
end
|
|
53
|
-
req.body = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
boosts: boosts
|
|
57
|
-
}.compact
|
|
58
|
-
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
|
|
99
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
100
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
101
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
59
102
|
end
|
|
60
103
|
TrophyApiClient::CreatePointsBoostsResponse.from_json(json_object: response.body)
|
|
61
104
|
end
|
|
62
105
|
|
|
63
106
|
# Delete multiple points boosts by ID.
|
|
64
107
|
#
|
|
108
|
+
# @param system_id [String] The UUID of the points system.
|
|
65
109
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
66
110
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
67
111
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
@@ -72,10 +116,11 @@ module TrophyApiClient
|
|
|
72
116
|
# api_key: "YOUR_API_KEY"
|
|
73
117
|
# )
|
|
74
118
|
# api.admin.points.boosts.delete
|
|
75
|
-
def delete(ids: nil, request_options: nil)
|
|
119
|
+
def delete(system_id:, ids: nil, request_options: nil)
|
|
76
120
|
response = @request_client.conn.delete do |req|
|
|
77
121
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
78
122
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
123
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
79
124
|
req.headers = {
|
|
80
125
|
**(req.headers || {}),
|
|
81
126
|
**@request_client.get_headers,
|
|
@@ -85,10 +130,79 @@ module TrophyApiClient
|
|
|
85
130
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
86
131
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
87
132
|
end
|
|
88
|
-
req.url "#{@request_client.get_url(environment: admin,
|
|
133
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
134
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
89
135
|
end
|
|
90
136
|
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
91
137
|
end
|
|
138
|
+
|
|
139
|
+
# Update multiple points boosts.
|
|
140
|
+
#
|
|
141
|
+
# @param system_id [String] The UUID of the points system.
|
|
142
|
+
# @param request [TrophyApiClient::PATCH_POINTS_BOOSTS_REQUEST]
|
|
143
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
144
|
+
# @return [TrophyApiClient::PatchPointsBoostsResponse]
|
|
145
|
+
# @example
|
|
146
|
+
# api = TrophyApiClient::Client.new(
|
|
147
|
+
# base_url: "https://api.example.com",
|
|
148
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
149
|
+
# api_key: "YOUR_API_KEY"
|
|
150
|
+
# )
|
|
151
|
+
# api.admin.points.boosts.update(system_id: "550e8400-e29b-41d4-a716-446655440000", request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Updated Boost Name", multiplier: 3 }])
|
|
152
|
+
def update(system_id:, request:, request_options: nil)
|
|
153
|
+
response = @request_client.conn.patch do |req|
|
|
154
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
155
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
156
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
157
|
+
req.headers = {
|
|
158
|
+
**(req.headers || {}),
|
|
159
|
+
**@request_client.get_headers,
|
|
160
|
+
**(request_options&.additional_headers || {})
|
|
161
|
+
}.compact
|
|
162
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
163
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
164
|
+
end
|
|
165
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
166
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
167
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
168
|
+
end
|
|
169
|
+
TrophyApiClient::PatchPointsBoostsResponse.from_json(json_object: response.body)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Get a single points boost by ID.
|
|
173
|
+
#
|
|
174
|
+
# @param system_id [String] The UUID of the points system.
|
|
175
|
+
# @param id [String] The UUID of the points boost.
|
|
176
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
177
|
+
# @return [TrophyApiClient::AdminPointsBoost]
|
|
178
|
+
# @example
|
|
179
|
+
# api = TrophyApiClient::Client.new(
|
|
180
|
+
# base_url: "https://api.example.com",
|
|
181
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
182
|
+
# api_key: "YOUR_API_KEY"
|
|
183
|
+
# )
|
|
184
|
+
# api.admin.points.boosts.get(system_id: "550e8400-e29b-41d4-a716-446655440000", id: "660f9500-f30c-42e5-b827-557766550001")
|
|
185
|
+
def get(system_id:, id:, request_options: nil)
|
|
186
|
+
response = @request_client.conn.get do |req|
|
|
187
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
188
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
189
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
190
|
+
req.headers = {
|
|
191
|
+
**(req.headers || {}),
|
|
192
|
+
**@request_client.get_headers,
|
|
193
|
+
**(request_options&.additional_headers || {})
|
|
194
|
+
}.compact
|
|
195
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
196
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
197
|
+
end
|
|
198
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
199
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
200
|
+
end
|
|
201
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
202
|
+
request_options: request_options)}/points/#{system_id}/boosts/#{id}"
|
|
203
|
+
end
|
|
204
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: response.body)
|
|
205
|
+
end
|
|
92
206
|
end
|
|
93
207
|
|
|
94
208
|
class AsyncBoostsClient
|
|
@@ -101,16 +215,58 @@ module TrophyApiClient
|
|
|
101
215
|
@request_client = request_client
|
|
102
216
|
end
|
|
103
217
|
|
|
104
|
-
#
|
|
218
|
+
# List points boosts for a system.
|
|
219
|
+
#
|
|
220
|
+
# @param system_id [String] The UUID of the points system.
|
|
221
|
+
# @param limit [Integer] Maximum number of results to return (1-100, default 10).
|
|
222
|
+
# @param skip [Integer] Number of results to skip for pagination (default 0).
|
|
223
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
224
|
+
# @return [TrophyApiClient::LIST_POINTS_BOOSTS_RESPONSE]
|
|
225
|
+
# @example
|
|
226
|
+
# api = TrophyApiClient::Client.new(
|
|
227
|
+
# base_url: "https://api.example.com",
|
|
228
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
229
|
+
# api_key: "YOUR_API_KEY"
|
|
230
|
+
# )
|
|
231
|
+
# api.admin.points.boosts.list(
|
|
232
|
+
# system_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
233
|
+
# limit: 1,
|
|
234
|
+
# skip: 1
|
|
235
|
+
# )
|
|
236
|
+
def list(system_id:, limit: nil, skip: nil, request_options: nil)
|
|
237
|
+
Async do
|
|
238
|
+
response = @request_client.conn.get do |req|
|
|
239
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
240
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
241
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
242
|
+
req.headers = {
|
|
243
|
+
**(req.headers || {}),
|
|
244
|
+
**@request_client.get_headers,
|
|
245
|
+
**(request_options&.additional_headers || {})
|
|
246
|
+
}.compact
|
|
247
|
+
req.params = {
|
|
248
|
+
**(request_options&.additional_query_parameters || {}),
|
|
249
|
+
"limit": limit,
|
|
250
|
+
"skip": skip
|
|
251
|
+
}.compact
|
|
252
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
253
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
254
|
+
end
|
|
255
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
256
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
257
|
+
end
|
|
258
|
+
parsed_json = JSON.parse(response.body)
|
|
259
|
+
parsed_json&.map do |item|
|
|
260
|
+
item = item.to_json
|
|
261
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Create points boosts.
|
|
105
267
|
#
|
|
106
|
-
# @param
|
|
107
|
-
# @param
|
|
108
|
-
# * :user_id (String)
|
|
109
|
-
# * :name (String)
|
|
110
|
-
# * :start (String)
|
|
111
|
-
# * :end_ (String)
|
|
112
|
-
# * :multiplier (Float)
|
|
113
|
-
# * :rounding (TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItemRounding)
|
|
268
|
+
# @param system_id [String] The UUID of the points system.
|
|
269
|
+
# @param request [TrophyApiClient::CREATE_POINTS_BOOSTS_REQUEST]
|
|
114
270
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
115
271
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
116
272
|
# @example
|
|
@@ -119,12 +275,13 @@ module TrophyApiClient
|
|
|
119
275
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
120
276
|
# api_key: "YOUR_API_KEY"
|
|
121
277
|
# )
|
|
122
|
-
# api.admin.points.boosts.create(
|
|
123
|
-
def create(
|
|
278
|
+
# api.admin.points.boosts.create(system_id: "550e8400-e29b-41d4-a716-446655440000", request: [{ user_id: "user-123", name: "Double XP Weekend", start: "2024-01-01", end_: "2024-01-03", multiplier: 2 }])
|
|
279
|
+
def create(system_id:, request:, request_options: nil)
|
|
124
280
|
Async do
|
|
125
281
|
response = @request_client.conn.post do |req|
|
|
126
282
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
127
283
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
284
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
128
285
|
req.headers = {
|
|
129
286
|
**(req.headers || {}),
|
|
130
287
|
**@request_client.get_headers,
|
|
@@ -133,12 +290,9 @@ module TrophyApiClient
|
|
|
133
290
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
134
291
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
135
292
|
end
|
|
136
|
-
req.body = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
boosts: boosts
|
|
140
|
-
}.compact
|
|
141
|
-
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
|
|
293
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
294
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
295
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
142
296
|
end
|
|
143
297
|
TrophyApiClient::CreatePointsBoostsResponse.from_json(json_object: response.body)
|
|
144
298
|
end
|
|
@@ -146,6 +300,7 @@ module TrophyApiClient
|
|
|
146
300
|
|
|
147
301
|
# Delete multiple points boosts by ID.
|
|
148
302
|
#
|
|
303
|
+
# @param system_id [String] The UUID of the points system.
|
|
149
304
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
150
305
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
151
306
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
@@ -156,11 +311,12 @@ module TrophyApiClient
|
|
|
156
311
|
# api_key: "YOUR_API_KEY"
|
|
157
312
|
# )
|
|
158
313
|
# api.admin.points.boosts.delete
|
|
159
|
-
def delete(ids: nil, request_options: nil)
|
|
314
|
+
def delete(system_id:, ids: nil, request_options: nil)
|
|
160
315
|
Async do
|
|
161
316
|
response = @request_client.conn.delete do |req|
|
|
162
317
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
163
318
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
319
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
164
320
|
req.headers = {
|
|
165
321
|
**(req.headers || {}),
|
|
166
322
|
**@request_client.get_headers,
|
|
@@ -170,11 +326,84 @@ module TrophyApiClient
|
|
|
170
326
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
171
327
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
172
328
|
end
|
|
173
|
-
req.url "#{@request_client.get_url(environment: admin,
|
|
329
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
330
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
174
331
|
end
|
|
175
332
|
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
176
333
|
end
|
|
177
334
|
end
|
|
335
|
+
|
|
336
|
+
# Update multiple points boosts.
|
|
337
|
+
#
|
|
338
|
+
# @param system_id [String] The UUID of the points system.
|
|
339
|
+
# @param request [TrophyApiClient::PATCH_POINTS_BOOSTS_REQUEST]
|
|
340
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
341
|
+
# @return [TrophyApiClient::PatchPointsBoostsResponse]
|
|
342
|
+
# @example
|
|
343
|
+
# api = TrophyApiClient::Client.new(
|
|
344
|
+
# base_url: "https://api.example.com",
|
|
345
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
346
|
+
# api_key: "YOUR_API_KEY"
|
|
347
|
+
# )
|
|
348
|
+
# api.admin.points.boosts.update(system_id: "550e8400-e29b-41d4-a716-446655440000", request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Updated Boost Name", multiplier: 3 }])
|
|
349
|
+
def update(system_id:, request:, request_options: nil)
|
|
350
|
+
Async do
|
|
351
|
+
response = @request_client.conn.patch do |req|
|
|
352
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
353
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
354
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
355
|
+
req.headers = {
|
|
356
|
+
**(req.headers || {}),
|
|
357
|
+
**@request_client.get_headers,
|
|
358
|
+
**(request_options&.additional_headers || {})
|
|
359
|
+
}.compact
|
|
360
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
361
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
362
|
+
end
|
|
363
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
364
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
365
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
366
|
+
end
|
|
367
|
+
TrophyApiClient::PatchPointsBoostsResponse.from_json(json_object: response.body)
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# Get a single points boost by ID.
|
|
372
|
+
#
|
|
373
|
+
# @param system_id [String] The UUID of the points system.
|
|
374
|
+
# @param id [String] The UUID of the points boost.
|
|
375
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
376
|
+
# @return [TrophyApiClient::AdminPointsBoost]
|
|
377
|
+
# @example
|
|
378
|
+
# api = TrophyApiClient::Client.new(
|
|
379
|
+
# base_url: "https://api.example.com",
|
|
380
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
381
|
+
# api_key: "YOUR_API_KEY"
|
|
382
|
+
# )
|
|
383
|
+
# api.admin.points.boosts.get(system_id: "550e8400-e29b-41d4-a716-446655440000", id: "660f9500-f30c-42e5-b827-557766550001")
|
|
384
|
+
def get(system_id:, id:, request_options: nil)
|
|
385
|
+
Async do
|
|
386
|
+
response = @request_client.conn.get do |req|
|
|
387
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
388
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
389
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
390
|
+
req.headers = {
|
|
391
|
+
**(req.headers || {}),
|
|
392
|
+
**@request_client.get_headers,
|
|
393
|
+
**(request_options&.additional_headers || {})
|
|
394
|
+
}.compact
|
|
395
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
396
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
397
|
+
end
|
|
398
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
399
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
400
|
+
end
|
|
401
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
402
|
+
request_options: request_options)}/points/#{system_id}/boosts/#{id}"
|
|
403
|
+
end
|
|
404
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: response.body)
|
|
405
|
+
end
|
|
406
|
+
end
|
|
178
407
|
end
|
|
179
408
|
end
|
|
180
409
|
end
|
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../../../requests"
|
|
4
|
+
require_relative "systems/client"
|
|
4
5
|
require_relative "boosts/client"
|
|
6
|
+
require_relative "levels/client"
|
|
7
|
+
require_relative "triggers/client"
|
|
5
8
|
|
|
6
9
|
module TrophyApiClient
|
|
7
10
|
module Admin
|
|
8
11
|
module Points
|
|
9
12
|
class Client
|
|
13
|
+
# @return [TrophyApiClient::Admin::Points::SystemsClient]
|
|
14
|
+
attr_reader :systems
|
|
10
15
|
# @return [TrophyApiClient::Admin::Points::BoostsClient]
|
|
11
16
|
attr_reader :boosts
|
|
17
|
+
# @return [TrophyApiClient::Admin::Points::LevelsClient]
|
|
18
|
+
attr_reader :levels
|
|
19
|
+
# @return [TrophyApiClient::Admin::Points::TriggersClient]
|
|
20
|
+
attr_reader :triggers
|
|
12
21
|
|
|
13
22
|
# @param request_client [TrophyApiClient::RequestClient]
|
|
14
23
|
# @return [TrophyApiClient::Admin::Points::Client]
|
|
15
24
|
def initialize(request_client:)
|
|
25
|
+
@systems = TrophyApiClient::Admin::Points::SystemsClient.new(request_client: request_client)
|
|
16
26
|
@boosts = TrophyApiClient::Admin::Points::BoostsClient.new(request_client: request_client)
|
|
27
|
+
@levels = TrophyApiClient::Admin::Points::LevelsClient.new(request_client: request_client)
|
|
28
|
+
@triggers = TrophyApiClient::Admin::Points::TriggersClient.new(request_client: request_client)
|
|
17
29
|
end
|
|
18
30
|
end
|
|
19
31
|
|
|
20
32
|
class AsyncClient
|
|
33
|
+
# @return [TrophyApiClient::Admin::Points::AsyncSystemsClient]
|
|
34
|
+
attr_reader :systems
|
|
21
35
|
# @return [TrophyApiClient::Admin::Points::AsyncBoostsClient]
|
|
22
36
|
attr_reader :boosts
|
|
37
|
+
# @return [TrophyApiClient::Admin::Points::AsyncLevelsClient]
|
|
38
|
+
attr_reader :levels
|
|
39
|
+
# @return [TrophyApiClient::Admin::Points::AsyncTriggersClient]
|
|
40
|
+
attr_reader :triggers
|
|
23
41
|
|
|
24
42
|
# @param request_client [TrophyApiClient::AsyncRequestClient]
|
|
25
43
|
# @return [TrophyApiClient::Admin::Points::AsyncClient]
|
|
26
44
|
def initialize(request_client:)
|
|
45
|
+
@systems = TrophyApiClient::Admin::Points::AsyncSystemsClient.new(request_client: request_client)
|
|
27
46
|
@boosts = TrophyApiClient::Admin::Points::AsyncBoostsClient.new(request_client: request_client)
|
|
47
|
+
@levels = TrophyApiClient::Admin::Points::AsyncLevelsClient.new(request_client: request_client)
|
|
48
|
+
@triggers = TrophyApiClient::Admin::Points::AsyncTriggersClient.new(request_client: request_client)
|
|
28
49
|
end
|
|
29
50
|
end
|
|
30
51
|
end
|