Class: Zyphr::AuthOrganizationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/auth_organizations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthOrganizationsApi

Returns a new instance of AuthOrganizationsApi.



19
20
21
# File 'lib/zyphr/api/auth_organizations_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zyphr/api/auth_organizations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_organization_member(id, add_organization_member_request, opts = {}) ⇒ OrganizationMembershipResponse

Add a member to an organization

Parameters:

Returns:



27
28
29
30
# File 'lib/zyphr/api/auth_organizations_api.rb', line 27

def add_organization_member(id, add_organization_member_request, opts = {})
  data, _status_code, _headers = add_organization_member_with_http_info(id, add_organization_member_request, opts)
  data
end

#add_organization_member_with_http_info(id, add_organization_member_request, opts = {}) ⇒ Array<(OrganizationMembershipResponse, Integer, Hash)>

Add a member to an organization

Parameters:

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/zyphr/api/auth_organizations_api.rb', line 37

def add_organization_member_with_http_info(id, add_organization_member_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.add_organization_member ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.add_organization_member"
  end
  # verify the required parameter 'add_organization_member_request' is set
  if @api_client.config.client_side_validation && add_organization_member_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_organization_member_request' when calling AuthOrganizationsApi.add_organization_member"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(add_organization_member_request)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationMembershipResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.add_organization_member",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#add_organization_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_organization(create_organization_request, opts = {}) ⇒ OrganizationResponse

Create an organization Create a new organization inside the current application × environment. Membership is many-to-many — add end users via POST /auth/organizations/id/members. The Default organization for the environment is auto-created at migration time and cannot be created via API.

Parameters:

Returns:



99
100
101
102
# File 'lib/zyphr/api/auth_organizations_api.rb', line 99

def create_organization(create_organization_request, opts = {})
  data, _status_code, _headers = create_organization_with_http_info(create_organization_request, opts)
  data
end

#create_organization_with_http_info(create_organization_request, opts = {}) ⇒ Array<(OrganizationResponse, Integer, Hash)>

Create an organization Create a new organization inside the current application × environment. Membership is many-to-many — add end users via POST /auth/organizations/id/members. The Default organization for the environment is auto-created at migration time and cannot be created via API.

Parameters:

Returns:

  • (Array<(OrganizationResponse, Integer, Hash)>)

    OrganizationResponse data, response status code and response headers



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/zyphr/api/auth_organizations_api.rb', line 109

def create_organization_with_http_info(create_organization_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.create_organization ...'
  end
  # verify the required parameter 'create_organization_request' is set
  if @api_client.config.client_side_validation && create_organization_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_organization_request' when calling AuthOrganizationsApi.create_organization"
  end
  # resource path
  local_var_path = '/auth/organizations'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization_request)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.create_organization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#create_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_organization(id, opts = {}) ⇒ nil

Delete an organization Hard-deletes the org and cascades memberships. The Default organization cannot be deleted.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


167
168
169
170
# File 'lib/zyphr/api/auth_organizations_api.rb', line 167

def delete_organization(id, opts = {})
  delete_organization_with_http_info(id, opts)
  nil
end

#delete_organization_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete an organization Hard-deletes the org and cascades memberships. The Default organization cannot be deleted.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/zyphr/api/auth_organizations_api.rb', line 177

def delete_organization_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.delete_organization ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.delete_organization"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.delete_organization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#delete_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_organization(id, opts = {}) ⇒ OrganizationResponse

Get organization by id

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



227
228
229
230
# File 'lib/zyphr/api/auth_organizations_api.rb', line 227

def get_organization(id, opts = {})
  data, _status_code, _headers = get_organization_with_http_info(id, opts)
  data
end

#get_organization_with_http_info(id, opts = {}) ⇒ Array<(OrganizationResponse, Integer, Hash)>

Get organization by id

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrganizationResponse, Integer, Hash)>)

    OrganizationResponse data, response status code and response headers



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/zyphr/api/auth_organizations_api.rb', line 236

def get_organization_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.get_organization ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.get_organization"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.get_organization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#get_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organization_members(id, opts = {}) ⇒ OrganizationMembersListResponse

List organization members

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :cursor (String)

Returns:



