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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +165 -77
- data/bin/console +15 -0
- data/lib/apimatic_api/api_helper.rb +10 -10
- data/lib/apimatic_api/client.rb +108 -96
- data/lib/apimatic_api/configuration.rb +198 -125
- data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +90 -84
- data/lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb +89 -0
- data/lib/apimatic_api/controllers/base_controller.rb +55 -66
- data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +201 -178
- data/lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb +110 -0
- data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +56 -198
- data/lib/apimatic_api/controllers/sdk_generation_async_controller.rb +112 -0
- data/lib/apimatic_api/controllers/transformation_controller.rb +180 -174
- data/lib/apimatic_api/exceptions/api_exception.rb +21 -10
- data/lib/apimatic_api/exceptions/bad_request_response_sdk_exception.rb +46 -0
- data/lib/apimatic_api/exceptions/internal_server_error_response_exception.rb +46 -0
- data/lib/apimatic_api/exceptions/problem_details_exception.rb +74 -0
- data/lib/apimatic_api/exceptions/unauthorized_response_exception.rb +46 -0
- data/lib/apimatic_api/http/api_response.rb +19 -0
- data/lib/apimatic_api/http/auth/custom_header_authentication.rb +48 -38
- data/lib/apimatic_api/http/http_call_back.rb +10 -10
- data/lib/apimatic_api/http/http_method_enum.rb +10 -10
- data/lib/apimatic_api/http/http_request.rb +10 -10
- data/lib/apimatic_api/http/http_response.rb +10 -10
- data/lib/apimatic_api/http/proxy_settings.rb +22 -0
- data/lib/apimatic_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/apimatic_api/logging/sdk_logger.rb +17 -0
- data/lib/apimatic_api/models/accept.rb +26 -0
- data/lib/apimatic_api/models/api_validation_summary.rb +100 -75
- data/lib/apimatic_api/models/base_model.rb +110 -62
- data/lib/apimatic_api/models/content_type.rb +26 -0
- data/lib/apimatic_api/models/export_formats.rb +85 -60
- data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +85 -59
- data/lib/apimatic_api/models/line_info.rb +105 -0
- data/lib/apimatic_api/models/links.rb +82 -0
- data/lib/apimatic_api/models/platforms.rb +57 -39
- data/lib/apimatic_api/models/portal_generation_async_response.rb +68 -0
- data/lib/apimatic_api/models/portal_generation_status_response.rb +70 -0
- data/lib/apimatic_api/models/sdk_generation_async_response.rb +68 -0
- data/lib/apimatic_api/models/sdk_generation_status_response.rb +70 -0
- data/lib/apimatic_api/models/sdk_languages.rb +56 -0
- data/lib/apimatic_api/models/status.rb +48 -0
- data/lib/apimatic_api/models/transform_via_url_request.rb +85 -60
- data/lib/apimatic_api/models/transformation.rb +180 -152
- data/lib/apimatic_api/models/user_code_generation.rb +167 -140
- data/lib/apimatic_api/models/validate_api_result.rb +82 -0
- data/lib/apimatic_api/models/validation_entry.rb +143 -0
- data/lib/apimatic_api/models/validation_summary.rb +145 -0
- data/lib/apimatic_api/utilities/date_time_helper.rb +11 -11
- data/lib/apimatic_api/utilities/file_wrapper.rb +28 -16
- data/lib/apimatic_api.rb +79 -86
- metadata +39 -89
- data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +0 -74
- data/lib/apimatic_api/controllers/apis_management_controller.rb +0 -260
- data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +0 -136
- data/lib/apimatic_api/models/api_entity.rb +0 -220
- data/lib/apimatic_api/models/api_entity_code_generation.rb +0 -131
- data/lib/apimatic_api/models/api_entity_identifier.rb +0 -48
- data/lib/apimatic_api/models/attributes.rb +0 -48
- data/lib/apimatic_api/models/auth_scope.rb +0 -75
- data/lib/apimatic_api/models/authentication.rb +0 -112
- data/lib/apimatic_api/models/code_gen_settings.rb +0 -541
- data/lib/apimatic_api/models/code_generation.rb +0 -122
- data/lib/apimatic_api/models/docs_validation_summary.rb +0 -75
- data/lib/apimatic_api/models/endpoints_group.rb +0 -57
- data/lib/apimatic_api/models/environment.rb +0 -79
- data/lib/apimatic_api/models/field.rb +0 -156
- data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +0 -48
- data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +0 -61
- data/lib/apimatic_api/models/import_api_version_via_url_request.rb +0 -64
- data/lib/apimatic_api/models/import_api_via_file_request_body.rb +0 -51
- data/lib/apimatic_api/models/import_api_via_url_request.rb +0 -49
- data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +0 -66
- data/lib/apimatic_api/models/import_validation_summary.rb +0 -75
- data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +0 -51
- data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +0 -49
- data/lib/apimatic_api/models/meta_data.rb +0 -70
- data/lib/apimatic_api/models/parameter.rb +0 -165
- data/lib/apimatic_api/models/paramter_format_details.rb +0 -48
- data/lib/apimatic_api/models/platforms_template.rb +0 -49
- data/lib/apimatic_api/models/server.rb +0 -69
- data/lib/apimatic_api/models/server_configuration.rb +0 -105
- data/lib/apimatic_api/models/test_gen_settings.rb +0 -70
- data/lib/apimatic_api/models/transform_via_file_request_body.rb +0 -61
- data/lib/apimatic_api/models/user_code_generation_requirements.rb +0 -57
- data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +0 -51
- data/test/controllers/controller_test_base.rb +0 -29
- data/test/controllers/test_api_validation_external_apis_controller.rb +0 -144
- data/test/controllers/test_api_validation_imported_apis_controller.rb +0 -2971
- data/test/controllers/test_code_generation_external_apis_controller.rb +0 -32
- data/test/controllers/test_docs_portal_management_controller.rb +0 -94
- data/test/controllers/test_transformation_controller.rb +0 -32
- data/test/http_response_catcher.rb +0 -19
|
@@ -1,125 +1,198 @@
|
|
|
1
|
-
# apimatic_api
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
module ApimaticApi
|
|
7
|
-
# An enum for SDK environments.
|
|
8
|
-
class Environment
|
|
9
|
-
ENVIRONMENT = [
|
|
10
|
-
PRODUCTION = 'production'.freeze
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
custom_header_authentication_credentials =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
module ApimaticApi
|
|
7
|
-
#
|
|
8
|
-
class
|
|
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 [
|
|
16
|
-
#
|
|
17
|
-
#
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|