Class: OpenapiClient::OrganizationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/api/organizations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OrganizationsApi

Returns a new instance of OrganizationsApi.



19
20
21
# File 'lib/openapi_client/api/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/openapi_client/api/organizations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_invite(org_id, invite_id, opts = {}) ⇒ nil

Cancel Invite Cancels an invite that was sent to a new member.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the "slug").

  • invite_id (String)

    Id of the invite to cancel

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/openapi_client/api/organizations_api.rb', line 28

def cancel_invite(org_id, invite_id, opts = {})
  cancel_invite_with_http_info(org_id, invite_id, opts)
  nil
end

#cancel_invite_with_http_info(org_id, invite_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Cancel Invite Cancels an invite that was sent to a new member.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

  • invite_id (String)

    Id of the invite to cancel

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/openapi_client/api/organizations_api.rb', line 39

def cancel_invite_with_http_info(org_id, invite_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.cancel_invite ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.cancel_invite"
  end
  # verify the required parameter 'invite_id' is set
  if @api_client.config.client_side_validation && invite_id.nil?
    fail ArgumentError, "Missing the required parameter 'invite_id' when calling OrganizationsApi.cancel_invite"
  end
  # resource path
  local_var_path = '/v2/orgs/{org_id}/invites/{invite_id}'.sub('{' + 'org_id' + '}', CGI.escape(org_id.to_s)).sub('{' + 'invite_id' + '}', CGI.escape(invite_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'])

  # 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] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.cancel_invite",
    :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: OrganizationsApi#cancel_invite\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_organization(organization_create, opts = {}) ⇒ OrganizationReadWithAPIKey

Create Organization Creates a new organization that will be owned by the authenticated actor (i.e: human team member or api key).

Parameters:

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

    the optional parameters

Returns:



96
97
98
99
# File 'lib/openapi_client/api/organizations_api.rb', line 96

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

#create_organization_with_http_info(organization_create, opts = {}) ⇒ Array<(OrganizationReadWithAPIKey, Integer, Hash)>

Create Organization Creates a new organization that will be owned by the authenticated actor (i.e: human team member or api key).

Parameters:

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

    the optional parameters

Returns:

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

    OrganizationReadWithAPIKey data, response status code and response headers



106
107
108
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
# File 'lib/openapi_client/api/organizations_api.rb', line 106

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

  # 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'])
  # 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(organization_create)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.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: OrganizationsApi#create_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Delete Organization Deletes an organization (Permit.io account) and all its related data.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:

  • (nil)


164
165
166
167
# File 'lib/openapi_client/api/organizations_api.rb', line 164

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

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

Delete Organization Deletes an organization (Permit.io account) and all its related data.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



174
175
176
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
# File 'lib/openapi_client/api/organizations_api.rb', line 174

def delete_organization_with_http_info(org_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.delete_organization ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.delete_organization"
  end
  # resource path
  local_var_path = '/v2/orgs/{org_id}'.sub('{' + 'org_id' + '}', CGI.escape(org_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'])

  # 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] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.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: OrganizationsApi#delete_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_active_organization(opts = {}) ⇒ OrganizationRead

Get Active Organization Gets a single organization (Permit.io account) matching the given org_id, if such org exists and can be accessed by the authenticated actor.

Parameters:

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

    the optional parameters

Returns:



226
227
228
229
# File 'lib/openapi_client/api/organizations_api.rb', line 226

def get_active_organization(opts = {})
  data, _status_code, _headers = get_active_organization_with_http_info(opts)
  data
end

#get_active_organization_with_http_info(opts = {}) ⇒ Array<(OrganizationRead, Integer, Hash)>

Get Active Organization Gets a single organization (Permit.io account) matching the given org_id, if such org exists and can be accessed by the authenticated actor.

Parameters:

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

    the optional parameters

Returns:

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

    OrganizationRead data, response status code and response headers



235
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
# File 'lib/openapi_client/api/organizations_api.rb', line 235

def get_active_organization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.get_active_organization ...'
  end
  # resource path
  local_var_path = '/v2/orgs/active/org'

  # 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'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.get_active_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: OrganizationsApi#get_active_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_organization(org_id, opts = {}) ⇒ OrganizationRead

Get Organization Gets a single organization (Permit.io account) matching the given org_id, if such org exists and can be accessed by the authenticated actor.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:



284
285
286
287
# File 'lib/openapi_client/api/organizations_api.rb', line 284

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

#get_organization_with_http_info(org_id, opts = {}) ⇒ Array<(OrganizationRead, Integer, Hash)>

Get Organization Gets a single organization (Permit.io account) matching the given org_id, if such org exists and can be accessed by the authenticated actor.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:

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

    OrganizationRead data, response status code and response headers



294
295
296
297
298
299
300
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
# File 'lib/openapi_client/api/organizations_api.rb', line 294

def get_organization_with_http_info(org_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.get_organization ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.get_organization"
  end
  # resource path
  local_var_path = '/v2/orgs/{org_id}'.sub('{' + 'org_id' + '}', CGI.escape(org_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'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.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: OrganizationsApi#get_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#invite_members_to_organization(org_id, invite_create, opts = {}) ⇒ MultiInviteResult

Invite Members To Organization Invite new members into the organization.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

  • invite_create (Array<InviteCreate>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inviter_name (String)
  • :inviter_email (String)

Returns:



350
351
352
353
# File 'lib/openapi_client/api/organizations_api.rb', line 350

def invite_members_to_organization(org_id, invite_create, opts = {})
  data, _status_code, _headers = invite_members_to_organization_with_http_info(org_id, invite_create, opts)
  data
end

#invite_members_to_organization_with_http_info(org_id, invite_create, opts = {}) ⇒ Array<(MultiInviteResult, Integer, Hash)>

Invite Members To Organization Invite new members into the organization.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

  • invite_create (Array<InviteCreate>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inviter_name (String)
  • :inviter_email (String)

Returns:

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

    MultiInviteResult data, response status code and response headers



363
364
365
366
367
368
369
370
371
372
373
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
# File 'lib/openapi_client/api/organizations_api.rb', line 363

def invite_members_to_organization_with_http_info(org_id, invite_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.invite_members_to_organization ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.invite_members_to_organization"
  end
  # verify the required parameter 'invite_create' is set
  if @api_client.config.client_side_validation && invite_create.nil?
    fail ArgumentError, "Missing the required parameter 'invite_create' when calling OrganizationsApi.invite_members_to_organization"
  end
  # resource path
  local_var_path = '/v2/orgs/{org_id}/invites'.sub('{' + 'org_id' + '}', CGI.escape(org_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # 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(invite_create)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.invite_members_to_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: OrganizationsApi#invite_members_to_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organization_invites(org_id, opts = {}) ⇒ Array<InviteRead>

List Organization Invites Lists pending organization invites

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:



429
430
431
432
# File 'lib/openapi_client/api/organizations_api.rb', line 429

def list_organization_invites(org_id, opts = {})
  data, _status_code, _headers = list_organization_invites_with_http_info(org_id, opts)
  data
end

#list_organization_invites_with_http_info(org_id, opts = {}) ⇒ Array<(Array<InviteRead>, Integer, Hash)>

List Organization Invites Lists pending organization invites

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:

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

    Array<InviteRead> data, response status code and response headers



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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/openapi_client/api/organizations_api.rb', line 441

def list_organization_invites_with_http_info(org_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.list_organization_invites ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.list_organization_invites"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling OrganizationsApi.list_organization_invites, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling OrganizationsApi.list_organization_invites, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling OrganizationsApi.list_organization_invites, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v2/orgs/{org_id}/invites'.sub('{' + 'org_id' + '}', CGI.escape(org_id.to_s))

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<InviteRead>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.list_organization_invites",
    :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: OrganizationsApi#list_organization_invites\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organizations(opts = {}) ⇒ Array<OrganizationRead>

List Organizations Lists all the organizations that can be accessed by the authenticated actor (i.e: human team member or api key).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:



509
510
511
512
# File 'lib/openapi_client/api/organizations_api.rb', line 509

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

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

List Organizations Lists all the organizations that can be accessed by the authenticated actor (i.e: human team member or api key).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number of the results to fetch, starting at 1. (default to 1)

  • :per_page (Integer)

    The number of results per page (max 100). (default to 30)

Returns:

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

    Array<OrganizationRead> data, response status code and response headers



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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/openapi_client/api/organizations_api.rb', line 520

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

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling OrganizationsApi.list_organizations, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling OrganizationsApi.list_organizations, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v2/orgs'

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<OrganizationRead>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.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: OrganizationsApi#list_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_organization(org_id, organization_update, opts = {}) ⇒ OrganizationRead

Update Organization Updates the organization’s profile.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:



584
585
586
587
# File 'lib/openapi_client/api/organizations_api.rb', line 584

def update_organization(org_id, organization_update, opts = {})
  data, _status_code, _headers = update_organization_with_http_info(org_id, organization_update, opts)
  data
end

#update_organization_with_http_info(org_id, organization_update, opts = {}) ⇒ Array<(OrganizationRead, Integer, Hash)>

Update Organization Updates the organization&#39;s profile.

Parameters:

  • org_id (String)

    Either the unique id of the organization, or the URL-friendly key of the organization (i.e: the &quot;slug&quot;).

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

    the optional parameters

Returns:

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

    OrganizationRead data, response status code and response headers



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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/openapi_client/api/organizations_api.rb', line 595

def update_organization_with_http_info(org_id, organization_update, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.update_organization ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling OrganizationsApi.update_organization"
  end
  # verify the required parameter 'organization_update' is set
  if @api_client.config.client_side_validation && organization_update.nil?
    fail ArgumentError, "Missing the required parameter 'organization_update' when calling OrganizationsApi.update_organization"
  end
  # resource path
  local_var_path = '/v2/orgs/{org_id}'.sub('{' + 'org_id' + '}', CGI.escape(org_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'])
  # 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(organization_update)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"OrganizationsApi.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: OrganizationsApi#update_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end