class InfluxDB2::API::UsersApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/influxdb2/apis/generated/api/users_api.rb, line 18
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_users_id(user_id, opts = {}) click to toggle source

Delete a user @param user_id [String] The ID of the user to delete. @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [nil]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 26
def delete_users_id(user_id, opts = {})
  delete_users_id_with_http_info(user_id, opts)
  nil
end
delete_users_id_with_http_info(user_id, opts = {}) click to toggle source

Delete a user @param user_id [String] The ID of the user to delete. @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 36
def delete_users_id_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.delete_users_id ...'
  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 UsersApi.delete_users_id"
  end
  # resource path
  local_var_path = '/users/{userID}'.sub('{' + 'userID' + '}', 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

  new_options = opts.merge(
    :operation => :"UsersApi.delete_users_id",
    :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: UsersApi#delete_users_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_flags(opts = {}) click to toggle source

Return the feature flags for the currently authenticated user @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Hash<String, Object>]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 89
def get_flags(opts = {})
  data, _status_code, _headers = get_flags_with_http_info(opts)
  data
end
get_flags_with_http_info(opts = {}) click to toggle source

Return the feature flags for the currently authenticated user @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 98
def get_flags_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_flags ...'
  end
  # resource path
  local_var_path = '/flags'

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

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

  new_options = opts.merge(
    :operation => :"UsersApi.get_flags",
    :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: UsersApi#get_flags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_me(opts = {}) click to toggle source

Return the current authenticated user @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [UserResponse]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 147
def get_me(opts = {})
  data, _status_code, _headers = get_me_with_http_info(opts)
  data
end
get_me_with_http_info(opts = {}) click to toggle source

Return the current authenticated user @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 156
def get_me_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_me ...'
  end
  # resource path
  local_var_path = '/me'

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.get_me",
    :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: UsersApi#get_me\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_users(opts = {}) click to toggle source

List all users @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @option opts [Integer] :offset @option opts [Integer] :limit (default to 20) @option opts [String] :after The last resource ID from which to seek from (but not including). This is to be used instead of &#x60;offset&#x60;. @return [Users]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 208
def get_users(opts = {})
  data, _status_code, _headers = get_users_with_http_info(opts)
  data
end
get_users_id(user_id, opts = {}) click to toggle source

Retrieve a user @param user_id [String] The user ID. @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [UserResponse]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 285
def get_users_id(user_id, opts = {})
  data, _status_code, _headers = get_users_id_with_http_info(user_id, opts)
  data
end
get_users_id_with_http_info(user_id, opts = {}) click to toggle source

Retrieve a user @param user_id [String] The user ID. @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 295
def get_users_id_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_users_id ...'
  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 UsersApi.get_users_id"
  end
  # resource path
  local_var_path = '/users/{userID}'.sub('{' + 'userID' + '}', 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.get_users_id",
    :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: UsersApi#get_users_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_users_with_http_info(opts = {}) click to toggle source

List all users @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @option opts [Integer] :offset @option opts [Integer] :limit @option opts [String] :after The last resource ID from which to seek from (but not including). This is to be used instead of &#x60;offset&#x60;. @return [Array<(Users, Integer, Hash)>] Users data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 220
def get_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_users ...'
  end
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling UsersApi.get_users, must be greater than or equal to 0.'
  end

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

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

  # resource path
  local_var_path = '/users'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.get_users",
    :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: UsersApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_users_id(user_id, user, opts = {}) click to toggle source

Update a user @param user_id [String] The ID of the user to update. @param user [User] User update to apply @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [UserResponse]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 350
def patch_users_id(user_id, user, opts = {})
  data, _status_code, _headers = patch_users_id_with_http_info(user_id, user, opts)
  data
end
patch_users_id_with_http_info(user_id, user, opts = {}) click to toggle source

Update a user @param user_id [String] The ID of the user to update. @param user [User] User update to apply @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 361
def patch_users_id_with_http_info(user_id, user, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.patch_users_id ...'
  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 UsersApi.patch_users_id"
  end
  # verify the required parameter 'user' is set
  if @api_client.config.client_side_validation && user.nil?
    fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.patch_users_id"
  end
  # resource path
  local_var_path = '/users/{userID}'.sub('{' + 'userID' + '}', 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.patch_users_id",
    :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: UsersApi#patch_users_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_users(user, opts = {}) click to toggle source

Create a user @param user [User] User to create @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [UserResponse]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 421
def post_users(user, opts = {})
  data, _status_code, _headers = post_users_with_http_info(user, opts)
  data
end
post_users_id_password(user_id, password_reset_body, opts = {}) click to toggle source

Update a password @param user_id [String] The user ID. @param password_reset_body [PasswordResetBody] New password @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [nil]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 488
def post_users_id_password(user_id, password_reset_body, opts = {})
  post_users_id_password_with_http_info(user_id, password_reset_body, opts)
  nil
end
post_users_id_password_with_http_info(user_id, password_reset_body, opts = {}) click to toggle source

Update a password @param user_id [String] The user ID. @param password_reset_body [PasswordResetBody] New password @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 499
def post_users_id_password_with_http_info(user_id, password_reset_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.post_users_id_password ...'
  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 UsersApi.post_users_id_password"
  end
  # verify the required parameter 'password_reset_body' is set
  if @api_client.config.client_side_validation && password_reset_body.nil?
    fail ArgumentError, "Missing the required parameter 'password_reset_body' when calling UsersApi.post_users_id_password"
  end
  # resource path
  local_var_path = '/users/{userID}/password'.sub('{' + 'userID' + '}', 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"UsersApi.post_users_id_password",
    :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: UsersApi#post_users_id_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_users_with_http_info(user, opts = {}) click to toggle source

Create a user @param user [User] User to create @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 431
def post_users_with_http_info(user, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'
  end
  # verify the required parameter 'user' is set
  if @api_client.config.client_side_validation && user.nil?
    fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.post_users"
  end
  # resource path
  local_var_path = '/users'

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.post_users",
    :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: UsersApi#post_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
put_me_password(password_reset_body, opts = {}) click to toggle source

Update a password @param password_reset_body [PasswordResetBody] New password @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [nil]

# File lib/influxdb2/apis/generated/api/users_api.rb, line 559
def put_me_password(password_reset_body, opts = {})
  put_me_password_with_http_info(password_reset_body, opts)
  nil
end
put_me_password_with_http_info(password_reset_body, opts = {}) click to toggle source

Update a password @param password_reset_body [PasswordResetBody] New password @param [Hash] opts the optional parameters @option opts [String] :zap_trace_span OpenTracing span context @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/influxdb2/apis/generated/api/users_api.rb, line 569
def put_me_password_with_http_info(password_reset_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.put_me_password ...'
  end
  # verify the required parameter 'password_reset_body' is set
  if @api_client.config.client_side_validation && password_reset_body.nil?
    fail ArgumentError, "Missing the required parameter 'password_reset_body' when calling UsersApi.put_me_password"
  end
  # resource path
  local_var_path = '/me/password'

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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