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,198 +1,56 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # DocsPortalManagementController
8
- class DocsPortalManagementController < BaseController
9
- # Publish artifacts for a Hosted Portal.
10
- # This endpoint regenerates all the artifacts for a hosted portal and
11
- # uploads them to APIMatic's cloud storage, from where the Portal fetches
12
- # them. These artifacts include:
13
- # 1. SDKs
14
- # 2. Docs
15
- # 3. API Specification files
16
- # Call this endpoint to update your Hosted Portal after you update an API
17
- # Entity via any of the Import API Endpoints.
18
- # __**Note: If you have an embedded portal against the same API Entity,
19
- # artifacts for that portal will get updated as well.**__
20
- # @param [String] api_entity_id Required parameter: The ID of the API Entity
21
- # to update the portal artifacts for.
22
- # @return [void] response from the API call
23
- def publish_hosted_portal(api_entity_id)
24
- new_api_call_builder
25
- .request(new_request_builder(HttpMethodEnum::PUT,
26
- '/api-entities/{api_entity_id}/hosted-portal',
27
- Server::DEFAULT)
28
- .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
29
- .should_encode(true))
30
- .auth(Single.new('Authorization')))
31
- .response(new_response_handler
32
- .is_response_void(true))
33
- .execute
34
- end
35
-
36
- # Publish artifacts for an Embedded Portal and get the Portal Embed script.
37
- # This endpoint regenerates all the artifacts for an embedded portal and
38
- # uploads them to APIMatic's cloud storage, from where the Portal fetches
39
- # them. These artifacts include:
40
- # 1. SDKs
41
- # 2. Docs
42
- # 3. API Specification files
43
- # Call this endpoint to update your Embedded Portal after you update an API
44
- # Entity via any of the Import API Endpoints. This endpoint returns the
45
- # Portal Embed script in the response.
46
- # __**Note: If you have a hosted portal against the same API Entity,
47
- # artifacts for that portal will get updated as well.**__
48
- # @param [String] api_entity_id Required parameter: The ID of the API Entity
49
- # to update the portal artifacts for.
50
- # @return [void] response from the API call
51
- def publish_embedded_portal(api_entity_id)
52
- new_api_call_builder
53
- .request(new_request_builder(HttpMethodEnum::PUT,
54
- '/api-entities/{api_entity_id}/embedded-portal',
55
- Server::DEFAULT)
56
- .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
57
- .should_encode(true))
58
- .auth(Single.new('Authorization')))
59
- .response(new_response_handler
60
- .is_response_void(true))
61
- .execute
62
- end
63
-
64
- # Generate an On-premise Documentation Portal for an API Entity. This
65
- # endpoint generates all artifacts for the Portal and packages them together
66
- # into a zip file along with the required HTML, CSS and JS files. The
67
- # generated artifacts include:
68
- # 1. SDKs
69
- # 2. Docs
70
- # 3. API Specification files
71
- # The endpoint returns a zip file that contains a static Site and can be
72
- # hosted on any Web Server.
73
- # @param [String] api_entity_id Required parameter: The ID of the API Entity
74
- # to generate the Portal for.
75
- # @return [void] response from the API call
76
- def generate_on_prem_portal_via_api_entity(api_entity_id)
77
- new_api_call_builder
78
- .request(new_request_builder(HttpMethodEnum::GET,
79
- '/api-entities/{api_entity_id}/on-prem-portal',
80
- Server::DEFAULT)
81
- .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
82
- .should_encode(true))
83
- .auth(Single.new('Authorization')))
84
- .response(new_response_handler
85
- .is_response_void(true))
86
- .execute
87
- end
88
-
89
- # Generate an On-premise Documentation Portal by uploading a Portal Build
90
- # Input. This endpoint generates all artifacts for the Portal and packages
91
- # them together into a zip file along with the required HTML, CSS and JS
92
- # files. The generated artifacts include:
93
- # 1. SDKs
94
- # 2. Docs
95
- # 3. API Specification files
96
- # The endpoint returns a zip file that contains a static Site and can be
97
- # hosted on any Web Server.
98
- # @param [File | UploadIO] file Required parameter: The input file to the
99
- # Portal Generator. Must contain the build file.
100
- # @return [Binary] response from the API call
101
- def generate_on_prem_portal_via_build_input(file)
102
- new_api_call_builder
103
- .request(new_request_builder(HttpMethodEnum::POST,
104
- '/portal',
105
- Server::DEFAULT)
106
- .multipart_param(new_parameter(file, key: 'file')
107
- .default_content_type('application/octet-stream'))
108
- .auth(Single.new('Authorization')))
109
- .response(new_response_handler
110
- .local_error('400',
111
- 'Bad Request',
112
- APIException)
113
- .local_error('401',
114
- 'Unauthorized',
115
- APIException)
116
- .local_error('402',
117
- 'Subscription Issue',
118
- APIException)
119
- .local_error('422',
120
- 'Unprocessable Entity',
121
- APIException))
122
- .execute
123
- end
124
-
125
- # Generate Build Input for a Portal created using the UI workflow. The
126
- # Build Input will correspond to the draft version of the Portal i.e.
127
- # unpublished changes will also be included.
128
- # This can be used to create a backup of your Portal or to migrate from the
129
- # UI workflow to the docs as code workflow.
130
- # @param [String] api_group_id Required parameter: Example:
131
- # @param [Array[String]] api_entities Optional parameter: Example:
132
- # @return [String] response from the API call
133
- def generate_build_input_for_unpublished_portal(api_group_id,
134
- api_entities: nil)
135
- new_api_call_builder
136
- .request(new_request_builder(HttpMethodEnum::GET,
137
- '/portal/build/{apiGroupId}/draft',
138
- Server::DEFAULT)
139
- .template_param(new_parameter(api_group_id, key: 'apiGroupId')
140
- .should_encode(true))
141
- .query_param(new_parameter(api_entities, key: 'apiEntities'))
142
- .auth(Single.new('Authorization')))
143
- .response(new_response_handler
144
- .deserializer(APIHelper.method(:deserialize_primitive_types))
145
- .deserialize_into(proc do |response| response.to_s end)
146
- .is_primitive_response(true))
147
- .execute
148
- end
149
-
150
- # Generate Build Input for a Portal created using the UI workflow. The
151
- # Build Input will correspond to the published version of the Portal i.e.
152
- # unpublished changes will not be inlcuded.
153
- # This can be used to create a backup of your Portal or to migrate from the
154
- # UI workflow to the docs as code workflow.
155
- # @param [String] api_group_id Required parameter: Example:
156
- # @param [Array[String]] api_entities Optional parameter: Example:
157
- # @return [String] response from the API call
158
- def generate_build_input_for_published_portal(api_group_id,
159
- api_entities: nil)
160
- new_api_call_builder
161
- .request(new_request_builder(HttpMethodEnum::GET,
162
- '/portal/build/{apiGroupId}/published',
163
- Server::DEFAULT)
164
- .template_param(new_parameter(api_group_id, key: 'apiGroupId')
165
- .should_encode(true))
166
- .query_param(new_parameter(api_entities, key: 'apiEntities'))
167
- .auth(Single.new('Authorization')))
168
- .response(new_response_handler
169
- .deserializer(APIHelper.method(:deserialize_primitive_types))
170
- .deserialize_into(proc do |response| response.to_s end)
171
- .is_primitive_response(true))
172
- .execute
173
- end
174
-
175
- # Unpublish a Hosted or Embedded Portal published for an API Entity. Calling
176
- # this endpoint deletes all the published artifacts for a Portal from
177
- # APIMatic's cloud storage.
178
- # In case of a Hosted Portal, to completely remove the Portal, this endpoint
179
- # needs to be called against all API versions that the Portal hosts.
180
- # In case of an Embedded Portal, to completely remove the Portal, the user
181
- # needs to manually remove the Portal Embed script from the embedding site.
182
- # @param [String] api_entity_id Required parameter: The ID of the API Entity
183
- # to unpublish the Portal artifacts for.
184
- # @return [void] response from the API call
185
- def unpublish_portal(api_entity_id)
186
- new_api_call_builder
187
- .request(new_request_builder(HttpMethodEnum::DELETE,
188
- '/api-entities/{api_entity_id}/portal',
189
- Server::DEFAULT)
190
- .template_param(new_parameter(api_entity_id, key: 'api_entity_id')
191
- .should_encode(true))
192
- .auth(Single.new('Authorization')))
193
- .response(new_response_handler
194
- .is_response_void(true))
195
- .execute
196
- end
197
- end
198
- 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
+ # DocsPortalManagementController
8
+ class DocsPortalManagementController < BaseController
9
+ # Generate an On-premise Documentation Portal by uploading a Portal Build
10
+ # Input. This endpoint generates all artifacts for the Portal and packages
11
+ # them together into a zip file along with the required HTML, CSS and JS
12
+ # files. The generated artifacts include:
13
+ # 1. SDKs
14
+ # 2. Docs
15
+ # 3. API Specification files
16
+ # The endpoint returns a zip file that contains a static Site and can be
17
+ # hosted on any Web Server.
18
+ # @param [ContentType] content_type Required parameter: Example:
19
+ # @param [File | UploadIO] file Required parameter: The input file to the
20
+ # Portal Generator. Must contain the build file.
21
+ # @param [Hash] _query_parameters Additional optional query parameters are
22
+ # supported by this endpoint.
23
+ # @return [ApiResponse] Complete http response with raw body and status code.
24
+ def generate_on_prem_portal_via_build_input(content_type,
25
+ file,
26
+ _query_parameters: nil)
27
+ @api_call
28
+ .request(new_request_builder(HttpMethodEnum::POST,
29
+ '/portal',
30
+ Server::DEFAULT)
31
+ .multipart_param(new_parameter(file, key: 'file')
32
+ .is_required(true)
33
+ .default_content_type('application/octet-stream'))
34
+ .additional_query_params(_query_parameters)
35
+ .auth(Single.new('Authorization')))
36
+ .response(new_response_handler
37
+ .is_api_response(true)
38
+ .local_error('400',
39
+ 'Bad Request',
40
+ ProblemDetailsException)
41
+ .local_error('401',
42
+ 'Unauthorized',
43
+ UnauthorizedResponseException)
44
+ .local_error('403',
45
+ 'Subscription Issue',
46
+ ProblemDetailsException)
47
+ .local_error('422',
48
+ 'Unprocessable Entity - Contains error.zip for build issues',
49
+ APIException)
50
+ .local_error('500',
51
+ 'Internal Server Error',
52
+ InternalServerErrorResponseException))
53
+ .execute
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,112 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # SdkGenerationAsyncController
8
+ class SdkGenerationAsyncController < BaseController
9
+ # Create an async SDK Generation request by providing a Build Input
10
+ # @param [ContentType] content_type Required parameter: Example:
11
+ # @param [File | UploadIO] file Required parameter: The input file to the
12
+ # SDK Generator. Must contain the build file or a spec folder containing the
13
+ # API Specification.
14
+ # @param [SdkLanguages] language Required parameter: Languages for which
15
+ # SDKs can be generated.
16
+ # @param [String] x_api_matic_callback_url Optional parameter: Optional
17
+ # header containing callback url. This url will be called by the server once
18
+ # the SDK generation completes
19
+ # @param [String] package_version Optional parameter: Optional field
20
+ # containing the package version to apply to the generated SDK.
21
+ # @return [ApiResponse] Complete http response with raw body and status code.
22
+ def generate_sdk_via_build_input_async(content_type,
23
+ file,
24
+ language,
25
+ x_api_matic_callback_url: nil,
26
+ package_version: nil)
27
+ @api_call
28
+ .request(new_request_builder(HttpMethodEnum::POST,
29
+ '/sdk',
30
+ Server::DEFAULT)
31
+ .multipart_param(new_parameter(file, key: 'file')
32
+ .is_required(true)
33
+ .default_content_type('application/octet-stream'))
34
+ .form_param(new_parameter(language, key: 'language')
35
+ .is_required(true))
36
+ .header_param(new_parameter(x_api_matic_callback_url, key: 'X-APIMatic-CallbackUrl'))
37
+ .form_param(new_parameter(package_version, key: 'packageVersion'))
38
+ .header_param(new_parameter('application/json', key: 'accept'))
39
+ .auth(Single.new('Authorization')))
40
+ .response(new_response_handler
41
+ .deserializer(APIHelper.method(:custom_type_deserializer))
42
+ .deserialize_into(SdkGenerationAsyncResponse.method(:from_hash))
43
+ .is_api_response(true)
44
+ .local_error('400',
45
+ 'Bad Request',
46
+ ProblemDetailsException)
47
+ .local_error('401',
48
+ 'Unauthorized',
49
+ UnauthorizedResponseException)
50
+ .local_error('500',
51
+ 'Internal Server Error',
52
+ InternalServerErrorResponseException))
53
+ .execute
54
+ end
55
+
56
+ # Get the status of an SDK generation request
57
+ # @param [String] id Required parameter: TODO: type description here
58
+ # @return [ApiResponse] Complete http response with raw body and status code.
59
+ def get_sdk_generation_status(id)
60
+ @api_call
61
+ .request(new_request_builder(HttpMethodEnum::GET,
62
+ '/sdk/{id}/status',
63
+ Server::DEFAULT)
64
+ .template_param(new_parameter(id, key: 'id')
65
+ .is_required(true)
66
+ .should_encode(true))
67
+ .header_param(new_parameter('application/json', key: 'accept'))
68
+ .auth(Single.new('Authorization')))
69
+ .response(new_response_handler
70
+ .deserializer(APIHelper.method(:custom_type_deserializer))
71
+ .deserialize_into(SdkGenerationStatusResponse.method(:from_hash))
72
+ .is_api_response(true)
73
+ .local_error('400',
74
+ 'Bad Request',
75
+ ProblemDetailsException)
76
+ .local_error('401',
77
+ 'Unauthorized',
78
+ UnauthorizedResponseException)
79
+ .local_error('500',
80
+ 'Internal Server Error',
81
+ InternalServerErrorResponseException))
82
+ .execute
83
+ end
84
+
85
+ # Downloads the SDK artifacts. The endpoint returns a zip file containing
86
+ # the generated SDK.
87
+ # @param [String] id Required parameter: TODO: type description here
88
+ # @return [ApiResponse] Complete http response with raw body and status code.
89
+ def download_generated_sdk(id)
90
+ @api_call
91
+ .request(new_request_builder(HttpMethodEnum::GET,
92
+ '/sdk/{id}/download',
93
+ Server::DEFAULT)
94
+ .template_param(new_parameter(id, key: 'id')
95
+ .is_required(true)
96
+ .should_encode(true))
97
+ .auth(Single.new('Authorization')))
98
+ .response(new_response_handler
99
+ .is_api_response(true)
100
+ .local_error('400',
101
+ 'Bad Request',
102
+ ProblemDetailsException)
103
+ .local_error('401',
104
+ 'Unauthorized',
105
+ UnauthorizedResponseException)
106
+ .local_error('500',
107
+ 'Internal Server Error',
108
+ InternalServerErrorResponseException))
109
+ .execute
110
+ end
111
+ end
112
+ end