class OpsgenieSdk::UserApi
Attributes
Public Class Methods
# 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
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
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
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
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
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 'contact' @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
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 'contact' @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 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 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 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 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 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 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 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 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 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 'username', 'fullName' and 'insertedAt' @option opts [String] :order Direction of sorting. Should be one of 'asc' or 'desc' (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 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 'username', 'fullName' and 'insertedAt' @option opts [String] :order Direction of sorting. Should be one of 'asc' or 'desc' @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
(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
(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