trophy_api_client 1.8.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/requests.rb +34 -8
  4. data/lib/trophy_api_client/achievements/client.rb +4 -0
  5. data/lib/trophy_api_client/admin/attributes/client.rb +10 -0
  6. data/lib/trophy_api_client/admin/client.rb +7 -0
  7. data/lib/trophy_api_client/admin/leaderboards/client.rb +10 -0
  8. data/lib/trophy_api_client/admin/metrics/client.rb +10 -0
  9. data/lib/trophy_api_client/admin/points/boosts/client.rb +10 -0
  10. data/lib/trophy_api_client/admin/points/levels/client.rb +10 -0
  11. data/lib/trophy_api_client/admin/points/systems/client.rb +10 -0
  12. data/lib/trophy_api_client/admin/points/triggers/client.rb +10 -0
  13. data/lib/trophy_api_client/admin/streaks/client.rb +2 -0
  14. data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -0
  15. data/lib/trophy_api_client/admin/tenants/client.rb +376 -0
  16. data/lib/trophy_api_client/leaderboards/client.rb +4 -0
  17. data/lib/trophy_api_client/metrics/client.rb +2 -0
  18. data/lib/trophy_api_client/points/client.rb +10 -0
  19. data/lib/trophy_api_client/streaks/client.rb +4 -0
  20. data/lib/trophy_api_client/types/admin_points_boost.rb +2 -2
  21. data/lib/trophy_api_client/types/admin_tenant.rb +103 -0
  22. data/lib/trophy_api_client/types/admin_tenant_status.rb +9 -0
  23. data/lib/trophy_api_client/types/create_tenant_request_item.rb +66 -0
  24. data/lib/trophy_api_client/types/create_tenants_request.rb +7 -0
  25. data/lib/trophy_api_client/types/create_tenants_response.rb +74 -0
  26. data/lib/trophy_api_client/types/delete_tenants_response.rb +74 -0
  27. data/lib/trophy_api_client/types/list_tenants_response.rb +7 -0
  28. data/lib/trophy_api_client/types/update_tenant_request_item.rb +75 -0
  29. data/lib/trophy_api_client/types/update_tenants_request.rb +7 -0
  30. data/lib/trophy_api_client/types/update_tenants_response.rb +74 -0
  31. data/lib/trophy_api_client/users/client.rb +32 -0
  32. data/lib/trophy_api_client/version.rb +1 -1
  33. data/lib/trophy_api_client.rb +12 -4
  34. data/lib/types_export.rb +10 -0
  35. metadata +13 -2
@@ -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,
@@ -23,7 +23,7 @@ module TrophyApiClient
23
23
  attr_reader :multiplier
24
24
  # @return [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
25
25
  attr_reader :rounding
26
- # @return [String] The customer ID of the user the boost was created for, or null for
26
+ # @return [String] The ID of the user the boost was created for, or null for
27
27
  # global/attribute-filtered boosts.
28
28
  attr_reader :user_id
29
29
  # @return [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
@@ -44,7 +44,7 @@ module TrophyApiClient
44
44
  # @param end_ [String] The end date (YYYY-MM-DD) or null if no end date.
45
45
  # @param multiplier [Float] The points multiplier.
46
46
  # @param rounding [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
47
- # @param user_id [String] The customer ID of the user the boost was created for, or null for
47
+ # @param user_id [String] The ID of the user the boost was created for, or null for
48
48
  # global/attribute-filtered boosts.
49
49
  # @param user_attributes [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
