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
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../requests"
|
|
4
|
+
require_relative "../../types/list_tenants_response"
|
|
5
|
+
require "json"
|
|
6
|
+
require_relative "../../types/create_tenants_request"
|
|
7
|
+
require_relative "../../types/create_tenants_response"
|
|
8
|
+
require_relative "../../types/delete_tenants_response"
|
|
9
|
+
require_relative "../../types/update_tenants_request"
|
|
10
|
+
require_relative "../../types/update_tenants_response"
|
|
11
|
+
require_relative "../../types/admin_tenant"
|
|
12
|
+
require "async"
|
|
13
|
+
|
|
14
|
+
module TrophyApiClient
|
|
15
|
+
module Admin
|
|
16
|
+
class TenantsClient
|
|
17
|
+
# @return [TrophyApiClient::RequestClient]
|
|
18
|
+
attr_reader :request_client
|
|
19
|
+
|
|
20
|
+
# @param request_client [TrophyApiClient::RequestClient]
|
|
21
|
+
# @return [TrophyApiClient::Admin::TenantsClient]
|
|
22
|
+
def initialize(request_client:)
|
|
23
|
+
@request_client = request_client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# List tenants in the current environment.
|
|
27
|
+
#
|
|
28
|
+
# @param limit [Integer] Number of records to return.
|
|
29
|
+
# @param skip [Integer] Number of records to skip from the start of the list.
|
|
30
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
31
|
+
# @return [TrophyApiClient::LIST_TENANTS_RESPONSE]
|
|
32
|
+
# @example
|
|
33
|
+
# api = TrophyApiClient::Client.new(
|
|
34
|
+
# base_url: "https://api.example.com",
|
|
35
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
36
|
+
# api_key: "YOUR_API_KEY"
|
|
37
|
+
# )
|
|
38
|
+
# api.admin.tenants.list(limit: 1, skip: 1)
|
|
39
|
+
def list(limit: nil, skip: nil, request_options: nil)
|
|
40
|
+
response = @request_client.conn.get do |req|
|
|
41
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
42
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
43
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
44
|
+
req.headers = {
|
|
45
|
+
**(req.headers || {}),
|
|
46
|
+
**@request_client.get_headers,
|
|
47
|
+
**(request_options&.additional_headers || {})
|
|
48
|
+
}.compact
|
|
49
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit, "skip": skip }.compact
|
|
50
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
51
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
52
|
+
end
|
|
53
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
54
|
+
end
|
|
55
|
+
parsed_json = JSON.parse(response.body)
|
|
56
|
+
parsed_json&.map do |item|
|
|
57
|
+
item = item.to_json
|
|
58
|
+
TrophyApiClient::AdminTenant.from_json(json_object: item)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Create tenants.
|
|
63
|
+
#
|
|
64
|
+
# @param request [TrophyApiClient::CREATE_TENANTS_REQUEST]
|
|
65
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
66
|
+
# @return [TrophyApiClient::CreateTenantsResponse]
|
|
67
|
+
# @example
|
|
68
|
+
# api = TrophyApiClient::Client.new(
|
|
69
|
+
# base_url: "https://api.example.com",
|
|
70
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
71
|
+
# api_key: "YOUR_API_KEY"
|
|
72
|
+
# )
|
|
73
|
+
# api.admin.tenants.create(request: [{ customer_id: "customer_12345", name: "Acme Corp" }, { customer_id: "customer_67890", name: "Globex Inc" }])
|
|
74
|
+
def create(request:, request_options: nil)
|
|
75
|
+
response = @request_client.conn.post do |req|
|
|
76
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
77
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
78
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
79
|
+
req.headers = {
|
|
80
|
+
**(req.headers || {}),
|
|
81
|
+
**@request_client.get_headers,
|
|
82
|
+
**(request_options&.additional_headers || {})
|
|
83
|
+
}.compact
|
|
84
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
85
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
86
|
+
end
|
|
87
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
88
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
89
|
+
end
|
|
90
|
+
TrophyApiClient::CreateTenantsResponse.from_json(json_object: response.body)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Delete tenants by ID.
|
|
94
|
+
#
|
|
95
|
+
# @param ids [String] Tenant IDs to delete. Repeat the query param or provide a comma-separated list.
|
|
96
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
97
|
+
# @return [TrophyApiClient::DeleteTenantsResponse]
|
|
98
|
+
# @example
|
|
99
|
+
# api = TrophyApiClient::Client.new(
|
|
100
|
+
# base_url: "https://api.example.com",
|
|
101
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
102
|
+
# api_key: "YOUR_API_KEY"
|
|
103
|
+
# )
|
|
104
|
+
# api.admin.tenants.delete
|
|
105
|
+
def delete(ids: nil, request_options: nil)
|
|
106
|
+
response = @request_client.conn.delete do |req|
|
|
107
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
108
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
109
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
110
|
+
req.headers = {
|
|
111
|
+
**(req.headers || {}),
|
|
112
|
+
**@request_client.get_headers,
|
|
113
|
+
**(request_options&.additional_headers || {})
|
|
114
|
+
}.compact
|
|
115
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "ids": ids }.compact
|
|
116
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
117
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
118
|
+
end
|
|
119
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
120
|
+
end
|
|
121
|
+
TrophyApiClient::DeleteTenantsResponse.from_json(json_object: response.body)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Update tenants by ID.
|
|
125
|
+
#
|
|
126
|
+
# @param request [TrophyApiClient::UPDATE_TENANTS_REQUEST]
|
|
127
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
128
|
+
# @return [TrophyApiClient::UpdateTenantsResponse]
|
|
129
|
+
# @example
|
|
130
|
+
# api = TrophyApiClient::Client.new(
|
|
131
|
+
# base_url: "https://api.example.com",
|
|
132
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
133
|
+
# api_key: "YOUR_API_KEY"
|
|
134
|
+
# )
|
|
135
|
+
# api.admin.tenants.update(request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Acme Corporation" }])
|
|
136
|
+
def update(request:, request_options: nil)
|
|
137
|
+
response = @request_client.conn.patch do |req|
|
|
138
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
139
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
140
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
141
|
+
req.headers = {
|
|
142
|
+
**(req.headers || {}),
|
|
143
|
+
**@request_client.get_headers,
|
|
144
|
+
**(request_options&.additional_headers || {})
|
|
145
|
+
}.compact
|
|
146
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
147
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
148
|
+
end
|
|
149
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
150
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
151
|
+
end
|
|
152
|
+
TrophyApiClient::UpdateTenantsResponse.from_json(json_object: response.body)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Get a tenant by ID.
|
|
156
|
+
#
|
|
157
|
+
# @param id [String] The UUID of the tenant to retrieve.
|
|
158
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
159
|
+
# @return [TrophyApiClient::AdminTenant]
|
|
160
|
+
# @example
|
|
161
|
+
# api = TrophyApiClient::Client.new(
|
|
162
|
+
# base_url: "https://api.example.com",
|
|
163
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
164
|
+
# api_key: "YOUR_API_KEY"
|
|
165
|
+
# )
|
|
166
|
+
# api.admin.tenants.get(id: "550e8400-e29b-41d4-a716-446655440000")
|
|
167
|
+
def get(id:, request_options: nil)
|
|
168
|
+
response = @request_client.conn.get do |req|
|
|
169
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
170
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
171
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
172
|
+
req.headers = {
|
|
173
|
+
**(req.headers || {}),
|
|
174
|
+
**@request_client.get_headers,
|
|
175
|
+
**(request_options&.additional_headers || {})
|
|
176
|
+
}.compact
|
|
177
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
178
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
179
|
+
end
|
|
180
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
181
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
182
|
+
end
|
|
183
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants/#{id}"
|
|
184
|
+
end
|
|
185
|
+
TrophyApiClient::AdminTenant.from_json(json_object: response.body)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
class AsyncTenantsClient
|
|
190
|
+
# @return [TrophyApiClient::AsyncRequestClient]
|
|
191
|
+
attr_reader :request_client
|
|
192
|
+
|
|
193
|
+
# @param request_client [TrophyApiClient::AsyncRequestClient]
|
|
194
|
+
# @return [TrophyApiClient::Admin::AsyncTenantsClient]
|
|
195
|
+
def initialize(request_client:)
|
|
196
|
+
@request_client = request_client
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# List tenants in the current environment.
|
|
200
|
+
#
|
|
201
|
+
# @param limit [Integer] Number of records to return.
|
|
202
|
+
# @param skip [Integer] Number of records to skip from the start of the list.
|
|
203
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
204
|
+
# @return [TrophyApiClient::LIST_TENANTS_RESPONSE]
|
|
205
|
+
# @example
|
|
206
|
+
# api = TrophyApiClient::Client.new(
|
|
207
|
+
# base_url: "https://api.example.com",
|
|
208
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
209
|
+
# api_key: "YOUR_API_KEY"
|
|
210
|
+
# )
|
|
211
|
+
# api.admin.tenants.list(limit: 1, skip: 1)
|
|
212
|
+
def list(limit: nil, skip: nil, request_options: nil)
|
|
213
|
+
Async do
|
|
214
|
+
response = @request_client.conn.get do |req|
|
|
215
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
216
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
217
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
218
|
+
req.headers = {
|
|
219
|
+
**(req.headers || {}),
|
|
220
|
+
**@request_client.get_headers,
|
|
221
|
+
**(request_options&.additional_headers || {})
|
|
222
|
+
}.compact
|
|
223
|
+
req.params = {
|
|
224
|
+
**(request_options&.additional_query_parameters || {}),
|
|
225
|
+
"limit": limit,
|
|
226
|
+
"skip": skip
|
|
227
|
+
}.compact
|
|
228
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
229
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
230
|
+
end
|
|
231
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
232
|
+
end
|
|
233
|
+
parsed_json = JSON.parse(response.body)
|
|
234
|
+
parsed_json&.map do |item|
|
|
235
|
+
item = item.to_json
|
|
236
|
+
TrophyApiClient::AdminTenant.from_json(json_object: item)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Create tenants.
|
|
242
|
+
#
|
|
243
|
+
# @param request [TrophyApiClient::CREATE_TENANTS_REQUEST]
|
|
244
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
245
|
+
# @return [TrophyApiClient::CreateTenantsResponse]
|
|
246
|
+
# @example
|
|
247
|
+
# api = TrophyApiClient::Client.new(
|
|
248
|
+
# base_url: "https://api.example.com",
|
|
249
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
250
|
+
# api_key: "YOUR_API_KEY"
|
|
251
|
+
# )
|
|
252
|
+
# api.admin.tenants.create(request: [{ customer_id: "customer_12345", name: "Acme Corp" }, { customer_id: "customer_67890", name: "Globex Inc" }])
|
|
253
|
+
def create(request:, request_options: nil)
|
|
254
|
+
Async do
|
|
255
|
+
response = @request_client.conn.post do |req|
|
|
256
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
257
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
258
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
259
|
+
req.headers = {
|
|
260
|
+
**(req.headers || {}),
|
|
261
|
+
**@request_client.get_headers,
|
|
262
|
+
**(request_options&.additional_headers || {})
|
|
263
|
+
}.compact
|
|
264
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
265
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
266
|
+
end
|
|
267
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
268
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
269
|
+
end
|
|
270
|
+
TrophyApiClient::CreateTenantsResponse.from_json(json_object: response.body)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Delete tenants by ID.
|
|
275
|
+
#
|
|
276
|
+
# @param ids [String] Tenant IDs to delete. Repeat the query param or provide a comma-separated list.
|
|
277
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
278
|
+
# @return [TrophyApiClient::DeleteTenantsResponse]
|
|
279
|
+
# @example
|
|
280
|
+
# api = TrophyApiClient::Client.new(
|
|
281
|
+
# base_url: "https://api.example.com",
|
|
282
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
283
|
+
# api_key: "YOUR_API_KEY"
|
|
284
|
+
# )
|
|
285
|
+
# api.admin.tenants.delete
|
|
286
|
+
def delete(ids: nil, request_options: nil)
|
|
287
|
+
Async do
|
|
288
|
+
response = @request_client.conn.delete do |req|
|
|
289
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
290
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
291
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
292
|
+
req.headers = {
|
|
293
|
+
**(req.headers || {}),
|
|
294
|
+
**@request_client.get_headers,
|
|
295
|
+
**(request_options&.additional_headers || {})
|
|
296
|
+
}.compact
|
|
297
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "ids": ids }.compact
|
|
298
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
299
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
300
|
+
end
|
|
301
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
302
|
+
end
|
|
303
|
+
TrophyApiClient::DeleteTenantsResponse.from_json(json_object: response.body)
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Update tenants by ID.
|
|
308
|
+
#
|
|
309
|
+
# @param request [TrophyApiClient::UPDATE_TENANTS_REQUEST]
|
|
310
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
311
|
+
# @return [TrophyApiClient::UpdateTenantsResponse]
|
|
312
|
+
# @example
|
|
313
|
+
# api = TrophyApiClient::Client.new(
|
|
314
|
+
# base_url: "https://api.example.com",
|
|
315
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
316
|
+
# api_key: "YOUR_API_KEY"
|
|
317
|
+
# )
|
|
318
|
+
# api.admin.tenants.update(request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Acme Corporation" }])
|
|
319
|
+
def update(request:, request_options: nil)
|
|
320
|
+
Async do
|
|
321
|
+
response = @request_client.conn.patch do |req|
|
|
322
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
323
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
324
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
325
|
+
req.headers = {
|
|
326
|
+
**(req.headers || {}),
|
|
327
|
+
**@request_client.get_headers,
|
|
328
|
+
**(request_options&.additional_headers || {})
|
|
329
|
+
}.compact
|
|
330
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
331
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
332
|
+
end
|
|
333
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
334
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants"
|
|
335
|
+
end
|
|
336
|
+
TrophyApiClient::UpdateTenantsResponse.from_json(json_object: response.body)
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Get a tenant by ID.
|
|
341
|
+
#
|
|
342
|
+
# @param id [String] The UUID of the tenant to retrieve.
|
|
343
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
344
|
+
# @return [TrophyApiClient::AdminTenant]
|
|
345
|
+
# @example
|
|
346
|
+
# api = TrophyApiClient::Client.new(
|
|
347
|
+
# base_url: "https://api.example.com",
|
|
348
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
349
|
+
# api_key: "YOUR_API_KEY"
|
|
350
|
+
# )
|
|
351
|
+
# api.admin.tenants.get(id: "550e8400-e29b-41d4-a716-446655440000")
|
|
352
|
+
def get(id:, request_options: nil)
|
|
353
|
+
Async do
|
|
354
|
+
response = @request_client.conn.get do |req|
|
|
355
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
356
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
357
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
358
|
+
req.headers = {
|
|
359
|
+
**(req.headers || {}),
|
|
360
|
+
**@request_client.get_headers,
|
|
361
|
+
**(request_options&.additional_headers || {})
|
|
362
|
+
}.compact
|
|
363
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
364
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
365
|
+
end
|
|
366
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
367
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
368
|
+
end
|
|
369
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/tenants/#{id}"
|
|
370
|
+
end
|
|
371
|
+
TrophyApiClient::AdminTenant.from_json(json_object: response.body)
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
end
|
|
@@ -35,6 +35,7 @@ module TrophyApiClient
|
|
|
35
35
|
response = @request_client.conn.get do |req|
|
|
36
36
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
37
37
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
38
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
38
39
|
req.headers = {
|
|
39
40
|
**(req.headers || {}),
|
|
40
41
|
**@request_client.get_headers,
|
|
@@ -89,6 +90,7 @@ module TrophyApiClient
|
|
|
89
90
|
response = @request_client.conn.get do |req|
|
|
90
91
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
91
92
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
93
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
92
94
|
req.headers = {
|
|
93
95
|
**(req.headers || {}),
|
|
94
96
|
**@request_client.get_headers,
|
|
@@ -140,6 +142,7 @@ module TrophyApiClient
|
|
|
140
142
|
response = @request_client.conn.get do |req|
|
|
141
143
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
142
144
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
145
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
143
146
|
req.headers = {
|
|
144
147
|
**(req.headers || {}),
|
|
145
148
|
**@request_client.get_headers,
|
|
@@ -196,6 +199,7 @@ module TrophyApiClient
|
|
|
196
199
|
response = @request_client.conn.get do |req|
|
|
197
200
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
198
201
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
202
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
199
203
|
req.headers = {
|
|
200
204
|
**(req.headers || {}),
|
|
201
205
|
**@request_client.get_headers,
|
|
@@ -50,6 +50,7 @@ module TrophyApiClient
|
|
|
50
50
|
response = @request_client.conn.post do |req|
|
|
51
51
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
52
52
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
53
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
53
54
|
req.headers = {
|
|
54
55
|
**(req.headers || {}),
|
|
55
56
|
**@request_client.get_headers,
|
|
@@ -116,6 +117,7 @@ module TrophyApiClient
|
|
|
116
117
|
response = @request_client.conn.post do |req|
|
|
117
118
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
118
119
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
120
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
119
121
|
req.headers = {
|
|
120
122
|
**(req.headers || {}),
|
|
121
123
|
**@request_client.get_headers,
|
|
@@ -39,6 +39,7 @@ module TrophyApiClient
|
|
|
39
39
|
response = @request_client.conn.get do |req|
|
|
40
40
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
41
41
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
42
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
42
43
|
req.headers = {
|
|
43
44
|
**(req.headers || {}),
|
|
44
45
|
**@request_client.get_headers,
|
|
@@ -76,6 +77,7 @@ module TrophyApiClient
|
|
|
76
77
|
response = @request_client.conn.get do |req|
|
|
77
78
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
78
79
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
80
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
79
81
|
req.headers = {
|
|
80
82
|
**(req.headers || {}),
|
|
81
83
|
**@request_client.get_headers,
|
|
@@ -111,6 +113,7 @@ module TrophyApiClient
|
|
|
111
113
|
response = @request_client.conn.get do |req|
|
|
112
114
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
113
115
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
116
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
114
117
|
req.headers = {
|
|
115
118
|
**(req.headers || {}),
|
|
116
119
|
**@request_client.get_headers,
|
|
@@ -148,6 +151,7 @@ module TrophyApiClient
|
|
|
148
151
|
response = @request_client.conn.get do |req|
|
|
149
152
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
150
153
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
154
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
151
155
|
req.headers = {
|
|
152
156
|
**(req.headers || {}),
|
|
153
157
|
**@request_client.get_headers,
|
|
@@ -184,6 +188,7 @@ module TrophyApiClient
|
|
|
184
188
|
response = @request_client.conn.get do |req|
|
|
185
189
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
186
190
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
191
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
187
192
|
req.headers = {
|
|
188
193
|
**(req.headers || {}),
|
|
189
194
|
**@request_client.get_headers,
|
|
@@ -236,6 +241,7 @@ module TrophyApiClient
|
|
|
236
241
|
response = @request_client.conn.get do |req|
|
|
237
242
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
238
243
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
244
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
239
245
|
req.headers = {
|
|
240
246
|
**(req.headers || {}),
|
|
241
247
|
**@request_client.get_headers,
|
|
@@ -275,6 +281,7 @@ module TrophyApiClient
|
|
|
275
281
|
response = @request_client.conn.get do |req|
|
|
276
282
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
277
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?
|
|
278
285
|
req.headers = {
|
|
279
286
|
**(req.headers || {}),
|
|
280
287
|
**@request_client.get_headers,
|
|
@@ -312,6 +319,7 @@ module TrophyApiClient
|
|
|
312
319
|
response = @request_client.conn.get do |req|
|
|
313
320
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
314
321
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
322
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
315
323
|
req.headers = {
|
|
316
324
|
**(req.headers || {}),
|
|
317
325
|
**@request_client.get_headers,
|
|
@@ -351,6 +359,7 @@ module TrophyApiClient
|
|
|
351
359
|
response = @request_client.conn.get do |req|
|
|
352
360
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
353
361
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
362
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
354
363
|
req.headers = {
|
|
355
364
|
**(req.headers || {}),
|
|
356
365
|
**@request_client.get_headers,
|
|
@@ -389,6 +398,7 @@ module TrophyApiClient
|
|
|
389
398
|
response = @request_client.conn.get do |req|
|
|
390
399
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
391
400
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
401
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
392
402
|
req.headers = {
|
|
393
403
|
**(req.headers || {}),
|
|
394
404
|
**@request_client.get_headers,
|
|
@@ -35,6 +35,7 @@ module TrophyApiClient
|
|
|
35
35
|
response = @request_client.conn.get do |req|
|
|
36
36
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
37
37
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
38
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
38
39
|
req.headers = {
|
|
39
40
|
**(req.headers || {}),
|
|
40
41
|
**@request_client.get_headers,
|
|
@@ -70,6 +71,7 @@ module TrophyApiClient
|
|
|
70
71
|
response = @request_client.conn.get do |req|
|
|
71
72
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
72
73
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
74
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
73
75
|
req.headers = {
|
|
74
76
|
**(req.headers || {}),
|
|
75
77
|
**@request_client.get_headers,
|
|
@@ -117,6 +119,7 @@ module TrophyApiClient
|
|
|
117
119
|
response = @request_client.conn.get do |req|
|
|
118
120
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
119
121
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
122
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
120
123
|
req.headers = {
|
|
121
124
|
**(req.headers || {}),
|
|
122
125
|
**@request_client.get_headers,
|
|
@@ -154,6 +157,7 @@ module TrophyApiClient
|
|
|
154
157
|
response = @request_client.conn.get do |req|
|
|
155
158
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
156
159
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
160
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
157
161
|
req.headers = {
|
|
158
162
|
**(req.headers || {}),
|
|
159
163
|
**@request_client.get_headers,
|