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.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +142 -0
  4. data/Rakefile +10 -0
  5. data/client-meta.json +9 -0
  6. data/docs/Action.md +27 -0
  7. data/docs/ActionApi.md +172 -0
  8. data/docs/ActionCollection.md +21 -0
  9. data/docs/CollectionLinks.md +23 -0
  10. data/docs/CollectionMetadata.md +21 -0
  11. data/docs/GraphqlApi.md +62 -0
  12. data/docs/GraphqlIn.md +21 -0
  13. data/docs/GraphqlOut.md +19 -0
  14. data/docs/GroupRef.md +19 -0
  15. data/docs/HttpApiError.md +19 -0
  16. data/docs/HttpApiErrorCollection.md +17 -0
  17. data/docs/Request.md +49 -0
  18. data/docs/RequestApi.md +292 -0
  19. data/docs/RequestCollection.md +21 -0
  20. data/docs/RequestIn.md +23 -0
  21. data/docs/ResourceObject.md +21 -0
  22. data/docs/Tag.md +17 -0
  23. data/docs/TagResource.md +21 -0
  24. data/docs/Template.md +23 -0
  25. data/docs/TemplateApi.md +124 -0
  26. data/docs/TemplateCollection.md +21 -0
  27. data/docs/Workflow.md +29 -0
  28. data/docs/WorkflowApi.md +469 -0
  29. data/docs/WorkflowCollection.md +21 -0
  30. data/generate.sh +9 -0
  31. data/git_push.sh +58 -0
  32. data/insights-approval-api-client.gemspec +39 -0
  33. data/lib/insights-approval-api-client.rb +63 -0
  34. data/lib/insights-approval-api-client/api/action_api.rb +231 -0
  35. data/lib/insights-approval-api-client/api/graphql_api.rb +86 -0
  36. data/lib/insights-approval-api-client/api/request_api.rb +381 -0
  37. data/lib/insights-approval-api-client/api/template_api.rb +169 -0
  38. data/lib/insights-approval-api-client/api/workflow_api.rb +630 -0
  39. data/lib/insights-approval-api-client/api_client.rb +386 -0
  40. data/lib/insights-approval-api-client/api_error.rb +57 -0
  41. data/lib/insights-approval-api-client/configuration.rb +268 -0
  42. data/lib/insights-approval-api-client/models/action.rb +293 -0
  43. data/lib/insights-approval-api-client/models/action_collection.rb +226 -0
  44. data/lib/insights-approval-api-client/models/collection_links.rb +237 -0
  45. data/lib/insights-approval-api-client/models/collection_metadata.rb +227 -0
  46. data/lib/insights-approval-api-client/models/graphql_in.rb +237 -0
  47. data/lib/insights-approval-api-client/models/graphql_out.rb +219 -0
  48. data/lib/insights-approval-api-client/models/group_ref.rb +223 -0
  49. data/lib/insights-approval-api-client/models/http_api_error.rb +218 -0
  50. data/lib/insights-approval-api-client/models/http_api_error_collection.rb +210 -0
  51. data/lib/insights-approval-api-client/models/request.rb +417 -0
  52. data/lib/insights-approval-api-client/models/request_collection.rb +226 -0
  53. data/lib/insights-approval-api-client/models/request_in.rb +255 -0
  54. data/lib/insights-approval-api-client/models/resource_object.rb +243 -0
  55. data/lib/insights-approval-api-client/models/tag.rb +207 -0
  56. data/lib/insights-approval-api-client/models/tag_resource.rb +242 -0
  57. data/lib/insights-approval-api-client/models/template.rb +235 -0
  58. data/lib/insights-approval-api-client/models/template_collection.rb +226 -0
  59. data/lib/insights-approval-api-client/models/workflow.rb +283 -0
  60. data/lib/insights-approval-api-client/models/workflow_collection.rb +226 -0
  61. data/lib/insights-approval-api-client/version.rb +15 -0
  62. data/openapi.json +1540 -0
  63. data/spec/api/action_api_spec.rb +72 -0
  64. data/spec/api/graphql_api_spec.rb +47 -0
  65. data/spec/api/request_api_spec.rb +100 -0
  66. data/spec/api/template_api_spec.rb +62 -0
  67. data/spec/api/workflow_api_spec.rb +145 -0
  68. data/spec/api_client_spec.rb +226 -0
  69. data/spec/configuration_spec.rb +42 -0
  70. data/spec/models/action_collection_spec.rb +53 -0
  71. data/spec/models/action_spec.rb +75 -0
  72. data/spec/models/collection_links_spec.rb +59 -0
  73. data/spec/models/collection_metadata_spec.rb +53 -0
  74. data/spec/models/graphql_in_spec.rb +53 -0
  75. data/spec/models/graphql_out_spec.rb +47 -0
  76. data/spec/models/group_ref_spec.rb +47 -0
  77. data/spec/models/http_api_error_collection_spec.rb +41 -0
  78. data/spec/models/http_api_error_spec.rb +47 -0
  79. data/spec/models/request_collection_spec.rb +53 -0
  80. data/spec/models/request_in_spec.rb +59 -0
  81. data/spec/models/request_spec.rb +145 -0
  82. data/spec/models/resource_object_spec.rb +53 -0
  83. data/spec/models/tag_resource_spec.rb +53 -0
  84. data/spec/models/tag_spec.rb +41 -0
  85. data/spec/models/template_collection_spec.rb +53 -0
  86. data/spec/models/template_spec.rb +59 -0
  87. data/spec/models/workflow_collection_spec.rb +53 -0
  88. data/spec/models/workflow_spec.rb +77 -0
  89. data/spec/spec_helper.rb +111 -0
  90. metadata +218 -0
