sdksio-apimatic-sdk 3.0.0 → 3.0.1

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +165 -77
  4. data/bin/console +15 -0
  5. data/lib/apimatic_api/api_helper.rb +10 -10
  6. data/lib/apimatic_api/client.rb +108 -96
  7. data/lib/apimatic_api/configuration.rb +198 -125
  8. data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +90 -84
  9. data/lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb +89 -0
  10. data/lib/apimatic_api/controllers/base_controller.rb +55 -66
  11. data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +201 -178
  12. data/lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb +110 -0
  13. data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +56 -198
  14. data/lib/apimatic_api/controllers/sdk_generation_async_controller.rb +112 -0
  15. data/lib/apimatic_api/controllers/transformation_controller.rb +180 -174
  16. data/lib/apimatic_api/exceptions/api_exception.rb +21 -10
  17. data/lib/apimatic_api/exceptions/bad_request_response_sdk_exception.rb +46 -0
  18. data/lib/apimatic_api/exceptions/internal_server_error_response_exception.rb +46 -0
  19. data/lib/apimatic_api/exceptions/problem_details_exception.rb +74 -0
  20. data/lib/apimatic_api/exceptions/unauthorized_response_exception.rb +46 -0
  21. data/lib/apimatic_api/http/api_response.rb +19 -0
  22. data/lib/apimatic_api/http/auth/custom_header_authentication.rb +48 -38
  23. data/lib/apimatic_api/http/http_call_back.rb +10 -10
  24. data/lib/apimatic_api/http/http_method_enum.rb +10 -10
  25. data/lib/apimatic_api/http/http_request.rb +10 -10
  26. data/lib/apimatic_api/http/http_response.rb +10 -10
  27. data/lib/apimatic_api/http/proxy_settings.rb +22 -0
  28. data/lib/apimatic_api/logging/configuration/api_logging_configuration.rb +186 -0
  29. data/lib/apimatic_api/logging/sdk_logger.rb +17 -0
  30. data/lib/apimatic_api/models/accept.rb +26 -0
  31. data/lib/apimatic_api/models/api_validation_summary.rb +100 -75
  32. data/lib/apimatic_api/models/base_model.rb +110 -62
  33. data/lib/apimatic_api/models/content_type.rb +26 -0
  34. data/lib/apimatic_api/models/export_formats.rb +85 -60
  35. data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +85 -59
  36. data/lib/apimatic_api/models/line_info.rb +105 -0
  37. data/lib/apimatic_api/models/links.rb +82 -0
  38. data/lib/apimatic_api/models/platforms.rb +57 -39
  39. data/lib/apimatic_api/models/portal_generation_async_response.rb +68 -0
  40. data/lib/apimatic_api/models/portal_generation_status_response.rb +70 -0
  41. data/lib/apimatic_api/models/sdk_generation_async_response.rb +68 -0
  42. data/lib/apimatic_api/models/sdk_generation_status_response.rb +70 -0
  43. data/lib/apimatic_api/models/sdk_languages.rb +56 -0
  44. data/lib/apimatic_api/models/status.rb +48 -0
  45. data/lib/apimatic_api/models/transform_via_url_request.rb +85 -60
  46. data/lib/apimatic_api/models/transformation.rb +180 -152
  47. data/lib/apimatic_api/models/user_code_generation.rb +167 -140
  48. data/lib/apimatic_api/models/validate_api_result.rb +82 -0
  49. data/lib/apimatic_api/models/validation_entry.rb +143 -0
  50. data/lib/apimatic_api/models/validation_summary.rb +145 -0
  51. data/lib/apimatic_api/utilities/date_time_helper.rb +11 -11
  52. data/lib/apimatic_api/utilities/file_wrapper.rb +28 -16
  53. data/lib/apimatic_api.rb +79 -86
  54. metadata +39 -89
  55. data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +0 -74
  56. data/lib/apimatic_api/controllers/apis_management_controller.rb +0 -260
  57. data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +0 -136
  58. data/lib/apimatic_api/models/api_entity.rb +0 -220
  59. data/lib/apimatic_api/models/api_entity_code_generation.rb +0 -131
  60. data/lib/apimatic_api/models/api_entity_identifier.rb +0 -48
  61. data/lib/apimatic_api/models/attributes.rb +0 -48
  62. data/lib/apimatic_api/models/auth_scope.rb +0 -75
  63. data/lib/apimatic_api/models/authentication.rb +0 -112
  64. data/lib/apimatic_api/models/code_gen_settings.rb +0 -541
  65. data/lib/apimatic_api/models/code_generation.rb +0 -122
  66. data/lib/apimatic_api/models/docs_validation_summary.rb +0 -75
  67. data/lib/apimatic_api/models/endpoints_group.rb +0 -57
  68. data/lib/apimatic_api/models/environment.rb +0 -79
  69. data/lib/apimatic_api/models/field.rb +0 -156
  70. data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +0 -48
  71. data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +0 -61
  72. data/lib/apimatic_api/models/import_api_version_via_url_request.rb +0 -64
  73. data/lib/apimatic_api/models/import_api_via_file_request_body.rb +0 -51
  74. data/lib/apimatic_api/models/import_api_via_url_request.rb +0 -49
  75. data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +0 -66
  76. data/lib/apimatic_api/models/import_validation_summary.rb +0 -75
  77. data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +0 -51
  78. data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +0 -49
  79. data/lib/apimatic_api/models/meta_data.rb +0 -70
  80. data/lib/apimatic_api/models/parameter.rb +0 -165
  81. data/lib/apimatic_api/models/paramter_format_details.rb +0 -48
  82. data/lib/apimatic_api/models/platforms_template.rb +0 -49
  83. data/lib/apimatic_api/models/server.rb +0 -69
  84. data/lib/apimatic_api/models/server_configuration.rb +0 -105
  85. data/lib/apimatic_api/models/test_gen_settings.rb +0 -70
  86. data/lib/apimatic_api/models/transform_via_file_request_body.rb +0 -61
  87. data/lib/apimatic_api/models/user_code_generation_requirements.rb +0 -57
  88. data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +0 -51
  89. data/test/controllers/controller_test_base.rb +0 -29
  90. data/test/controllers/test_api_validation_external_apis_controller.rb +0 -144
  91. data/test/controllers/test_api_validation_imported_apis_controller.rb +0 -2971
  92. data/test/controllers/test_code_generation_external_apis_controller.rb +0 -32
  93. data/test/controllers/test_docs_portal_management_controller.rb +0 -94
  94. data/test/controllers/test_transformation_controller.rb +0 -32
  95. data/test/http_response_catcher.rb +0 -19