290
291
292
293
# File 'lib/zyphr/api/auth_organizations_api.rb', line 290

def list_organization_members(id, opts = {})
  data, _status_code, _headers = list_organization_members_with_http_info(id, opts)
  data
end

#list_organization_members_with_http_info(id, opts = {}) ⇒ Array<(OrganizationMembersListResponse, Integer, Hash)>

List organization members

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :cursor (String)

Returns:



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/zyphr/api/auth_organizations_api.rb', line 301

def list_organization_members_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organization_members ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.list_organization_members"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AuthOrganizationsApi.list_organization_members, must be smaller than or equal to 200.'
  end

  # resource path
  local_var_path = '/auth/organizations/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationMembersListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.list_organization_members",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organization_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organizations(opts = {}) ⇒ OrganizationListResponse

List organizations List organizations in the current environment. Cursor-paginated.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :cursor (String)
  • :search (String)

    ILIKE match on name OR slug

Returns:



362
363
364
365
# File 'lib/zyphr/api/auth_organizations_api.rb', line 362

def list_organizations(opts = {})
  data, _status_code, _headers = list_organizations_with_http_info(opts)
  data
end

#list_organizations_for_end_user(user_id, opts = {}) ⇒ OrganizationListResponse

List organizations an end user belongs to Inverse of the membership list — returns all orgs the user is a member of within the current environment. Use this when the orgs[] JWT claim is omitted because the user belongs to more than 50.

Parameters:

  • user_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



430
431
432
433
# File 'lib/zyphr/api/auth_organizations_api.rb', line 430

def list_organizations_for_end_user(user_id, opts = {})
  data, _status_code, _headers = list_organizations_for_end_user_with_http_info(user_id, opts)
  data
end

#list_organizations_for_end_user_with_http_info(user_id, opts = {}) ⇒ Array<(OrganizationListResponse, Integer, Hash)>

List organizations an end user belongs to Inverse of the membership list — returns all orgs the user is a member of within the current environment. Use this when the orgs[] JWT claim is omitted because the user belongs to more than 50.

Parameters:

  • user_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrganizationListResponse, Integer, Hash)>)

    OrganizationListResponse data, response status code and response headers



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/zyphr/api/auth_organizations_api.rb', line 440

def list_organizations_for_end_user_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organizations_for_end_user ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.list_organizations_for_end_user"
  end
  # resource path
  local_var_path = '/auth/end-users/{user_id}/organizations'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.list_organizations_for_end_user",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organizations_for_end_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organizations_with_http_info(opts = {}) ⇒ Array<(OrganizationListResponse, Integer, Hash)>

List organizations List organizations in the current environment. Cursor-paginated.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :cursor (String)
  • :search (String)

    ILIKE match on name OR slug

Returns:

  • (Array<(OrganizationListResponse, Integer, Hash)>)

    OrganizationListResponse data, response status code and response headers



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/zyphr/api/auth_organizations_api.rb', line 374

def list_organizations_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organizations ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AuthOrganizationsApi.list_organizations, must be smaller than or equal to 200.'
  end

  # resource path
  local_var_path = '/auth/organizations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.list_organizations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_organization_member(id, user_id, opts = {}) ⇒ nil

Remove a member from an organization

Parameters:

  • id (String)
  • user_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


493
494
495
496
# File 'lib/zyphr/api/auth_organizations_api.rb', line 493

def remove_organization_member(id, user_id, opts = {})
  remove_organization_member_with_http_info(id, user_id, opts)
  nil
end

#remove_organization_member_with_http_info(id, user_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove a member from an organization

Parameters:

  • id (String)
  • user_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/zyphr/api/auth_organizations_api.rb', line 503

