sdksio-apimatic-sdk 3.0.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 (70) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +82 -0
  4. data/lib/apimatic_api/api_helper.rb +10 -0
  5. data/lib/apimatic_api/client.rb +96 -0
  6. data/lib/apimatic_api/configuration.rb +125 -0
  7. data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +84 -0
  8. data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +74 -0
  9. data/lib/apimatic_api/controllers/apis_management_controller.rb +260 -0
  10. data/lib/apimatic_api/controllers/base_controller.rb +66 -0
  11. data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +178 -0
  12. data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +136 -0
  13. data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +198 -0
  14. data/lib/apimatic_api/controllers/transformation_controller.rb +174 -0
  15. data/lib/apimatic_api/exceptions/api_exception.rb +10 -0
  16. data/lib/apimatic_api/http/auth/custom_header_authentication.rb +42 -0
  17. data/lib/apimatic_api/http/http_call_back.rb +10 -0
  18. data/lib/apimatic_api/http/http_method_enum.rb +10 -0
  19. data/lib/apimatic_api/http/http_request.rb +10 -0
  20. data/lib/apimatic_api/http/http_response.rb +10 -0
  21. data/lib/apimatic_api/models/api_entity.rb +220 -0
  22. data/lib/apimatic_api/models/api_entity_code_generation.rb +131 -0
  23. data/lib/apimatic_api/models/api_entity_identifier.rb +48 -0
  24. data/lib/apimatic_api/models/api_validation_summary.rb +75 -0
  25. data/lib/apimatic_api/models/attributes.rb +48 -0
  26. data/lib/apimatic_api/models/auth_scope.rb +75 -0
  27. data/lib/apimatic_api/models/authentication.rb +112 -0
  28. data/lib/apimatic_api/models/base_model.rb +62 -0
  29. data/lib/apimatic_api/models/code_gen_settings.rb +541 -0
  30. data/lib/apimatic_api/models/code_generation.rb +122 -0
  31. data/lib/apimatic_api/models/docs_validation_summary.rb +75 -0
  32. data/lib/apimatic_api/models/endpoints_group.rb +57 -0
  33. data/lib/apimatic_api/models/environment.rb +79 -0
  34. data/lib/apimatic_api/models/export_formats.rb +60 -0
  35. data/lib/apimatic_api/models/field.rb +156 -0
  36. data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +48 -0
  37. data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +61 -0
  38. data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +59 -0
  39. data/lib/apimatic_api/models/import_api_version_via_url_request.rb +64 -0
  40. data/lib/apimatic_api/models/import_api_via_file_request_body.rb +51 -0
  41. data/lib/apimatic_api/models/import_api_via_url_request.rb +49 -0
  42. data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +66 -0
  43. data/lib/apimatic_api/models/import_validation_summary.rb +75 -0
  44. data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +51 -0
  45. data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +49 -0
  46. data/lib/apimatic_api/models/meta_data.rb +70 -0
  47. data/lib/apimatic_api/models/parameter.rb +165 -0
  48. data/lib/apimatic_api/models/paramter_format_details.rb +48 -0
  49. data/lib/apimatic_api/models/platforms.rb +39 -0
  50. data/lib/apimatic_api/models/platforms_template.rb +49 -0
  51. data/lib/apimatic_api/models/server.rb +69 -0
  52. data/lib/apimatic_api/models/server_configuration.rb +105 -0
  53. data/lib/apimatic_api/models/test_gen_settings.rb +70 -0
  54. data/lib/apimatic_api/models/transform_via_file_request_body.rb +61 -0
  55. data/lib/apimatic_api/models/transform_via_url_request.rb +60 -0
  56. data/lib/apimatic_api/models/transformation.rb +152 -0
  57. data/lib/apimatic_api/models/user_code_generation.rb +140 -0
  58. data/lib/apimatic_api/models/user_code_generation_requirements.rb +57 -0
  59. data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +51 -0
  60. data/lib/apimatic_api/utilities/date_time_helper.rb +11 -0
  61. data/lib/apimatic_api/utilities/file_wrapper.rb +16 -0
  62. data/lib/apimatic_api.rb +86 -0
  63. data/test/controllers/controller_test_base.rb +29 -0
  64. data/test/controllers/test_api_validation_external_apis_controller.rb +144 -0
  65. data/test/controllers/test_api_validation_imported_apis_controller.rb +2971 -0
  66. data/test/controllers/test_code_generation_external_apis_controller.rb +32 -0
  67. data/test/controllers/test_docs_portal_management_controller.rb +94 -0
  68. data/test/controllers/test_transformation_controller.rb +32 -0
  69. data/test/http_response_catcher.rb +19 -0
  70. metadata +187 -0
