trophy_api_client 1.3.4 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cb9d52fcaab5cf68909f48fb282a528d76efa4d788b57fe4ca290590a27126e
4
- data.tar.gz: 07be917c807d0d55ff077b67e758f1265c5bf2e34e98af77fc7835ef14b525d0
3
+ metadata.gz: 7f93fc6f266f49a381617ca6d262f760e777a174f77daa80f902ced5676ee423
4
+ data.tar.gz: b67333cb8bd33fcee392d5b917b3b2f70bb48489779d8b42dec3554302f49160
5
5
  SHA512:
6
- metadata.gz: d012a7bb3f7adf0a59a1e538a5e5baa3861b6ab771a88d0b54cbc30d837aa5cee38d21df5e8aa3b7dd70bb10b30cd05e1966d9cf90b48faef932ceb5b97ed5fb
7
- data.tar.gz: a224b34e74c972fddbfad0ba495c1ca61327146d523120203e9c1401da8dc8a096ae4fcb40a21a76a717c0b58e23713a84f9b3f3a7346d1a03b083794c1511f7
6
+ metadata.gz: 42e60f2f9c52427320993227dd3d3d0afbfcb6f87f1abb4e8513c264c5df8e2a63fc216c54aeb6960cce81ea24f6c3b20b755cda22a7bbd6c77b8a79f56ef3e5
7
+ data.tar.gz: bf10f0374086942dc1c4967c3299e3664274bdae7cef0b3f91106f61dbd3480bf996389237ae5669501cbc70acfed11ed3c2f25526dac0218b26805d7aeed14c
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.3.4"
5
+ VERSION = "1.5.0"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -3,7 +3,7 @@
3
3
  require_relative "../../../../requests"
4
4
  require_relative "types/create_points_boosts_request_boosts_item"
5
5
  require_relative "../../../types/create_points_boosts_response"
6
- require_relative "../../../types/archive_points_boosts_response"
6
+ require_relative "../../../types/delete_points_boosts_response"
7
7
  require "async"
8
8
 
9
9
  module TrophyApiClient
@@ -22,7 +22,7 @@ module TrophyApiClient
22
22
  # Create points boosts for multiple users.
23
23
  #
24
24
  # @param system_key [String] The key of the points system to create boosts for.
25
- # @param boosts [Array<Hash>] Array of boosts to create. Maximum 1,000 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
25
+ # @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
26
26
  # * :user_id (String)
27
27
  # * :name (String)
28
28
  # * :start (String)
@@ -60,19 +60,19 @@ module TrophyApiClient
60
60
  TrophyApiClient::CreatePointsBoostsResponse.from_json(json_object: response.body)
61
61
  end
62
62
 
63
- # Archive multiple points boosts by ID.
63
+ # Delete multiple points boosts by ID.
64
64
  #
65
65
  # @param ids [String] A list of up to 100 boost IDs.
66
66
  # @param request_options [TrophyApiClient::RequestOptions]
67
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
67
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
68
68
  # @example
69
69
  # api = TrophyApiClient::Client.new(
70
70
  # base_url: "https://api.example.com",
71
71
  # environment: TrophyApiClient::Environment::PRODUCTION,
72
72
  # api_key: "YOUR_API_KEY"
73
73
  # )
74
- # api.admin.points.boosts.batch_archive
75
- def batch_archive(ids: nil, request_options: nil)
74
+ # api.admin.points.boosts.delete
75
+ def delete(ids: nil, request_options: nil)
76
76
  response = @request_client.conn.delete do |req|
77
77
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
78
78
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
@@ -87,39 +87,7 @@ module TrophyApiClient
87
87
  end
88
88
  req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
89
89
  end
90
- TrophyApiClient::ArchivePointsBoostsResponse.from_json(json_object: response.body)
91
- end
92
-
93
- # Archive a points boost by ID.
94
- #
95
- # @param id [String] The UUID of the points boost to archive
96
- # @param request_options [TrophyApiClient::RequestOptions]
97
- # @return [Void]
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.points.boosts.archive(id: "id")
105
- def archive(id:, request_options: nil)
106
- @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 = {
110
- **(req.headers || {}),
111
- **@request_client.get_headers,
112
- **(request_options&.additional_headers || {})
113
- }.compact
114
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
115
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
116
- end
117
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
118
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
119
- end
120
- req.url "#{@request_client.get_url(environment: admin,
121
- request_options: request_options)}/points/boosts/#{id}"
122
- end
90
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
123
91
  end
