Class: ApimaticApi::DocsPortalGenerationAsyncController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb

Overview

DocsPortalGenerationAsyncController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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_portal(id) ⇒ ApiResponse

Downloads the portal artifacts. The generated artifacts include:

  1. SDKs
  2. Docs
  3. API Specification files The endpoint returns a zip file that contains a static Site and can be hosted on any Web Server.

Parameters:

  • id (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb', line 84

def download_generated_portal(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/portal/v2/{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('422',
                             'Unprocessable Entity - Contains error.zip for build issues',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             InternalServerErrorResponseException))
    .execute
end

#generate_on_prem_portal_via_build_input_async(content_type, file, x_api_matic_callback_url: nil) ⇒ ApiResponse

Create an async On-premise Documentation Portal Generation request by providing a Portal Build Input Portal Generator. Must contain the build file. header containing callback url. This url will be called by the server once the portal generation completes

Parameters:

  • content_type (ContentType)

    Required parameter: Example:

  • file (File | UploadIO)

    Required parameter: The input file to the

  • x_api_matic_callback_url (String) (defaults to: nil)

    Optional parameter: Optional

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb', line 18

def generate_on_prem_portal_via_build_input_async(content_type,
                                                  file,
                                                  x_api_matic_callback_url: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/portal/v2',
                                 Server::DEFAULT)
               .multipart_param(new_parameter(file, key: 'file')
                                 .is_required(true)
                                 .default_content_type('application/octet-stream'))
               .header_param(new_parameter(x_api_matic_callback_url, key: 'X-APIMatic-CallbackUrl'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Authorization')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PortalGenerationAsyncResponse.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_portal_generation_status(id) ⇒ ApiResponse

Get the status of a portal generation request

Parameters:

  • id (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb', line 50

def get_portal_generation_status(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/portal/v2/{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(PortalGenerationStatusResponse.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