insights-approval-api-client 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,381 @@
|
|
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 RequestApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Add an approval request by given parameters
|
23
|
+
# Add an approval request by given parameters, available to anyone
|
24
|
+
# @param request_in [RequestIn] Parameters need to create a request
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Request]
|
27
|
+
def create_request(request_in, opts = {})
|
28
|
+
data, _status_code, _headers = create_request_with_http_info(request_in, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Add an approval request by given parameters
|
33
|
+
# Add an approval request by given parameters, available to anyone
|
34
|
+
# @param request_in [RequestIn] Parameters need to create a request
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Request, Integer, Hash)>] Request data, response status code and response headers
|
37
|
+
def create_request_with_http_info(request_in, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: RequestApi.create_request ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'request_in' is set
|
42
|
+
if @api_client.config.client_side_validation && request_in.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'request_in' when calling RequestApi.create_request"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/requests'
|
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(request_in)
|
63
|
+
|
64
|
+
# return_type
|
65
|
+
return_type = opts[:return_type] || 'Request'
|
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: RequestApi#create_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
|
86
|
+
# Return an array of requester made approval requests, available to anyone
|
87
|
+
# The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). Program generated child requests are not included.
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @option opts [String] :x_rh_persona Current login user's persona
|
90
|
+
# @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100)
|
91
|
+
# @option opts [Integer] :offset Starting Offset (default to 0)
|
92
|
+
# @option opts [Object] :filter Filter for querying collections.
|
93
|
+
# @option opts [String] :sort_by Parameter to sort collection
|
94
|
+
# @return [RequestCollection]
|
95
|
+
def list_requests(opts = {})
|
96
|
+
data, _status_code, _headers = list_requests_with_http_info(opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# Return an array of requester made approval requests, available to anyone
|
101
|
+
# The result depends on the x-rh-persona header (approval/admin, approval/requseter, or approval/approver). Program generated child requests are not included.
|
102
|
+
# @param [Hash] opts the optional parameters
|
103
|
+
# @option opts [String] :x_rh_persona Current login user's persona
|
104
|
+
# @option opts [Integer] :limit How many items to return at one time (max 1000)
|
105
|
+
# @option opts [Integer] :offset Starting Offset
|
106
|
+
# @option opts [Object] :filter Filter for querying collections.
|
107
|
+
# @option opts [String] :sort_by Parameter to sort collection
|
108
|
+
# @return [Array<(RequestCollection, Integer, Hash)>] RequestCollection data, response status code and response headers
|
109
|
+
def list_requests_with_http_info(opts = {})
|
110
|
+
if @api_client.config.debugging
|
111
|
+
@api_client.config.logger.debug 'Calling API: RequestApi.list_requests ...'
|
112
|
+
end
|
113
|
+
allowable_values = ["approval/admin", "approval/approver", "approval/requester"]
|
114
|
+
if @api_client.config.client_side_validation && opts[:'x_rh_persona'] && !allowable_values.include?(opts[:'x_rh_persona'])
|
115
|
+
fail ArgumentError, "invalid value for \"x_rh_persona\", must be one of #{allowable_values}"
|
116
|
+
end
|
117
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
|
118
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RequestApi.list_requests, must be smaller than or equal to 1000.'
|
119
|
+
end
|
120
|
+
|
121
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
122
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RequestApi.list_requests, must be greater than or equal to 1.'
|
123
|
+
end
|
124
|
+
|
125
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
126
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling RequestApi.list_requests, must be greater than or equal to 0.'
|
127
|
+
end
|
128
|
+
|
129
|
+
# resource path
|
130
|
+
local_var_path = '/requests'
|
131
|
+
|
132
|
+
# query parameters
|
133
|
+
query_params = opts[:query_params] || {}
|
134
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
135
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
136
|
+
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
|
137
|
+
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
|
138
|
+
|
139
|
+
# header parameters
|
140
|
+
header_params = opts[:header_params] || {}
|
141
|
+
# HTTP header 'Accept' (if needed)
|
142
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
143
|
+
header_params[:'x-rh-persona'] = opts[:'x_rh_persona'] if !opts[:'x_rh_persona'].nil?
|
144
|
+
|
145
|
+
# form parameters
|
146
|
+
form_params = opts[:form_params] || {}
|
147
|
+
|
148
|
+
# http body (model)
|
149
|
+
post_body = opts[:body]
|
150
|
+
|
151
|
+
# return_type
|
152
|
+
return_type = opts[:return_type] || 'RequestCollection'
|
153
|
+
|
154
|
+
# auth_names
|
155
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
156
|
+
|
157
|
+
new_options = opts.merge(
|
158
|
+
:header_params => header_params,
|
159
|
+
:query_params => query_params,
|
160
|
+
:form_params => form_params,
|
161
|
+
:body => post_body,
|
162
|
+
:auth_names => auth_names,
|
163
|
+
:return_type => return_type
|
164
|
+
)
|
165
|
+
|
166
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
167
|
+
if @api_client.config.debugging
|
168
|
+
@api_client.config.logger.debug "API called: RequestApi#list_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
169
|
+
end
|
170
|
+
return data, status_code, headers
|
171
|
+
end
|
172
|
+
|
173
|
+
# Return an array of child requests of a given request id
|
174
|
+
# 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).
|
175
|
+
# @param request_id [String] Id of request
|
176
|
+
# @param [Hash] opts the optional parameters
|
177
|
+
# @option opts [String] :x_rh_persona Current login user's persona
|
178
|
+
# @return [RequestCollection]
|
179
|
+
def list_requests_by_request(request_id, opts = {})
|
180
|
+
data, _status_code, _headers = list_requests_by_request_with_http_info(request_id, opts)
|
181
|
+
data
|
182
|
+
end
|
183
|
+
|
184
|
+
# Return an array of child requests of a given request id
|
185
|
+
# 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).
|
186
|
+
# @param request_id [String] Id of request
|
187
|
+
# @param [Hash] opts the optional parameters
|
188
|
+
# @option opts [String] :x_rh_persona Current login user's persona
|
189
|
+
# @return [Array<(RequestCollection, Integer, Hash)>] RequestCollection data, response status code and response headers
|
190
|
+
def list_requests_by_request_with_http_info(request_id, opts = {})
|
191
|
+
if @api_client.config.debugging
|
192
|
+
@api_client.config.logger.debug 'Calling API: RequestApi.list_requests_by_request ...'
|
193
|
+
end
|
194
|
+
# verify the required parameter 'request_id' is set
|
195
|
+
if @api_client.config.client_side_validation && request_id.nil?
|
196
|
+
fail ArgumentError, "Missing the required parameter 'request_id' when calling RequestApi.list_requests_by_request"
|
197
|
+
end
|
198
|
+
pattern = Regexp.new(/^\d+$/)
|
199
|
+
if @api_client.config.client_side_validation && request_id !~ pattern
|
200
|
+
fail ArgumentError, "invalid value for 'request_id' when calling RequestApi.list_requests_by_request, must conform to the pattern #{pattern}."
|
201
|
+
end
|
202
|
+
|
203
|
+
allowable_values = ["approval/admin", "approval/approver", "approval/requester"]
|
204
|
+
if @api_client.config.client_side_validation && opts[:'x_rh_persona'] && !allowable_values.include?(opts[:'x_rh_persona'])
|
205
|
+
fail ArgumentError, "invalid value for \"x_rh_persona\", must be one of #{allowable_values}"
|
206
|
+
end
|
207
|
+
# resource path
|
208
|
+
local_var_path = '/requests/{request_id}/requests'.sub('{' + 'request_id' + '}', CGI.escape(request_id.to_s))
|
209
|
+
|
210
|
+
# query parameters
|
211
|
+
query_params = opts[:query_params] || {}
|
212
|
+
|
213
|
+
# header parameters
|
214
|
+
header_params = opts[:header_params] || {}
|
215
|
+
# HTTP header 'Accept' (if needed)
|
216
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
217
|
+
header_params[:'x-rh-persona'] = opts[:'x_rh_persona'] if !opts[:'x_rh_persona'].nil?
|
218
|
+
|
219
|
+
# form parameters
|
220
|
+
form_params = opts[:form_params] || {}
|
221
|
+
|
222
|
+
# http body (model)
|
223
|
+
post_body = opts[:body]
|
224
|
+
|
225
|
+
# return_type
|
226
|
+
return_type = opts[:return_type] || 'RequestCollection'
|
227
|
+
|
228
|
+
# auth_names
|
229
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
230
|
+
|
231
|
+
new_options = opts.merge(
|
232
|
+
:header_params => header_params,
|
233
|
+
:query_params => query_params,
|
234
|
+
:form_params => form_params,
|
235
|
+
:body => post_body,
|
236
|
+
:auth_names => auth_names,
|
237
|
+
:return_type => return_type
|
238
|
+
)
|
239
|
+
|
240
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
241
|
+
if @api_client.config.debugging
|
242
|
+
@api_client.config.logger.debug "API called: RequestApi#list_requests_by_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
243
|
+
end
|
244
|
+
return data, status_code, headers
|
245
|
+
end
|
246
|
+
|
247
|
+
# Return an approval request by given id
|
248
|
+
# Return an approval request by given id, available to anyone who can access the request
|
249
|
+
# @param id [String] Query by id
|
250
|
+
# @param [Hash] opts the optional parameters
|
251
|
+
# @return [Request]
|
252
|
+
def show_request(id, opts = {})
|
253
|
+
data, _status_code, _headers = show_request_with_http_info(id, opts)
|
254
|
+
data
|
255
|
+
end
|
256
|
+
|
257
|
+
# Return an approval request by given id
|
258
|
+
# Return an approval request by given id, available to anyone who can access the request
|
259
|
+
# @param id [String] Query by id
|
260
|
+
# @param [Hash] opts the optional parameters
|
261
|
+
# @return [Array<(Request, Integer, Hash)>] Request data, response status code and response headers
|
262
|
+
def show_request_with_http_info(id, opts = {})
|
263
|
+
if @api_client.config.debugging
|
264
|
+
@api_client.config.logger.debug 'Calling API: RequestApi.show_request ...'
|
265
|
+
end
|
266
|
+
# verify the required parameter 'id' is set
|
267
|
+
if @api_client.config.client_side_validation && id.nil?
|
268
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling RequestApi.show_request"
|
269
|
+
end
|
270
|
+
pattern = Regexp.new(/^\d+$/)
|
271
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
272
|
+
fail ArgumentError, "invalid value for 'id' when calling RequestApi.show_request, must conform to the pattern #{pattern}."
|
273
|
+
end
|
274
|
+
|
275
|
+
# resource path
|
276
|
+
local_var_path = '/requests/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
277
|
+
|
278
|
+
# query parameters
|
279
|
+
query_params = opts[:query_params] || {}
|
280
|
+
|
281
|
+
# header parameters
|
282
|
+
header_params = opts[:header_params] || {}
|
283
|
+
# HTTP header 'Accept' (if needed)
|
284
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
285
|
+
|
286
|
+
# form parameters
|
287
|
+
form_params = opts[:form_params] || {}
|
288
|
+
|
289
|
+
# http body (model)
|
290
|
+
post_body = opts[:body]
|
291
|
+
|
292
|
+
# return_type
|
293
|
+
return_type = opts[:return_type] || 'Request'
|
294
|
+
|
295
|
+
# auth_names
|
296
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
297
|
+
|
298
|
+
new_options = opts.merge(
|
299
|
+
:header_params => header_params,
|
300
|
+
:query_params => query_params,
|
301
|
+
:form_params => form_params,
|
302
|
+
:body => post_body,
|
303
|
+
:auth_names => auth_names,
|
304
|
+
:return_type => return_type
|
305
|
+
)
|
306
|
+
|
307
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
308
|
+
if @api_client.config.debugging
|
309
|
+
@api_client.config.logger.debug "API called: RequestApi#show_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
310
|
+
end
|
311
|
+
return data, status_code, headers
|
312
|
+
end
|
313
|
+
|
314
|
+
# Return request content of a given request id
|
315
|
+
# Return request content of a given request id, available to all
|
316
|
+
# @param request_id [String] Id of request
|
317
|
+
# @param [Hash] opts the optional parameters
|
318
|
+
# @return [Object]
|
319
|
+
def show_request_content(request_id, opts = {})
|
320
|
+
data, _status_code, _headers = show_request_content_with_http_info(request_id, opts)
|
321
|
+
data
|
322
|
+
end
|
323
|
+
|
324
|
+
# Return request content of a given request id
|
325
|
+
# Return request content of a given request id, available to all
|
326
|
+
# @param request_id [String] Id of request
|
327
|
+
# @param [Hash] opts the optional parameters
|
328
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
329
|
+
def show_request_content_with_http_info(request_id, opts = {})
|
330
|
+
if @api_client.config.debugging
|
331
|
+
@api_client.config.logger.debug 'Calling API: RequestApi.show_request_content ...'
|
332
|
+
end
|
333
|
+
# verify the required parameter 'request_id' is set
|
334
|
+
if @api_client.config.client_side_validation && request_id.nil?
|
335
|
+
fail ArgumentError, "Missing the required parameter 'request_id' when calling RequestApi.show_request_content"
|
336
|
+
end
|
337
|
+
pattern = Regexp.new(/^\d+$/)
|
338
|
+
if @api_client.config.client_side_validation && request_id !~ pattern
|
339
|
+
fail ArgumentError, "invalid value for 'request_id' when calling RequestApi.show_request_content, must conform to the pattern #{pattern}."
|
340
|
+
end
|
341
|
+
|
342
|
+
# resource path
|
343
|
+
local_var_path = '/requests/{request_id}/content'.sub('{' + 'request_id' + '}', CGI.escape(request_id.to_s))
|
344
|
+
|
345
|
+
# query parameters
|
346
|
+
query_params = opts[:query_params] || {}
|
347
|
+
|
348
|
+
# header parameters
|
349
|
+
header_params = opts[:header_params] || {}
|
350
|
+
# HTTP header 'Accept' (if needed)
|
351
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
352
|
+
|
353
|
+
# form parameters
|
354
|
+
form_params = opts[:form_params] || {}
|
355
|
+
|
356
|
+
# http body (model)
|
357
|
+
post_body = opts[:body]
|
358
|
+
|
359
|
+
# return_type
|
360
|
+
return_type = opts[:return_type] || 'Object'
|
361
|
+
|
362
|
+
# auth_names
|
363
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
364
|
+
|
365
|
+
new_options = opts.merge(
|
366
|
+
:header_params => header_params,
|
367
|
+
:query_params => query_params,
|
368
|
+
:form_params => form_params,
|
369
|
+
:body => post_body,
|
370
|
+
:auth_names => auth_names,
|
371
|
+
:return_type => return_type
|
372
|
+
)
|
373
|
+
|
374
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
375
|
+
if @api_client.config.debugging
|
376
|
+
@api_client.config.logger.debug "API called: RequestApi#show_request_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
377
|
+
end
|
378
|
+
return data, status_code, headers
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
@@ -0,0 +1,169 @@
|
|
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 TemplateApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Return all templates, only available for admin
|
23
|
+
# Return all templates
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100)
|
26
|
+
# @option opts [Integer] :offset Starting Offset (default to 0)
|
27
|
+
# @option opts [Object] :filter Filter for querying collections.
|
28
|
+
# @option opts [String] :sort_by Parameter to sort collection
|
29
|
+
# @return [TemplateCollection]
|
30
|
+
def list_templates(opts = {})
|
31
|
+
data, _status_code, _headers = list_templates_with_http_info(opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Return all templates, only available for admin
|
36
|
+
# Return all templates
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [Integer] :limit How many items to return at one time (max 1000)
|
39
|
+
# @option opts [Integer] :offset Starting Offset
|
40
|
+
# @option opts [Object] :filter Filter for querying collections.
|
41
|
+
# @option opts [String] :sort_by Parameter to sort collection
|
42
|
+
# @return [Array<(TemplateCollection, Integer, Hash)>] TemplateCollection data, response status code and response headers
|
43
|
+
def list_templates_with_http_info(opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: TemplateApi.list_templates ...'
|
46
|
+
end
|
47
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
|
48
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TemplateApi.list_templates, must be smaller than or equal to 1000.'
|
49
|
+
end
|
50
|
+
|
51
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
52
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TemplateApi.list_templates, must be greater than or equal to 1.'
|
53
|
+
end
|
54
|
+
|
55
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
56
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling TemplateApi.list_templates, must be greater than or equal to 0.'
|
57
|
+
end
|
58
|
+
|
59
|
+
# resource path
|
60
|
+
local_var_path = '/templates'
|
61
|
+
|
62
|
+
# query parameters
|
63
|
+
query_params = opts[:query_params] || {}
|
64
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
65
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
66
|
+
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
|
67
|
+
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
|
68
|
+
|
69
|
+
# header parameters
|
70
|
+
header_params = opts[:header_params] || {}
|
71
|
+
# HTTP header 'Accept' (if needed)
|
72
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
+
|
74
|
+
# form parameters
|
75
|
+
form_params = opts[:form_params] || {}
|
76
|
+
|
77
|
+
# http body (model)
|
78
|
+
post_body = opts[:body]
|
79
|
+
|
80
|
+
# return_type
|
81
|
+
return_type = opts[:return_type] || 'TemplateCollection'
|
82
|
+
|
83
|
+
# auth_names
|
84
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
85
|
+
|
86
|
+
new_options = opts.merge(
|
87
|
+
:header_params => header_params,
|
88
|
+
:query_params => query_params,
|
89
|
+
:form_params => form_params,
|
90
|
+
:body => post_body,
|
91
|
+
:auth_names => auth_names,
|
92
|
+
:return_type => return_type
|
93
|
+
)
|
94
|
+
|
95
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
96
|
+
if @api_client.config.debugging
|
97
|
+
@api_client.config.logger.debug "API called: TemplateApi#list_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
98
|
+
end
|
99
|
+
return data, status_code, headers
|
100
|
+
end
|
101
|
+
|
102
|
+
# Return a template by given id, only available for admin
|
103
|
+
# Return a template by given id
|
104
|
+
# @param id [String] Query by id
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @return [Template]
|
107
|
+
def show_template(id, opts = {})
|
108
|
+
data, _status_code, _headers = show_template_with_http_info(id, opts)
|
109
|
+
data
|
110
|
+
end
|
111
|
+
|
112
|
+
# Return a template by given id, only available for admin
|
113
|
+
# Return a template by given id
|
114
|
+
# @param id [String] Query by id
|
115
|
+
# @param [Hash] opts the optional parameters
|
116
|
+
# @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
|
117
|
+
def show_template_with_http_info(id, opts = {})
|
118
|
+
if @api_client.config.debugging
|
119
|
+
@api_client.config.logger.debug 'Calling API: TemplateApi.show_template ...'
|
120
|
+
end
|
121
|
+
# verify the required parameter 'id' is set
|
122
|
+
if @api_client.config.client_side_validation && id.nil?
|
123
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling TemplateApi.show_template"
|
124
|
+
end
|
125
|
+
pattern = Regexp.new(/^\d+$/)
|
126
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
127
|
+
fail ArgumentError, "invalid value for 'id' when calling TemplateApi.show_template, must conform to the pattern #{pattern}."
|
128
|
+
end
|
129
|
+
|
130
|
+
# resource path
|
131
|
+
local_var_path = '/templates/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
132
|
+
|
133
|
+
# query parameters
|
134
|
+
query_params = opts[:query_params] || {}
|
135
|
+
|
136
|
+
# header parameters
|
137
|
+
header_params = opts[:header_params] || {}
|
138
|
+
# HTTP header 'Accept' (if needed)
|
139
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
140
|
+
|
141
|
+
# form parameters
|
142
|
+
form_params = opts[:form_params] || {}
|
143
|
+
|
144
|
+
# http body (model)
|
145
|
+
post_body = opts[:body]
|
146
|
+
|
147
|
+
# return_type
|
148
|
+
return_type = opts[:return_type] || 'Template'
|
149
|
+
|
150
|
+
# auth_names
|
151
|
+
auth_names = opts[:auth_names] || ['Basic_auth']
|
152
|
+
|
153
|
+
new_options = opts.merge(
|
154
|
+
:header_params => header_params,
|
155
|
+
:query_params => query_params,
|
156
|
+
:form_params => form_params,
|
157
|
+
:body => post_body,
|
158
|
+
:auth_names => auth_names,
|
159
|
+
:return_type => return_type
|
160
|
+
)
|
161
|
+
|
162
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
163
|
+
if @api_client.config.debugging
|
164
|
+
@api_client.config.logger.debug "API called: TemplateApi#show_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
165
|
+
end
|
166
|
+
return data, status_code, headers
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|