Class: ClerkHttpClient::OrganizationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/clerk-http-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/clerk-http-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/clerk-http-client/api/organizations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_organization(opts = {}) ⇒ Organization

Create an organization Creates a new organization with the given name for an instance. You can specify an optional slug for the new organization. If provided, the organization slug can contain only lowercase alphanumeric characters (letters and digits) and the dash "-". Organization slugs must be unique for the instance. You can provide additional metadata for the organization and set any custom attribute you want. Organizations support private and public metadata. Private metadata can only be accessed from the Backend API. Public metadata can be accessed from the Backend API, and are read-only from the Frontend API. The ‘created_by` user will see this as their [active organization] (clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don’t explicitly set a different organization as active before then.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



28
29
30
31
# File 'lib/clerk-http-client/api/organizations_api.rb', line 28

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

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

Create an organization Creates a new organization with the given name for an instance. You can specify an optional slug for the new organization. If provided, the organization slug can contain only lowercase alphanumeric characters (letters and digits) and the dash &quot;-&quot;. Organization slugs must be unique for the instance. You can provide additional metadata for the organization and set any custom attribute you want. Organizations support private and public metadata. Private metadata can only be accessed from the Backend API. Public metadata can be accessed from the Backend API, and are read-only from the Frontend API. The &#x60;created_by&#x60; user will see this as their [active organization] (clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don&#39;t explicitly set a different organization as active before then. POST

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    Organization data, 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
# File 'lib/clerk-http-client/api/organizations_api.rb', line 39

def create_organization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.create_organization ...'
  end
  # resource path
  local_var_path = '/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(opts[:'create_organization_request'])

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

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

  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(organization_id, opts = {}) ⇒ DeletedObject

Delete an organization Deletes the given organization. Please note that deleting an organization will also delete all memberships and invitations. This is not reversible.

Parameters:

  • organization_id (String)

    The ID of the organization to delete

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

    the optional parameters

Returns:



94
95
96
97
# File 'lib/clerk-http-client/api/organizations_api.rb', line 94

def delete_organization(organization_id, opts = {})
  data, _status_code, _headers = delete_organization_with_http_info(organization_id, opts)
  data
end

#delete_organization_logo(organization_id, opts = {}) ⇒ Organization

Delete the organization’s logo.

Parameters:

  • organization_id (String)

    The ID of the organization for which the logo will be deleted.

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

    the optional parameters

Returns:



158
159
160
161
# File 'lib/clerk-http-client/api/organizations_api.rb', line 158

def (organization_id, opts = {})
  data, _status_code, _headers = delete_organization_logo_with_http_info(organization_id, opts)
  data
end

#delete_organization_logo_with_http_info(organization_id, opts = {}) ⇒ Array<(Organization, Integer, Hash)>

Delete the organization&#39;s logo. DELETE

Parameters:

  • organization_id (String)

    The ID of the organization for which the logo will be deleted.

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

    the optional parameters

Returns:

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

    Organization data, response status code and response headers



168
169
170
171
172
173
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
# File 'lib/clerk-http-client/api/organizations_api.rb', line 168

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

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

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

#delete_organization_with_http_info(organization_id, opts = {}) ⇒ Array<(DeletedObject, Integer, Hash)>

Delete an organization Deletes the given organization. Please note that deleting an organization will also delete all memberships and invitations. This is not reversible. DELETE

Parameters:

  • organization_id (String)

    The ID of the organization to delete

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

    the optional parameters

Returns:

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

    DeletedObject data, response status code and response headers



105
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
# File 'lib/clerk-http-client/api/organizations_api.rb', line 105

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

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

  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_organization(organization_id, opts = {}) ⇒ Organization

Retrieve an organization by ID or slug Fetches the organization whose ID or slug matches the provided ‘id_or_slug` URL query parameter.

Parameters:

  • organization_id (String)

    The ID or slug of the organization

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

    the optional parameters