@@ -1,125 +1,198 @@
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
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze,
11
+ TESTING = 'testing'.freeze
12
+ ].freeze
13
+
14
+ # Converts a string or symbol into a valid Environment constant.
15
+ def self.from_value(value, default_value = PRODUCTION)
16
+ return default_value if value.nil?
17
+
18
+ str = value.to_s.strip.downcase
19
+ case str
20
+ when 'production' then PRODUCTION
21
+ when 'testing' then TESTING
22
+
23
+ else
24
+ warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
25
+ default_value
26
+ end
27
+ end
28
+ end
29
+
30
+ # An enum for API servers.
31
+ class Server
32
+ SERVER = [
33
+ DEFAULT = 'default'.freeze
34
+ ].freeze
35
+
36
+ # Converts a string or symbol into a valid Server constant.
37
+ def self.from_value(value, default_value = DEFAULT)
38
+ return default_value if value.nil?
39
+
40
+ default_value
41
+ end
42
+ end
43
+
44
+ # All configuration including auth info and base URI for the API access
45
+ # are configured in this class.
46
+ class Configuration < CoreLibrary::HttpClientConfiguration
47
+ # The attribute readers for properties.
48
+ attr_reader :environment, :custom_url,
49
+ :custom_header_authentication_credentials, :user_agent
50
+
51
+ class << self
52
+ attr_reader :environments
53
+ end
54
+
55
+ def initialize(
56
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
57
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
58
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
59
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
60
+ logging_configuration: nil, environment: Environment::PRODUCTION,
61
+ custom_url: 'https://localhost:44301/api',
62
+ custom_header_authentication_credentials: nil,
63
+ user_agent: 'TODO: Replace'
64
+ )
65
+ super connection: connection, adapter: adapter, timeout: timeout,
66
+ max_retries: max_retries, retry_interval: retry_interval,
67
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
68
+ retry_methods: retry_methods, http_callback: http_callback,
69
+ proxy_settings: proxy_settings,
70
+ logging_configuration: logging_configuration
71
+
72
+ # Current API environment
73
+ @environment = String(environment)
74
+
75
+ # The testing domain for the API
76
+ @custom_url = custom_url
77
+
78
+ # The object holding Custom Header Signature credentials
79
+ @custom_header_authentication_credentials = custom_header_authentication_credentials
80
+
81
+ # TODO: Replace
82
+ @user_agent = user_agent
83
+
84
+ # Initializing Custom Header Signature credentials with the provided auth parameters
85
+ @custom_header_authentication_credentials = custom_header_authentication_credentials
86
+
87
+ # The Http Client to use for making requests.
88
+ set_http_client CoreLibrary::FaradayClient.new(self)
89
+ end
90
+
91
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
92
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
93
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
94
+ proxy_settings: nil, logging_configuration: nil,
95
+ environment: nil, custom_url: nil,
96
+ custom_header_authentication_credentials: nil,
97
+ user_agent: nil)
98
+ connection ||= self.connection
99
+ adapter ||= self.adapter
100
+ timeout ||= self.timeout
101
+ max_retries ||= self.max_retries
102
+ retry_interval ||= self.retry_interval
103
+ backoff_factor ||= self.backoff_factor
104
+ retry_statuses ||= self.retry_statuses
105
+ retry_methods ||= self.retry_methods
106
+ http_callback ||= self.http_callback
107
+ proxy_settings ||= self.proxy_settings
108
+ logging_configuration ||= self.logging_configuration
109
+ environment ||= self.environment
110
+ custom_url ||= self.custom_url
111
+ user_agent ||= self.user_agent
112
+ custom_header_authentication_credentials ||= self.custom_header_authentication_credentials
113
+
114
+ Configuration.new(
115
+ connection: connection, adapter: adapter, timeout: timeout,
116
+ max_retries: max_retries, retry_interval: retry_interval,
117
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
118
+ retry_methods: retry_methods, http_callback: http_callback,
119
+ proxy_settings: proxy_settings,
120
+ logging_configuration: logging_configuration, environment: environment,
121
+ custom_url: custom_url, user_agent: user_agent,
122
+ custom_header_authentication_credentials: custom_header_authentication_credentials
123
+ )
124
+ end
125
+
126
+
127
+ # All the environments the SDK can run in.
128
+ ENVIRONMENTS = {
129
+ Environment::PRODUCTION => {
130
+ Server::DEFAULT => 'https://api.apimatic.io'
131
+ },
132
+ Environment::TESTING => {
133
+ Server::DEFAULT => '{customUrl}'
134
+ }
135
+ }.freeze
136
+
137
+ # Generates the appropriate base URI for the environment and the server.
138
+ # @param [Configuration::Server] server The server enum for which the base URI is
139
+ # required.
140
+ # @return [String] The base URI.
141
+ def get_base_uri(server = Server::DEFAULT)
142
+ parameters = {
143
+ 'customUrl' => { 'value' => custom_url, 'encode' => false }
144
+ }
145
+ APIHelper.append_url_with_template_parameters(
146
+ ENVIRONMENTS[environment][server], parameters
147
+ )
148
+ end
149
+
150
+ # Builds a Configuration instance using environment variables.
151
+ def self.build_default_config_from_env
152
+ # === Core environment ===
153
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
154
+ custom_url = ENV.fetch('CUSTOM_URL', 'https://localhost:44301/api')
155
+ user_agent = ENV.fetch('USER_AGENT', 'TODO: Replace')
156
+ timeout = (ENV['TIMEOUT'] || 30).to_f
157
+ max_retries = (ENV['MAX_RETRIES'] || 0).to_i
158
+ retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
159
+ backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
160
+ retry_statuses = ENV.fetch('RETRY_STATUSES',
161
+ '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
162
+ .split(',')
163
+ .map(&:strip)
164
+ .map do |item|
165
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
166
+ end
167
+ retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
168
+ .split(',')
169
+ .map(&:strip)
170
+ .map do |item|
171
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
172
+ end
173
+
174
+ # === Authentication credentials ===
175
+ custom_header_authentication_credentials = CustomHeaderAuthenticationCredentials.from_env
176
+
177
+ # === Proxy settings ===
178
+ proxy_settings = ProxySettings.from_env
179
+ # === Logging Configuration ===
180
+ logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
181
+
182
+ Configuration.new(
183
+ environment: environment,
184
+ custom_url: custom_url,
185
+ user_agent: user_agent,
186
+ timeout: timeout,
187
+ max_retries: max_retries,
188
+ retry_interval: retry_interval,
189
+ backoff_factor: backoff_factor,
190
+ retry_statuses: retry_statuses,
191
+ retry_methods: retry_methods,
192
+ custom_header_authentication_credentials: custom_header_authentication_credentials,
193
+ proxy_settings: proxy_settings,
194
+ logging_configuration: logging_configuration
195
+ )
196
+ end
197
+ end
198
+ end
@@ -1,84 +1,90 @@
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
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.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 [ContentType] content_type Required parameter: Example:
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 [ApiResponse] Complete http response with raw body and status code.
22
+ def validate_api_via_file(content_type,
23
+ file)
24
+ @api_call
25
+ .request(new_request_builder(HttpMethodEnum::POST,
26
+ '/validation/validate-via-file',
27
+ Server::DEFAULT)
28
+ .multipart_param(new_parameter(file, key: 'file')
29
+ .is_required(true)
30
+ .default_content_type('application/octet-stream'))
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(ApiValidationSummary.method(:from_hash))
36
+ .is_api_response(true)
37
+ .local_error('400',
38
+ 'Bad Request',
39
+ APIException)
40
+ .local_error('401',
41
+ 'Unauthenticated',
42
+ APIException)
43
+ .local_error('403',
44
+ 'Forbidden',
45
+ APIException)
46
+ .local_error('500',
47
+ 'Internal Server Error',
48
+ APIException))
49
+ .execute
50
+ end
51
+
52
+ # Validate an API by providing the URL of the API specification file.
53
+ # You can also specify [API
54
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
55
+ # validating the API using this endpoint. When specifying Metadata, the URL
56
+ # provided will be that of a zip file containing the API specification file
57
+ # and the `APIMATIC-META` json file.
58
+ # @param [String] description_url Required parameter: The URL for the API
59
+ # specification file.<br><br>**Note:** This URL should be publicly
60
+ # accessible.
61
+ # @return [ApiResponse] Complete http response with raw body and status code.
62
+ def validate_api_via_url(description_url)
63
+ @api_call
64
+ .request(new_request_builder(HttpMethodEnum::GET,
65
+ '/validation/validate-via-url',
66
+ Server::DEFAULT)
67
+ .query_param(new_parameter(description_url, key: 'descriptionUrl')
68
+ .is_required(true))
69
+ .header_param(new_parameter('application/json', key: 'accept'))
70
+ .auth(Single.new('Authorization')))
71
+ .response(new_response_handler
72
+ .deserializer(APIHelper.method(:custom_type_deserializer))
73
+ .deserialize_into(ApiValidationSummary.method(:from_hash))
74
+ .is_api_response(true)
75
+ .local_error('400',
76
+ 'Bad Request',
77
+ APIException)
78
+ .local_error('401',
79
+ 'Unauthenticated',
80
+ APIException)
81
+ .local_error('403',
82
+ 'Forbidden',
83
+ APIException)
84
+ .local_error('500',
85
+ 'Internal Server Error',
86
+ APIException))
87
+ .execute
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,89 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # ApiValidationV2ExternalApisController
8
+ class ApiValidationV2ExternalApisController < 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 [ContentType] content_type Required parameter: Example:
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 [ApiResponse] Complete http response with raw body and status code.
22
+ def validate_api_via_file_v2(content_type,
23
+ file)
24
+ @api_call
25
+ .request(new_request_builder(HttpMethodEnum::POST,
26
+ '/validation/v2/validate-via-file',
27
+ Server::DEFAULT)
28
+ .multipart_param(new_parameter(file, key: 'file')
29
+ .is_required(true)
30
+ .default_content_type('application/octet-stream'))
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(ValidateApiResult.method(:from_hash))
36
+ .is_api_response(true)
37
+ .local_error('400',
38
+ 'Bad Request',
39
+ ProblemDetailsException)
40
+ .local_error('401',
41
+ 'Unauthorized',
42
+ UnauthorizedResponseException)
43
+ .local_error('403',
44
+ 'Subscription Issue',
45
+ ProblemDetailsException)
46
+ .local_error('500',
47
+ 'Internal Server Error',
48
+ InternalServerErrorResponseException))
49
+ .execute
50
+ end
51
+
52
+ # Validate an API by providing the URL of the API specification file.
53
+ # You can also specify [API
54
+ # Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while
55
+ # validating the API using this endpoint. When specifying Metadata, the URL
56
+ # provided will be that of a zip file containing the API specification file
57
+ # and the `APIMATIC-META` json file.
58
+ # @param [String] url Required parameter: The URL for the API specification
59
+ # file.<br><br>**Note:** This URL should be publicly accessible.
60
+ # @return [ApiResponse] Complete http response with raw body and status code.
61
+ def validate_api_via_url_v2(url)
62
+ @api_call
63
+ .request(new_request_builder(HttpMethodEnum::GET,
64
+ '/validation/v2/validate-via-url',
65
+ Server::DEFAULT)
66
+ .query_param(new_parameter(url, key: 'url')
67
+ .is_required(true))
68
+ .header_param(new_parameter('application/json', key: 'accept'))
69
+ .auth(Single.new('Authorization')))
70
+ .response(new_response_handler
71
+ .deserializer(APIHelper.method(:custom_type_deserializer))
72
+ .deserialize_into(ValidateApiResult.method(:from_hash))
73
+ .is_api_response(true)
74
+ .local_error('400',
75
+ 'Bad Request',
76
+ ProblemDetailsException)
77
+ .local_error('401',
78
+ 'Unauthorized',
79
+ UnauthorizedResponseException)
80
+ .local_error('403',
81
+ 'Subscription Issue',
82
+ ProblemDetailsException)
83
+ .local_error('500',
84
+ 'Internal Server Error',
85
+ InternalServerErrorResponseException))
86
+ .execute
87
+ end
88
+ end
89
+ end