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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1e966b2e7ee1e910f8cd4284061fab491ad2aa59067b1df31478fb0851dd8547
4
+ data.tar.gz: be7e3593f690762eb8d4d60bfa096272bc8f7a0f05aa95e72075a791ab439d20
5
+ SHA512:
6
+ metadata.gz: 896ecf8dd9458bdc288dd46819afb3dcc841e8f52007b9cda8d2f02f0d877b14149f2e33e81acf29118f236d1bd3b23340ff2aea2d93e1603c6ed4fc4604bfd2
7
+ data.tar.gz: 98090b131858ba9c8b87cd813abf2f3363dfb1a26c655d662ed92719127e1ff7c5473fff8951481058850361718a40125715b8a0b752213a7a46890ea705c323
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2024 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+
2
+ # Getting Started with Apimatic API
3
+
4
+ ## Introduction
5
+
6
+ This API gives you programmatic access to APIMatic's Code Generation, Docs Generation and Transformation Engine
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```ruby
13
+ gem install sdksio-apimatic-sdk -v 3.0.0
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'sdksio-apimatic-sdk', '3.0.0'
20
+ ```
21
+
22
+ For additional gem details, see the [RubyGems page for the sdksio-apimatic-sdk gem](https://rubygems.org/gems/sdksio-apimatic-sdk/versions/3.0.0).
23
+
24
+ ## Test the SDK
25
+
26
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
27
+
28
+ ```
29
+ rake
30
+ ```
31
+
32
+ ## Initialize the API Client
33
+
34
+ **_Note:_** Documentation for the client can be found [here.](doc/client.md)
35
+
36
+ The following parameters are configurable for the API Client:
37
+
38
+ | Parameter | Type | Description |
39
+ | --- | --- | --- |
40
+ | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
41
+ | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
42
+ | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
43
+ | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
44
+ | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
45
+ | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
46
+ | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
47
+ | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put get put]** |
48
+ | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
49
+ | `custom_header_authentication_credentials` | [`CustomHeaderAuthenticationCredentials`](__base_path/$a/custom-header-signature.md) | The credential object for Custom Header Signature |
50
+
51
+ The API client can be initialized as follows:
52
+
53
+ ```ruby
54
+ client = ApimaticApi::Client.new(
55
+ custom_header_authentication_credentials: CustomHeaderAuthenticationCredentials.new(
56
+ authorization: 'Authorization'
57
+ )
58
+ )
59
+ ```
60
+
61
+ ## Authorization
62
+
63
+ This API uses the following authentication schemes.
64
+
65
+ * [`Authorization (Custom Header Signature)`](__base_path/$a/custom-header-signature.md)
66
+
67
+ ## List of APIs
68
+
69
+ * [APIs Management](doc/controllers/apis-management.md)
70
+ * [Code Generation-Imported APIs](doc/controllers/code-generation-imported-apis.md)
71
+ * [Code Generation-External APIs](doc/controllers/code-generation-external-apis.md)
72
+ * [Docs Portal Management](doc/controllers/docs-portal-management.md)
73
+ * [API Validation-Imported APIs](doc/controllers/api-validation-imported-apis.md)
74
+ * [API Validation-External APIs](doc/controllers/api-validation-external-apis.md)
75
+ * [Transformation](doc/controllers/transformation.md)
76
+
77
+ ## Classes Documentation
78
+
79
+ * [Utility Classes](doc/utility-classes.md)
80
+ * [HttpResponse](doc/http-response.md)
81
+ * [HttpRequest](doc/http-request.md)
82
+
@@ -0,0 +1,10 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,96 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # apimatic_api client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ # Access to apis_management controller.
13
+ # @return [ApisManagementController] Returns the controller instance.
14
+ def apis_management
15
+ @apis_management ||= ApisManagementController.new @global_configuration
16
+ end
17
+
18
+ # Access to code_generation_imported_apis controller.
19
+ # @return [CodeGenerationImportedApisController] Returns the controller instance.
20
+ def code_generation_imported_apis
21
+ @code_generation_imported_apis ||= CodeGenerationImportedApisController.new @global_configuration
22
+ end
23
+
24
+ # Access to code_generation_external_apis controller.
25
+ # @return [CodeGenerationExternalApisController] Returns the controller instance.
26
+ def code_generation_external_apis
27
+ @code_generation_external_apis ||= CodeGenerationExternalApisController.new @global_configuration
28
+ end
29
+
30
+ # Access to transformation controller.
31
+ # @return [TransformationController] Returns the controller instance.
32
+ def transformation
33
+ @transformation ||= TransformationController.new @global_configuration
34
+ end
35
+
36
+ # Access to docs_portal_management controller.
37
+ # @return [DocsPortalManagementController] Returns the controller instance.
38
+ def docs_portal_management
39
+ @docs_portal_management ||= DocsPortalManagementController.new @global_configuration
40
+ end
41
+
42
+ # Access to api_validation_imported_apis controller.
43
+ # @return [APIValidationImportedApisController] Returns the controller instance.
44
+ def api_validation_imported_apis
45
+ @api_validation_imported_apis ||= APIValidationImportedApisController.new @global_configuration
46
+ end
47
+
48
+ # Access to api_validation_external_apis controller.
49
+ # @return [APIValidationExternalApisController] Returns the controller instance.
50
+ def api_validation_external_apis
51
+ @api_validation_external_apis ||= APIValidationExternalApisController.new @global_configuration
52
+ end
53
+
54
+ def initialize(
55
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
56
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
57
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
58
+ retry_methods: %i[get put get put], http_callback: nil,
59
+ environment: Environment::PRODUCTION, authorization: nil,
60
+ custom_header_authentication_credentials: nil, config: nil
61
+ )
62
+ @config = if config.nil?
63
+ Configuration.new(
64
+ connection: connection, adapter: adapter, timeout: timeout,
65
+ max_retries: max_retries, retry_interval: retry_interval,
66
+ backoff_factor: backoff_factor,
67
+ retry_statuses: retry_statuses,
68
+ retry_methods: retry_methods, http_callback: http_callback,
69
+ environment: environment, authorization: authorization,
70
+ custom_header_authentication_credentials: custom_header_authentication_credentials
71
+ )
72
+ else
73
+ config
74
+ end
75
+
76
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
77
+ .base_uri_executor(@config.method(:get_base_uri))
78
+ .global_errors(BaseController::GLOBAL_ERRORS)
79
+ .user_agent(BaseController.user_agent)
80
+
81
+ initialize_auth_managers(@global_configuration)
82
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
83
+ end
84
+
85
+ # Initializes the auth managers hash used for authenticating API calls.
86
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
87
+ def initialize_auth_managers(global_config)
88
+ @auth_managers = {}
89
+ http_client_config = global_config.client_configuration
90
+ %w[Authorization].each { |auth| @auth_managers[auth] = nil }
91
+ @auth_managers['Authorization'] = CustomHeaderAuthentication.new(
92
+ http_client_config.custom_header_authentication_credentials
93
+ )
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,125 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze
11
+ ].freeze
12
+ end
13
+
14
+ # An enum for API servers.
15
+ class Server
16
+ SERVER = [
17
+ DEFAULT = 'default'.freeze
18
+ ].freeze
19
+ end
20
+
21
+ # All configuration including auth info and base URI for the API access
22
+ # are configured in this class.
23
+ class Configuration < CoreLibrary::HttpClientConfiguration
24
+ def authorization
25
+ @custom_header_authentication_credentials.authorization
26
+ end
27
+
28
+ # The attribute readers for properties.
29
+ attr_reader :environment, :custom_header_authentication_credentials
30
+
31
+ class << self
32
+ attr_reader :environments
33
+ end
34
+
35
+ def initialize(
36
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
37
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
38
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
39
+ retry_methods: %i[get put get put], http_callback: nil,
40
+ environment: Environment::PRODUCTION, authorization: nil,
41
+ custom_header_authentication_credentials: nil
42
+ )
43
+
44
+ super connection: connection, adapter: adapter, timeout: timeout,
45
+ max_retries: max_retries, retry_interval: retry_interval,
46
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
47
+ retry_methods: retry_methods, http_callback: http_callback
48
+
49
+ # Current API environment
50
+ @environment = String(environment)
51
+
52
+ # Auth Header. Provide your Auth key in the format `X-Auth-Key {auth-key}`.
53
+ @authorization = authorization
54
+
55
+ # Initializing Custom Header Signature credentials with the provided auth parameters
56
+ @custom_header_authentication_credentials = create_auth_credentials_object(
57
+ authorization, custom_header_authentication_credentials
58
+ )
59
+
60
+ # The Http Client to use for making requests.
61
+ set_http_client CoreLibrary::FaradayClient.new(self)
62
+ end
63
+
64
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
65
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
66
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
67
+ environment: nil, authorization: nil,
68
+ custom_header_authentication_credentials: nil)
69
+ connection ||= self.connection
70
+ adapter ||= self.adapter
71
+ timeout ||= self.timeout
72
+ max_retries ||= self.max_retries
73
+ retry_interval ||= self.retry_interval
74
+ backoff_factor ||= self.backoff_factor
75
+ retry_statuses ||= self.retry_statuses
76
+ retry_methods ||= self.retry_methods
77
+ http_callback ||= self.http_callback
78
+ environment ||= self.environment
79
+ custom_header_authentication_credentials = create_auth_credentials_object(
80
+ authorization,
81
+ custom_header_authentication_credentials || self.custom_header_authentication_credentials
82
+ )
83
+
84
+ Configuration.new(
85
+ connection: connection, adapter: adapter, timeout: timeout,
86
+ max_retries: max_retries, retry_interval: retry_interval,
87
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
88
+ retry_methods: retry_methods, http_callback: http_callback,
89
+ environment: environment,
90
+ custom_header_authentication_credentials: custom_header_authentication_credentials
91
+ )
92
+ end
93
+
94
+ def create_auth_credentials_object(authorization,
95
+ custom_header_authentication_credentials)
96
+ return custom_header_authentication_credentials if authorization.nil?
97
+
98
+ warn('The \'authorization\' params are deprecated. Use \'custom_header_a'\
99
+ 'uthentication_credentials\' param instead.')
100
+
101
+ unless custom_header_authentication_credentials.nil?
102
+ return custom_header_authentication_credentials.clone_with(
103
+ authorization: authorization
104
+ )
105
+ end
106
+
107
+ CustomHeaderAuthenticationCredentials.new(authorization: authorization)
108
+ end
109
+
110
+ # All the environments the SDK can run in.
111
+ ENVIRONMENTS = {
112
+ Environment::PRODUCTION => {
113
+ Server::DEFAULT => 'https://api.apimatic.io'
114
+ }
115
+ }.freeze
116
+
117
+ # Generates the appropriate base URI for the environment and the server.
118
+ # @param [Configuration::Server] server The server enum for which the base URI is
119
+ # required.
120
+ # @return [String] The base URI.
121
+ def get_base_uri(server = Server::DEFAULT)
122
+ ENVIRONMENTS[environment][server].clone
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,84 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # APIValidationExternalApisController
8
+ class APIValidationExternalApisController < BaseController
9
+ # Validate an API by uploading the API specification file.
10
+ # You can also specify [API
11
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
12
+ # validating the API using this endpoint. When specifying Metadata, the
13
+ # uploaded file will be a zip file containing the API specification file and
14
+ # the `APIMATIC-META` json file.
15
+ # @param [File | UploadIO] file Required parameter: The API specification
16
+ # file.<br>The type of the specification file should be any of the
17
+ # [supported
18
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
19
+ # ported-input-formats).
20
+ # @return [ApiValidationSummary] response from the API call
21
+ def validate_api_via_file(file)
22
+ new_api_call_builder
23
+ .request(new_request_builder(HttpMethodEnum::POST,
24
+ '/validation/validate-via-file',
25
+ Server::DEFAULT)
26
+ .multipart_param(new_parameter(file, key: 'file')
27
+ .default_content_type('application/octet-stream'))
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(ApiValidationSummary.method(:from_hash))
33
+ .local_error('400',
34
+ 'Bad Request',
35
+ APIException)
36
+ .local_error('401',
37
+ 'Unauthenticated',
38
+ APIException)
39
+ .local_error('403',
40
+ 'Forbidden',
41
+ APIException)
42
+ .local_error('500',
43
+ 'Internal Server Error',
44
+ APIException))
45
+ .execute
46
+ end
47
+
48
+ # Validate an API by providing the URL of the API specification file.
49
+ # You can also specify [API
50
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
51
+ # validating the API using this endpoint. When specifying Metadata, the URL
52
+ # provided will be that of a zip file containing the API specification file
53
+ # and the `APIMATIC-META` json file.
54
+ # @param [String] description_url Required parameter: The URL for the API
55
+ # specification file.<br><br>**Note:** This URL should be publicly
56
+ # accessible.
57
+ # @return [ApiValidationSummary] response from the API call
58
+ def validate_api_via_url(description_url)
59
+ new_api_call_builder
60
+ .request(new_request_builder(HttpMethodEnum::GET,
61
+ '/validation/validate-via-url',
62
+ Server::DEFAULT)
63
+ .query_param(new_parameter(description_url, key: 'descriptionUrl'))
64
+ .header_param(new_parameter('application/json', key: 'accept'))
65
+ .auth(Single.new('Authorization')))
66
+ .response(new_response_handler
67
+ .deserializer(APIHelper.method(:custom_type_deserializer))
68
+ .deserialize_into(ApiValidationSummary.method(:from_hash))
69
+ .local_error('400',
70
+ 'Bad Request',
71
+ APIException)
72
+ .local_error('401',
73
+ 'Unauthenticated',
74
+ APIException)
75
+ .local_error('403',
76
+ 'Forbidden',
77
+ APIException)
78
+ .local_error('500',
79
+ 'Internal Server Error',
80
+ APIException))
81
+ .execute
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,74 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # APIValidationImportedApisController
8
+ class APIValidationImportedApisController < BaseController
9
+ # Validate an API using the [APIMatic
10
+ # Validator](https://docs.apimatic.io/generate-sdks/overview-sdks#step-2-api
11
+ # -validation).
12
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
13
+ # to perform validation for.
14
+ # @return [ApiValidationSummary] response from the API call
15
+ def validate_api(api_entity_id)
16
+ new_api_call_builder
17
+ .request(new_request_builder(HttpMethodEnum::GET,
18
+ '/api-entities/{api_entity_id}/api-validation-summary',
19
+ Server::DEFAULT)
20
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
21
+ .should_encode(true))
22
+ .header_param(new_parameter('application/json', key: 'accept'))
23
+ .auth(Single.new('Authorization')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(ApiValidationSummary.method(:from_hash))
27
+ .local_error('400',
28
+ 'Bad Request',
29
+ APIException)
30
+ .local_error('403',
31
+ 'Forbidden',
32
+ APIException)
33
+ .local_error('404',
34
+ 'API not found',
35
+ APIException)
36
+ .local_error('500',
37
+ 'Internal Server Error',
38
+ APIException))
39
+ .execute
40
+ end
41
+
42
+ # Validate an API for documentation generation. This process validates the
43
+ # API for missing examples or missing descriptions.
44
+ # @param [String] api_entity_id Required parameter: The ID of the API Entity
45
+ # to perform validation for.
46
+ # @return [DocsValidationSummary] response from the API call
47
+ def validate_api_for_docs(api_entity_id)
48
+ new_api_call_builder
49
+ .request(new_request_builder(HttpMethodEnum::GET,
50
+ '/api-entities/{api_entity_id}/docs-validation-summary',
51
+ Server::DEFAULT)
52
+ .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
53
+ .should_encode(true))
54
+ .header_param(new_parameter('application/json', key: 'accept'))
55
+ .auth(Single.new('Authorization')))
56
+ .response(new_response_handler
57
+ .deserializer(APIHelper.method(:custom_type_deserializer))
58
+ .deserialize_into(DocsValidationSummary.method(:from_hash))
59
+ .local_error('400',
60
+ 'Bad Request',
61
+ APIException)
62
+ .local_error('403',
63
+ 'Forbidden',
64
+ APIException)
65
+ .local_error('404',
66
+ 'API not found',
67
+ APIException)
68
+ .local_error('500',
69
+ 'Internal Server Error',
70
+ APIException))
71
+ .execute
72
+ end
73
+ end
74
+ end