Options Hash (opts):

  • :include_members_count (Boolean)

    Flag to denote whether or not the organization&#39;s members count should be included in the response.

Returns:



223
224
225
226
# File 'lib/clerk-http-client/api/organizations_api.rb', line 223

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

#get_organization_with_http_info(organization_id, opts = {}) ⇒ Array<(Organization, Integer, Hash)>

Retrieve an organization by ID or slug Fetches the organization whose ID or slug matches the provided &#x60;id_or_slug&#x60; URL query parameter. GET

Parameters:

  • organization_id (String)

    The ID or slug of the organization

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

    the optional parameters

Options Hash (opts):

  • :include_members_count (Boolean)

    Flag to denote whether or not the organization&#39;s members count should be included in the response.

Returns:

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

    Organization 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
278
279
280
281
282
# File 'lib/clerk-http-client/api/organizations_api.rb', line 235

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_members_count'] = opts[:'include_members_count'] if !opts[:'include_members_count'].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] || 'Organization'

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

  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

#list_organizations(opts = {}) ⇒ Organizations

Get a list of organizations for an instance This request returns the list of organizations for an instance. Results can be paginated using the optional ‘limit` and `offset` query parameters. The organizations are ordered by descending creation date. Most recent organizations will be returned first.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :include_members_count (Boolean)

    Flag to denote whether the member counts of each organization should be included in the response or not.

  • :query (String)

    Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug.

  • :order_by (String)

    Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their &#x60;name&#x60;, &#x60;created_at&#x60; or &#x60;members_count&#x60;. In order to specify the direction, you can use the &#x60;+/-&#x60; symbols prepended in the property to order by. For example, if you want organizations to be returned in descending order according to their &#x60;created_at&#x60; property, you can use &#x60;-created_at&#x60;. If you don&#39;t use &#x60;+&#x60; or &#x60;-&#x60;, then &#x60;+&#x60; is implied. Defaults to &#x60;-created_at&#x60;. (default to ‘-created_at’)

Returns:



294
295
296
297
# File 'lib/clerk-http-client/api/organizations_api.rb', line 294

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

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

Get a list of organizations for an instance This request returns the list of organizations for an instance. Results can be paginated using the optional &#x60;limit&#x60; and &#x60;offset&#x60; query parameters. The organizations are ordered by descending creation date. Most recent organizations will be returned first. GET

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :include_members_count (Boolean)

    Flag to denote whether the member counts of each organization should be included in the response or not.

  • :query (String)

    Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug.

  • :order_by (String)

    Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their &#x60;name&#x60;, &#x60;created_at&#x60; or &#x60;members_count&#x60;. In order to specify the direction, you can use the &#x60;+/-&#x60; symbols prepended in the property to order by. For example, if you want organizations to be returned in descending order according to their &#x60;created_at&#x60; property, you can use &#x60;-created_at&#x60;. If you don&#39;t use &#x60;+&#x60; or &#x60;-&#x60;, then &#x60;+&#x60; is implied. Defaults to &#x60;-created_at&#x60;. (default to ‘-created_at’)

Returns:

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

    Organizations data, response status code and response headers



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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/clerk-http-client/api/organizations_api.rb', line 309

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[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationsApi.list_organizations, must be smaller than or equal to 500.'
  end

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

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

  # resource path
  local_var_path = '/organizations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'include_members_count'] = opts[:'include_members_count'] if !opts[:'include_members_count'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].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] || 'Organizations'

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

  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

#merge_organization_metadata(organization_id, merge_organization_metadata_request, opts = {}) ⇒ Organization

Merge and update metadata for an organization Update organization metadata attributes by merging existing values with the provided parameters. Metadata values will be updated via a deep merge. Deep meaning that any nested JSON objects will be merged as well. You can remove metadata keys at any level by setting their value to ‘null`.