124
92
  end
125
93
 
@@ -136,7 +104,7 @@ module TrophyApiClient
136
104
  # Create points boosts for multiple users.
137
105
  #
138
106
  # @param system_key [String] The key of the points system to create boosts for.
139
- # @param boosts [Array<Hash>] Array of boosts to create. Maximum 1,000 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
107
+ # @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
140
108
  # * :user_id (String)
141
109
  # * :name (String)
142
110
  # * :start (String)
@@ -176,19 +144,19 @@ module TrophyApiClient
176
144
  end
177
145
  end
178
146
 
179
- # Archive multiple points boosts by ID.
147
+ # Delete multiple points boosts by ID.
180
148
  #
181
149
  # @param ids [String] A list of up to 100 boost IDs.
182
150
  # @param request_options [TrophyApiClient::RequestOptions]
183
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
151
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
184
152
  # @example
185
153
  # api = TrophyApiClient::Client.new(
186
154
  # base_url: "https://api.example.com",
187
155
  # environment: TrophyApiClient::Environment::PRODUCTION,
188
156
  # api_key: "YOUR_API_KEY"
189
157
  # )
190
- # api.admin.points.boosts.batch_archive
191
- def batch_archive(ids: nil, request_options: nil)
158
+ # api.admin.points.boosts.delete
159
+ def delete(ids: nil, request_options: nil)
192
160
  Async do
193
161
  response = @request_client.conn.delete do |req|
194
162
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -204,41 +172,7 @@ module TrophyApiClient
204
172
  end
205
173
  req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
206
174
  end
207
- TrophyApiClient::ArchivePointsBoostsResponse.from_json(json_object: response.body)
208
- end
209
- end
210
-
211
- # Archive a points boost by ID.
212
- #
213
- # @param id [String] The UUID of the points boost to archive
214
- # @param request_options [TrophyApiClient::RequestOptions]
215
- # @return [Void]
216
- # @example
217
- # api = TrophyApiClient::Client.new(
218
- # base_url: "https://api.example.com",
219
- # environment: TrophyApiClient::Environment::PRODUCTION,
220
- # api_key: "YOUR_API_KEY"
221
- # )
222
- # api.admin.points.boosts.archive(id: "id")
223
- def archive(id:, request_options: nil)
224
- Async do
225
- @request_client.conn.delete do |req|
226
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
227
- req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
228
- req.headers = {
229
- **(req.headers || {}),
230
- **@request_client.get_headers,
231
- **(request_options&.additional_headers || {})
232
- }.compact
233
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
234
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
235
- end
236
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
237
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
238
- end
239
- req.url "#{@request_client.get_url(environment: admin,
240
- request_options: request_options)}/points/boosts/#{id}"
241
- end
175
+ TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
242
176
  end
243
177
  end
244
178
  end
@@ -17,9 +17,11 @@ module TrophyApiClient
17
17
  @request_client = request_client
18
18
  end
19
19
 
20
- # Restore streaks for multiple users to the maximum length in the last 90 days (in
21
- # the case of daily streaks), one year (in the case of weekly streaks), or two
22
- # years (in the case of monthly streaks).
20
+ # Restore streaks for multiple users to the maximum previously achieved streak
21
+ # length found within the current restore window: the last 90 days for daily
22
+ # streaks, weekly periods starting with the week containing the start of the
23
+ # current calendar year for weekly streaks, and monthly periods starting at the
24
+ # beginning of the previous calendar year for monthly streaks.
23
25
  #
24
26
  # @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
25
27
  # * :id (String)
@@ -61,9 +63,11 @@ module TrophyApiClient
61
63
  @request_client = request_client
62
64
  end
63
65
 