50
50
  # boosts (i.e. when `userId` is null). Empty array if no filters are set.
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_tenant_status"
4
+ require "date"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # A tenant in a multi-tenant environment.
10
+ class AdminTenant
11
+ # @return [String] The tenant UUID.
12
+ attr_reader :id
13
+ # @return [String] The external customer ID for this tenant.
14
+ attr_reader :customer_id
15
+ # @return [String] Human-readable name for the tenant.
16
+ attr_reader :name
17
+ # @return [TrophyApiClient::AdminTenantStatus] The lifecycle status of the tenant.
18
+ attr_reader :status
19
+ # @return [DateTime] When the tenant was created.
20
+ attr_reader :created
21
+ # @return [DateTime] When the tenant was last updated.
22
+ attr_reader :updated
23
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
24
+ attr_reader :additional_properties
25
+ # @return [Object]
26
+ attr_reader :_field_set
27
+ protected :_field_set
28
+
29
+ OMIT = Object.new
30
+
31
+ # @param id [String] The tenant UUID.
32
+ # @param customer_id [String] The external customer ID for this tenant.
33
+ # @param name [String] Human-readable name for the tenant.
34
+ # @param status [TrophyApiClient::AdminTenantStatus] The lifecycle status of the tenant.
35
+ # @param created [DateTime] When the tenant was created.
36
+ # @param updated [DateTime] When the tenant was last updated.
37
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
38
+ # @return [TrophyApiClient::AdminTenant]
39
+ def initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil)
40
+ @id = id
41
+ @customer_id = customer_id
42
+ @name = name
43
+ @status = status
44
+ @created = created
45
+ @updated = updated
46
+ @additional_properties = additional_properties
47
+ @_field_set = {
48
+ "id": id,
49
+ "customerId": customer_id,
50
+ "name": name,
51
+ "status": status,
52
+ "created": created,
53
+ "updated": updated
54
+ }
55
+ end
56
+
57
+ # Deserialize a JSON object to an instance of AdminTenant
58
+ #
59
+ # @param json_object [String]
60
+ # @return [TrophyApiClient::AdminTenant]
61
+ def self.from_json(json_object:)
62
+ struct = JSON.parse(json_object, object_class: OpenStruct)
63
+ parsed_json = JSON.parse(json_object)
64
+ id = parsed_json["id"]
65
+ customer_id = parsed_json["customerId"]
66
+ name = parsed_json["name"]
67
+ status = parsed_json["status"]
68
+ created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
69
+ updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
70
+ new(
71
+ id: id,
72
+ customer_id: customer_id,
73
+ name: name,
74
+ status: status,
75
+ created: created,
76
+ updated: updated,
77
+ additional_properties: struct
78
+ )
79
+ end
80
+
81
+ # Serialize an instance of AdminTenant to a JSON object
82
+ #
83
+ # @return [String]
84
+ def to_json(*_args)
85
+ @_field_set&.to_json
86
+ end
87
+
88
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
89
+ # hash and check each fields type against the current object's property
90
+ # definitions.
91
+ #
92
+ # @param obj [Object]
93
+ # @return [Void]
94
+ def self.validate_raw(obj:)
95
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
96
+ obj.customer_id.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
97
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
98
+ obj.status.is_a?(TrophyApiClient::AdminTenantStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
99
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
100
+ obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TrophyApiClient
4
+ # The lifecycle status of the tenant.
5
+ class AdminTenantStatus
6
+ ACTIVE = "active"
7
+ ARCHIVED = "archived"
8
+ end
9
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ # A tenant to create.
8
+ class CreateTenantRequestItem
9
+ # @return [String] The external customer ID. Must be unique within the environment.
10
+ attr_reader :customer_id
11
+ # @return [String] Human-readable name for the tenant.
12
+ attr_reader :name
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param customer_id [String] The external customer ID. Must be unique within the environment.
22
+ # @param name [String] Human-readable name for the tenant.
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [TrophyApiClient::CreateTenantRequestItem]
25
+ def initialize(customer_id:, name:, additional_properties: nil)
26
+ @customer_id = customer_id
27
+ @name = name
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "customerId": customer_id, "name": name }
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of CreateTenantRequestItem
33
+ #
34
+ # @param json_object [String]
35
+ # @return [TrophyApiClient::CreateTenantRequestItem]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ customer_id = parsed_json["customerId"]
40
+ name = parsed_json["name"]
41
+ new(
42
+ customer_id: customer_id,
43
+ name: name,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of CreateTenantRequestItem to a JSON object
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ @_field_set&.to_json
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.customer_id.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
63
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "create_tenant_request_item"
4
+
5
+ module TrophyApiClient
6
+ CREATE_TENANTS_REQUEST = Array
7
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_tenant"
4
+ require_relative "admin_issue"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # Response containing created tenants and any issues.
10
+ class CreateTenantsResponse
11
+ # @return [Array<TrophyApiClient::AdminTenant>] Array of successfully created tenants.
12
+ attr_reader :created
13
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
14
+ attr_reader :issues
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param created [Array<TrophyApiClient::AdminTenant>] Array of successfully created tenants.
24
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [TrophyApiClient::CreateTenantsResponse]
27
+ def initialize(created:, issues:, additional_properties: nil)
28
+ @created = created
29
+ @issues = issues
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "created": created, "issues": issues }
32
+ end
33
+
34
+ # Deserialize a JSON object to an instance of CreateTenantsResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [TrophyApiClient::CreateTenantsResponse]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ created = parsed_json["created"]&.map do |item|
42
+ item = item.to_json
43
+ TrophyApiClient::AdminTenant.from_json(json_object: item)
44
+ end
45
+ issues = parsed_json["issues"]&.map do |item|
46
+ item = item.to_json
47
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
48
+ end
49
+ new(
50
+ created: created,
51
+ issues: issues,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of CreateTenantsResponse to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.created.is_a?(Array) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
71
+ obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "deleted_resource"
4
+ require_relative "admin_issue"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # Response containing deleted tenant IDs and any issues.
10
+ class DeleteTenantsResponse
11
+ # @return [Array<TrophyApiClient::DeletedResource>] Array of deleted tenant IDs.
12
+ attr_reader :deleted
13
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during deletion.
14
+ attr_reader :issues
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted tenant IDs.
24
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during deletion.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [TrophyApiClient::DeleteTenantsResponse]
27
+ def initialize(deleted:, issues:, additional_properties: nil)
28
+ @deleted = deleted
29
+ @issues = issues
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "deleted": deleted, "issues": issues }
32
+ end
33
+
34
+ # Deserialize a JSON object to an instance of DeleteTenantsResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [TrophyApiClient::DeleteTenantsResponse]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ deleted = parsed_json["deleted"]&.map do |item|
42
+ item = item.to_json
43
+ TrophyApiClient::DeletedResource.from_json(json_object: item)
44
+ end
45
+ issues = parsed_json["issues"]&.map do |item|
46
+ item = item.to_json
47
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
48
+ end
49
+ new(
50
+ deleted: deleted,
51
+ issues: issues,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of DeleteTenantsResponse to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
71
+ obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_tenant"
4
+
5
+ module TrophyApiClient
6
+ LIST_TENANTS_RESPONSE = Array
7
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ # A tenant to update.
8
+ class UpdateTenantRequestItem
9
+ # @return [String] The UUID of the tenant to update.
10
+ attr_reader :id
11
+ # @return [String] New external customer ID.
12
+ attr_reader :customer_id
13
+ # @return [String] New display name for the tenant.
14
+ attr_reader :name
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param id [String] The UUID of the tenant to update.
24
+ # @param customer_id [String] New external customer ID.
25
+ # @param name [String] New display name for the tenant.
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [TrophyApiClient::UpdateTenantRequestItem]
28
+ def initialize(id:, customer_id: OMIT, name: OMIT, additional_properties: nil)
29
+ @id = id
30
+ @customer_id = customer_id if customer_id != OMIT
31
+ @name = name if name != OMIT
32
+ @additional_properties = additional_properties
33
+ @_field_set = { "id": id, "customerId": customer_id, "name": name }.reject do |_k, v|
34
+ v == OMIT
35
+ end
36
+ end
37
+
38
+ # Deserialize a JSON object to an instance of UpdateTenantRequestItem
39
+ #
40
+ # @param json_object [String]
41
+ # @return [TrophyApiClient::UpdateTenantRequestItem]
42
+ def self.from_json(json_object:)
43
+ struct = JSON.parse(json_object, object_class: OpenStruct)
44
+ parsed_json = JSON.parse(json_object)
45
+ id = parsed_json["id"]
46
+ customer_id = parsed_json["customerId"]
47
+ name = parsed_json["name"]
48
+ new(
49
+ id: id,
50
+ customer_id: customer_id,
51
+ name: name,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of UpdateTenantRequestItem to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
71
+ obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
72
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "update_tenant_request_item"
4
+
5
+ module TrophyApiClient
6
+ UPDATE_TENANTS_REQUEST = Array
7
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_tenant"
4
+ require_relative "admin_issue"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # Response containing updated tenants and any issues.
10
+ class UpdateTenantsResponse
11
+ # @return [Array<TrophyApiClient::AdminTenant>] Array of successfully updated tenants.
12
+ attr_reader :updated
13
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during update.
14
+ attr_reader :issues
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param updated [Array<TrophyApiClient::AdminTenant>] Array of successfully updated tenants.
24
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during update.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [TrophyApiClient::UpdateTenantsResponse]
27
+ def initialize(updated:, issues:, additional_properties: nil)
28
+ @updated = updated
29
+ @issues = issues
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "updated": updated, "issues": issues }
32
+ end
33
+
34
+ # Deserialize a JSON object to an instance of UpdateTenantsResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [TrophyApiClient::UpdateTenantsResponse]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ updated = parsed_json["updated"]&.map do |item|
42
+ item = item.to_json
43
+ TrophyApiClient::AdminTenant.from_json(json_object: item)
44
+ end
45
+ issues = parsed_json["issues"]&.map do |item|
46
+ item = item.to_json
47
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
48
+ end
49
+ new(
50
+ updated: updated,
51
+ issues: issues,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of UpdateTenantsResponse to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.updated.is_a?(Array) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
71
+ obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end