torii-backend 0.0.9 → 0.0.11

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/spec/server-v1.json +1 -1
  3. data/src/torii/backend/generated/lib/torii_backend_generated/api/server_organizations_api.rb +374 -0
  4. data/src/torii/backend/generated/lib/torii_backend_generated/api/server_users_api.rb +69 -0
  5. data/src/torii/backend/generated/lib/torii_backend_generated/models/cursor_page_response_server_organization_member_response.rb +206 -0
  6. data/src/torii/backend/generated/lib/torii_backend_generated/models/cursor_page_response_server_organization_response.rb +206 -0
  7. data/src/torii/backend/generated/lib/torii_backend_generated/models/cursor_page_response_server_user_organization_response.rb +206 -0
  8. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_impersonation_token_response.rb +1 -1
  9. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_organization_member_response.rb +308 -0
  10. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_organization_response.rb +292 -0
  11. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_user_organization_response.rb +324 -0
  12. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_user_search_request.rb +16 -5
  13. data/src/torii/backend/generated/lib/torii_backend_generated/models/update_organization_metadata_request.rb +162 -0
  14. data/src/torii/backend/generated/lib/torii_backend_generated/models/user_session_response.rb +1 -1
  15. data/src/torii/backend/generated/lib/torii_backend_generated.rb +8 -0
  16. data/src/torii/backend/generated/spec/api/server_organizations_api_spec.rb +102 -0
  17. data/src/torii/backend/generated/spec/models/cursor_page_response_server_organization_member_response_spec.rb +48 -0
  18. data/src/torii/backend/generated/spec/models/cursor_page_response_server_organization_response_spec.rb +48 -0
  19. data/src/torii/backend/generated/spec/models/cursor_page_response_server_user_organization_response_spec.rb +48 -0
  20. data/src/torii/backend/generated/spec/models/server_organization_member_response_spec.rb +72 -0
  21. data/src/torii/backend/generated/spec/models/server_organization_response_spec.rb +72 -0
  22. data/src/torii/backend/generated/spec/models/server_user_organization_response_spec.rb +78 -0
  23. data/src/torii/backend/generated/spec/models/update_organization_metadata_request_spec.rb +42 -0
  24. data/src/torii/backend/version.rb +1 -1
  25. metadata +18 -2
