Class: ApimaticApi::SdkGenerationAsyncController
- Inherits:
-
BaseController
- Object
- BaseController
- ApimaticApi::SdkGenerationAsyncController
- Defined in:
- lib/apimatic_api/controllers/sdk_generation_async_controller.rb
Overview
SdkGenerationAsyncController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#download_generated_sdk(id) ⇒ ApiResponse
Downloads the SDK artifacts.
-
#generate_sdk_via_build_input_async(content_type, file, language, x_api_matic_callback_url: nil, package_version: nil) ⇒ ApiResponse
Create an async SDK Generation request by providing a Build Input SDK Generator.
-
#get_sdk_generation_status(id) ⇒ ApiResponse
Get the status of an SDK generation request.
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
#download_generated_sdk(id) ⇒ ApiResponse
Downloads the SDK artifacts. The endpoint returns a zip file containing the generated SDK.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/apimatic_api/controllers/sdk_generation_async_controller.rb', line 89 def download_generated_sdk(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/sdk/{id}/download', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_api_response(true) .local_error('400', 'Bad Request', ProblemDetailsException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('500', 'Internal Server Error', InternalServerErrorResponseException)) .execute end |
#generate_sdk_via_build_input_async(content_type, file, language, x_api_matic_callback_url: nil, package_version: nil) ⇒ ApiResponse
Create an async SDK Generation request by providing a Build Input SDK Generator. Must contain the build file or a spec folder containing the API Specification. SDKs can be generated. header containing callback url. This url will be called by the server once the SDK generation completes containing the package version to apply to the generated SDK.
22 23 24 25 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 |
# File 'lib/apimatic_api/controllers/sdk_generation_async_controller.rb', line 22 def generate_sdk_via_build_input_async(content_type, file, language, x_api_matic_callback_url: nil, package_version: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/sdk', Server::DEFAULT) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .form_param(new_parameter(language, key: 'language') .is_required(true)) .header_param(new_parameter(x_api_matic_callback_url, key: 'X-APIMatic-CallbackUrl')) .form_param(new_parameter(package_version, key: 'packageVersion')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SdkGenerationAsyncResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', ProblemDetailsException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('500', 'Internal Server Error', InternalServerErrorResponseException)) .execute end |
#get_sdk_generation_status(id) ⇒ ApiResponse
Get the status of an SDK generation request
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/apimatic_api/controllers/sdk_generation_async_controller.rb', line 59 def get_sdk_generation_status(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/sdk/{id}/status', Server::DEFAULT) .template_param(new_parameter(id, key: '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(SdkGenerationStatusResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', ProblemDetailsException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('500', 'Internal Server Error', InternalServerErrorResponseException)) .execute end |