class OpsgenieSdk::UserApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/opsgenie_sdk/api/user_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_user(body, opts = {}) click to toggle source

Create User Creates a user with the given payload @param body Request payload of the user object @param [Hash] opts the optional parameters @return [SuccessResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 27
def create_user(body, opts = {})
  data, _status_code, _headers = create_user_with_http_info(body, opts)
  data
end
create_user_with_http_info(body, opts = {}) click to toggle source

Create User Creates a user with the given payload @param body Request payload of the user object @param [Hash] opts the optional parameters @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 37
def create_user_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.create_user ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user"
  end
  # resource path
  local_var_path = '/v2/users'

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_user(identifier, opts = {}) click to toggle source

Delete User Delete user with the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [SuccessResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 79
def delete_user(identifier, opts = {})
  data, _status_code, _headers = delete_user_with_http_info(identifier, opts)
  data
end
delete_user_with_http_info(identifier, opts = {}) click to toggle source

Delete User Delete user with the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 89
def delete_user_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.delete_user ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.delete_user"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_user(identifier, opts = {}) click to toggle source

Get User Get user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @option opts [Array<String>] :expand Comma separated list of strings to create a more detailed response. The only expandable field for user api is &#39;contact&#39; @return [GetUserResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 132
def get_user(identifier, opts = {})
  data, _status_code, _headers = get_user_with_http_info(identifier, opts)
  data
end
get_user_with_http_info(identifier, opts = {}) click to toggle source

Get User Get user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @option opts [Array<String>] :expand Comma separated list of strings to create a more detailed response. The only expandable field for user api is &#39;contact&#39; @return [Array<(GetUserResponse, Fixnum, Hash)>] GetUserResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 143
def get_user_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.get_user ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.get_user"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :csv) if !opts[:'expand'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetUserResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_user_escalations(identifier, opts = {}) click to toggle source

List User Escalations List escalations of the user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [ListUserEscalationsResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 186
def list_user_escalations(identifier, opts = {})
  data, _status_code, _headers = list_user_escalations_with_http_info(identifier, opts)
  data
end
list_user_escalations_with_http_info(identifier, opts = {}) click to toggle source

List User Escalations List escalations of the user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [Array<(ListUserEscalationsResponse, Fixnum, Hash)>] ListUserEscalationsResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 196
def list_user_escalations_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_user_escalations ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.list_user_escalations"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/escalations'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListUserEscalationsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#list_user_escalations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_user_forwarding_rules(identifier, opts = {}) click to toggle source

List User Forwarding Rules List user forwarding rules for the given user identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [ListUserForwardingRulesResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 238
def list_user_forwarding_rules(identifier, opts = {})
  data, _status_code, _headers = list_user_forwarding_rules_with_http_info(identifier, opts)
  data
end
list_user_forwarding_rules_with_http_info(identifier, opts = {}) click to toggle source

List User Forwarding Rules List user forwarding rules for the given user identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [Array<(ListUserForwardingRulesResponse, Fixnum, Hash)>] ListUserForwardingRulesResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 248
def list_user_forwarding_rules_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_user_forwarding_rules ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.list_user_forwarding_rules"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/forwarding-rules'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListUserForwardingRulesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#list_user_forwarding_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_user_schedules(identifier, opts = {}) click to toggle source

List User Schedules List schedules of the user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [ListUserSchedulesResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 290
def list_user_schedules(identifier, opts = {})
  data, _status_code, _headers = list_user_schedules_with_http_info(identifier, opts)
  data
end
list_user_schedules_with_http_info(identifier, opts = {}) click to toggle source

List User Schedules List schedules of the user for the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [Array<(ListUserSchedulesResponse, Fixnum, Hash)>] ListUserSchedulesResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 300
def list_user_schedules_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_user_schedules ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.list_user_schedules"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/schedules'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListUserSchedulesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#list_user_schedules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_user_teams(identifier, opts = {}) click to toggle source

List User Teams List user teams for the given user identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [ListUserTeamsResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 342
def list_user_teams(identifier, opts = {})
  data, _status_code, _headers = list_user_teams_with_http_info(identifier, opts)
  data
end
list_user_teams_with_http_info(identifier, opts = {}) click to toggle source

List User Teams List user teams for the given user identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @return [Array<(ListUserTeamsResponse, Fixnum, Hash)>] ListUserTeamsResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 352
def list_user_teams_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_user_teams ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.list_user_teams"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/teams'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListUserTeamsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#list_user_teams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_users(opts = {}) click to toggle source

List users List users with given parameters @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of users to retrieve (default to 100) @option opts [Integer] :offset Number of users to skip from start (default to 0) @option opts [String] :sort_field Field to use in sorting. Should be one of &#39;username&#39;, &#39;fullName&#39; and &#39;insertedAt&#39; @option opts [String] :order Direction of sorting. Should be one of &#39;asc&#39; or &#39;desc&#39; (default to asc) @option opts [String] :query Field:value combinations with most of user fields to make more advanced searches. Possible fields are username, fullName, blocked, verified, role, locale, timeZone, userAddress and createdAt @return [ListUsersResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 398
def list_users(opts = {})
  data, _status_code, _headers = list_users_with_http_info(opts)
  data
end
list_users_with_http_info(opts = {}) click to toggle source

List users List users with given parameters @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of users to retrieve @option opts [Integer] :offset Number of users to skip from start @option opts [String] :sort_field Field to use in sorting. Should be one of &#39;username&#39;, &#39;fullName&#39; and &#39;insertedAt&#39; @option opts [String] :order Direction of sorting. Should be one of &#39;asc&#39; or &#39;desc&#39; @option opts [String] :query Field:value combinations with most of user fields to make more advanced searches. Possible fields are username, fullName, blocked, verified, role, locale, timeZone, userAddress and createdAt @return [Array<(ListUsersResponse, Fixnum, Hash)>] ListUsersResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 412
def list_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_users ...'
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/v2/users'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListUsersResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_user(identifier, opts = {}) click to toggle source

Update User (Partial) Update user with the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @option opts [UpdateUserPayload] :body Request payload of the user object @return [SuccessResponse]

# File lib/opsgenie_sdk/api/user_api.rb, line 459
def update_user(identifier, opts = {})
  data, _status_code, _headers = update_user_with_http_info(identifier, opts)
  data
end
update_user_with_http_info(identifier, opts = {}) click to toggle source

Update User (Partial) Update user with the given identifier @param identifier Identifier of the user to be searched @param [Hash] opts the optional parameters @option opts [UpdateUserPayload] :body Request payload of the user object @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/user_api.rb, line 470
def update_user_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.update_user ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling UserApi.update_user"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end