insights-approval-api-client 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +142 -0
- data/Rakefile +10 -0
- data/client-meta.json +9 -0
- data/docs/Action.md +27 -0
- data/docs/ActionApi.md +172 -0
- data/docs/ActionCollection.md +21 -0
- data/docs/CollectionLinks.md +23 -0
- data/docs/CollectionMetadata.md +21 -0
- data/docs/GraphqlApi.md +62 -0
- data/docs/GraphqlIn.md +21 -0
- data/docs/GraphqlOut.md +19 -0
- data/docs/GroupRef.md +19 -0
- data/docs/HttpApiError.md +19 -0
- data/docs/HttpApiErrorCollection.md +17 -0
- data/docs/Request.md +49 -0
- data/docs/RequestApi.md +292 -0
- data/docs/RequestCollection.md +21 -0
- data/docs/RequestIn.md +23 -0
- data/docs/ResourceObject.md +21 -0
- data/docs/Tag.md +17 -0
- data/docs/TagResource.md +21 -0
- data/docs/Template.md +23 -0
- data/docs/TemplateApi.md +124 -0
- data/docs/TemplateCollection.md +21 -0
- data/docs/Workflow.md +29 -0
- data/docs/WorkflowApi.md +469 -0
- data/docs/WorkflowCollection.md +21 -0
- data/generate.sh +9 -0
- data/git_push.sh +58 -0
- data/insights-approval-api-client.gemspec +39 -0
- data/lib/insights-approval-api-client.rb +63 -0
- data/lib/insights-approval-api-client/api/action_api.rb +231 -0
- data/lib/insights-approval-api-client/api/graphql_api.rb +86 -0
- data/lib/insights-approval-api-client/api/request_api.rb +381 -0
- data/lib/insights-approval-api-client/api/template_api.rb +169 -0
- data/lib/insights-approval-api-client/api/workflow_api.rb +630 -0
- data/lib/insights-approval-api-client/api_client.rb +386 -0
- data/lib/insights-approval-api-client/api_error.rb +57 -0
- data/lib/insights-approval-api-client/configuration.rb +268 -0
- data/lib/insights-approval-api-client/models/action.rb +293 -0
- data/lib/insights-approval-api-client/models/action_collection.rb +226 -0
- data/lib/insights-approval-api-client/models/collection_links.rb +237 -0
- data/lib/insights-approval-api-client/models/collection_metadata.rb +227 -0
- data/lib/insights-approval-api-client/models/graphql_in.rb +237 -0
- data/lib/insights-approval-api-client/models/graphql_out.rb +219 -0
- data/lib/insights-approval-api-client/models/group_ref.rb +223 -0
- data/lib/insights-approval-api-client/models/http_api_error.rb +218 -0
- data/lib/insights-approval-api-client/models/http_api_error_collection.rb +210 -0
- data/lib/insights-approval-api-client/models/request.rb +417 -0
- data/lib/insights-approval-api-client/models/request_collection.rb +226 -0
- data/lib/insights-approval-api-client/models/request_in.rb +255 -0
- data/lib/insights-approval-api-client/models/resource_object.rb +243 -0
- data/lib/insights-approval-api-client/models/tag.rb +207 -0
- data/lib/insights-approval-api-client/models/tag_resource.rb +242 -0
- data/lib/insights-approval-api-client/models/template.rb +235 -0
- data/lib/insights-approval-api-client/models/template_collection.rb +226 -0
- data/lib/insights-approval-api-client/models/workflow.rb +283 -0
- data/lib/insights-approval-api-client/models/workflow_collection.rb +226 -0
- data/lib/insights-approval-api-client/version.rb +15 -0
- data/openapi.json +1540 -0
- data/spec/api/action_api_spec.rb +72 -0
- data/spec/api/graphql_api_spec.rb +47 -0
- data/spec/api/request_api_spec.rb +100 -0
- data/spec/api/template_api_spec.rb +62 -0
- data/spec/api/workflow_api_spec.rb +145 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/action_collection_spec.rb +53 -0
- data/spec/models/action_spec.rb +75 -0
- data/spec/models/collection_links_spec.rb +59 -0
- data/spec/models/collection_metadata_spec.rb +53 -0
- data/spec/models/graphql_in_spec.rb +53 -0
- data/spec/models/graphql_out_spec.rb +47 -0
- data/spec/models/group_ref_spec.rb +47 -0
- data/spec/models/http_api_error_collection_spec.rb +41 -0
- data/spec/models/http_api_error_spec.rb +47 -0
- data/spec/models/request_collection_spec.rb +53 -0
- data/spec/models/request_in_spec.rb +59 -0
- data/spec/models/request_spec.rb +145 -0
- data/spec/models/resource_object_spec.rb +53 -0
- data/spec/models/tag_resource_spec.rb +53 -0
- data/spec/models/tag_spec.rb +41 -0
- data/spec/models/template_collection_spec.rb +53 -0
- data/spec/models/template_spec.rb +59 -0
- data/spec/models/workflow_collection_spec.rb +53 -0
- data/spec/models/workflow_spec.rb +77 -0
- data/spec/spec_helper.rb +111 -0
- metadata +218 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# ApprovalApiClient::WorkflowCollection
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**meta** | [**CollectionMetadata**](CollectionMetadata.md) | | [optional]
|
8
|
+
**links** | [**CollectionLinks**](CollectionLinks.md) | | [optional]
|
9
|
+
**data** | [**Array<Workflow>**](Workflow.md) | | [optional]
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'ApprovalApiClient'
|
15
|
+
|
16
|
+
instance = ApprovalApiClient::WorkflowCollection.new(meta: null,
|
17
|
+
links: null,
|
18
|
+
data: null)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
data/generate.sh
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
|
3
|
+
rm -rf openapi.json
|
4
|
+
curl https://raw.githubusercontent.com/RedHatInsights/approval-api/master/public/doc/openapi-3-v1.2.json -o openapi.json
|
5
|
+
openapi-generator validate -i openapi.json
|
6
|
+
rm -rf ./lib
|
7
|
+
rm -rf ./spec
|
8
|
+
rm -rf ./docs
|
9
|
+
openapi-generator generate -g ruby -i openapi.json -c client-meta.json -o .
|
data/git_push.sh
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
3
|
+
#
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
5
|
+
|
6
|
+
git_user_id=$1
|
7
|
+
git_repo_id=$2
|
8
|
+
release_note=$3
|
9
|
+
git_host=$4
|
10
|
+
|
11
|
+
if [ "$git_host" = "" ]; then
|
12
|
+
git_host="github.com"
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
14
|
+
fi
|
15
|
+
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
17
|
+
git_user_id="GIT_USER_ID"
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
19
|
+
fi
|
20
|
+
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
22
|
+
git_repo_id="GIT_REPO_ID"
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [ "$release_note" = "" ]; then
|
27
|
+
release_note="Minor update"
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
29
|
+
fi
|
30
|
+
|
31
|
+
# Initialize the local directory as a Git repository
|
32
|
+
git init
|
33
|
+
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
35
|
+
git add .
|
36
|
+
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
38
|
+
git commit -m "$release_note"
|
39
|
+
|
40
|
+
# Sets the new remote
|
41
|
+
git_remote=`git remote`
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
43
|
+
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
47
|
+
else
|
48
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
49
|
+
fi
|
50
|
+
|
51
|
+
fi
|
52
|
+
|
53
|
+
git pull origin master
|
54
|
+
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|
58
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#Insights Service Approval APIs
|
5
|
+
|
6
|
+
#APIs to query approval service
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.2.0
|
9
|
+
Contact: support@redhat.com
|
10
|
+
Generated by: https://openapi-generator.tech
|
11
|
+
OpenAPI Generator version: 4.2.2
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "insights-approval-api-client/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "insights-approval-api-client"
|
20
|
+
s.version = ApprovalApiClient::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["Insights Authors"]
|
23
|
+
s.email = ["support@redhat.com"]
|
24
|
+
s.homepage = "https://github.com/RedHatInsights/approval-api-client-ruby"
|
25
|
+
s.summary = "Insights Service Approval APIs Ruby Gem"
|
26
|
+
s.description = "Ruby client gem to connect to Insights Approval Service"
|
27
|
+
s.license = 'Apache-2.0'
|
28
|
+
s.required_ruby_version = ">= 1.9"
|
29
|
+
|
30
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
|
+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
32
|
+
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
34
|
+
|
35
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
36
|
+
s.test_files = `find spec/*`.split("\n")
|
37
|
+
s.executables = []
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
=begin
|
2
|
+
#Insights Service Approval APIs
|
3
|
+
|
4
|
+
#APIs to query approval service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.2.0
|
7
|
+
Contact: support@redhat.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'insights-approval-api-client/api_client'
|
15
|
+
require 'insights-approval-api-client/api_error'
|
16
|
+
require 'insights-approval-api-client/version'
|
17
|
+
require 'insights-approval-api-client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'insights-approval-api-client/models/action'
|
21
|
+
require 'insights-approval-api-client/models/action_collection'
|
22
|
+
require 'insights-approval-api-client/models/collection_links'
|
23
|
+
require 'insights-approval-api-client/models/collection_metadata'
|
24
|
+
require 'insights-approval-api-client/models/graphql_in'
|
25
|
+
require 'insights-approval-api-client/models/graphql_out'
|
26
|
+
require 'insights-approval-api-client/models/group_ref'
|
27
|
+
require 'insights-approval-api-client/models/http_api_error'
|
28
|
+
require 'insights-approval-api-client/models/http_api_error_collection'
|
29
|
+
require 'insights-approval-api-client/models/request'
|
30
|
+
require 'insights-approval-api-client/models/request_collection'
|
31
|
+
require 'insights-approval-api-client/models/request_in'
|
32
|
+
require 'insights-approval-api-client/models/resource_object'
|
33
|
+
require 'insights-approval-api-client/models/tag'
|
34
|
+
require 'insights-approval-api-client/models/tag_resource'
|
35
|
+
require 'insights-approval-api-client/models/template'
|
36
|
+
require 'insights-approval-api-client/models/template_collection'
|
37
|
+
require 'insights-approval-api-client/models/workflow'
|
38
|
+
require 'insights-approval-api-client/models/workflow_collection'
|
39
|
+
|
40
|
+
# APIs
|
41
|
+
require 'insights-approval-api-client/api/action_api'
|
42
|
+
require 'insights-approval-api-client/api/graphql_api'
|
43
|
+
require 'insights-approval-api-client/api/request_api'
|
44
|
+
require 'insights-approval-api-client/api/template_api'
|
45
|
+
require 'insights-approval-api-client/api/workflow_api'
|
46
|
+
|
47
|
+
module ApprovalApiClient
|
48
|
+
class << self
|
49
|
+
# Customize default settings for the SDK using block.
|
50
|
+
# ApprovalApiClient.configure do |config|
|
51
|
+
# config.username = "xxx"
|
52
|
+
# config.password = "xxx"
|
53
|
+
# end
|
54
|
+
# If no block given, return the default Configuration object.
|
55
|
+
def configure
|
56
|
+
if block_given?
|
57
|
+
yield(Configuration.default)
|
58
|
+
else
|
59
|
+
Configuration.default
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
=begin
|
2
|
+
#Insights Service Approval APIs
|
3
|
+
|
4
|
+
#APIs to query approval service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.2.0
|
7
|
+
Contact: support@redhat.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module ApprovalApiClient
|
16
|
+
class ActionApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Add an action to a given request
|
23
|
+
# Add an action to a given request. Admin can do approve, deny, memo, and cancel operations; approver can do approve, deny and memo operations; while requester can do only cancel operation.
|
24
|
+
# @param request_id [String] Id of request
|
25
|
+
# @param action [Action] Action object that will be added
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [Action]
|
28
|
+
def create_action(request_id, action, opts = {})
|
29
|
+
data, _status_code, _headers = create_action_with_http_info(request_id, action, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Add an action to a given request
|
34
|
+
# Add an action to a given request. Admin can do approve, deny, memo, and cancel operations; approver can do approve, deny and memo operations; while requester can do only cancel operation.
|
35
|
+
# @param request_id [String] Id of request
|
36
|
+
# @param action [Action] Action object that will be added
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(Action, Integer, Hash)>] Action data, response status code and response headers
|
39
|
+
def create_action_with_http_info(request_id, action, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: ActionApi.create_action ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'request_id' is set
|
44
|
+
if @api_client.config.client_side_validation && request_id.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'request_id' when calling ActionApi.create_action"
|
46
|
+
end
|
47
|
+
pattern = Regexp.new(/^\d+$/)
|
48
|
+
if @api_client.config.client_side_validation && request_id !~ pattern
|
49
|
+
fail ArgumentError, "invalid value for 'request_id' when calling ActionApi.create_action, must conform to the pattern #{pattern}."
|
50
|
+
end
|
51
|
+
|
52
|
+
# verify the required parameter 'action' is set
|
53
|
+
if @api_client.config.client_side_validation && action.nil?
|
54
|
+
fail ArgumentError, "Missing the required parameter 'action' when calling ActionApi.create_action"
|
55
|
+
end
|
56
|
+
# resource path
|
57
|
+
local_var_path = '/requests/{request_id}/actions'.sub('{' + 'request_id' + '}', CGI.escape(request_id.to_s))
|
58
|
+
|
59
|
+
# query parameters
|
60
|
+
query_params = opts[:query_params] || {}
|
61
|
+
|
62
|
+
# header parameters
|
63
|
+
header_params = opts[:header_params] || {}
|
64
|
+
# HTTP header 'Accept' (if needed)
|
65
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
66
|
+
# HTTP header 'Content-Type'
|
67
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
68
|
+
|
69
|
+
# form parameters
|
70
|
+
form_params = opts[:form_params] || {}
|
71
|
+
|
72
|
+
# http body (model)
|
73
|
+
post_body = opts[:body] || @api_client.object_to_http_body(action)
|
74
|
+
|
75
|
+
# return_type
|
76
|
+
return_type = opts[:return_type] || 'Action'
|
77
|
+
|
78
|
+
# auth_names
|
79
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
80
|
+
|
81
|
+
new_options = opts.merge(
|
82
|
+
:header_params => header_params,
|
83
|
+
:query_params => query_params,
|
84
|
+
:form_params => form_params,
|
85
|
+
:body => post_body,
|
86
|
+
:auth_names => auth_names,
|
87
|
+
:return_type => return_type
|
88
|
+
)
|
89
|
+
|
90
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
91
|
+
if @api_client.config.debugging
|
92
|
+
@api_client.config.logger.debug "API called: ActionApi#create_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
93
|
+
end
|
94
|
+
return data, status_code, headers
|
95
|
+
end
|
96
|
+
|
97
|
+
# List all actions of a request
|
98
|
+
# Return actions in a given request, available for admin/approver
|
99
|
+
# @param request_id [String] Id of request
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @return [ActionCollection]
|
102
|
+
def list_actions_by_request(request_id, opts = {})
|
103
|
+
data, _status_code, _headers = list_actions_by_request_with_http_info(request_id, opts)
|
104
|
+
data
|
105
|
+
end
|
106
|
+
|
107
|
+
# List all actions of a request
|
108
|
+
# Return actions in a given request, available for admin/approver
|
109
|
+
# @param request_id [String] Id of request
|
110
|
+
# @param [Hash] opts the optional parameters
|
111
|
+
# @return [Array<(ActionCollection, Integer, Hash)>] ActionCollection data, response status code and response headers
|
112
|
+
def list_actions_by_request_with_http_info(request_id, opts = {})
|
113
|
+
if @api_client.config.debugging
|
114
|
+
@api_client.config.logger.debug 'Calling API: ActionApi.list_actions_by_request ...'
|
115
|
+
end
|
116
|
+
# verify the required parameter 'request_id' is set
|
117
|
+
if @api_client.config.client_side_validation && request_id.nil?
|
118
|
+
fail ArgumentError, "Missing the required parameter 'request_id' when calling ActionApi.list_actions_by_request"
|
119
|
+
end
|
120
|
+
pattern = Regexp.new(/^\d+$/)
|
121
|
+
if @api_client.config.client_side_validation && request_id !~ pattern
|
122
|
+
fail ArgumentError, "invalid value for 'request_id' when calling ActionApi.list_actions_by_request, must conform to the pattern #{pattern}."
|
123
|
+
end
|
124
|
+
|
125
|
+
# resource path
|
126
|
+
local_var_path = '/requests/{request_id}/actions'.sub('{' + 'request_id' + '}', CGI.escape(request_id.to_s))
|
127
|
+
|
128
|
+
# query parameters
|
129
|
+
query_params = opts[:query_params] || {}
|
130
|
+
|
131
|
+
# header parameters
|
132
|
+
header_params = opts[:header_params] || {}
|
133
|
+
# HTTP header 'Accept' (if needed)
|
134
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
135
|
+
|
136
|
+
# form parameters
|
137
|
+
form_params = opts[:form_params] || {}
|
138
|
+
|
139
|
+
# http body (model)
|
140
|
+
post_body = opts[:body]
|
141
|
+
|
142
|
+
# return_type
|
143
|
+
return_type = opts[:return_type] || 'ActionCollection'
|
144
|
+
|
145
|
+
# auth_names
|
146
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
147
|
+
|
148
|
+
new_options = opts.merge(
|
149
|
+
:header_params => header_params,
|
150
|
+
:query_params => query_params,
|
151
|
+
:form_params => form_params,
|
152
|
+
:body => post_body,
|
153
|
+
:auth_names => auth_names,
|
154
|
+
:return_type => return_type
|
155
|
+
)
|
156
|
+
|
157
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
158
|
+
if @api_client.config.debugging
|
159
|
+
@api_client.config.logger.debug "API called: ActionApi#list_actions_by_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
160
|
+
end
|
161
|
+
return data, status_code, headers
|
162
|
+
end
|
163
|
+
|
164
|
+
# Return an user action by id
|
165
|
+
# Return an user action by id, available to all
|
166
|
+
# @param id [String] Query by id
|
167
|
+
# @param [Hash] opts the optional parameters
|
168
|
+
# @return [Action]
|
169
|
+
def show_action(id, opts = {})
|
170
|
+
data, _status_code, _headers = show_action_with_http_info(id, opts)
|
171
|
+
data
|
172
|
+
end
|
173
|
+
|
174
|
+
# Return an user action by id
|
175
|
+
# Return an user action by id, available to all
|
176
|
+
# @param id [String] Query by id
|
177
|
+
# @param [Hash] opts the optional parameters
|
178
|
+
# @return [Array<(Action, Integer, Hash)>] Action data, response status code and response headers
|
179
|
+
def show_action_with_http_info(id, opts = {})
|
180
|
+
if @api_client.config.debugging
|
181
|
+
@api_client.config.logger.debug 'Calling API: ActionApi.show_action ...'
|
182
|
+
end
|
183
|
+
# verify the required parameter 'id' is set
|
184
|
+
if @api_client.config.client_side_validation && id.nil?
|
185
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ActionApi.show_action"
|
186
|
+
end
|
187
|
+
pattern = Regexp.new(/^\d+$/)
|
188
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
189
|
+
fail ArgumentError, "invalid value for 'id' when calling ActionApi.show_action, must conform to the pattern #{pattern}."
|
190
|
+
end
|
191
|
+
|
192
|
+
# resource path
|
193
|
+
local_var_path = '/actions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
194
|
+
|
195
|
+
# query parameters
|
196
|
+
query_params = opts[:query_params] || {}
|
197
|
+
|
198
|
+
# header parameters
|
199
|
+
header_params = opts[:header_params] || {}
|
200
|
+
# HTTP header 'Accept' (if needed)
|
201
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
202
|
+
|
203
|
+
# form parameters
|
204
|
+
form_params = opts[:form_params] || {}
|
205
|
+
|
206
|
+
# http body (model)
|
207
|
+
post_body = opts[:body]
|
208
|
+
|
209
|
+
# return_type
|
210
|
+
return_type = opts[:return_type] || 'Action'
|
211
|
+
|
212
|
+
# auth_names
|
213
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
214
|
+
|
215
|
+
new_options = opts.merge(
|
216
|
+
:header_params => header_params,
|
217
|
+
:query_params => query_params,
|
218
|
+
:form_params => form_params,
|
219
|
+
:body => post_body,
|
220
|
+
:auth_names => auth_names,
|
221
|
+
:return_type => return_type
|
222
|
+
)
|
223
|
+
|
224
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
225
|
+
if @api_client.config.debugging
|
226
|
+
@api_client.config.logger.debug "API called: ActionApi#show_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
227
|
+
end
|
228
|
+
return data, status_code, headers
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
=begin
|
2
|
+
#Insights Service Approval APIs
|
3
|
+
|
4
|
+
#APIs to query approval service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.2.0
|
7
|
+
Contact: support@redhat.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module ApprovalApiClient
|
16
|
+
class GraphqlApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Perform a GraphQL Query
|
23
|
+
# Performs a GraphQL Query
|
24
|
+
# @param graphql_in [GraphqlIn] GraphQL Query Request
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [GraphqlOut]
|
27
|
+
def post_graphql(graphql_in, opts = {})
|
28
|
+
data, _status_code, _headers = post_graphql_with_http_info(graphql_in, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Perform a GraphQL Query
|
33
|
+
# Performs a GraphQL Query
|
34
|
+
# @param graphql_in [GraphqlIn] GraphQL Query Request
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(GraphqlOut, Integer, Hash)>] GraphqlOut data, response status code and response headers
|
37
|
+
def post_graphql_with_http_info(graphql_in, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: GraphqlApi.post_graphql ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'graphql_in' is set
|
42
|
+
if @api_client.config.client_side_validation && graphql_in.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'graphql_in' when calling GraphqlApi.post_graphql"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/graphql'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
57
|
+
|
58
|
+
# form parameters
|
59
|
+
form_params = opts[:form_params] || {}
|
60
|
+
|
61
|
+
# http body (model)
|
62
|
+
post_body = opts[:body] || @api_client.object_to_http_body(graphql_in)
|
63
|
+
|
64
|
+
# return_type
|
65
|
+
return_type = opts[:return_type] || 'GraphqlOut'
|
66
|
+
|
67
|
+
# auth_names
|
68
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
69
|
+
|
70
|
+
new_options = opts.merge(
|
71
|
+
:header_params => header_params,
|
72
|
+
:query_params => query_params,
|
73
|
+
:form_params => form_params,
|
74
|
+
:body => post_body,
|
75
|
+
:auth_names => auth_names,
|
76
|
+
:return_type => return_type
|
77
|
+
)
|
78
|
+
|
79
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
80
|
+
if @api_client.config.debugging
|
81
|
+
@api_client.config.logger.debug "API called: GraphqlApi#post_graphql\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|