64
- # Restore streaks for multiple users to the maximum length in the last 90 days (in
65
- # the case of daily streaks), one year (in the case of weekly streaks), or two
66
- # years (in the case of monthly streaks).
66
+ # Restore streaks for multiple users to the maximum previously achieved streak
67
+ # length found within the current restore window: the last 90 days for daily
68
+ # streaks, weekly periods starting with the week containing the start of the
69
+ # current calendar year for weekly streaks, and monthly periods starting at the
70
+ # beginning of the previous calendar year for monthly streaks.
67
71
  #
68
72
  # @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
69
73
  # * :id (String)
@@ -20,7 +20,7 @@ module TrophyApiClient
20
20
 
21
21
  # Create streak freezes for multiple users.
22
22
  #
23
- # @param freezes [Array<Hash>] Array of freezes to create. Maximum 1,000 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
23
+ # @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
24
24
  # * :user_id (String)
25
25
  # @param request_options [TrophyApiClient::RequestOptions]
26
26
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
@@ -62,7 +62,7 @@ module TrophyApiClient
62
62
 
63
63
  # Create streak freezes for multiple users.
64
64
  #
65
- # @param freezes [Array<Hash>] Array of freezes to create. Maximum 1,000 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
65
+ # @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
66
66
  # * :user_id (String)
67
67
  # @param request_options [TrophyApiClient::RequestOptions]
68
68
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_issue_severity"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module TrophyApiClient
8
+ # An issue encountered while processing an item in an admin API request.
9
+ class AdminIssue
10
+ # @return [String] The ID of the user the issue relates to, when applicable.
11
+ attr_reader :user_id
12
+ # @return [String] The ID of the points boost the issue relates to, when applicable.
13
+ attr_reader :boost_id
14
+ # @return [Integer] The zero-based index of the item the issue relates to, when no resource ID
15
+ # exists yet.
16
+ attr_reader :index
17
+ # @return [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
18
+ attr_reader :severity
19
+ # @return [String] A human-readable description of the issue.
20
+ attr_reader :message
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param user_id [String] The ID of the user the issue relates to, when applicable.
30
+ # @param boost_id [String] The ID of the points boost the issue relates to, when applicable.
31
+ # @param index [Integer] The zero-based index of the item the issue relates to, when no resource ID
32
+ # exists yet.
33
+ # @param severity [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
34
+ # @param message [String] A human-readable description of the issue.
35
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
36
+ # @return [TrophyApiClient::AdminIssue]
37
+ def initialize(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil)
38
+ @user_id = user_id if user_id != OMIT
39
+ @boost_id = boost_id if boost_id != OMIT
40
+ @index = index if index != OMIT
41
+ @severity = severity
42
+ @message = message
43
+ @additional_properties = additional_properties
44
+ @_field_set = {
45
+ "userId": user_id,
46
+ "boostId": boost_id,
47
+ "index": index,
48
+ "severity": severity,
49
+ "message": message
50
+ }.reject do |_k, v|
51
+ v == OMIT
52
+ end
53
+ end
54
+
55
+ # Deserialize a JSON object to an instance of AdminIssue
56
+ #
57
+ # @param json_object [String]
58
+ # @return [TrophyApiClient::AdminIssue]
59
+ def self.from_json(json_object:)
60
+ struct = JSON.parse(json_object, object_class: OpenStruct)
61
+ parsed_json = JSON.parse(json_object)
62
+ user_id = parsed_json["userId"]
63
+ boost_id = parsed_json["boostId"]
64
+ index = parsed_json["index"]
65
+ severity = parsed_json["severity"]
66
+ message = parsed_json["message"]
67
+ new(
68
+ user_id: user_id,
69
+ boost_id: boost_id,
70
+ index: index,
71
+ severity: severity,
72
+ message: message,
73
+ additional_properties: struct
74
+ )
75
+ end
76
+
77
+ # Serialize an instance of AdminIssue to a JSON object
78
+ #
79
+ # @return [String]
80
+ def to_json(*_args)
81
+ @_field_set&.to_json
82
+ end
83
+
84
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
85
+ # hash and check each fields type against the current object's property
86
+ # definitions.
87
+ #
88
+ # @param obj [Object]
89
+ # @return [Void]
90
+ def self.validate_raw(obj:)
91
+ obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
92
+ obj.boost_id&.is_a?(String) != false || raise("Passed value for field obj.boost_id is not the expected type, validation failed.")
93
+ obj.index&.is_a?(Integer) != false || raise("Passed value for field obj.index is not the expected type, validation failed.")
94
+ obj.severity.is_a?(TrophyApiClient::AdminIssueSeverity) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.")
95
+ obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
96
+ end
97
+ end
98
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  # The severity level of the issue.
5
- class BulkInsertIssueLevel
5
+ class AdminIssueSeverity
6
6
  ERROR = "error"