@@ -0,0 +1,630 @@
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 WorkflowApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Add a workflow by given template id, only available for admin
23
+ # Add a workflow by given template id
24
+ # @param template_id [String] Id of template
25
+ # @param workflow [Workflow] Parameters need to create workflow
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [Workflow]
28
+ def add_workflow_to_template(template_id, workflow, opts = {})
29
+ data, _status_code, _headers = add_workflow_to_template_with_http_info(template_id, workflow, opts)
30
+ data
31
+ end
32
+
33
+ # Add a workflow by given template id, only available for admin
34
+ # Add a workflow by given template id
35
+ # @param template_id [String] Id of template
36
+ # @param workflow [Workflow] Parameters need to create workflow
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers
39
+ def add_workflow_to_template_with_http_info(template_id, workflow, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.add_workflow_to_template ...'
42
+ end
43
+ # verify the required parameter 'template_id' is set
44
+ if @api_client.config.client_side_validation && template_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling WorkflowApi.add_workflow_to_template"
46
+ end
47
+ pattern = Regexp.new(/^\d+$/)
48
+ if @api_client.config.client_side_validation && template_id !~ pattern
49
+ fail ArgumentError, "invalid value for 'template_id' when calling WorkflowApi.add_workflow_to_template, must conform to the pattern #{pattern}."
50
+ end
51
+
52
+ # verify the required parameter 'workflow' is set
53
+ if @api_client.config.client_side_validation && workflow.nil?
54
+ fail ArgumentError, "Missing the required parameter 'workflow' when calling WorkflowApi.add_workflow_to_template"
55
+ end
56
+ # resource path
57
+ local_var_path = '/templates/{template_id}/workflows'.sub('{' + 'template_id' + '}', CGI.escape(template_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(workflow)
74
+
75
+ # return_type
76
+ return_type = opts[:return_type] || 'Workflow'
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: WorkflowApi#add_workflow_to_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
96
+
97
+ # Delete approval workflow by given id, only available for admin
98
+ # Delete approval workflow by given id
99
+ # @param id [String] Query by id
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [nil]
102
+ def destroy_workflow(id, opts = {})
103
+ destroy_workflow_with_http_info(id, opts)
104
+ nil
105
+ end
106
+
107
+ # Delete approval workflow by given id, only available for admin
108
+ # Delete approval workflow by given id
109
+ # @param id [String] Query by id
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
112
+ def destroy_workflow_with_http_info(id, opts = {})
113
+ if @api_client.config.debugging
114
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.destroy_workflow ...'
115
+ end
116
+ # verify the required parameter 'id' is set
117
+ if @api_client.config.client_side_validation && id.nil?
118
+ fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.destroy_workflow"
119
+ end
120
+ pattern = Regexp.new(/^\d+$/)
121
+ if @api_client.config.client_side_validation && id !~ pattern
122
+ fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.destroy_workflow, must conform to the pattern #{pattern}."
123
+ end
124
+
125
+ # resource path
126
+ local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+
134
+ # form parameters
135
+ form_params = opts[:form_params] || {}
136
+
137
+ # http body (model)
138
+ post_body = opts[:body]
139
+
140
+ # return_type
141
+ return_type = opts[:return_type]
142
+
143
+ # auth_names
144
+ auth_names = opts[:auth_names] || ['Basic_auth']
145
+
146
+ new_options = opts.merge(
147
+ :header_params => header_params,
148
+ :query_params => query_params,
149
+ :form_params => form_params,
150
+ :body => post_body,
151
+ :auth_names => auth_names,
152
+ :return_type => return_type
153
+ )
154
+
155
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
156
+ if @api_client.config.debugging
157
+ @api_client.config.logger.debug "API called: WorkflowApi#destroy_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
158
+ end
159
+ return data, status_code, headers
160
+ end
161
+
162
+ # Create a resource link to a given workflow
163
+ # Link a resource object to a given workflow
164
+ # @param id [String] Query by id
165
+ # @param resource_object [ResourceObject] Parameters needed to create a link
166
+ # @param [Hash] opts the optional parameters
167
+ # @return [nil]
168
+ def link_workflow(id, resource_object, opts = {})
169
+ link_workflow_with_http_info(id, resource_object, opts)
170
+ nil
171
+ end
172
+
173
+ # Create a resource link to a given workflow
174
+ # Link a resource object to a given workflow
175
+ # @param id [String] Query by id
176
+ # @param resource_object [ResourceObject] Parameters needed to create a link
177
+ # @param [Hash] opts the optional parameters
178
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
179
+ def link_workflow_with_http_info(id, resource_object, opts = {})
180
+ if @api_client.config.debugging
181
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.link_workflow ...'
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 WorkflowApi.link_workflow"
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 WorkflowApi.link_workflow, must conform to the pattern #{pattern}."
190
+ end
191
+
192
+ # verify the required parameter 'resource_object' is set
193
+ if @api_client.config.client_side_validation && resource_object.nil?
194
+ fail ArgumentError, "Missing the required parameter 'resource_object' when calling WorkflowApi.link_workflow"
195
+ end
196
+ # resource path
197
+ local_var_path = '/workflows/{id}/link'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
198
+
199
+ # query parameters
200
+ query_params = opts[:query_params] || {}
201
+
202
+ # header parameters
203
+ header_params = opts[:header_params] || {}
204
+ # HTTP header 'Content-Type'
205
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
206
+
207
+ # form parameters
208
+ form_params = opts[:form_params] || {}
209
+
210
+ # http body (model)
211
+ post_body = opts[:body] || @api_client.object_to_http_body(resource_object)
212
+
213
+ # return_type
214
+ return_type = opts[:return_type]
215
+
216
+ # auth_names
217
+ auth_names = opts[:auth_names] || ['Basic_auth']
218
+
219
+ new_options = opts.merge(
220
+ :header_params => header_params,
221
+ :query_params => query_params,
222
+ :form_params => form_params,
223
+ :body => post_body,
224
+ :auth_names => auth_names,
225
+ :return_type => return_type
226
+ )
227
+
228
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
229
+ if @api_client.config.debugging
230
+ @api_client.config.logger.debug "API called: WorkflowApi#link_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
231
+ end
232
+ return data, status_code, headers
233
+ end
234
+
235
+ # Return all approval workflows, only available for admin
236
+ # Depends on the query parameters, either return all workflows in ascending sequence order when no parameters are provided; or return the workflows linking to the resource object whose app_name, object_type and object_id are specified by query parameters
237
+ # @param [Hash] opts the optional parameters
238
+ # @option opts [String] :app_name Name of the application
239
+ # @option opts [String] :object_id Id of the resource object
240
+ # @option opts [String] :object_type Type of the resource object
241
+ # @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100)
242
+ # @option opts [Integer] :offset Starting Offset (default to 0)
243
+ # @option opts [Object] :filter Filter for querying collections.
244
+ # @option opts [String] :sort_by Parameter to sort collection
245
+ # @return [WorkflowCollection]
246
+ def list_workflows(opts = {})
247
+ data, _status_code, _headers = list_workflows_with_http_info(opts)
248
+ data
249
+ end
250
+
251
+ # Return all approval workflows, only available for admin
252
+ # Depends on the query parameters, either return all workflows in ascending sequence order when no parameters are provided; or return the workflows linking to the resource object whose app_name, object_type and object_id are specified by query parameters
253
+ # @param [Hash] opts the optional parameters
254
+ # @option opts [String] :app_name Name of the application
255
+ # @option opts [String] :object_id Id of the resource object
256
+ # @option opts [String] :object_type Type of the resource object
257
+ # @option opts [Integer] :limit How many items to return at one time (max 1000)
258
+ # @option opts [Integer] :offset Starting Offset
259
+ # @option opts [Object] :filter Filter for querying collections.
260
+ # @option opts [String] :sort_by Parameter to sort collection
261
+ # @return [Array<(WorkflowCollection, Integer, Hash)>] WorkflowCollection data, response status code and response headers
262
+ def list_workflows_with_http_info(opts = {})
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.list_workflows ...'
265
+ end
266
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
267
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows, must be smaller than or equal to 1000.'
268
+ end
269
+
270
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
271
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows, must be greater than or equal to 1.'
272
+ end
273
+
274
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
275
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WorkflowApi.list_workflows, must be greater than or equal to 0.'
276
+ end
277
+
278
+ # resource path
279
+ local_var_path = '/workflows'
280
+
281
+ # query parameters
282
+ query_params = opts[:query_params] || {}
283
+ query_params[:'app_name'] = opts[:'app_name'] if !opts[:'app_name'].nil?
284
+ query_params[:'object_id'] = opts[:'object_id'] if !opts[:'object_id'].nil?
285
+ query_params[:'object_type'] = opts[:'object_type'] if !opts[:'object_type'].nil?
286
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
287
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
288
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
289
+ query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
290
+
291
+ # header parameters
292
+ header_params = opts[:header_params] || {}
293
+ # HTTP header 'Accept' (if needed)
294
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
295
+
296
+ # form parameters
297
+ form_params = opts[:form_params] || {}
298
+
299
+ # http body (model)
300
+ post_body = opts[:body]
301
+
302
+ # return_type
303
+ return_type = opts[:return_type] || 'WorkflowCollection'
304
+
305
+ # auth_names
306
+ auth_names = opts[:auth_names] || ['Basic_auth']
307
+
308
+ new_options = opts.merge(
309
+ :header_params => header_params,
310
+ :query_params => query_params,
311
+ :form_params => form_params,
312
+ :body => post_body,
313
+ :auth_names => auth_names,
314
+ :return_type => return_type
315
+ )
316
+
317
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
318
+ if @api_client.config.debugging
319
+ @api_client.config.logger.debug "API called: WorkflowApi#list_workflows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
320
+ end
321
+ return data, status_code, headers
322
+ end
323
+
324
+ # Return an array of workflows by given template id, only available for admin
325
+ # Return an array of workflows by given template id
326
+ # @param template_id [String] Id of template
327
+ # @param [Hash] opts the optional parameters
328
+ # @option opts [Integer] :limit How many items to return at one time (max 1000) (default to 100)
329
+ # @option opts [Integer] :offset Starting Offset (default to 0)
330
+ # @option opts [Object] :filter Filter for querying collections.
331
+ # @option opts [String] :sort_by Parameter to sort collection
332
+ # @return [WorkflowCollection]
333
+ def list_workflows_by_template(template_id, opts = {})
334
+ data, _status_code, _headers = list_workflows_by_template_with_http_info(template_id, opts)
335
+ data
336
+ end
337
+
338
+ # Return an array of workflows by given template id, only available for admin
339
+ # Return an array of workflows by given template id
340
+ # @param template_id [String] Id of template
341
+ # @param [Hash] opts the optional parameters
342
+ # @option opts [Integer] :limit How many items to return at one time (max 1000)
343
+ # @option opts [Integer] :offset Starting Offset
344
+ # @option opts [Object] :filter Filter for querying collections.
345
+ # @option opts [String] :sort_by Parameter to sort collection
346
+ # @return [Array<(WorkflowCollection, Integer, Hash)>] WorkflowCollection data, response status code and response headers
347
+ def list_workflows_by_template_with_http_info(template_id, opts = {})
348
+ if @api_client.config.debugging
349
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.list_workflows_by_template ...'
350
+ end
351
+ # verify the required parameter 'template_id' is set
352
+ if @api_client.config.client_side_validation && template_id.nil?
353
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling WorkflowApi.list_workflows_by_template"
354
+ end
355
+ pattern = Regexp.new(/^\d+$/)
356
+ if @api_client.config.client_side_validation && template_id !~ pattern
357
+ fail ArgumentError, "invalid value for 'template_id' when calling WorkflowApi.list_workflows_by_template, must conform to the pattern #{pattern}."
358
+ end
359
+
360
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
361
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows_by_template, must be smaller than or equal to 1000.'
362
+ end
363
+
364
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
365
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WorkflowApi.list_workflows_by_template, must be greater than or equal to 1.'
366
+ end
367
+
368
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
369
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WorkflowApi.list_workflows_by_template, must be greater than or equal to 0.'
370
+ end
371
+
372
+ # resource path
373
+ local_var_path = '/templates/{template_id}/workflows'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))
374
+
375
+ # query parameters
376
+ query_params = opts[:query_params] || {}
377
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
378
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
379
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
380
+ query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
381
+
382
+ # header parameters
383
+ header_params = opts[:header_params] || {}
384
+ # HTTP header 'Accept' (if needed)
385
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
386
+
387
+ # form parameters
388
+ form_params = opts[:form_params] || {}
389
+
390
+ # http body (model)
391
+ post_body = opts[:body]
392
+
393
+ # return_type
394
+ return_type = opts[:return_type] || 'WorkflowCollection'
395
+
396
+ # auth_names
397
+ auth_names = opts[:auth_names] || ['Basic_auth']
398
+
399
+ new_options = opts.merge(
400
+ :header_params => header_params,
401
+ :query_params => query_params,
402
+ :form_params => form_params,
403
+ :body => post_body,
404
+ :auth_names => auth_names,
405
+ :return_type => return_type
406
+ )
407
+
408
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
409
+ if @api_client.config.debugging
410
+ @api_client.config.logger.debug "API called: WorkflowApi#list_workflows_by_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
411
+ end
412
+ return data, status_code, headers
413
+ end
414
+
415
+ # Return an approval workflow by given id, only available for admin
416
+ # Return an approval workflow by given id
417
+ # @param id [String] Query by id
418
+ # @param [Hash] opts the optional parameters
419
+ # @return [Workflow]
420
+ def show_workflow(id, opts = {})
421
+ data, _status_code, _headers = show_workflow_with_http_info(id, opts)
422
+ data
423
+ end
424
+
425
+ # Return an approval workflow by given id, only available for admin
426
+ # Return an approval workflow by given id
427
+ # @param id [String] Query by id
428
+ # @param [Hash] opts the optional parameters
429
+ # @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers
430
+ def show_workflow_with_http_info(id, opts = {})
431
+ if @api_client.config.debugging
432
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.show_workflow ...'
433
+ end
434
+ # verify the required parameter 'id' is set
435
+ if @api_client.config.client_side_validation && id.nil?
436
+ fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.show_workflow"
437
+ end
438
+ pattern = Regexp.new(/^\d+$/)
439
+ if @api_client.config.client_side_validation && id !~ pattern
440
+ fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.show_workflow, must conform to the pattern #{pattern}."
441
+ end
442
+
443
+ # resource path
444
+ local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
445
+
446
+ # query parameters
447
+ query_params = opts[:query_params] || {}
448
+
449
+ # header parameters
450
+ header_params = opts[:header_params] || {}
451
+ # HTTP header 'Accept' (if needed)
452
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
453
+
454
+ # form parameters
455
+ form_params = opts[:form_params] || {}
456
+
457
+ # http body (model)
458
+ post_body = opts[:body]
459
+
460
+ # return_type
461
+ return_type = opts[:return_type] || 'Workflow'
462
+
463
+ # auth_names
464
+ auth_names = opts[:auth_names] || ['Basic_auth']
465
+
466
+ new_options = opts.merge(
467
+ :header_params => header_params,
468
+ :query_params => query_params,
469
+ :form_params => form_params,
470
+ :body => post_body,
471
+ :auth_names => auth_names,
472
+ :return_type => return_type
473
+ )
474
+
475
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
476
+ if @api_client.config.debugging
477
+ @api_client.config.logger.debug "API called: WorkflowApi#show_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
478
+ end
479
+ return data, status_code, headers
480
+ end
481
+
482
+ # Break the link between a resource object and selected workflow
483
+ # Break the link between a resource object and selected workflow
484
+ # @param id [String] Query by id
485
+ # @param resource_object [ResourceObject] Parameters needed to remove a link
486
+ # @param [Hash] opts the optional parameters
487
+ # @return [nil]
488
+ def unlink_workflow(id, resource_object, opts = {})
489
+ unlink_workflow_with_http_info(id, resource_object, opts)
490
+ nil
491
+ end
492
+
493
+ # Break the link between a resource object and selected workflow
494
+ # Break the link between a resource object and selected workflow
495
+ # @param id [String] Query by id
496
+ # @param resource_object [ResourceObject] Parameters needed to remove a link
497
+ # @param [Hash] opts the optional parameters
498
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
499
+ def unlink_workflow_with_http_info(id, resource_object, opts = {})
500
+ if @api_client.config.debugging
501
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.unlink_workflow ...'
502
+ end
503
+ # verify the required parameter 'id' is set
504
+ if @api_client.config.client_side_validation && id.nil?
505
+ fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.unlink_workflow"
506
+ end
507
+ pattern = Regexp.new(/^\d+$/)
508
+ if @api_client.config.client_side_validation && id !~ pattern
509
+ fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.unlink_workflow, must conform to the pattern #{pattern}."
510
+ end
511
+
512
+ # verify the required parameter 'resource_object' is set
513
+ if @api_client.config.client_side_validation && resource_object.nil?
514
+ fail ArgumentError, "Missing the required parameter 'resource_object' when calling WorkflowApi.unlink_workflow"
515
+ end
516
+ # resource path
517
+ local_var_path = '/workflows/{id}/unlink'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
518
+
519
+ # query parameters
520
+ query_params = opts[:query_params] || {}
521
+
522
+ # header parameters
523
+ header_params = opts[:header_params] || {}
524
+ # HTTP header 'Content-Type'
525
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
526
+
527
+ # form parameters
528
+ form_params = opts[:form_params] || {}
529
+
530
+ # http body (model)
531
+ post_body = opts[:body] || @api_client.object_to_http_body(resource_object)
532
+
533
+ # return_type
534
+ return_type = opts[:return_type]
535
+
536
+ # auth_names
537
+ auth_names = opts[:auth_names] || ['Basic_auth']
538
+
539
+ new_options = opts.merge(
540
+ :header_params => header_params,
541
+ :query_params => query_params,
542
+ :form_params => form_params,
543
+ :body => post_body,
544
+ :auth_names => auth_names,
545
+ :return_type => return_type
546
+ )
547
+
548
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
549
+ if @api_client.config.debugging
550
+ @api_client.config.logger.debug "API called: WorkflowApi#unlink_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
551
+ end
552
+ return data, status_code, headers
553
+ end
554
+
555
+ # Update an approval workflow by given id, only available for admin
556
+ # Update an approval workflow by given id
557
+ # @param id [String] Query by id
558
+ # @param workflow [Workflow] Parameters need to update approval workflow
559
+ # @param [Hash] opts the optional parameters
560
+ # @return [Workflow]
561
+ def update_workflow(id, workflow, opts = {})
562
+ data, _status_code, _headers = update_workflow_with_http_info(id, workflow, opts)
563
+ data
564
+ end
565
+
566
+ # Update an approval workflow by given id, only available for admin
567
+ # Update an approval workflow by given id
568
+ # @param id [String] Query by id
569
+ # @param workflow [Workflow] Parameters need to update approval workflow
570
+ # @param [Hash] opts the optional parameters
571
+ # @return [Array<(Workflow, Integer, Hash)>] Workflow data, response status code and response headers
572
+ def update_workflow_with_http_info(id, workflow, opts = {})
573
+ if @api_client.config.debugging
574
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.update_workflow ...'
575
+ end
576
+ # verify the required parameter 'id' is set
577
+ if @api_client.config.client_side_validation && id.nil?
578
+ fail ArgumentError, "Missing the required parameter 'id' when calling WorkflowApi.update_workflow"
579
+ end
580
+ pattern = Regexp.new(/^\d+$/)
581
+ if @api_client.config.client_side_validation && id !~ pattern
582
+ fail ArgumentError, "invalid value for 'id' when calling WorkflowApi.update_workflow, must conform to the pattern #{pattern}."
583
+ end
584
+
585
+ # verify the required parameter 'workflow' is set
586
+ if @api_client.config.client_side_validation && workflow.nil?
587
+ fail ArgumentError, "Missing the required parameter 'workflow' when calling WorkflowApi.update_workflow"
588
+ end
589
+ # resource path
590
+ local_var_path = '/workflows/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
591
+
592
+ # query parameters
593
+ query_params = opts[:query_params] || {}
594
+
595
+ # header parameters
596
+ header_params = opts[:header_params] || {}
597
+ # HTTP header 'Accept' (if needed)
598
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
599
+ # HTTP header 'Content-Type'
600
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
601
+
602
+ # form parameters
603
+ form_params = opts[:form_params] || {}
604
+
605
+ # http body (model)
606
+ post_body = opts[:body] || @api_client.object_to_http_body(workflow)
607
+
608
+ # return_type
609
+ return_type = opts[:return_type] || 'Workflow'
610
+
611
+ # auth_names
612
+ auth_names = opts[:auth_names] || ['Basic_auth']
613
+
614
+ new_options = opts.merge(
615
+ :header_params => header_params,
616
+ :query_params => query_params,
617
+ :form_params => form_params,
618
+ :body => post_body,
619
+ :auth_names => auth_names,
620
+ :return_type => return_type
621
+ )
622
+
623
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
624
+ if @api_client.config.debugging
625
+ @api_client.config.logger.debug "API called: WorkflowApi#update_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
626
+ end
627
+ return data, status_code, headers
628
+ end
629
+ end
630
+ end