Parameters:

  • organization_id (String)

    The ID of the organization for which metadata will be merged or updated

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

    the optional parameters

Returns:



377
378
379
380
# File 'lib/clerk-http-client/api/organizations_api.rb', line 377

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

#merge_organization_metadata_with_http_info(organization_id, merge_organization_metadata_request, opts = {}) ⇒ Array<(Organization, Integer, Hash)>

Merge and update metadata for an organization Update organization metadata attributes by merging existing values with the provided parameters. Metadata values will be updated via a deep merge. Deep meaning that any nested JSON objects will be merged as well. You can remove metadata keys at any level by setting their value to &#x60;null&#x60;. PATCH

Parameters:

  • organization_id (String)

    The ID of the organization for which metadata will be merged or updated

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

    the optional parameters

Returns:

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

    Organization data, response status code and response headers



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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/clerk-http-client/api/organizations_api.rb', line 389

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

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

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

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

#update_organization(organization_id, update_organization_request, opts = {}) ⇒ Organization

Update an organization Updates an existing organization

Parameters:

  • organization_id (String)

    The ID of the organization to update

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

    the optional parameters

Returns:



453
454
455
456
# File 'lib/clerk-http-client/api/organizations_api.rb', line 453

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

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

Update an organization Updates an existing organization PATCH

Parameters:

  • organization_id (String)

    The ID of the organization to update

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

    the optional parameters

Returns:

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

    Organization data, response status code and response headers



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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/clerk-http-client/api/organizations_api.rb', line 465

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

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

  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

#upload_organization_logo(organization_id, file, opts = {}) ⇒ OrganizationWithLogo

Upload a logo for the organization Set or replace an organization’s logo, by uploading an image file. This endpoint uses the ‘multipart/form-data` request content type and accepts a file of image type. The file size cannot exceed 10MB. Only the following file content types are supported: `image/jpeg`, `image/png`, `image/gif`, `image/webp`, `image/x-icon`, `image/vnd.microsoft.icon`.

Parameters:

  • organization_id (String)

    The ID of the organization for which to upload a logo

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

    the optional parameters

Options Hash (opts):

  • :uploader_user_id (String)

    The ID of the user that will be credited with the image upload.

Returns:



530
531
532
533
# File 'lib/clerk-http-client/api/organizations_api.rb', line 530

def (organization_id, file, opts = {})
  data, _status_code, _headers = upload_organization_logo_with_http_info(organization_id, file, opts)
  data
end

#upload_organization_logo_with_http_info(organization_id, file, opts = {}) ⇒ Array<(OrganizationWithLogo, Integer, Hash)>

Upload a logo for the organization Set or replace an organization&#39;s logo, by uploading an image file. This endpoint uses the &#x60;multipart/form-data&#x60; request content type and accepts a file of image type. The file size cannot exceed 10MB. Only the following file content types are supported: &#x60;image/jpeg&#x60;, &#x60;image/png&#x60;, &#x60;image/gif&#x60;, &#x60;image/webp&#x60;, &#x60;image/x-icon&#x60;, &#x60;image/vnd.microsoft.icon&#x60;. PUT

Parameters:

  • organization_id (String)

    The ID of the organization for which to upload a logo

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

    the optional parameters

Options Hash (opts):

  • :uploader_user_id (String)

    The ID of the user that will be credited with the image upload.

Returns:

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

    OrganizationWithLogo data, response status code and response headers



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
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/clerk-http-client/api/organizations_api.rb', line 543

def upload_organization_logo_with_http_info(organization_id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsApi.upload_organization_logo ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationsApi.upload_organization_logo"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling OrganizationsApi.upload_organization_logo"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/logo'.sub('{' + 'organization_id' + '}', CGI.escape(organization_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(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['uploader_user_id'] = opts[:'uploader_user_id'] if !opts[:'uploader_user_id'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"OrganizationsApi.upload_organization_logo",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsApi#upload_organization_logo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end