translationApiClient 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d0d7a9bb22733a83f8ab698a68fc2ab050df480
4
+ data.tar.gz: c181f2d541570e6e92022842691d5135761ee20f
5
+ SHA512:
6
+ metadata.gz: 765d3e4e7fe2ee3bff5efed1a267642e314c17b1cf1e636bf6ca944fdbbf5de7aed4babdf73ca7840810f1a4766ef3967c68d4669c2b12e947743b9f76c27d34
7
+ data.tar.gz: d7417e3180150a49273f48b0086c392e8f1fe9da73fc37b6b428d69b1bd2401c091d5dbd4953eb9f5f8faa5bb0c357bd8e3e9ed6e8f9406957c5a458d628de9c
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'typhoeus', '~> 0.2', '>= 0.2.1'
4
+ gem 'addressable', '~> 2.2', '>= 2.2.4'
5
+ gem 'json', '~> 1.4', '>= 1.4.6'
6
+ gem 'rspec', '~> 3.2', '>= 3.2.0'
7
+ gem 'vcr', '~> 2.9', '>= 2.9.3'
8
+ gem 'webmock', '~> 1.6', '>= 1.6.2'
9
+ gem 'autotest', '~> 4.4', '>= 4.4.6'
10
+ gem 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
11
+ gem 'autotest-growl', '~> 0.2', '>= 0.2.16'
12
+ gem 'autotest-fsevent', '~> 0.2', '>= 0.2.10'
13
+ gem 'httpadapter', '~> 1.0.1'
14
+ gem 'rack', '~> 1.6.4'
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,17 @@
1
+ Systran translation Ruby Client Library.
2
+ ===================
3
+ This is a Ruby implementation of the Systran Translation Client Library. This client is a standard gem.
4
+
5
+ Build
6
+ -------------
7
+ ```
8
+ gem build translationApiClient.gemspec
9
+ ```
10
+
11
+
12
+ Test
13
+ -------------
14
+ ```
15
+ bundle install
16
+ rspec spec/translationApiClient_spec.rb
17
+ ```
@@ -0,0 +1 @@
1
+ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
@@ -0,0 +1,28 @@
1
+ # Swagger common files
2
+ require 'TranslationApi_client/monkey'
3
+ require 'TranslationApi_client/swagger'
4
+ require 'TranslationApi_client/swagger/configuration'
5
+ require 'TranslationApi_client/swagger/request'
6
+ require 'TranslationApi_client/swagger/response'
7
+ require 'TranslationApi_client/swagger/version'
8
+
9
+ # Models
10
+ require 'TranslationApi_client/models/base_object'
11
+ require 'TranslationApi_client/models/translation_output'
12
+ require 'TranslationApi_client/models/translation_response'
13
+ require 'TranslationApi_client/models/translation_status'
14
+ require 'TranslationApi_client/models/translation_cancel'
15
+ require 'TranslationApi_client/models/profile_id'
16
+ require 'TranslationApi_client/models/language_pair'
17
+ require 'TranslationApi_client/models/supported_language_response'
18
+ require 'TranslationApi_client/models/profile'
19
+ require 'TranslationApi_client/models/profiles_response'
20
+ require 'httpadapter'
21
+
22
+ # APIs
23
+ require 'TranslationApi_client/api/translation_api'
24
+
25
+ module TranslationApiClient
26
+ # Initialize the default configuration
27
+ Swagger.configuration ||= Swagger::Configuration.new
28
+ end
@@ -0,0 +1,363 @@
1
+ require "uri"
2
+ require 'ostruct'
3
+ require 'json'
4
+
5
+ module TranslationApiClient
6
+ class TranslationApi
7
+ basePath = "https://api-platform.systran.net/"
8
+ # apiInvoker = APIInvoker
9
+
10
+ # List of profiles
11
+ # List of profiles available for translation.\n
12
+ # @param [Hash] opts the optional parameters
13
+ # @option opts [string] :source Source language code of the profile
14
+ # @option opts [string] :target Target Language code of the profile\n
15
+ # @option opts [array[int]] :id Identifier of the profile\n
16
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
17
+ # @return [ProfilesResponse]
18
+ def self.translation_profile_get(opts = {})
19
+
20
+
21
+ # resource path
22
+ path = "/translation/profile".sub('{format}','json')
23
+
24
+ # query parameters
25
+ query_params = {}
26
+ query_params[:'source'] = opts[:'source'] if opts[:'source']
27
+ query_params[:'target'] = opts[:'target'] if opts[:'target']
28
+ query_params[:'id'] = opts[:'id'] if opts[:'id']
29
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
30
+
31
+ # header parameters
32
+ header_params = {}
33
+
34
+ # HTTP header 'Accept' (if needed)
35
+ _header_accept = ['application/json']
36
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
37
+
38
+ # HTTP header 'Content-Type'
39
+ _header_content_type = []
40
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
41
+
42
+ # form parameters
43
+ form_params = {}
44
+
45
+ # http body (model)
46
+ post_body = nil
47
+
48
+
49
+ auth_names = ['accessToken', 'apiKey']
50
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
51
+ obj = ProfilesResponse.new() and obj.build_from_hash(response)
52
+ end
53
+
54
+ # Supported Languages
55
+ # List of language pairs in which translation is supported.\n\nThis list can be limited to a specific source language or target language.\n
56
+ # @param [Hash] opts the optional parameters
57
+ # @option opts [array[string]] :source Language code of the source text\n
58
+ # @option opts [array[string]] :target Language code into which to translate the source text\n
59
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
60
+ # @return [SupportedLanguageResponse]
61
+ def self.translation_supported_languages_get(opts = {})
62
+
63
+
64
+ # resource path
65
+ path = "/translation/supportedLanguages".sub('{format}','json')
66
+
67
+ # query parameters
68
+ query_params = {}
69
+ query_params[:'source'] = opts[:'source'] if opts[:'source']
70
+ query_params[:'target'] = opts[:'target'] if opts[:'target']
71
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
72
+
73
+ # header parameters
74
+ header_params = {}
75
+
76
+ # HTTP header 'Accept' (if needed)
77
+ _header_accept = ['application/json']
78
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
79
+
80
+ # HTTP header 'Content-Type'
81
+ _header_content_type = []
82
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
83
+
84
+ # form parameters
85
+ form_params = {}
86
+
87
+ # http body (model)
88
+ post_body = nil
89
+
90
+
91
+ auth_names = ['accessToken', 'apiKey']
92
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
93
+ obj = SupportedLanguageResponse.new() and obj.build_from_hash(response)
94
+ end
95
+
96
+ # Translate
97
+ # Translate text from source language to target language\n
98
+ # @param input Input text (this parameter can be repeated)\n
99
+ # @param target Target language code ([details](#description_langage_code_values))
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [string] :source Source language code ([details](#description_langage_code_values)) or `auto`.\n\nWhen the value is set to `auto`, the language will be automatically detected, used to enhance the translation, and returned in output.\n
102
+ # @option opts [string] :format Format of the source text.\n\nValid values are `text` for plain text, `html` for HTML pages, and `auto` for automatic detection. The MIME type of file format supported by SYSTRAN can also be used (application/vnd.openxmlformats, application/vnd.oasis.opendocument, ...)\n
103
+ # @option opts [int] :profile Profile id\n
104
+ # @option opts [boolean] :with_source If `true`, the source will also be sent back in the response message. It can be useful when used with the withAnnotations option to align the source document with the translated document\n
105
+ # @option opts [boolean] :with_annotations If `true`, different annotations will be provided in the translated document. If the option 'withSource' is used, the annotations will also be provided in the source document. It will provide segments, tokens, not found words,...\n
106
+ # @option opts [string] :with_dictionary User Dictionary or/and Normalization Dictionary ids to be applied to the translation result. Each dictionary 'id' has to be separate by a comma.\n
107
+ # @option opts [boolean] :back_translation If `true`, the translated text will be translated back in source language\n
108
+ # @option opts [array[string]] :options Additional options.\n\nAn option can be a JSON object containing a set of key/value generic options supported by the translator. It can also be a string with the syntax '<key>:<value>' to pass a key/value generic option to the translator.\n
109
+ # @option opts [string] :encoding Encoding. `base64` can be useful to send binary documents in the JSON body. Please note that another alternative is to use translateFile\n
110
+ # @option opts [boolean] :async If `true`, the translation is performed asynchronously.\n\nThe \"/translate/status\" service must be used to wait for the completion of the request and the \"translate/result\" service must be used to get the final result. The \"/translate/cancel\" can be used to cancel the request.\n
111
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
112
+ # @return [TranslationResponse]
113
+ def self.translation_translate_get(input, target, opts = {})
114
+
115
+ # verify the required parameter 'input' is set
116
+ raise "Missing the required parameter 'input' when calling translation_translate_get" if input.nil?
117
+
118
+ # verify the required parameter 'target' is set
119
+ raise "Missing the required parameter 'target' when calling translation_translate_get" if target.nil?
120
+
121
+
122
+ # resource path
123
+ path = "/translation/text/translate".sub('{format}','json')
124
+
125
+ # query parameters
126
+ query_params = {}
127
+ query_params[:'input'] = input
128
+ query_params[:'target'] = target
129
+ query_params[:'source'] = opts[:'source'] if opts[:'source']
130
+ query_params[:'format'] = opts[:'format'] if opts[:'format']
131
+ query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
132
+ query_params[:'withSource'] = opts[:'with_source'] if opts[:'with_source']
133
+ query_params[:'withAnnotations'] = opts[:'with_annotations'] if opts[:'with_annotations']
134
+ query_params[:'withDictionary'] = opts[:'with_dictionary'] if opts[:'with_dictionary']
135
+ query_params[:'backTranslation'] = opts[:'back_translation'] if opts[:'back_translation']
136
+ query_params[:'options'] = opts[:'options'] if opts[:'options']
137
+ query_params[:'encoding'] = opts[:'encoding'] if opts[:'encoding']
138
+ #query_params[:'async'] = opts[:'async'] if opts[:'async']
139
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
140
+
141
+ # header parameters
142
+ header_params = {}
143
+
144
+ # HTTP header 'Accept' (if needed)
145
+ _header_accept = ['application/json']
146
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
147
+
148
+ # HTTP header 'Content-Type'
149
+ _header_content_type = []
150
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
151
+
152
+ # form parameters
153
+ form_params = {}
154
+
155
+ # http body (model)
156
+ post_body = nil
157
+
158
+
159
+ auth_names = ['accessToken', 'apiKey']
160
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
161
+ obj = TranslationResponse.new() and obj.build_from_hash(response)
162
+ end
163
+
164
+ # Translate Cancel
165
+ # Cancel an asynchronous translation request\n
166
+ # @param request_id Request Identifier\n
167
+ # @param [Hash] opts the optional parameters
168
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
169
+ # @return [TranslationCancel]
170
+ def self.translation_translate_cancel_get(request_id, opts = {})
171
+
172
+ # verify the required parameter 'request_id' is set
173
+ raise "Missing the required parameter 'request_id' when calling translation_translate_cancel_get" if request_id.nil?
174
+
175
+
176
+ # resource path
177
+ path = "/translation/file/cancel".sub('{format}','json')
178
+
179
+ # query parameters
180
+ query_params = {}
181
+ query_params[:'requestId'] = request_id
182
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
183
+
184
+ # header parameters
185
+ header_params = {}
186
+
187
+ # HTTP header 'Accept' (if needed)
188
+ _header_accept = ['application/json']
189
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
190
+
191
+ # HTTP header 'Content-Type'
192
+ _header_content_type = []
193
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
194
+
195
+ # form parameters
196
+ form_params = {}
197
+
198
+ # http body (model)
199
+ post_body = nil
200
+
201
+
202
+ auth_names = ['accessToken', 'apiKey']
203
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
204
+ obj = TranslationCancel.new() and obj.build_from_hash(response)
205
+ end
206
+
207
+ # Translate file
208
+ # Translate a file from source language to target language\n\n\n* In asynchronous mode (async=true), the response will be a JSON containing a request identifier. This identifier can then be used to poll the request status and its result when completed.\n\n ```\n {\n \"requestId\": \"54a3d860e62ea467b136eddb\" /* Request identifier to use to get the status,\n the result of the request and to cancel it */\n \"error\": \"\", /* Error at request level */\n }\n ```\n\n* In synchronous mode, the response will be either:\n\n * The **translated document**, directly, if `source` parameters was not `auto` and `withSource` was not true\n * A `multipart/mixed` document with the following parts:\n\n 1. **Detected language**, if request was done with `auto` source language\n\n * Header:\n\n `part-name: detectedLanguage`\n\n * Body: JSON document\n ```\n {\n detectedLanguage: \"string\"\n detectedLanguageConfidence : number\n }\n ```\n\n 2. **Source document**, if request was done with `withSource`:\n\n * Header: `part-name: source`\n * Body: Source document\n\n 3. **Translated document**\n\n * Header: `part-name: output`\n\n * Body: Translated document\n
209
+ # @param input Input file\n
210
+ # @param target Target language code ([details](#description_langage_code_values))
211
+ # @param [Hash] opts the optional parameters
212
+ # @option opts [string] :source Source language code ([details](#description_langage_code_values)) or `auto`.\n\nWhen the value is set to `auto`, the language will be automatically detected, used to enhance the translation, and returned in output.\n
213
+ # @option opts [string] :format Format of the source text.\n\nValid values are `text` for plain text, `html` for HTML pages, and `auto` for automatic detection. The MIME type of file format supported by SYSTRAN can also be used (application/vnd.openxmlformats, application/vnd.oasis.opendocument, ...)\n
214
+ # @option opts [int] :profile Profile id\n
215
+ # @option opts [boolean] :with_source If `true`, the source will also be sent back in the response message. It can be useful when used with the withAnnotations option to align the source document with the translated document\n
216
+ # @option opts [boolean] :with_annotations If `true`, different annotations will be provided in the translated document. If the option 'withSource' is used, the annotations will also be provided in the source document. It will provide segments, tokens, not found words,...\n
217
+ # @option opts [string] :with_dictionary User Dictionary or/and Normalization Dictionary ids to be applied to the translation result. Each dictionary 'id' has to be separate by a comma.\n
218
+ # @option opts [array[string]] :options Additional options.\n\nAn option can be a JSON object containing a set of key/value generic options supported by the translator. It can also be a string with the syntax '<key>:<value>' to pass a key/value generic option to the translator.\n
219
+ # @option opts [string] :encoding Encoding. `base64` can be useful to send binary documents in the JSON body. Please note that another alternative is to use translateFile\n
220
+ # @option opts [boolean] :async If `true`, the translation is performed asynchronously.\n\nThe \"/translate/status\" service must be used to wait for the completion of the request and the \"translate/result\" service must be used to get the final result. The \"/translate/cancel\" can be used to cancel the request.\n
221
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
222
+ # @return [file]
223
+ def self.translation_translate_file_get(input, target, opts = {})
224
+
225
+ # verify the required parameter 'input' is set
226
+ raise "Missing the required parameter 'input' when calling translation_translate_file_get" if input.nil?
227
+
228
+ # verify the required parameter 'target' is set
229
+ raise "Missing the required parameter 'target' when calling translation_translate_file_get" if target.nil?
230
+
231
+
232
+ # resource path
233
+ path = "/translation/file/translate".sub('{format}','json')
234
+
235
+ # query parameters
236
+ query_params = {}
237
+ query_params[:'target'] = target
238
+ query_params[:'source'] = opts[:'source'] if opts[:'source']
239
+ query_params[:'format'] = opts[:'format'] if opts[:'format']
240
+ query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
241
+ query_params[:'withSource'] = opts[:'with_source'] if opts[:'with_source']
242
+ query_params[:'withAnnotations'] = opts[:'with_annotations'] if opts[:'with_annotations']
243
+ query_params[:'withDictionary'] = opts[:'with_dictionary'] if opts[:'with_dictionary']
244
+ query_params[:'options'] = opts[:'options'] if opts[:'options']
245
+ query_params[:'encoding'] = opts[:'encoding'] if opts[:'encoding']
246
+ query_params[:'async'] = opts[:'async'] if opts[:'async']
247
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
248
+
249
+ # header parameters
250
+ header_params = {}
251
+
252
+ # HTTP header 'Accept' (if needed)
253
+ _header_accept = ['application/json', 'multipart/mixed', '*/*']
254
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
255
+
256
+ # HTTP header 'Content-Type'
257
+ _header_content_type = ['multipart/form-data', 'application/x-www-form-urlencoded', '*/*']
258
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
259
+
260
+ # form parameters
261
+ form_params = {}
262
+ form_params["input"] = input
263
+
264
+ # http body (model)
265
+ post_body = nil
266
+
267
+
268
+ auth_names = ['accessToken', 'apiKey']
269
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
270
+ if query_params[:'async']
271
+ OpenStruct.new(response)
272
+ else
273
+ response
274
+ end
275
+ end
276
+
277
+ # Translate Result
278
+ # Get the result of an asynchronous translation request\n\nDepending on the initial request, the response can have multiple formats:\n* `/translation/translate` initiated request\n\n → the response will be a JSON document (model below)\n\n* `/translation/translate/file` initiated request\n\n → the response will be either:\n\n * The **translated document**, directly, if `source` parameters was not `auto` and `withSource` was not true\n * A `multipart/mixed` document with the following parts:\n\n 1. **Detected language**, if request was done with `auto` source language\n\n * Header:\n\n `part-name: detectedLanguage`\n\n * Body: JSON document\n ```\n {\n detectedLanguage: \"string\"\n detectedLanguageConfidence : number\n }\n ```\n\n 2. **Source document**, if request was done with `withSource`:\n\n * Header: `part-name: source`\n * Body: Source document\n\n 3. **Translated document**\n\n * Header: `part-name: output`\n\n * Body: Translated document\n\nAn error can occur in the following cases:\n* Invalid request ID\n* No result available (see request status for more information)\n* Unable to retrieve the result\n* ...\n
279
+ # @param request_id Request Identifier\n
280
+ # @param [Hash] opts the optional parameters
281
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
282
+ # @return [TranslationResponse]
283
+ def self.translation_translate_result_get(request_id, opts = {})
284
+
285
+ # verify the required parameter 'request_id' is set
286
+ raise "Missing the required parameter 'request_id' when calling translation_translate_result_get" if request_id.nil?
287
+
288
+
289
+ # resource path
290
+ path = "/translation/file/result".sub('{format}','json')
291
+
292
+ # query parameters
293
+ query_params = {}
294
+ query_params[:'requestId'] = request_id
295
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
296
+
297
+ # header parameters
298
+ header_params = {}
299
+
300
+ # HTTP header 'Accept' (if needed)
301
+ _header_accept = ['application/json', 'multipart/mixed', '*/*']
302
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
303
+
304
+ # HTTP header 'Content-Type'
305
+ _header_content_type = []
306
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
307
+
308
+ # form parameters
309
+ form_params = {}
310
+
311
+ # http body (model)
312
+ post_body = nil
313
+
314
+
315
+ auth_names = ['accessToken', 'apiKey']
316
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
317
+ obj = TranslationResponse.new() and obj.build_from_hash(response)
318
+ end
319
+
320
+ # Translate Status
321
+ # Get the status of an asynchronous translation request\n\nThe translation result is available when the value of the status field is `finished`.\n\nThe translation request is unsuccessful when the value of the status field is `error`.\n
322
+ # @param request_id Request Identifier\n
323
+ # @param [Hash] opts the optional parameters
324
+ # @option opts [string] :callback Javascript callback function name for JSONP Support\n
325
+ # @return [TranslationStatus]
326
+ def self.translation_translate_status_get(request_id, opts = {})
327
+
328
+ # verify the required parameter 'request_id' is set
329
+ raise "Missing the required parameter 'request_id' when calling translation_translate_status_get" if request_id.nil?
330
+
331
+
332
+ # resource path
333
+ path = "/translation/file/status".sub('{format}','json')
334
+
335
+ # query parameters
336
+ query_params = {}
337
+ query_params[:'requestId'] = request_id
338
+ query_params[:'callback'] = opts[:'callback'] if opts[:'callback']
339
+
340
+ # header parameters
341
+ header_params = {}
342
+
343
+ # HTTP header 'Accept' (if needed)
344
+ _header_accept = ['application/json']
345
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
346
+
347
+ # HTTP header 'Content-Type'
348
+ _header_content_type = []
349
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
350
+
351
+ # form parameters
352
+ form_params = {}
353
+
354
+ # http body (model)
355
+ post_body = nil
356
+
357
+
358
+ auth_names = ['accessToken', 'apiKey']
359
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
360
+ obj = TranslationStatus.new() and obj.build_from_hash(response)
361
+ end
362
+ end
363
+ end