def remove_organization_member_with_http_info(id, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.remove_organization_member ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.remove_organization_member"
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.remove_organization_member"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}/members/{user_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.remove_organization_member",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#remove_organization_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#switch_organization(switch_organization_request, opts = {}) ⇒ SwitchOrganizationResponse

Switch the active organization on a session Takes a valid refresh token + a target organization the user is a member of, verifies membership at mint time, revokes the old session, and mints a fresh access + refresh pair with ‘org_id` set to the target. The old refresh token is invalidated (jti rotated). Use this when the user’s active workspace changes (the Slack/Linear workspace-switch pattern).

Parameters:

Returns:



558
559
560
561
# File 'lib/zyphr/api/auth_organizations_api.rb', line 558

def switch_organization(switch_organization_request, opts = {})
  data, _status_code, _headers = switch_organization_with_http_info(switch_organization_request, opts)
  data
end

#switch_organization_with_http_info(switch_organization_request, opts = {}) ⇒ Array<(SwitchOrganizationResponse, Integer, Hash)>

Switch the active organization on a session Takes a valid refresh token + a target organization the user is a member of, verifies membership at mint time, revokes the old session, and mints a fresh access + refresh pair with &#x60;org_id&#x60; set to the target. The old refresh token is invalidated (jti rotated). Use this when the user&#39;s active workspace changes (the Slack/Linear workspace-switch pattern).

Parameters:

Returns:

  • (Array<(SwitchOrganizationResponse, Integer, Hash)>)

    SwitchOrganizationResponse data, response status code and response headers



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/zyphr/api/auth_organizations_api.rb', line 568

def switch_organization_with_http_info(switch_organization_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.switch_organization ...'
  end
  # verify the required parameter 'switch_organization_request' is set
  if @api_client.config.client_side_validation && switch_organization_request.nil?
    fail ArgumentError, "Missing the required parameter 'switch_organization_request' when calling AuthOrganizationsApi.switch_organization"
  end
  # resource path
  local_var_path = '/auth/sessions/switch-organization'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(switch_organization_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SwitchOrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.switch_organization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#switch_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_organization(id, update_organization_request, opts = {}) ⇒ OrganizationResponse

Update an organization The Default organization cannot be renamed or have its slug/metadata changed.

Parameters:

  • id (String)
  • update_organization_request (UpdateOrganizationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



627
628
629
630
# File 'lib/zyphr/api/auth_organizations_api.rb', line 627

def update_organization(id, update_organization_request, opts = {})
  data, _status_code, _headers = update_organization_with_http_info(id, update_organization_request, opts)
  data
end

#update_organization_member_role(id, user_id, update_organization_member_role_request, opts = {}) ⇒ OrganizationMembershipResponse

Update a member’s role

Parameters:

Returns:



701
702
703
704
# File 'lib/zyphr/api/auth_organizations_api.rb', line 701

def update_organization_member_role(id, user_id, update_organization_member_role_request, opts = {})
  data, _status_code, _headers = update_organization_member_role_with_http_info(id, user_id, update_organization_member_role_request, opts)
  data
end

#update_organization_member_role_with_http_info(id, user_id, update_organization_member_role_request, opts = {}) ⇒ Array<(OrganizationMembershipResponse, Integer, Hash)>

Update a member&#39;s role

Parameters:

Returns:



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/zyphr/api/auth_organizations_api.rb', line 712

def update_organization_member_role_with_http_info(id, user_id, update_organization_member_role_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.update_organization_member_role ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.update_organization_member_role"
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.update_organization_member_role"
  end
  # verify the required parameter 'update_organization_member_role_request' is set
  if @api_client.config.client_side_validation && update_organization_member_role_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_organization_member_role_request' when calling AuthOrganizationsApi.update_organization_member_role"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}/members/{user_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_member_role_request)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationMembershipResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.update_organization_member_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#update_organization_member_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_organization_with_http_info(id, update_organization_request, opts = {}) ⇒ Array<(OrganizationResponse, Integer, Hash)>

Update an organization The Default organization cannot be renamed or have its slug/metadata changed.

Parameters:

  • id (String)
  • update_organization_request (UpdateOrganizationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrganizationResponse, Integer, Hash)>)

    OrganizationResponse data, response status code and response headers



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/zyphr/api/auth_organizations_api.rb', line 638

def update_organization_with_http_info(id, update_organization_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.update_organization ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.update_organization"
  end
  # verify the required parameter 'update_organization_request' is set
  if @api_client.config.client_side_validation && update_organization_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_organization_request' when calling AuthOrganizationsApi.update_organization"
  end
  # resource path
  local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_request)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthOrganizationsApi.update_organization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthOrganizationsApi#update_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end