7
7
  WARNING = "warning"
8
8
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "created_points_boost"
4
- require_relative "bulk_insert_issue"
4
+ require_relative "admin_issue"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -11,7 +11,7 @@ module TrophyApiClient
11
11
  class CreatePointsBoostsResponse
12
12
  # @return [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
13
13
  attr_reader :created
14
- # @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during boost creation.
14
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
15
15
  attr_reader :issues
16
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
17
17
  attr_reader :additional_properties
@@ -22,7 +22,7 @@ module TrophyApiClient
22
22
  OMIT = Object.new
23
23
 
24
24
  # @param created [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
25
- # @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during boost creation.
25
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
26
26
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
27
  # @return [TrophyApiClient::CreatePointsBoostsResponse]
28
28
  def initialize(created:, issues:, additional_properties: nil)
@@ -45,7 +45,7 @@ module TrophyApiClient
45
45
  end
46
46
  issues = parsed_json["issues"]&.map do |item|
47
47
  item = item.to_json
48
- TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
48
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
49
49
  end
50
50
  new(
51
51
  created: created,
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "bulk_insert_issue"
3
+ require_relative "admin_issue"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
7
7
  module TrophyApiClient
8
8
  # Response containing any issues encountered while creating streak freezes.
9
9
  class CreateStreakFreezesResponse
10
- # @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
10
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
11
11
  attr_reader :issues
12
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
13
13
  attr_reader :additional_properties
@@ -17,7 +17,7 @@ module TrophyApiClient
17
17
 
18
18
  OMIT = Object.new
19
19
 
20
- # @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
20
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
21
21
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
22
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
23
23
  def initialize(issues:, additional_properties: nil)
@@ -35,7 +35,7 @@ module TrophyApiClient
35
35
  parsed_json = JSON.parse(json_object)
36
36
  issues = parsed_json["issues"]&.map do |item|
37
37
  item = item.to_json
38
- TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
38
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
39
39
  end
40
40
  new(issues: issues, additional_properties: struct)
41
41
  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 the points boosts that were deleted and any per-item issues.
10
+ class DeletePointsBoostsResponse
11
+ # @return [Array<TrophyApiClient::DeletedResource>] Array of deleted points boosts represented by ID.
12
+ attr_reader :deleted
13
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
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 points boosts represented by ID.
24
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
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 DeletePointsBoostsResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
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 DeletePointsBoostsResponse 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
@@ -4,10 +4,10 @@ require "ostruct"
4
4
  require "json"
5
5
 
6
6
  module TrophyApiClient
7
- # Response containing the count of archived points boosts.
8
- class ArchivePointsBoostsResponse
9
- # @return [Integer] The number of boosts that were archived.
10
- attr_reader :archived_count
7
+ # A deleted resource represented by ID.
8
+ class DeletedResource
9
+ # @return [String] The ID of the deleted resource.
10
+ attr_reader :id
11
11
  # @return [OpenStruct] Additional properties unmapped to the current class definition
12
12
  attr_reader :additional_properties
13
13
  # @return [Object]
@@ -16,27 +16,27 @@ module TrophyApiClient
16
16
 
17
17
  OMIT = Object.new
18
18
 
19
- # @param archived_count [Integer] The number of boosts that were archived.
19
+ # @param id [String] The ID of the deleted resource.
20
20
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
22
- def initialize(archived_count:, additional_properties: nil)
23
- @archived_count = archived_count
21
+ # @return [TrophyApiClient::DeletedResource]
22
+ def initialize(id:, additional_properties: nil)
23
+ @id = id
24
24
  @additional_properties = additional_properties
25
- @_field_set = { "archivedCount": archived_count }
25
+ @_field_set = { "id": id }
26
26
  end
27
27
 
28
- # Deserialize a JSON object to an instance of ArchivePointsBoostsResponse
28
+ # Deserialize a JSON object to an instance of DeletedResource
29
29
  #
30
30
  # @param json_object [String]
31
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
31
+ # @return [TrophyApiClient::DeletedResource]
32
32
  def self.from_json(json_object:)
33
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
34
34
  parsed_json = JSON.parse(json_object)
35
- archived_count = parsed_json["archivedCount"]
36
- new(archived_count: archived_count, additional_properties: struct)
35
+ id = parsed_json["id"]
36
+ new(id: id, additional_properties: struct)
37
37
  end
38
38
 
39
- # Serialize an instance of ArchivePointsBoostsResponse to a JSON object
39
+ # Serialize an instance of DeletedResource to a JSON object
40
40
  #
41
41
  # @return [String]
42
42
  def to_json(*_args)
@@ -50,7 +50,7 @@ module TrophyApiClient
50
50
  # @param obj [Object]
51
51
  # @return [Void]
52
52
  def self.validate_raw(obj:)
53
- obj.archived_count.is_a?(Integer) != false || raise("Passed value for field obj.archived_count is not the expected type, validation failed.")
53
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
54
54
  end
55
55
  end
56
56
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "bulk_insert_issue"
3
+ require_relative "admin_issue"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
@@ -9,7 +9,7 @@ module TrophyApiClient
9
9
  class RestoreStreaksResponse
10
10
  # @return [Array<String>] Array of user IDs whose streaks were successfully restored.
11
11
  attr_reader :restored_users
12
- # @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during streak restoration.
12
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
13
13
  attr_reader :issues
14
14
  # @return [OpenStruct] Additional properties unmapped to the current class definition
15
15
  attr_reader :additional_properties
@@ -20,7 +20,7 @@ module TrophyApiClient
20
20
  OMIT = Object.new
21
21
 
22
22
  # @param restored_users [Array<String>] Array of user IDs whose streaks were successfully restored.
23
- # @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during streak restoration.
23
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
24
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
25
  # @return [TrophyApiClient::RestoreStreaksResponse]
26
26
  def initialize(restored_users:, issues:, additional_properties: nil)
@@ -40,7 +40,7 @@ module TrophyApiClient
40
40
  restored_users = parsed_json["restoredUsers"]
41
41
  issues = parsed_json["issues"]&.map do |item|
42
42
  item = item.to_json
43
- TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
43
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
44
44
  end
45
45
  new(
46
46
  restored_users: restored_users,
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.3.4"
2
+ VERSION = "1.5.0"
3
3
  end
data/lib/types_export.rb CHANGED
@@ -94,10 +94,11 @@ require_relative "trophy_api_client/types/created_points_boost_status"
94
94
  require_relative "trophy_api_client/types/created_points_boost_rounding"
95
95
  require_relative "trophy_api_client/types/created_points_boost"
96
96
  require_relative "trophy_api_client/types/create_points_boosts_response"
97
- require_relative "trophy_api_client/types/archive_points_boosts_response"
97
+ require_relative "trophy_api_client/types/delete_points_boosts_response"
98
98
  require_relative "trophy_api_client/types/restore_streaks_response"
99
- require_relative "trophy_api_client/types/bulk_insert_issue_level"
100
- require_relative "trophy_api_client/types/bulk_insert_issue"
99
+ require_relative "trophy_api_client/types/admin_issue_severity"
100
+ require_relative "trophy_api_client/types/admin_issue"
101
+ require_relative "trophy_api_client/types/deleted_resource"
101
102
  require_relative "trophy_api_client/types/wrapped_metric_by_attribute_value_value"
102
103
  require_relative "trophy_api_client/types/wrapped_metric"
103
104
  require_relative "trophy_api_client/types/wrapped_points"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophy_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc
@@ -123,10 +123,9 @@ files:
123
123
  - lib/trophy_api_client/types/achievement_response_trigger.rb
124
124
  - lib/trophy_api_client/types/achievement_response_user_attributes_item.rb
125
125
  - lib/trophy_api_client/types/achievement_with_stats_response.rb
126
- - lib/trophy_api_client/types/archive_points_boosts_response.rb
126
+ - lib/trophy_api_client/types/admin_issue.rb
127
+ - lib/trophy_api_client/types/admin_issue_severity.rb
127
128
  - lib/trophy_api_client/types/base_streak_response.rb
128
- - lib/trophy_api_client/types/bulk_insert_issue.rb
129
- - lib/trophy_api_client/types/bulk_insert_issue_level.rb
130
129
  - lib/trophy_api_client/types/bulk_streak_response.rb
131
130
  - lib/trophy_api_client/types/bulk_streak_response_item.rb
132
131
  - lib/trophy_api_client/types/create_points_boosts_response.rb
@@ -134,6 +133,8 @@ files:
134
133
  - lib/trophy_api_client/types/created_points_boost.rb
135
134
  - lib/trophy_api_client/types/created_points_boost_rounding.rb
136
135
  - lib/trophy_api_client/types/created_points_boost_status.rb
136
+ - lib/trophy_api_client/types/delete_points_boosts_response.rb
137
+ - lib/trophy_api_client/types/deleted_resource.rb
137
138
  - lib/trophy_api_client/types/error_body.rb
138
139
  - lib/trophy_api_client/types/event_response.rb
139
140
  - lib/trophy_api_client/types/get_user_points_response.rb
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "bulk_insert_issue_level"
4
- require "ostruct"
5
- require "json"
6
-
7
- module TrophyApiClient
8
- # An issue encountered while bulk inserting data.
9
- class BulkInsertIssue
10
- # @return [String] The ID of the user the issue relates to.
11
- attr_reader :user_id
12
- # @return [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
13
- attr_reader :level
14
- # @return [String] A human-readable description of the issue.
15
- attr_reader :reason
16
- # @return [OpenStruct] Additional properties unmapped to the current class definition
17
- attr_reader :additional_properties
18
- # @return [Object]
19
- attr_reader :_field_set
20
- protected :_field_set
21
-
22
- OMIT = Object.new
23
-
24
- # @param user_id [String] The ID of the user the issue relates to.
25
- # @param level [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
26
- # @param reason [String] A human-readable description of the issue.
27
- # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
- # @return [TrophyApiClient::BulkInsertIssue]
29
- def initialize(user_id:, level:, reason:, additional_properties: nil)
30
- @user_id = user_id
31
- @level = level
32
- @reason = reason
33
- @additional_properties = additional_properties
34
- @_field_set = { "userId": user_id, "level": level, "reason": reason }
35
- end
36
-
37
- # Deserialize a JSON object to an instance of BulkInsertIssue
38
- #
39
- # @param json_object [String]
40
- # @return [TrophyApiClient::BulkInsertIssue]
41
- def self.from_json(json_object:)
42
- struct = JSON.parse(json_object, object_class: OpenStruct)
43
- parsed_json = JSON.parse(json_object)
44
- user_id = parsed_json["userId"]
45
- level = parsed_json["level"]
46
- reason = parsed_json["reason"]
47
- new(
48
- user_id: user_id,
49
- level: level,
50
- reason: reason,
51
- additional_properties: struct
52
- )
53
- end
54
-
55
- # Serialize an instance of BulkInsertIssue to a JSON object
56
- #
57
- # @return [String]
58
- def to_json(*_args)
59
- @_field_set&.to_json
60
- end
61
-
62
- # Leveraged for Union-type generation, validate_raw attempts to parse the given
63
- # hash and check each fields type against the current object's property
64
- # definitions.
65
- #
66
- # @param obj [Object]
67
- # @return [Void]
68
- def self.validate_raw(obj:)
69
- obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
70
- obj.level.is_a?(TrophyApiClient::BulkInsertIssueLevel) != false || raise("Passed value for field obj.level is not the expected type, validation failed.")
71
- obj.reason.is_a?(String) != false || raise("Passed value for field obj.reason is not the expected type, validation failed.")
72
- end
73
- end
74
- end