@@ -0,0 +1,374 @@
1
+ =begin
2
+ #Torii Backend API
3
+
4
+ #Server-to-server API (BAPI) for backend SDKs. Authenticated with a secret key (Bearer sk_live_* / sk_test_*).
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module ToriiBackendGenerated
16
+ class ServerOrganizationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get an organization
23
+ # One organization with both metadata bags.
24
+ # @param organization_id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ServerOrganizationResponse]
27
+ def get_organization(organization_id, opts = {})
28
+ data, _status_code, _headers = get_organization_with_http_info(organization_id, opts)
29
+ data
30
+ end
31
+
32
+ # Get an organization
33
+ # One organization with both metadata bags.
34
+ # @param organization_id [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ServerOrganizationResponse, Integer, Hash)>] ServerOrganizationResponse data, response status code and response headers
37
+ def get_organization_with_http_info(organization_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ServerOrganizationsApi.get_organization ...'
40
+ end
41
+ # verify the required parameter 'organization_id' is set
42
+ if @api_client.config.client_side_validation && organization_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling ServerOrganizationsApi.get_organization"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/server/v1/organizations/{organizationId}'.sub('{organizationId}', CGI.escape(organization_id.to_s))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:debug_body]
61
+
62
+ # return_type
63
+ return_type = opts[:debug_return_type] || 'ServerOrganizationResponse'
64
+
65
+ # auth_names
66
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
67
+
68
+ new_options = opts.merge(
69
+ :operation => :"ServerOrganizationsApi.get_organization",
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => return_type
76
+ )
77
+
78
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: ServerOrganizationsApi#get_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
85
+ # List organization members
86
+ # Cursor-paginated page of the organization's USER memberships, each with both metadata bags. Ordered by member user id ascending (a creation-ordered uuid v7, which is also the seek key), NOT by join time.
87
+ # @param organization_id [String]
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20; values outside 1-100 are clamped). (default to 20)
90
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
91
+ # @return [CursorPageResponseServerOrganizationMemberResponse]
92
+ def list_members(organization_id, opts = {})
93
+ data, _status_code, _headers = list_members_with_http_info(organization_id, opts)
94
+ data
95
+ end
96
+
97
+ # List organization members
98
+ # Cursor-paginated page of the organization&#39;s USER memberships, each with both metadata bags. Ordered by member user id ascending (a creation-ordered uuid v7, which is also the seek key), NOT by join time.
99
+ # @param organization_id [String]
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20; values outside 1-100 are clamped). (default to 20)
102
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
103
+ # @return [Array<(CursorPageResponseServerOrganizationMemberResponse, Integer, Hash)>] CursorPageResponseServerOrganizationMemberResponse data, response status code and response headers
104
+ def list_members_with_http_info(organization_id, opts = {})
105
+ if @api_client.config.debugging
106
+ @api_client.config.logger.debug 'Calling API: ServerOrganizationsApi.list_members ...'
107
+ end
108
+ # verify the required parameter 'organization_id' is set
109
+ if @api_client.config.client_side_validation && organization_id.nil?
110
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling ServerOrganizationsApi.list_members"
111
+ end
112
+ # resource path
113
+ local_var_path = '/api/server/v1/organizations/{organizationId}/members'.sub('{organizationId}', CGI.escape(organization_id.to_s))
114
+
115
+ # query parameters
116
+ query_params = opts[:query_params] || {}
117
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
118
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
119
+
120
+ # header parameters
121
+ header_params = opts[:header_params] || {}
122
+ # HTTP header 'Accept' (if needed)
123
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
124
+
125
+ # form parameters
126
+ form_params = opts[:form_params] || {}
127
+
128
+ # http body (model)
129
+ post_body = opts[:debug_body]
130
+
131
+ # return_type
132
+ return_type = opts[:debug_return_type] || 'CursorPageResponseServerOrganizationMemberResponse'
133
+
134
+ # auth_names
135
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
136
+
137
+ new_options = opts.merge(
138
+ :operation => :"ServerOrganizationsApi.list_members",
139
+ :header_params => header_params,
140
+ :query_params => query_params,
141
+ :form_params => form_params,
142
+ :body => post_body,
143
+ :auth_names => auth_names,
144
+ :return_type => return_type
145
+ )
146
+
147
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
148
+ if @api_client.config.debugging
149
+ @api_client.config.logger.debug "API called: ServerOrganizationsApi#list_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
150
+ end
151
+ return data, status_code, headers
152
+ end
153
+
154
+ # List organizations
155
+ # Cursor-paginated page of the environment's organizations, with both metadata bags. Optional `name` filter is a case-insensitive substring match.
156
+ # @param [Hash] opts the optional parameters
157
+ # @option opts [String] :name Case-insensitive substring filter on the organization name.
158
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20; values outside 1-100 are clamped). (default to 20)
159
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
160
+ # @return [CursorPageResponseServerOrganizationResponse]
161
+ def list_organizations(opts = {})
162
+ data, _status_code, _headers = list_organizations_with_http_info(opts)
163
+ data
164
+ end
165
+
166
+ # List organizations
167
+ # Cursor-paginated page of the environment&#39;s organizations, with both metadata bags. Optional &#x60;name&#x60; filter is a case-insensitive substring match.
168
+ # @param [Hash] opts the optional parameters
169
+ # @option opts [String] :name Case-insensitive substring filter on the organization name.
170
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20; values outside 1-100 are clamped). (default to 20)
171
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
172
+ # @return [Array<(CursorPageResponseServerOrganizationResponse, Integer, Hash)>] CursorPageResponseServerOrganizationResponse data, response status code and response headers
173
+ def list_organizations_with_http_info(opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: ServerOrganizationsApi.list_organizations ...'
176
+ end
177
+ # resource path
178
+ local_var_path = '/api/server/v1/organizations'
179
+
180
+ # query parameters
181
+ query_params = opts[:query_params] || {}
182
+ query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
183
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
184
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
190
+
191
+ # form parameters
192
+ form_params = opts[:form_params] || {}
193
+
194
+ # http body (model)
195
+ post_body = opts[:debug_body]
196
+
197
+ # return_type
198
+ return_type = opts[:debug_return_type] || 'CursorPageResponseServerOrganizationResponse'
199
+
200
+ # auth_names
201
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
202
+
203
+ new_options = opts.merge(
204
+ :operation => :"ServerOrganizationsApi.list_organizations",
205
+ :header_params => header_params,
206
+ :query_params => query_params,
207
+ :form_params => form_params,
208
+ :body => post_body,
209
+ :auth_names => auth_names,
210
+ :return_type => return_type
211
+ )
212
+
213
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
214
+ if @api_client.config.debugging
215
+ @api_client.config.logger.debug "API called: ServerOrganizationsApi#list_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
216
+ end
217
+ return data, status_code, headers
218
+ end
219
+
220
+ # Update organization membership metadata
221
+ # Deep-merges into either bag on one membership, with the same tri-state contract as the organization endpoint. Each bag on the membership has its own 8 KB budget, separate from the organization's bags.
222
+ # @param organization_id [String]
223
+ # @param member_user_id [String]
224
+ # @param update_organization_metadata_request [UpdateOrganizationMetadataRequest]
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [ServerOrganizationMemberResponse]
227
+ def update_member_metadata(organization_id, member_user_id, update_organization_metadata_request, opts = {})
228
+ data, _status_code, _headers = update_member_metadata_with_http_info(organization_id, member_user_id, update_organization_metadata_request, opts)
229
+ data
230
+ end
231
+
232
+ # Update organization membership metadata
233
+ # Deep-merges into either bag on one membership, with the same tri-state contract as the organization endpoint. Each bag on the membership has its own 8 KB budget, separate from the organization&#39;s bags.
234
+ # @param organization_id [String]
235
+ # @param member_user_id [String]
236
+ # @param update_organization_metadata_request [UpdateOrganizationMetadataRequest]
237
+ # @param [Hash] opts the optional parameters
238
+ # @return [Array<(ServerOrganizationMemberResponse, Integer, Hash)>] ServerOrganizationMemberResponse data, response status code and response headers
239
+ def update_member_metadata_with_http_info(organization_id, member_user_id, update_organization_metadata_request, opts = {})
240
+ if @api_client.config.debugging
241
+ @api_client.config.logger.debug 'Calling API: ServerOrganizationsApi.update_member_metadata ...'
242
+ end
243
+ # verify the required parameter 'organization_id' is set
244
+ if @api_client.config.client_side_validation && organization_id.nil?
245
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling ServerOrganizationsApi.update_member_metadata"
246
+ end
247
+ # verify the required parameter 'member_user_id' is set
248
+ if @api_client.config.client_side_validation && member_user_id.nil?
249
+ fail ArgumentError, "Missing the required parameter 'member_user_id' when calling ServerOrganizationsApi.update_member_metadata"
250
+ end
251
+ # verify the required parameter 'update_organization_metadata_request' is set
252
+ if @api_client.config.client_side_validation && update_organization_metadata_request.nil?
253
+ fail ArgumentError, "Missing the required parameter 'update_organization_metadata_request' when calling ServerOrganizationsApi.update_member_metadata"
254
+ end
255
+ # resource path
256
+ local_var_path = '/api/server/v1/organizations/{organizationId}/members/{memberUserId}/metadata'.sub('{organizationId}', CGI.escape(organization_id.to_s)).sub('{memberUserId}', CGI.escape(member_user_id.to_s))
257
+
258
+ # query parameters
259
+ query_params = opts[:query_params] || {}
260
+
261
+ # header parameters
262
+ header_params = opts[:header_params] || {}
263
+ # HTTP header 'Accept' (if needed)
264
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
265
+ # HTTP header 'Content-Type'
266
+ content_type = @api_client.select_header_content_type(['application/json'])
267
+ if !content_type.nil?
268
+ header_params['Content-Type'] = content_type
269
+ end
270
+
271
+ # form parameters
272
+ form_params = opts[:form_params] || {}
273
+
274
+ # http body (model)
275
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_metadata_request)
276
+
277
+ # return_type
278
+ return_type = opts[:debug_return_type] || 'ServerOrganizationMemberResponse'
279
+
280
+ # auth_names
281
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
282
+
283
+ new_options = opts.merge(
284
+ :operation => :"ServerOrganizationsApi.update_member_metadata",
285
+ :header_params => header_params,
286
+ :query_params => query_params,
287
+ :form_params => form_params,
288
+ :body => post_body,
289
+ :auth_names => auth_names,
290
+ :return_type => return_type
291
+ )
292
+
293
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
294
+ if @api_client.config.debugging
295
+ @api_client.config.logger.debug "API called: ServerOrganizationsApi#update_member_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
296
+ end
297
+ return data, status_code, headers
298
+ end
299
+
300
+ # Update organization metadata
301
+ # Deep-merges into either metadata bag. Each bag is tri-state: omit the key to leave the bag unchanged, or send an object to deep-merge into it (a key set to null removes it). Each bag is capped at 8 KB on its own, measured on the merged result rather than on the patch you send. A request naming neither bag is a 400.
302
+ # @param organization_id [String]
303
+ # @param update_organization_metadata_request [UpdateOrganizationMetadataRequest]
304
+ # @param [Hash] opts the optional parameters
305
+ # @return [ServerOrganizationResponse]
306
+ def update_organization_metadata(organization_id, update_organization_metadata_request, opts = {})
307
+ data, _status_code, _headers = update_organization_metadata_with_http_info(organization_id, update_organization_metadata_request, opts)
308
+ data
309
+ end
310
+
311
+ # Update organization metadata
312
+ # Deep-merges into either metadata bag. Each bag is tri-state: omit the key to leave the bag unchanged, or send an object to deep-merge into it (a key set to null removes it). Each bag is capped at 8 KB on its own, measured on the merged result rather than on the patch you send. A request naming neither bag is a 400.
313
+ # @param organization_id [String]
314
+ # @param update_organization_metadata_request [UpdateOrganizationMetadataRequest]
315
+ # @param [Hash] opts the optional parameters
316
+ # @return [Array<(ServerOrganizationResponse, Integer, Hash)>] ServerOrganizationResponse data, response status code and response headers
317
+ def update_organization_metadata_with_http_info(organization_id, update_organization_metadata_request, opts = {})
318
+ if @api_client.config.debugging
319
+ @api_client.config.logger.debug 'Calling API: ServerOrganizationsApi.update_organization_metadata ...'
320
+ end
321
+ # verify the required parameter 'organization_id' is set
322
+ if @api_client.config.client_side_validation && organization_id.nil?
323
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling ServerOrganizationsApi.update_organization_metadata"
324
+ end
325
+ # verify the required parameter 'update_organization_metadata_request' is set
326
+ if @api_client.config.client_side_validation && update_organization_metadata_request.nil?
327
+ fail ArgumentError, "Missing the required parameter 'update_organization_metadata_request' when calling ServerOrganizationsApi.update_organization_metadata"
328
+ end
329
+ # resource path
330
+ local_var_path = '/api/server/v1/organizations/{organizationId}/metadata'.sub('{organizationId}', CGI.escape(organization_id.to_s))
331
+
332
+ # query parameters
333
+ query_params = opts[:query_params] || {}
334
+
335
+ # header parameters
336
+ header_params = opts[:header_params] || {}
337
+ # HTTP header 'Accept' (if needed)
338
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
339
+ # HTTP header 'Content-Type'
340
+ content_type = @api_client.select_header_content_type(['application/json'])
341
+ if !content_type.nil?
342
+ header_params['Content-Type'] = content_type
343
+ end
344
+
345
+ # form parameters
346
+ form_params = opts[:form_params] || {}
347
+
348
+ # http body (model)
349
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_metadata_request)
350
+
351
+ # return_type
352
+ return_type = opts[:debug_return_type] || 'ServerOrganizationResponse'
353
+
354
+ # auth_names
355
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
356
+
357
+ new_options = opts.merge(
358
+ :operation => :"ServerOrganizationsApi.update_organization_metadata",
359
+ :header_params => header_params,
360
+ :query_params => query_params,
361
+ :form_params => form_params,
362
+ :body => post_body,
363
+ :auth_names => auth_names,
364
+ :return_type => return_type
365
+ )
366
+
367
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
368
+ if @api_client.config.debugging
369
+ @api_client.config.logger.debug "API called: ServerOrganizationsApi#update_organization_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
370
+ end
371
+ return data, status_code, headers
372
+ end
373
+ end
374
+ end
@@ -276,6 +276,75 @@ module ToriiBackendGenerated
276
276
  return data, status_code, headers