@@ -0,0 +1,260 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # ApisManagementController
8
+ class ApisManagementController < BaseController
9
+ # Import an API into the APIMatic Dashboard by uploading the API
10
+ # specification file.
11
+ # You can also specify [API
12
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
13
+ # importing the API using this endpoint. When specifying Metadata, the
14
+ # uploaded file will be a zip file containing the API specification file and
15
+ # the `APIMATIC-META` json file.
16
+ # @param [File | UploadIO] file Required parameter: The API specification
17
+ # file.<br>The type of the specification file should be any of the
18
+ # [supported
19
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
20
+ # ported-input-formats).
21
+ # @return [ApiEntity] response from the API call
22
+ def import_api_via_file(file)
23
+ new_api_call_builder
24
+ .request(new_request_builder(HttpMethodEnum::POST,
25
+ '/api-entities/import-via-file',
26
+ Server::DEFAULT)
27
+ .multipart_param(new_parameter(file, key: 'file')
28
+ .default_content_type('application/octet-stream'))
29
+ .header_param(new_parameter('application/json', key: 'accept'))
30
+ .auth(Single.new('Authorization')))
31
+ .response(new_response_handler
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(ApiEntity.method(:from_hash))
34
+ .local_error('400',
35
+ 'Bad Request',
36
+ APIException)
37
+ .local_error('412',
38
+ 'Precondition Failed',
39
+ APIException)
40
+ .local_error('422',
41
+ 'Unprocessable Entity',
42
+ APIException)
43
+ .local_error('500',
44
+ 'Internal Server Error',
45
+ APIException))
46
+ .execute
47
+ end
48
+
49
+ # Import an API into the APIMatic Dashboard by providing the URL of the API
50
+ # specification file.
51
+ # You can also specify [API
52
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
53
+ # importing the API using this endpoint. When specifying Metadata, the URL
54
+ # provided will be that of a zip file containing the API specification file
55
+ # and the `APIMATIC-META` json file.
56
+ # @param [ImportApiViaUrlRequest] body Required parameter: Request Body
57
+ # @return [ApiEntity] response from the API call
58
+ def import_api_via_url(body)
59
+ new_api_call_builder
60
+ .request(new_request_builder(HttpMethodEnum::POST,
61
+ '/api-entities/import-via-url',
62
+ Server::DEFAULT)
63
+ .header_param(new_parameter('application/vnd.apimatic.apiEntityUrlImportDto.v1+json', key: 'Content-Type'))
64
+ .body_param(new_parameter(body))
65
+ .header_param(new_parameter('application/json', key: 'accept'))
66
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
67
+ .auth(Single.new('Authorization')))
68
+ .response(new_response_handler
69
+ .deserializer(APIHelper.method(:custom_type_deserializer))
70
+ .deserialize_into(ApiEntity.method(:from_hash))
71
+ .local_error('400',
72
+ 'Bad Request',
73
+ APIException)
74
+ .local_error('412',
75
+ 'Precondition Failed',
76
+ APIException)
77
+ .local_error('422',
78
+ 'Unprocessable Entity',
79
+ APIException)
80
+ .local_error('500',
81
+ 'Internal Server Error',
82
+ APIException))
83
+ .execute
84
+ end
85
+
86
+ # Import a new version for an API, against an existing API Group, by
87
+ # uploading the API specification file.
88
+ # You can also specify [API
89
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
90
+ # importing the API version using this endpoint. When specifying Metadata,
91
+ # the uploaded file will be a zip file containing the API specification file
92
+ # and the `APIMATIC-META` json file.
93
+ # @param [String] api_group_id Required parameter: The ID of the API Group
94
+ # for which to import a new API version.
95
+ # @param [String] version_override Required parameter: The version number
96
+ # with which the new API version will be imported. This version number will
97
+ # override the version specified in the API specification file.<br>APIMatic
98
+ # recommends versioning the API with the [versioning
99
+ # scheme](https://docs.apimatic.io/define-apis/basic-settings/#version)
100
+ # documented in the docs.
101
+ # @param [File | UploadIO] file Required parameter: The API specification
102
+ # file.<br>The type of the specification file should be any of the
103
+ # [supported
104
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
105
+ # ported-input-formats).
106
+ # @return [ApiEntity] response from the API call
107
+ def import_new_api_version_via_file(api_group_id,
108
+ version_override,
109
+ file)
110
+ new_api_call_builder
111
+ .request(new_request_builder(HttpMethodEnum::POST,
112
+ '/api-groups/{api_group_id}/api-entities/import-via-file',
113
+ Server::DEFAULT)
114
+ .template_param(new_parameter(api_group_id, key: 'api_group_id')
115
+ .should_encode(true))
116
+ .form_param(new_parameter(version_override, key: 'version_override'))
117
+ .multipart_param(new_parameter(file, key: 'file')
118
+ .default_content_type('application/octet-stream'))
119
+ .header_param(new_parameter('application/json', key: 'accept'))
120
+ .auth(Single.new('Authorization')))
121
+ .response(new_response_handler
122
+ .deserializer(APIHelper.method(:custom_type_deserializer))
123
+ .deserialize_into(ApiEntity.method(:from_hash)))
124
+ .execute
125
+ end
126
+
127
+ # Import a new version for an API, against an existing API Group, by
128
+ # providing the URL of the API specification file.
129
+ # You can also specify [API
130
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
131
+ # importing the API version using this endpoint. When specifying Metadata,
132
+ # the URL provided will be that of a zip file containing the API
133
+ # specification file and the `APIMATIC-META` json file.
134
+ # @param [String] api_group_id Required parameter: The ID of the API Group
135
+ # for which to import a new API version.
136
+ # @param [ImportApiVersionViaUrlRequest] body Required parameter: Request
137
+ # Body
138
+ # @return [ApiEntity] response from the API call
139
+ def import_new_api_version_via_url(api_group_id,
140
+ body)
141
+ new_api_call_builder
142
+ .request(new_request_builder(HttpMethodEnum::POST,
143
+ '/api-groups/{api_group_id}/api-entities/import-via-url',
144
+ Server::DEFAULT)
145
+ .template_param(new_parameter(api_group_id, key: 'api_group_id')
146
+ .should_encode(true))
147
+ .header_param(new_parameter('application/vnd.apimatic.apiGroupApiEntityUrlImportDto.v1+json', key: 'Content-Type'))
148
+ .body_param(new_parameter(body))
149
+ .header_param(new_parameter('application/json', key: 'accept'))
150
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
151
+ .auth(Single.new('Authorization')))
152
+ .response(new_response_handler
153
+ .deserializer(APIHelper.method(:custom_type_deserializer))
154
+ .deserialize_into(ApiEntity.method(:from_hash)))
155
+ .execute
156
+ end
157
+
158
+ # Replace an API version of an API Group, by uploading the API specification
159
+ # file that will replace the current version.
160
+ # You can also specify [API
161
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
162
+ # importing the API version using this endpoint. When specifying Metadata,
163
+ # the uploaded file will be a zip file containing the API specification file
164
+ # and the `APIMATIC-META` json file.
165
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
166
+ # to replace.
167
+ # @param [File | UploadIO] file Required parameter: The API specification
168
+ # file.<br>The type of the specification file should be any of the
169
+ # [supported
170
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
171
+ # ported-input-formats).
172
+ # @return [void] response from the API call
173
+ def inplace_api_import_via_file(api_entity_id,
174
+ file)
175
+ new_api_call_builder
176
+ .request(new_request_builder(HttpMethodEnum::PUT,
177
+ '/api-entities/{api_entity_id}/import-via-file',
178
+ Server::DEFAULT)
179
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
180
+ .should_encode(true))
181
+ .multipart_param(new_parameter(file, key: 'file')
182
+ .default_content_type('application/octet-stream'))
183
+ .auth(Single.new('Authorization')))
184
+ .response(new_response_handler
185
+ .is_response_void(true))
186
+ .execute
187
+ end
188
+
189
+ # Replace an API version of an API Group, by providing the URL of the API
190
+ # specification file that will replace the current version.
191
+ # You can also specify [API
192
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
193
+ # importing the API version using this endpoint. When specifying Metadata,
194
+ # the URL provided will be that of a zip file containing the API
195
+ # specification file and the `APIMATIC-META` json file.
196
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
197
+ # to replace.
198
+ # @param [InplaceImportApiViaUrlRequest] body Required parameter: Request
199
+ # Body
200
+ # @return [void] response from the API call
201
+ def inplace_api_import_via_url(api_entity_id,
202
+ body)
203
+ new_api_call_builder
204
+ .request(new_request_builder(HttpMethodEnum::PUT,
205
+ '/api-entities/{api_entity_id}/import-via-url',
206
+ Server::DEFAULT)
207
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
208
+ .should_encode(true))
209
+ .header_param(new_parameter('application/vnd.apimatic.apiEntityUrlImportDto.v1+json', key: 'Content-Type'))
210
+ .body_param(new_parameter(body))
211
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
212
+ .auth(Single.new('Authorization')))
213
+ .response(new_response_handler
214
+ .is_response_void(true))
215
+ .execute
216
+ end
217
+
218
+ # Fetch an API Entity.
219
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
220
+ # to fetch.
221
+ # @return [ApiEntity] response from the API call
222
+ def fetch_api_entity(api_entity_id)
223
+ new_api_call_builder
224
+ .request(new_request_builder(HttpMethodEnum::GET,
225
+ '/api-entities/{api_entity_id}',
226
+ Server::DEFAULT)
227
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
228
+ .should_encode(true))
229
+ .header_param(new_parameter('application/json', key: 'accept'))
230
+ .auth(Single.new('Authorization')))
231
+ .response(new_response_handler
232
+ .deserializer(APIHelper.method(:custom_type_deserializer))
233
+ .deserialize_into(ApiEntity.method(:from_hash)))
234
+ .execute
235
+ end
236
+
237
+ # Download the API Specification file for a an API Version in any of the API
238
+ # Specification formats supported by APIMatic.
239
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
240
+ # to download.
241
+ # @param [ExportFormats] format Required parameter: The format in which to
242
+ # download the API.<br>The format can be any of the [supported
243
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
244
+ # ported-input-formats).
245
+ # @return [Binary] response from the API call
246
+ def download_api_specification(api_entity_id,
247
+ format)
248
+ new_api_call_builder
249
+ .request(new_request_builder(HttpMethodEnum::GET,
250
+ '/api-entities/{api_entity_id}/api-description',
251
+ Server::DEFAULT)
252
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
253
+ .should_encode(true))
254
+ .query_param(new_parameter(format, key: 'format'))
255
+ .auth(Single.new('Authorization')))
256
+ .response(new_response_handler)
257
+ .execute
258
+ end
259
+ end
260
+ end
@@ -0,0 +1,66 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # BaseController.
8
+ class BaseController
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'APIMatic CLI'
14
+ end
15
+
16
+
17
+ GLOBAL_ERRORS = {
18
+ 'default' => ErrorCase.new
19
+ .error_message('HTTP response not OK.')
20
+ .exception_type(APIException)
21
+ }.freeze
22
+
23
+ # Initialization constructor.
24
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
25
+ def initialize(global_configuration)
26
+ @global_configuration = global_configuration
27
+ @config = @global_configuration.client_configuration
28
+ @http_call_back = @config.http_callback
29
+ @api_call = ApiCall.new(@global_configuration)
30
+ end
31
+
32
+ # Creates a new builder for the Api Call instance.
33
+ # @return [ApiCall] The instance of ApiCall.
34
+ def new_api_call_builder
35
+ @api_call.new_builder
36
+ end
37
+
38
+ # Creates a new instance of the request builder.
39
+ # @param [String] http_method The HTTP method to use in the request.
40
+ # @param [String] path The endpoint path to use in the request.
41
+ # @param [String] server The server to extract the base uri for the request.
42
+ # @return [RequestBuilder] The instance of RequestBuilder.
43
+ def new_request_builder(http_method, path, server)
44
+ RequestBuilder.new
45
+ .http_method(http_method)
46
+ .path(path)
47
+ .server(server)
48
+ end
49
+
50
+ # Creates a new instance of the response handler.
51
+ # @return [ResponseHandler] The instance of ResponseHandler.
52
+ def new_response_handler
53
+ ResponseHandler.new
54
+ end
55
+
56
+ # Creates a new instance of the parameter.
57
+ # @param [String|optional] key The key of the parameter.
58
+ # @param [Object] value The value of the parameter.
59
+ # @return [Parameter] The instance of Parameter.
60
+ def new_parameter(value, key: nil)
61
+ Parameter.new
62
+ .key(key)
63
+ .value(value)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,178 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # CodeGenerationExternalApisController
8
+ class CodeGenerationExternalApisController < BaseController
9
+ # Generate an SDK for an API by by uploading the API specification file.
10
+ # This endpoint generates and then uploads the generated SDK to APIMatic's
11
+ # cloud storage. An ID for the generation performed is returned as part of
12
+ # the response.
13
+ # This endpoint does not import an API into APIMatic.
14
+ # @param [File | UploadIO] file Required parameter: The API specification
15
+ # file.<br>The type of the specification file should be any of the
16
+ # [supported
17
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
18
+ # ported-input-formats).
19
+ # @param [Platforms] template Required parameter: The structure contains
20
+ # platforms that APIMatic CodeGen can generate SDKs and Docs in.
21
+ # @return [UserCodeGeneration] response from the API call
22
+ def generate_sdk_via_file(file,
23
+ template)
24
+ new_api_call_builder
25
+ .request(new_request_builder(HttpMethodEnum::POST,
26
+ '/code-generations/generate-via-file',
27
+ Server::DEFAULT)
28
+ .multipart_param(new_parameter(file, key: 'file')
29
+ .default_content_type('application/octet-stream'))
30
+ .form_param(new_parameter(template, key: 'template'))
31
+ .header_param(new_parameter('application/json', key: 'accept'))
32
+ .auth(Single.new('Authorization')))
33
+ .response(new_response_handler
34
+ .deserializer(APIHelper.method(:custom_type_deserializer))
35
+ .deserialize_into(UserCodeGeneration.method(:from_hash)))
36
+ .execute
37
+ end
38
+
39
+ # Generate an SDK for an API by providing the URL of the API specification
40
+ # file.
41
+ # This endpoint generates and then uploads the generated SDK to APIMatic's
42
+ # cloud storage. An ID for the generation performed is returned as part of
43
+ # the response.
44
+ # This endpoint does not import an API into APIMatic.
45
+ # @param [GenerateSdkViaUrlRequest] body Required parameter: Request Body
46
+ # @return [UserCodeGeneration] response from the API call
47
+ def generate_sdk_via_url(body)
48
+ new_api_call_builder
49
+ .request(new_request_builder(HttpMethodEnum::POST,
50
+ '/code-generations/generate-via-url',
51
+ Server::DEFAULT)
52
+ .header_param(new_parameter('application/vnd.apimatic.userCodeGenerationDto.v1+json', key: 'Content-Type'))
53
+ .body_param(new_parameter(body))
54
+ .header_param(new_parameter('application/json', key: 'accept'))
55
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
56
+ .auth(Single.new('Authorization')))
57
+ .response(new_response_handler
58
+ .deserializer(APIHelper.method(:custom_type_deserializer))
59
+ .deserialize_into(UserCodeGeneration.method(:from_hash)))
60
+ .execute
61
+ end
62
+
63
+ # Download the SDK generated via the Generate SDK endpoints.
64
+ # @param [String] codegen_id Required parameter: The ID of code generation
65
+ # received in the response of the [Generate SDK Via
66
+ # File](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
67
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-s
68
+ # dk-via-file) or [Generate SDK Via URL
69
+ # ](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c3052d9
70
+ # 61b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-sdk-v
71
+ # ia-url) calls.
72
+ # @return [Binary] response from the API call
73
+ def download_generated_sdk(codegen_id)
74
+ new_api_call_builder
75
+ .request(new_request_builder(HttpMethodEnum::GET,
76
+ '/code-generations/{codegen_id}/generated-sdk',
77
+ Server::DEFAULT)
78
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
79
+ .should_encode(true))
80
+ .auth(Single.new('Authorization')))
81
+ .response(new_response_handler)
82
+ .execute
83
+ end
84
+
85
+ # Get a list of all SDK generations performed with external APIs via the
86
+ # Generate SDK endpoints.
87
+ # @return [Array[UserCodeGeneration]] response from the API call
88
+ def list_all_code_generations_external
89
+ new_api_call_builder
90
+ .request(new_request_builder(HttpMethodEnum::GET,
91
+ '/code-generations',
92
+ Server::DEFAULT)
93
+ .header_param(new_parameter('application/json', key: 'accept'))
94
+ .auth(Single.new('Authorization')))
95
+ .response(new_response_handler
96
+ .deserializer(APIHelper.method(:custom_type_deserializer))
97
+ .deserialize_into(UserCodeGeneration.method(:from_hash))
98
+ .is_response_array(true))
99
+ .execute
100
+ end
101
+
102
+ # Download the API Specification file used as input for a specific SDK
103
+ # generation performed via the Generate SDK endpoints.
104
+ # @param [String] codegen_id Required parameter: The ID of the code
105
+ # generation to download the API specification for. The code generation ID
106
+ # is received in the response of the [Generate SDK Via
107
+ # File](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
108
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-s
109
+ # dk-via-file) or [Generate SDK Via URL
110
+ # ](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c3052d9
111
+ # 61b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-sdk-v
112
+ # ia-url) calls
113
+ # @return [Binary] response from the API call
114
+ def download_input_file_codegen(codegen_id)
115
+ new_api_call_builder
116
+ .request(new_request_builder(HttpMethodEnum::GET,
117
+ '/code-generations/{codegen_id}/input-file',
118
+ Server::DEFAULT)
119
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
120
+ .should_encode(true))
121
+ .auth(Single.new('Authorization')))
122
+ .response(new_response_handler)
123
+ .execute
124
+ end
125
+
126
+ # Get details on an SDK generation performed for an external API via the
127
+ # Generate SDK endpoints.
128
+ # @param [String] codegen_id Required parameter: The ID of the code
129
+ # generation to fetch. The code generation ID is received in the response of
130
+ # the [Generate SDK Via
131
+ # File](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
132
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-s
133
+ # dk-via-file) or [Generate SDK Via URL
134
+ # ](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c3052d9
135
+ # 61b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-sdk-v
136
+ # ia-url) calls.
137
+ # @return [UserCodeGeneration] response from the API call
138
+ def get_a_code_generation_codegen(codegen_id)
139
+ new_api_call_builder
140
+ .request(new_request_builder(HttpMethodEnum::GET,
141
+ '/code-generations/{codegen_id}',
142
+ Server::DEFAULT)
143
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
144
+ .should_encode(true))
145
+ .header_param(new_parameter('application/json', key: 'accept'))
146
+ .auth(Single.new('Authorization')))
147
+ .response(new_response_handler
148
+ .deserializer(APIHelper.method(:custom_type_deserializer))
149
+ .deserialize_into(UserCodeGeneration.method(:from_hash)))
150
+ .execute
151
+ end
152
+
153
+ # Delete an SDK generation performed for an API via the Generate SDK
154
+ # endpoints.
155
+ # @param [String] codegen_id Required parameter: The ID of the code
156
+ # generation to delete. The code generation ID is received in the response
157
+ # of the [Generate SDK Via
158
+ # File](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
159
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-s
160
+ # dk-via-file) or [Generate SDK Via URL
161
+ # ](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c3052d9
162
+ # 61b/v/3_0#/http/api-endpoints/code-generation-external-apis/generate-sdk-v
163
+ # ia-url) calls.
164
+ # @return [void] response from the API call
165
+ def delete_code_generation1(codegen_id)
166
+ new_api_call_builder
167
+ .request(new_request_builder(HttpMethodEnum::DELETE,
168
+ '/code-generations/{codegen_id}',
169
+ Server::DEFAULT)
170
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
171
+ .should_encode(true))
172
+ .auth(Single.new('Authorization')))
173
+ .response(new_response_handler
174
+ .is_response_void(true))
175
+ .execute
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,136 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # CodeGenerationImportedApisController
8
+ class CodeGenerationImportedApisController < BaseController
9
+ # Generate an SDK for an API Version.
10
+ # This endpoint generates and then uploads the generated SDK to APIMatic's
11
+ # cloud storage. An ID for the generation performed is returned as part of
12
+ # the response.
13
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
14
+ # to generate the SDK for.
15
+ # @param [Platforms] template Required parameter: The structure contains
16
+ # platforms that APIMatic CodeGen can generate SDKs and Docs in.
17
+ # @return [APIEntityCodeGeneration] response from the API call
18
+ def generate_sdk(api_entity_id,
19
+ template)
20
+ new_api_call_builder
21
+ .request(new_request_builder(HttpMethodEnum::POST,
22
+ '/api-entities/{api_entity_id}/code-generations/generate',
23
+ Server::DEFAULT)
24
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
25
+ .should_encode(true))
26
+ .form_param(new_parameter(template, key: 'template'))
27
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
28
+ .header_param(new_parameter('application/json', key: 'accept'))
29
+ .auth(Single.new('Authorization')))
30
+ .response(new_response_handler
31
+ .deserializer(APIHelper.method(:custom_type_deserializer))
32
+ .deserialize_into(APIEntityCodeGeneration.method(:from_hash)))
33
+ .execute
34
+ end
35
+
36
+ # Download the SDK generated via the Generate SDK endpoint.
37
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
38
+ # for which the SDK was generated.
39
+ # @param [String] codegen_id Required parameter: The ID of code generation
40
+ # received in the response of the [SDK generation
41
+ # call](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
42
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-imported-apis/generate-s
43
+ # dk).
44
+ # @return [Binary] response from the API call
45
+ def download_sdk(api_entity_id,
46
+ codegen_id)
47
+ new_api_call_builder
48
+ .request(new_request_builder(HttpMethodEnum::GET,
49
+ '/api-entities/{api_entity_id}/code-generations/{codegen_id}/generated-sdk',
50
+ Server::DEFAULT)
51
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
52
+ .should_encode(true))
53
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
54
+ .should_encode(true))
55
+ .auth(Single.new('Authorization')))
56
+ .response(new_response_handler)
57
+ .execute
58
+ end
59
+
60
+ # Get a list of all SDK generations done against an API Version via the
61
+ # Generate SDK endpoint.
62
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
63
+ # for which to list code generations.
64
+ # @return [Array[APIEntityCodeGeneration]] response from the API call
65
+ def list_all_code_generations_imported(api_entity_id)
66
+ new_api_call_builder
67
+ .request(new_request_builder(HttpMethodEnum::GET,
68
+ '/api-entities/{api_entity_id}/code-generations',
69
+ Server::DEFAULT)
70
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
71
+ .should_encode(true))
72
+ .header_param(new_parameter('application/json', key: 'accept'))
73
+ .auth(Single.new('Authorization')))
74
+ .response(new_response_handler
75
+ .deserializer(APIHelper.method(:custom_type_deserializer))
76
+ .deserialize_into(APIEntityCodeGeneration.method(:from_hash))
77
+ .is_response_array(true))
78
+ .execute
79
+ end
80
+
81
+ # Get details on an SDK generation performed via the Generate SDK endpoint.
82
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
83
+ # to fetch the code generation for.
84
+ # @param [String] codegen_id Required parameter: The ID of the code
85
+ # generation to fetch. The code generation ID is received in the response of
86
+ # the [SDK generation
87
+ # call](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
88
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-imported-apis/generate-s
89
+ # dk).
90
+ # @return [APIEntityCodeGeneration] response from the API call
91
+ def get_a_code_generation_imported(api_entity_id,
92
+ codegen_id)
93
+ new_api_call_builder
94
+ .request(new_request_builder(HttpMethodEnum::GET,
95
+ '/api-entities/{api_entity_id}/code-generations/{codegen_id}',
96
+ Server::DEFAULT)
97
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
98
+ .should_encode(true))
99
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
100
+ .should_encode(true))
101
+ .header_param(new_parameter('application/json', key: 'accept'))
102
+ .auth(Single.new('Authorization')))
103
+ .response(new_response_handler
104
+ .deserializer(APIHelper.method(:custom_type_deserializer))
105
+ .deserialize_into(APIEntityCodeGeneration.method(:from_hash)))
106
+ .execute
107
+ end
108
+
109
+ # Delete an SDK generation performed for an API Version via the Generate SDK
110
+ # endpoint.
111
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
112
+ # to delete the code generation for.
113
+ # @param [String] codegen_id Required parameter: The ID of the code
114
+ # generation to delete. The code generation ID is received in the response
115
+ # of the [SDK generation
116
+ # call](https://www.apimatic.io/api-docs-preview/dashboard/60eea3b7a73395c30
117
+ # 52d961b/v/3_0#/http/api-endpoints/code-generation-imported-apis/generate-s
118
+ # dk).
119
+ # @return [void] response from the API call
120
+ def delete_code_generation(api_entity_id,
121
+ codegen_id)
122
+ new_api_call_builder
123
+ .request(new_request_builder(HttpMethodEnum::DELETE,
124
+ '/api-entities/{api_entity_id}/code-generations/{codegen_id}',
125
+ Server::DEFAULT)
126
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
127
+ .should_encode(true))
128
+ .template_param(new_parameter(codegen_id, key: 'codegen_id')
129
+ .should_encode(true))
130
+ .auth(Single.new('Authorization')))
131
+ .response(new_response_handler
132
+ .is_response_void(true))
133
+ .execute
134
+ end
135
+ end
136
+ end