class ApprovalApiClient::RequestApi
Attributes
Public Class Methods
# File lib/insights-approval-api-client/api/request_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Add an approval request by given parameters Add an approval request by given parameters, available to anyone @param request_in [RequestIn] Parameters need to create a request @param [Hash] opts the optional parameters @return [Request]
# File lib/insights-approval-api-client/api/request_api.rb, line 27 def create_request(request_in, opts = {}) data, _status_code, _headers = create_request_with_http_info(request_in, opts) data end
Add an approval request by given parameters Add an approval request by given parameters, available to anyone @param request_in [RequestIn] Parameters need to create a request @param [Hash] opts the optional parameters @return [Array<(Request
, Integer, Hash)>] Request
data, response status code and response headers
# File lib/insights-approval-api-client/api/request_api.rb, line 37 def create_request_with_http_info(request_in, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RequestApi.create_request ...' end # verify the required parameter 'request_in' is set if @api_client.config.client_side_validation && request_in.nil? fail ArgumentError, "Missing the required parameter 'request_in' when calling RequestApi.create_request" end # resource path local_var_path = '/requests' # 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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(request_in) # return_type return_type = opts[:return_type] || 'Request' # auth_names auth_names = opts[:auth_names] || ['Basic_auth'] new_options = opts.merge( :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: RequestApi#create_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Return an array of requester made approval requests, available to anyone The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). Program generated child requests are not included. @param [Hash] opts the optional parameters @option opts [String] :x_rh_persona Current login user's persona @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100) @option opts [Integer] :offset Starting Offset (default to 0) @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [RequestCollection]
# File lib/insights-approval-api-client/api/request_api.rb, line 95 def list_requests(opts = {}) data, _status_code, _headers = list_requests_with_http_info(opts) data end
Return an array of child requests of a given request id Return an array of child requests of a given request id. The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). @param request_id [String] Id of request @param [Hash] opts the optional parameters @option opts [String] :x_rh_persona Current login user's persona @return [RequestCollection]
# File lib/insights-approval-api-client/api/request_api.rb, line 179 def list_requests_by_request(request_id, opts = {}) data, _status_code, _headers = list_requests_by_request_with_http_info(request_id, opts) data end
Return an array of child requests of a given request id Return an array of child requests of a given request id. The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). @param request_id [String] Id of request @param [Hash] opts the optional parameters @option opts [String] :x_rh_persona Current login user's persona @return [Array<(RequestCollection
, Integer, Hash)>] RequestCollection
data, response status code and response headers
# File lib/insights-approval-api-client/api/request_api.rb, line 190 def list_requests_by_request_with_http_info(request_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RequestApi.list_requests_by_request ...' end # verify the required parameter 'request_id' is set if @api_client.config.client_side_validation && request_id.nil? fail ArgumentError, "Missing the required parameter 'request_id' when calling RequestApi.list_requests_by_request" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && request_id !~ pattern fail ArgumentError, "invalid value for 'request_id' when calling RequestApi.list_requests_by_request, must conform to the pattern #{pattern}." end allowable_values = ["approval/admin", "approval/approver", "approval/requester"] if @api_client.config.client_side_validation && opts[:'x_rh_persona'] && !allowable_values.include?(opts[:'x_rh_persona']) fail ArgumentError, "invalid value for \"x_rh_persona\", must be one of #{allowable_values}" end # resource path local_var_path = '/requests/{request_id}/requests'.sub('{' + 'request_id' + '}', CGI.escape(request_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[:'x-rh-persona'] = opts[:'x_rh_persona'] if !opts[:'x_rh_persona'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'RequestCollection' # auth_names auth_names = opts[:auth_names] || ['Basic_auth'] new_options = opts.merge( :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: RequestApi#list_requests_by_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Return an array of requester made approval requests, available to anyone The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). Program generated child requests are not included. @param [Hash] opts the optional parameters @option opts [String] :x_rh_persona Current login user's persona @option opts [Integer] :limit How many items to return at one time (max 1000) @option opts [Integer] :offset Starting Offset @option opts [Object] :filter Filter for querying collections. @option opts [String] :sort_by Parameter to sort collection @return [Array<(RequestCollection
, Integer, Hash)>] RequestCollection
data, response status code and response headers
# File lib/insights-approval-api-client/api/request_api.rb, line 109 def list_requests_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RequestApi.list_requests ...' end allowable_values = ["approval/admin", "approval/approver", "approval/requester"] if @api_client.config.client_side_validation && opts[:'x_rh_persona'] && !allowable_values.include?(opts[:'x_rh_persona']) fail ArgumentError, "invalid value for \"x_rh_persona\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RequestApi.list_requests, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RequestApi.list_requests, 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 RequestApi.list_requests, must be greater than or equal to 0.' end # resource path local_var_path = '/requests' # 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[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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[:'x-rh-persona'] = opts[:'x_rh_persona'] if !opts[:'x_rh_persona'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'RequestCollection' # auth_names auth_names = opts[:auth_names] || ['Basic_auth'] new_options = opts.merge( :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: RequestApi#list_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Return an approval request by given id Return an approval request by given id, available to anyone who can access the request @param id [String] Query by id @param [Hash] opts the optional parameters @return [Request]
# File lib/insights-approval-api-client/api/request_api.rb, line 252 def show_request(id, opts = {}) data, _status_code, _headers = show_request_with_http_info(id, opts) data end
Return request content of a given request id Return request content of a given request id, available to all @param request_id [String] Id of request @param [Hash] opts the optional parameters @return [Object]
# File lib/insights-approval-api-client/api/request_api.rb, line 319 def show_request_content(request_id, opts = {}) data, _status_code, _headers = show_request_content_with_http_info(request_id, opts) data end
Return request content of a given request id Return request content of a given request id, available to all @param request_id [String] Id of request @param [Hash] opts the optional parameters @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
# File lib/insights-approval-api-client/api/request_api.rb, line 329 def show_request_content_with_http_info(request_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RequestApi.show_request_content ...' end # verify the required parameter 'request_id' is set if @api_client.config.client_side_validation && request_id.nil? fail ArgumentError, "Missing the required parameter 'request_id' when calling RequestApi.show_request_content" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && request_id !~ pattern fail ArgumentError, "invalid value for 'request_id' when calling RequestApi.show_request_content, must conform to the pattern #{pattern}." end # resource path local_var_path = '/requests/{request_id}/content'.sub('{' + 'request_id' + '}', CGI.escape(request_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Object' # auth_names auth_names = opts[:auth_names] || ['Basic_auth'] new_options = opts.merge( :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: RequestApi#show_request_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Return an approval request by given id Return an approval request by given id, available to anyone who can access the request @param id [String] Query by id @param [Hash] opts the optional parameters @return [Array<(Request
, Integer, Hash)>] Request
data, response status code and response headers
# File lib/insights-approval-api-client/api/request_api.rb, line 262 def show_request_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RequestApi.show_request ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RequestApi.show_request" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && id !~ pattern fail ArgumentError, "invalid value for 'id' when calling RequestApi.show_request, must conform to the pattern #{pattern}." end # resource path local_var_path = '/requests/{id}'.sub('{' + 'id' + '}', CGI.escape(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(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Request' # auth_names auth_names = opts[:auth_names] || ['Basic_auth'] new_options = opts.merge( :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: RequestApi#show_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end