277
277
  end
278
278
 
279
+ # List a user's organizations
280
+ # Returns a cursor-paginated page of the organizations this user is a member of, with the user's role in each and that membership's metadata bags. The mirror image of listing an organization's members. Note the bags are the MEMBERSHIP's, not the organization's: read the organization itself for those.
281
+ # @param user_id [String] Identifier of the user whose organizations to list.
282
+ # @param [Hash] opts the optional parameters
283
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20). (default to 20)
284
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
285
+ # @return [CursorPageResponseServerUserOrganizationResponse]
286
+ def list_user_organizations(user_id, opts = {})
287
+ data, _status_code, _headers = list_user_organizations_with_http_info(user_id, opts)
288
+ data
289
+ end
290
+
291
+ # List a user&#39;s organizations
292
+ # Returns a cursor-paginated page of the organizations this user is a member of, with the user&#39;s role in each and that membership&#39;s metadata bags. The mirror image of listing an organization&#39;s members. Note the bags are the MEMBERSHIP&#39;s, not the organization&#39;s: read the organization itself for those.
293
+ # @param user_id [String] Identifier of the user whose organizations to list.
294
+ # @param [Hash] opts the optional parameters
295
+ # @option opts [Integer] :limit Maximum number of items in the returned page (default 20). (default to 20)
296
+ # @option opts [String] :cursor Opaque cursor returned by the previous page&#39;s &#x60;nextCursor&#x60;. Omit to fetch the first page.
297
+ # @return [Array<(CursorPageResponseServerUserOrganizationResponse, Integer, Hash)>] CursorPageResponseServerUserOrganizationResponse data, response status code and response headers
298
+ def list_user_organizations_with_http_info(user_id, opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: ServerUsersApi.list_user_organizations ...'
301
+ end
302
+ # verify the required parameter 'user_id' is set
303
+ if @api_client.config.client_side_validation && user_id.nil?
304
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ServerUsersApi.list_user_organizations"
305
+ end
306
+ # resource path
307
+ local_var_path = '/api/server/v1/users/{userId}/organizations'.sub('{userId}', CGI.escape(user_id.to_s))
308
+
309
+ # query parameters
310
+ query_params = opts[:query_params] || {}
311
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
312
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
313
+
314
+ # header parameters
315
+ header_params = opts[:header_params] || {}
316
+ # HTTP header 'Accept' (if needed)
317
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
318
+
319
+ # form parameters
320
+ form_params = opts[:form_params] || {}
321
+
322
+ # http body (model)
323
+ post_body = opts[:debug_body]
324
+
325
+ # return_type
326
+ return_type = opts[:debug_return_type] || 'CursorPageResponseServerUserOrganizationResponse'
327
+
328
+ # auth_names
329
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
330
+
331
+ new_options = opts.merge(
332
+ :operation => :"ServerUsersApi.list_user_organizations",
333
+ :header_params => header_params,
334
+ :query_params => query_params,
335
+ :form_params => form_params,
336
+ :body => post_body,
337
+ :auth_names => auth_names,
338
+ :return_type => return_type
339
+ )
340
+
341
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
342
+ if @api_client.config.debugging
343
+ @api_client.config.logger.debug "API called: ServerUsersApi#list_user_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
344
+ end
345
+ return data, status_code, headers
346
+ end
347
+
279
348
  # Search users
280
349
  # Returns a cursor-paginated page of end-users in the environment matching the optional filters. Uses POST so the filter body can be sent without URL-encoding. Three id-selectors resolve users to a set of ids (`userIds`, the explicit batch-by-id lookup; `emailAddresses`, exact and case-insensitive; `email`, a case-insensitive substring); when more than one is supplied they are combined with AND (intersection). The remaining filters (`name`, `statuses`, `createdAfter`/`createdBefore`) apply on top.
281
350
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #Torii Backend API
3
+
4
+ #Server-to-server API (BAPI) for backend SDKs. Authenticated with a secret key (Bearer sk_live_* / sk_test_*).
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ToriiBackendGenerated
17
+ # A single page of results in a cursor-paginated list. Pass `nextCursor` as the `cursor` query parameter to fetch the following page.
18
+ class CursorPageResponseServerOrganizationMemberResponse < ApiModelBase
19
+ # Items in this page, in stable order.
20
+ attr_accessor :items
21
+
22
+ # Cursor to pass to fetch the next page. Null when this is the last page.
23
+ attr_accessor :next_cursor
24
+
25
+ # True if more pages are available (equivalent to `nextCursor != null`).
26
+ attr_accessor :has_more
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'items' => :'items',
32
+ :'next_cursor' => :'nextCursor',
33
+ :'has_more' => :'hasMore'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'items' => :'Array<ServerOrganizationMemberResponse>',
51
+ :'next_cursor' => :'String',
52
+ :'has_more' => :'Boolean'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'next_cursor',
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::CursorPageResponseServerOrganizationMemberResponse` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::CursorPageResponseServerOrganizationMemberResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'items')
80
+ if (value = attributes[:'items']).is_a?(Array)
81
+ self.items = value
82
+ end
83
+ else
84
+ self.items = nil
85
+ end
86
+
87
+ if attributes.key?(:'next_cursor')
88
+ self.next_cursor = attributes[:'next_cursor']
89
+ end
90
+
91
+ if attributes.key?(:'has_more')
92
+ self.has_more = attributes[:'has_more']
93
+ else
94
+ self.has_more = nil
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ if @items.nil?
104
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
105
+ end
106
+
107
+ if @has_more.nil?
108
+ invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ warn '[DEPRECATED] the `valid?` method is obsolete'
118
+ return false if @items.nil?
119
+ return false if @has_more.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] items Value to be assigned
125
+ def items=(items)
126
+ if items.nil?
127
+ fail ArgumentError, 'items cannot be nil'
128
+ end
129
+
130
+ @items = items
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] has_more Value to be assigned
135
+ def has_more=(has_more)
136
+ if has_more.nil?
137
+ fail ArgumentError, 'has_more cannot be nil'
138
+ end
139
+
140
+ @has_more = has_more
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ items == o.items &&
149
+ next_cursor == o.next_cursor &&
150
+ has_more == o.has_more
151
+ end
152
+
153
+ # @see the `==` method
154
+ # @param [Object] Object to be compared
155
+ def eql?(o)
156
+ self == o
157
+ end
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Integer] Hash code
161
+ def hash
162
+ [items, next_cursor, has_more].hash
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def self.build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ attributes = attributes.transform_keys(&:to_sym)
171
+ transformed_hash = {}
172
+ openapi_types.each_pair do |key, type|
173
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = nil
175
+ elsif type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[attribute_map[key]].is_a?(Array)
179
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
180
+ end
181
+ elsif !attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
183
+ end
184
+ end
185
+ new(transformed_hash)
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ end
205
+
206
+ end