Class: ApimaticApi::CodeGenerationExternalApisController
- Inherits:
-
BaseController
- Object
- BaseController
- ApimaticApi::CodeGenerationExternalApisController
- Defined in:
- lib/apimatic_api/controllers/code_generation_external_apis_controller.rb
Overview
CodeGenerationExternalApisController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#delete_code_generation_for_external_apis(codegen_id) ⇒ ApiResponse
Delete an SDK generation performed for an API via the Generate SDK endpoints.
-
#download_input_file(codegen_id) ⇒ ApiResponse
Download the API Specification file used as input for a specific SDK generation performed via the Generate SDK endpoints.
-
#download_sdk(codegen_id) ⇒ ApiResponse
Download the SDK generated via the Generate SDK endpoints.
-
#generate_sdk_via_file(accept, file, template, _query_parameters: nil) ⇒ ApiResponse
Generate an SDK for an API by by uploading the API specification file.
-
#generate_sdk_via_url(body) ⇒ ApiResponse
Generate an SDK for an API by providing the URL of the API specification file.
-
#get_a_code_generation(codegen_id) ⇒ ApiResponse
Get details on an SDK generation performed for an external API via the Generate SDK endpoints.
-
#list_all_code_generations ⇒ ApiResponse
Get a list of all SDK generations performed with external APIs via the Generate SDK endpoints.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler
Constructor Details
This class inherits a constructor from ApimaticApi::BaseController
Instance Method Details
#delete_code_generation_for_external_apis(codegen_id) ⇒ ApiResponse
Delete an SDK generation performed for an API via the Generate SDK endpoints. generation to delete. The code generation ID is received in the response of the [Generate SDK Via File]($e/Code%20Generation%20-%20External%20APIs/Generate%20SDK%20via%20Fi le) or Generate SDK Via URL calls.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 186 def delete_code_generation_for_external_apis(codegen_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/code-generations/{codegen_id}', Server::DEFAULT) .template_param(new_parameter(codegen_id, key: 'codegen_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#download_input_file(codegen_id) ⇒ ApiResponse
Download the API Specification file used as input for a specific SDK generation performed via the Generate SDK endpoints. generation to download the API specification for. The code generation ID is received in the response of the [Generate SDK Via File]($e/Code%20Generation%20-%20External%20APIs/Generate%20SDK%20via%20Fi le) or Generate SDK Via URL calls
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 135 def download_input_file(codegen_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/code-generations/{codegen_id}/input-file', Server::DEFAULT) .template_param(new_parameter(codegen_id, key: 'codegen_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_api_response(true)) .execute end |
#download_sdk(codegen_id) ⇒ ApiResponse
Download the SDK generated via the Generate SDK endpoints. received in the response of the [Generate SDK Via File]($e/Code%20Generation%20-%20External%20APIs/Generate%20SDK%20via%20Fi le) or Generate SDK Via URL calls.
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 93 def download_sdk(codegen_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/code-generations/{codegen_id}/generated-sdk', Server::DEFAULT) .template_param(new_parameter(codegen_id, key: 'codegen_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_api_response(true)) .execute end |
#generate_sdk_via_file(accept, file, template, _query_parameters: nil) ⇒ ApiResponse
Generate an SDK for an API by by uploading the API specification file.
This endpoint generates and then uploads the generated SDK to APIMatic's
cloud storage. An ID for the generation performed is returned as part of
the response.
This endpoint does not import an API into APIMatic.
'application/json' to ensure JSON response format
file.
The type of the specification file should be any of the
[supported
formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
ported-input-formats).
platforms that APIMatic CodeGen can generate SDKs and Docs in.
supported by this endpoint.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 26 def generate_sdk_via_file(accept, file, template, _query_parameters: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/code-generations/generate-via-file', Server::DEFAULT) .header_param(new_parameter(accept, key: 'Accept') .is_required(true)) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .form_param(new_parameter(template, key: 'template') .is_required(true)) .additional_query_params(_query_parameters) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UserCodeGeneration.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', BadRequestResponseSdkException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('403', 'Subscription Issue', ProblemDetailsException)) .execute end |
#generate_sdk_via_url(body) ⇒ ApiResponse
Generate an SDK for an API by providing the URL of the API specification file. This endpoint generates and then uploads the generated SDK to APIMatic's cloud storage. An ID for the generation performed is returned as part of the response. This endpoint does not import an API into APIMatic.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 67 def generate_sdk_via_url(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/code-generations/generate-via-url', Server::DEFAULT) .header_param(new_parameter('application/vnd.apimatic.userCodeGenerationDto.v1+json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UserCodeGeneration.method(:from_hash)) .is_api_response(true)) .execute end |
#get_a_code_generation(codegen_id) ⇒ ApiResponse
Get details on an SDK generation performed for an external API via the Generate SDK endpoints. generation to fetch. The code generation ID is received in the response of the [Generate SDK Via File]($e/Code%20Generation%20-%20External%20APIs/Generate%20SDK%20via%20Fi le) or Generate SDK Via URL calls.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 159 def get_a_code_generation(codegen_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/code-generations/{codegen_id}', Server::DEFAULT) .template_param(new_parameter(codegen_id, key: 'codegen_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UserCodeGeneration.method(:from_hash)) .is_api_response(true)) .execute end |
#list_all_code_generations ⇒ ApiResponse
Get a list of all SDK generations performed with external APIs via the Generate SDK endpoints.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/apimatic_api/controllers/code_generation_external_apis_controller.rb', line 110 def list_all_code_generations @api_call .request(new_request_builder(HttpMethodEnum::GET, '/code-generations', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UserCodeGeneration.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |