trophy_api_client 1.7.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/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/{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_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_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_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_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/version.rb +1 -1
- data/lib/types_export.rb +64 -5
- metadata +68 -6
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d240a20a2e41b128afca2d98893f8c2442aeced7d0c565c9458efdb8f6ff0efa
|
|
4
|
+
data.tar.gz: 0e6698405fbc5e02e29b59cc97322237a7291c03a472430ddb45d25b6689c403
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 160583d898a66ec511045b0a89441016a527ff0d45e586e6b26f23d17a046765589333c22d21811ba98bb32a6e45fa7ac36fbae07f9724b29a6b36ea29be7e74
|
|
7
|
+
data.tar.gz: 7cfd1a899f7182d554377516f23a2641ab30ed5a35c891da819f9b02ee8f05ba207f84ff66d36b02ceda728e0e099110082072257c0b99b0688f78a0201898d7
|
data/lib/gemconfig.rb
CHANGED
|
@@ -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,55 @@ 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 = {
|
|
50
|
+
**(req.headers || {}),
|
|
51
|
+
**@request_client.get_headers,
|
|
52
|
+
**(request_options&.additional_headers || {})
|
|
53
|
+
}.compact
|
|
54
|
+
req.params = {
|
|
55
|
+
**(request_options&.additional_query_parameters || {}),
|
|
56
|
+
"limit": limit,
|
|
57
|
+
"skip": skip
|
|
58
|
+
}.compact
|
|
59
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
60
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
61
|
+
end
|
|
62
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
63
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
64
|
+
end
|
|
65
|
+
parsed_json = JSON.parse(response.body)
|
|
66
|
+
parsed_json&.map do |item|
|
|
67
|
+
item = item.to_json
|
|
68
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Create points boosts.
|
|
73
|
+
#
|
|
74
|
+
# @param system_id [String] The UUID of the points system.
|
|
75
|
+
# @param request [TrophyApiClient::CREATE_POINTS_BOOSTS_REQUEST]
|
|
32
76
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
33
77
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
34
78
|
# @example
|
|
@@ -37,8 +81,8 @@ module TrophyApiClient
|
|
|
37
81
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
38
82
|
# api_key: "YOUR_API_KEY"
|
|
39
83
|
# )
|
|
40
|
-
# api.admin.points.boosts.create(
|
|
41
|
-
def create(
|
|
84
|
+
# 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 }])
|
|
85
|
+
def create(system_id:, request:, request_options: nil)
|
|
42
86
|
response = @request_client.conn.post do |req|
|
|
43
87
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
44
88
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
@@ -50,18 +94,16 @@ module TrophyApiClient
|
|
|
50
94
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
51
95
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
52
96
|
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"
|
|
97
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
98
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
99
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
59
100
|
end
|
|
60
101
|
TrophyApiClient::CreatePointsBoostsResponse.from_json(json_object: response.body)
|
|
61
102
|
end
|
|
62
103
|
|
|
63
104
|
# Delete multiple points boosts by ID.
|
|
64
105
|
#
|
|
106
|
+
# @param system_id [String] The UUID of the points system.
|
|
65
107
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
66
108
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
67
109
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
@@ -72,7 +114,7 @@ module TrophyApiClient
|
|
|
72
114
|
# api_key: "YOUR_API_KEY"
|
|
73
115
|
# )
|
|
74
116
|
# api.admin.points.boosts.delete
|
|
75
|
-
def delete(ids: nil, request_options: nil)
|
|
117
|
+
def delete(system_id:, ids: nil, request_options: nil)
|
|
76
118
|
response = @request_client.conn.delete do |req|
|
|
77
119
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
78
120
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
@@ -85,10 +127,77 @@ module TrophyApiClient
|
|
|
85
127
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
86
128
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
87
129
|
end
|
|
88
|
-
req.url "#{@request_client.get_url(environment: admin,
|
|
130
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
131
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
89
132
|
end
|
|
90
133
|
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
91
134
|
end
|
|
135
|
+
|
|
136
|
+
# Update multiple points boosts.
|
|
137
|
+
#
|
|
138
|
+
# @param system_id [String] The UUID of the points system.
|
|
139
|
+
# @param request [TrophyApiClient::PATCH_POINTS_BOOSTS_REQUEST]
|
|
140
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
141
|
+
# @return [TrophyApiClient::PatchPointsBoostsResponse]
|
|
142
|
+
# @example
|
|
143
|
+
# api = TrophyApiClient::Client.new(
|
|
144
|
+
# base_url: "https://api.example.com",
|
|
145
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
146
|
+
# api_key: "YOUR_API_KEY"
|
|
147
|
+
# )
|
|
148
|
+
# 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 }])
|
|
149
|
+
def update(system_id:, request:, request_options: nil)
|
|
150
|
+
response = @request_client.conn.patch do |req|
|
|
151
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
152
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
153
|
+
req.headers = {
|
|
154
|
+
**(req.headers || {}),
|
|
155
|
+
**@request_client.get_headers,
|
|
156
|
+
**(request_options&.additional_headers || {})
|
|
157
|
+
}.compact
|
|
158
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
159
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
160
|
+
end
|
|
161
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
162
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
163
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
164
|
+
end
|
|
165
|
+
TrophyApiClient::PatchPointsBoostsResponse.from_json(json_object: response.body)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Get a single points boost by ID.
|
|
169
|
+
#
|
|
170
|
+
# @param system_id [String] The UUID of the points system.
|
|
171
|
+
# @param id [String] The UUID of the points boost.
|
|
172
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
173
|
+
# @return [TrophyApiClient::AdminPointsBoost]
|
|
174
|
+
# @example
|
|
175
|
+
# api = TrophyApiClient::Client.new(
|
|
176
|
+
# base_url: "https://api.example.com",
|
|
177
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
178
|
+
# api_key: "YOUR_API_KEY"
|
|
179
|
+
# )
|
|
180
|
+
# api.admin.points.boosts.get(system_id: "550e8400-e29b-41d4-a716-446655440000", id: "660f9500-f30c-42e5-b827-557766550001")
|
|
181
|
+
def get(system_id:, id:, request_options: nil)
|
|
182
|
+
response = @request_client.conn.get do |req|
|
|
183
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
184
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
185
|
+
req.headers = {
|
|
186
|
+
**(req.headers || {}),
|
|
187
|
+
**@request_client.get_headers,
|
|
188
|
+
**(request_options&.additional_headers || {})
|
|
189
|
+
}.compact
|
|
190
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
191
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
192
|
+
end
|
|
193
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
194
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
195
|
+
end
|
|
196
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
197
|
+
request_options: request_options)}/points/#{system_id}/boosts/#{id}"
|
|
198
|
+
end
|
|
199
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: response.body)
|
|
200
|
+
end
|
|
92
201
|
end
|
|
93
202
|
|
|
94
203
|
class AsyncBoostsClient
|
|
@@ -101,16 +210,57 @@ module TrophyApiClient
|
|
|
101
210
|
@request_client = request_client
|
|
102
211
|
end
|
|
103
212
|
|
|
104
|
-
#
|
|
213
|
+
# List points boosts for a system.
|
|
214
|
+
#
|
|
215
|
+
# @param system_id [String] The UUID of the points system.
|
|
216
|
+
# @param limit [Integer] Maximum number of results to return (1-100, default 10).
|
|
217
|
+
# @param skip [Integer] Number of results to skip for pagination (default 0).
|
|
218
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
219
|
+
# @return [TrophyApiClient::LIST_POINTS_BOOSTS_RESPONSE]
|
|
220
|
+
# @example
|
|
221
|
+
# api = TrophyApiClient::Client.new(
|
|
222
|
+
# base_url: "https://api.example.com",
|
|
223
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
224
|
+
# api_key: "YOUR_API_KEY"
|
|
225
|
+
# )
|
|
226
|
+
# api.admin.points.boosts.list(
|
|
227
|
+
# system_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
228
|
+
# limit: 1,
|
|
229
|
+
# skip: 1
|
|
230
|
+
# )
|
|
231
|
+
def list(system_id:, limit: nil, skip: nil, request_options: nil)
|
|
232
|
+
Async do
|
|
233
|
+
response = @request_client.conn.get do |req|
|
|
234
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
235
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
236
|
+
req.headers = {
|
|
237
|
+
**(req.headers || {}),
|
|
238
|
+
**@request_client.get_headers,
|
|
239
|
+
**(request_options&.additional_headers || {})
|
|
240
|
+
}.compact
|
|
241
|
+
req.params = {
|
|
242
|
+
**(request_options&.additional_query_parameters || {}),
|
|
243
|
+
"limit": limit,
|
|
244
|
+
"skip": skip
|
|
245
|
+
}.compact
|
|
246
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
247
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
248
|
+
end
|
|
249
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
250
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
251
|
+
end
|
|
252
|
+
parsed_json = JSON.parse(response.body)
|
|
253
|
+
parsed_json&.map do |item|
|
|
254
|
+
item = item.to_json
|
|
255
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Create points boosts.
|
|
105
261
|
#
|
|
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)
|
|
262
|
+
# @param system_id [String] The UUID of the points system.
|
|
263
|
+
# @param request [TrophyApiClient::CREATE_POINTS_BOOSTS_REQUEST]
|
|
114
264
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
115
265
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
116
266
|
# @example
|
|
@@ -119,8 +269,8 @@ module TrophyApiClient
|
|
|
119
269
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
120
270
|
# api_key: "YOUR_API_KEY"
|
|
121
271
|
# )
|
|
122
|
-
# api.admin.points.boosts.create(
|
|
123
|
-
def create(
|
|
272
|
+
# 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 }])
|
|
273
|
+
def create(system_id:, request:, request_options: nil)
|
|
124
274
|
Async do
|
|
125
275
|
response = @request_client.conn.post do |req|
|
|
126
276
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -133,12 +283,9 @@ module TrophyApiClient
|
|
|
133
283
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
134
284
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
135
285
|
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"
|
|
286
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
287
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
288
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
142
289
|
end
|
|
143
290
|
TrophyApiClient::CreatePointsBoostsResponse.from_json(json_object: response.body)
|
|
144
291
|
end
|
|
@@ -146,6 +293,7 @@ module TrophyApiClient
|
|
|
146
293
|
|
|
147
294
|
# Delete multiple points boosts by ID.
|
|
148
295
|
#
|
|
296
|
+
# @param system_id [String] The UUID of the points system.
|
|
149
297
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
150
298
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
151
299
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
@@ -156,7 +304,7 @@ module TrophyApiClient
|
|
|
156
304
|
# api_key: "YOUR_API_KEY"
|
|
157
305
|
# )
|
|
158
306
|
# api.admin.points.boosts.delete
|
|
159
|
-
def delete(ids: nil, request_options: nil)
|
|
307
|
+
def delete(system_id:, ids: nil, request_options: nil)
|
|
160
308
|
Async do
|
|
161
309
|
response = @request_client.conn.delete do |req|
|
|
162
310
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -170,11 +318,82 @@ module TrophyApiClient
|
|
|
170
318
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
171
319
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
172
320
|
end
|
|
173
|
-
req.url "#{@request_client.get_url(environment: admin,
|
|
321
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
322
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
174
323
|
end
|
|
175
324
|
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
176
325
|
end
|
|
177
326
|
end
|
|
327
|
+
|
|
328
|
+
# Update multiple points boosts.
|
|
329
|
+
#
|
|
330
|
+
# @param system_id [String] The UUID of the points system.
|
|
331
|
+
# @param request [TrophyApiClient::PATCH_POINTS_BOOSTS_REQUEST]
|
|
332
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
333
|
+
# @return [TrophyApiClient::PatchPointsBoostsResponse]
|
|
334
|
+
# @example
|
|
335
|
+
# api = TrophyApiClient::Client.new(
|
|
336
|
+
# base_url: "https://api.example.com",
|
|
337
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
338
|
+
# api_key: "YOUR_API_KEY"
|
|
339
|
+
# )
|
|
340
|
+
# 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 }])
|
|
341
|
+
def update(system_id:, request:, request_options: nil)
|
|
342
|
+
Async do
|
|
343
|
+
response = @request_client.conn.patch do |req|
|
|
344
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
345
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
346
|
+
req.headers = {
|
|
347
|
+
**(req.headers || {}),
|
|
348
|
+
**@request_client.get_headers,
|
|
349
|
+
**(request_options&.additional_headers || {})
|
|
350
|
+
}.compact
|
|
351
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
352
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
353
|
+
end
|
|
354
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
355
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
356
|
+
request_options: request_options)}/points/#{system_id}/boosts"
|
|
357
|
+
end
|
|
358
|
+
TrophyApiClient::PatchPointsBoostsResponse.from_json(json_object: response.body)
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Get a single points boost by ID.
|
|
363
|
+
#
|
|
364
|
+
# @param system_id [String] The UUID of the points system.
|
|
365
|
+
# @param id [String] The UUID of the points boost.
|
|
366
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
367
|
+
# @return [TrophyApiClient::AdminPointsBoost]
|
|
368
|
+
# @example
|
|
369
|
+
# api = TrophyApiClient::Client.new(
|
|
370
|
+
# base_url: "https://api.example.com",
|
|
371
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
372
|
+
# api_key: "YOUR_API_KEY"
|
|
373
|
+
# )
|
|
374
|
+
# api.admin.points.boosts.get(system_id: "550e8400-e29b-41d4-a716-446655440000", id: "660f9500-f30c-42e5-b827-557766550001")
|
|
375
|
+
def get(system_id:, id:, request_options: nil)
|
|
376
|
+
Async do
|
|
377
|
+
response = @request_client.conn.get do |req|
|
|
378
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
379
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
380
|
+
req.headers = {
|
|
381
|
+
**(req.headers || {}),
|
|
382
|
+
**@request_client.get_headers,
|
|
383
|
+
**(request_options&.additional_headers || {})
|
|
384
|
+
}.compact
|
|
385
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
386
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
387
|
+
end
|
|
388
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
389
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
390
|
+
end
|
|
391
|
+
req.url "#{@request_client.get_url(environment: admin,
|
|
392
|
+
request_options: request_options)}/points/#{system_id}/boosts/#{id}"
|
|
393
|
+
end
|
|
394
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: response.body)
|
|
395
|
+
end
|
|
396
|
+
end
|
|
178
397
|
end
|
|
179
398
|
end
|
|
180
399
|
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
|