aspose_html_cloud 19.6.0 → 22.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  --------------------------------------------------------------------------------------------------------------------
4
4
  <copyright company="Aspose" file="html_api.rb">
5
5
  </copyright>
6
- Copyright (c) 2019 Aspose.HTML for Cloud
6
+ Copyright (c) 2022 Aspose.HTML for Cloud
7
7
  <summary>
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -35,1411 +35,179 @@ module AsposeHtml
35
35
 
36
36
  def initialize(args)
37
37
  @api_client = AsposeHtml::ApiClient.default(args)
38
- end
39
-
40
-
41
- ################################################################################
42
- # Conversion Api
43
- ################################################################################
44
-
45
-
46
- # Convert the HTML, EPUB, SVG document from the storage by its name to the specified image format.
47
- #
48
- # @param name Document name.
49
- # @param out_format Resulting image format (jpeg, png, bmp, tiff, gif).
50
- # @param [Hash] opts the optional parameters
51
- # @option opts [Integer] :width Resulting image width.
52
- # @option opts [Integer] :height Resulting image height.
53
- # @option opts [Integer] :left_margin Left resulting image margin.
54
- # @option opts [Integer] :right_margin Right resulting image margin.
55
- # @option opts [Integer] :top_margin Top resulting image margin.
56
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
57
- # @option opts [Integer] :resolution Resolution of resulting image.
58
- # @option opts [String] :folder The source document folder.
59
- # @option opts [String] :storage The source document storage.
60
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
61
- def get_convert_document_to_image(name, out_format, opts = {})
62
- data, _status_code, _headers = get_convert_document_to_image_with_http_info(name, out_format, opts)
63
- return {file: data, status: _status_code, headers: _headers}
64
- end
65
-
66
- # Convert the HTML, EPUB, SVG document from the storage by its name to the specified image format.
67
- #
68
- # @param name Document name.
69
- # @param out_format Resulting image format(jpeg, png, bmp, tiff, gif).
70
- # @param [Hash] opts the optional parameters
71
- # @option opts [Integer] :width Resulting image width.
72
- # @option opts [Integer] :height Resulting image height.
73
- # @option opts [Integer] :left_margin Left resulting image margin.
74
- # @option opts [Integer] :right_margin Right resulting image margin.
75
- # @option opts [Integer] :top_margin Top resulting image margin.
76
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
77
- # @option opts [Integer] :resolution Resolution of resulting image.
78
- # @option opts [String] :folder The source document folder.
79
- # @option opts [String] :storage The source document storage.
80
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
81
- def get_convert_document_to_image_with_http_info(name, out_format, opts = {})
82
- if @api_client.config.debug
83
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_image ..."
84
- end
85
- # verify the required parameter 'name' is set
86
- if @api_client.config.client_side_validation && name.nil?
87
- fail ArgumentError, "Missing the required parameter 'name' when calling HtmlApi.get_convert_document_to_image"
88
- end
89
- # verify the required parameter 'out_format' is set
90
- if @api_client.config.client_side_validation && out_format.nil?
91
- fail ArgumentError, "Missing the required parameter 'out_format' when calling HtmlApi.get_convert_document_to_image"
92
- end
93
- # resource path
94
- local_var_path = "/html/{name}/convert/image/{outFormat}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'outFormat' + '}', out_format.to_s)
95
-
96
- # query parameters
97
- query_params = {}
98
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
99
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
100
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
101
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
102
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
103
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
104
- query_params[:'resolution'] = opts[:'resolution'] if !opts[:'resolution'].nil?
105
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
106
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
107
-
108
- # header parameters
109
- header_params = {}
110
- # HTTP header 'Accept' (if needed)
111
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
112
- # HTTP header 'Content-Type'
113
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
114
-
115
- # form parameters
116
- form_params = {}
117
-
118
- # http body (model)
119
- post_body = nil
120
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
121
- :header_params => header_params,
122
- :query_params => query_params,
123
- :form_params => form_params,
124
- :body => post_body,
125
- :return_type => 'File')
126
- if @api_client.config.debug
127
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
128
- end
129
- return data, status_code, headers
130
- end
131
-
132
- # Convert the HTML page from the web by its URL to the specified image format.
133
- #
134
- # @param source_url Source page URL.
135
- # @param out_format Resulting image format(jpeg, png, bmp, tiff, gif).
136
- # @param [Hash] opts the optional parameters
137
- # @option opts [Integer] :width Resulting image width.
138
- # @option opts [Integer] :height Resulting image height.
139
- # @option opts [Integer] :left_margin Left resulting image margin.
140
- # @option opts [Integer] :right_margin Right resulting image margin.
141
- # @option opts [Integer] :top_margin Top resulting image margin.
142
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
143
- # @option opts [Integer] :resolution Resolution of resulting image.
144
- # @option opts [String] :folder The document folder.
145
- # @option opts [String] :storage The document storage.
146
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
147
- def get_convert_document_to_image_by_url(source_url, out_format, opts = {})
148
- data, _status_code, _headers = get_convert_document_to_image_by_url_with_http_info(source_url, out_format, opts)
149
- return {file: data, status: _status_code, headers: _headers}
150
- end
151
-
152
- # Convert the HTML page from the web by its URL to the specified image format.
153
- #
154
- # @param source_url Source page URL.
155
- # @param out_format Resulting image format(jpeg, png, bmp, tiff, gif).
156
- # @param [Hash] opts the optional parameters
157
- # @option opts [Integer] :width Resulting image width.
158
- # @option opts [Integer] :height Resulting image height.
159
- # @option opts [Integer] :left_margin Left resulting image margin.
160
- # @option opts [Integer] :right_margin Right resulting image margin.
161
- # @option opts [Integer] :top_margin Top resulting image margin.
162
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
163
- # @option opts [Integer] :resolution Resolution of resulting image.
164
- # @option opts [String] :folder The document folder.
165
- # @option opts [String] :storage The document storage.
166
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
167
- def get_convert_document_to_image_by_url_with_http_info(source_url, out_format, opts = {})
168
- if @api_client.config.debug
169
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_image_by_url ..."
170
- end
171
- # verify the required parameter 'source_url' is set
172
- if @api_client.config.client_side_validation && source_url.nil?
173
- fail ArgumentError, "Missing the required parameter 'source_url' when calling HtmlApi.get_convert_document_to_image_by_url"
174
- end
175
- # verify the required parameter 'out_format' is set
176
- if @api_client.config.client_side_validation && out_format.nil?
177
- fail ArgumentError, "Missing the required parameter 'out_format' when calling HtmlApi.get_convert_document_to_image_by_url"
178
- end
179
- # resource path
180
- local_var_path = "/html/convert/image/{outFormat}".sub('{' + 'outFormat' + '}', out_format.to_s)
181
-
182
- # query parameters
183
- query_params = {}
184
- query_params[:'sourceUrl'] = source_url
185
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
186
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
187
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
188
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
189
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
190
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
191
- query_params[:'resolution'] = opts[:'resolution'] if !opts[:'resolution'].nil?
192
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
193
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
194
-
195
- # header parameters
196
- header_params = {}
197
- # HTTP header 'Accept' (if needed)
198
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
199
- # HTTP header 'Content-Type'
200
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
201
-
202
- # form parameters
203
- form_params = {}
204
-
205
- # http body (model)
206
- post_body = nil
207
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
208
- :header_params => header_params,
209
- :query_params => query_params,
210
- :form_params => form_params,
211
- :body => post_body,
212
- :return_type => 'File')
213
- if @api_client.config.debug
214
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_image_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
215
- end
216
- return data, status_code, headers
217
- end
218
-
219
- # Convert the HTML, EPUB, SVG document from the storage by its name to PDF.
220
- #
221
- # @param name Document name.
222
- # @param [Hash] opts the optional parameters
223
- # @option opts [Integer] :width Resulting image width.
224
- # @option opts [Integer] :height Resulting image height.
225
- # @option opts [Integer] :left_margin Left resulting image margin.
226
- # @option opts [Integer] :right_margin Right resulting image margin.
227
- # @option opts [Integer] :top_margin Top resulting image margin.
228
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
229
- # @option opts [String] :folder The document folder.
230
- # @option opts [String] :storage The document storage.
231
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
232
- def get_convert_document_to_pdf(name, opts = {})
233
- data, _status_code, _headers = get_convert_document_to_pdf_with_http_info(name, opts)
234
- return {file: data, status: _status_code, headers: _headers}
235
- end
236
-
237
- # Convert the HTML, EPUB, SVG document from the storage by its name to PDF.
238
- #
239
- # @param name Document name.
240
- # @param [Hash] opts the optional parameters
241
- # @option opts [Integer] :width Resulting image width.
242
- # @option opts [Integer] :height Resulting image height.
243
- # @option opts [Integer] :left_margin Left resulting image margin.
244
- # @option opts [Integer] :right_margin Right resulting image margin.
245
- # @option opts [Integer] :top_margin Top resulting image margin.
246
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
247
- # @option opts [String] :folder The document folder.
248
- # @option opts [String] :storage The document storage.
249
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
250
- def get_convert_document_to_pdf_with_http_info(name, opts = {})
251
- if @api_client.config.debug
252
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_pdf ..."
253
- end
254
- # verify the required parameter 'name' is set
255
- if @api_client.config.client_side_validation && name.nil?
256
- fail ArgumentError, "Missing the required parameter 'name' when calling HtmlApi.get_convert_document_to_pdf"
257
- end
258
- # resource path
259
- local_var_path = "/html/{name}/convert/pdf".sub('{' + 'name' + '}', name.to_s)
260
-
261
- # query parameters
262
- query_params = {}
263
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
264
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
265
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
266
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
267
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
268
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
269
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
270
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
271
-
272
- # header parameters
273
- header_params = {}
274
- # HTTP header 'Accept' (if needed)
275
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
276
- # HTTP header 'Content-Type'
277
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
278
-
279
- # form parameters
280
- form_params = {}
281
-
282
- # http body (model)
283
- post_body = nil
284
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
285
- :header_params => header_params,
286
- :query_params => query_params,
287
- :form_params => form_params,
288
- :body => post_body,
289
- :return_type => 'File')
290
- if @api_client.config.debug
291
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
292
- end
293
- return data, status_code, headers
294
- end
295
-
296
- # Convert the HTML page from the web by its URL to PDF.
297
- #
298
- # @param source_url Source page URL.
299
- # @param [Hash] opts the optional parameters
300
- # @option opts [Integer] :width Resulting image width.
301
- # @option opts [Integer] :height Resulting image height.
302
- # @option opts [Integer] :left_margin Left resulting image margin.
303
- # @option opts [Integer] :right_margin Right resulting image margin.
304
- # @option opts [Integer] :top_margin Top resulting image margin.
305
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
306
- # @option opts [String] :folder The document folder.
307
- # @option opts [String] :storage The document storage.
308
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
309
- def get_convert_document_to_pdf_by_url(source_url, opts = {})
310
- data, _status_code, _headers = get_convert_document_to_pdf_by_url_with_http_info(source_url, opts)
311
- return {file: data, status: _status_code, headers: _headers}
312
- end
313
-
314
- # Convert the HTML page from the web by its URL to PDF.
315
- #
316
- # @param source_url Source page URL.
317
- # @param [Hash] opts the optional parameters
318
- # @option opts [Integer] :width Resulting image width.
319
- # @option opts [Integer] :height Resulting image height.
320
- # @option opts [Integer] :left_margin Left resulting image margin.
321
- # @option opts [Integer] :right_margin Right resulting image margin.
322
- # @option opts [Integer] :top_margin Top resulting image margin.
323
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
324
- # @option opts [String] :folder The document folder.
325
- # @option opts [String] :storage The document storage.
326
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
327
- def get_convert_document_to_pdf_by_url_with_http_info(source_url, opts = {})
328
- if @api_client.config.debug
329
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_pdf_by_url ..."
330
- end
331
- # verify the required parameter 'source_url' is set
332
- if @api_client.config.client_side_validation && source_url.nil?
333
- fail ArgumentError, "Missing the required parameter 'source_url' when calling HtmlApi.get_convert_document_to_pdf_by_url"
334
- end
335
- # resource path
336
- local_var_path = "/html/convert/pdf"
337
-
338
- # query parameters
339
- query_params = {}
340
- query_params[:'sourceUrl'] = source_url
341
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
342
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
343
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
344
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
345
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
346
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
347
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
348
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
349
-
350
- # header parameters
351
- header_params = {}
352
- # HTTP header 'Accept' (if needed)
353
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
354
- # HTTP header 'Content-Type'
355
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
356
-
357
- # form parameters
358
- form_params = {}
359
-
360
- # http body (model)
361
- post_body = nil
362
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
363
- :header_params => header_params,
364
- :query_params => query_params,
365
- :form_params => form_params,
366
- :body => post_body,
367
- :return_type => 'File')
368
- if @api_client.config.debug
369
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_pdf_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
370
- end
371
- return data, status_code, headers
372
- end
373
-
374
- # Convert the HTML, EPUB, SVG document from the storage by its name to XPS.
375
- #
376
- # @param name Document name.
377
- # @param [Hash] opts the optional parameters
378
- # @option opts [Integer] :width Resulting image width.
379
- # @option opts [Integer] :height Resulting image height.
380
- # @option opts [Integer] :left_margin Left resulting image margin.
381
- # @option opts [Integer] :right_margin Right resulting image margin.
382
- # @option opts [Integer] :top_margin Top resulting image margin.
383
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
384
- # @option opts [String] :folder The document folder.
385
- # @option opts [String] :storage The document storage.
386
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
387
- def get_convert_document_to_xps(name, opts = {})
388
- data, _status_code, _headers = get_convert_document_to_xps_with_http_info(name, opts)
389
- return {file: data, status: _status_code, headers: _headers}
390
- end
391
-
392
- # Convert the HTML, EPUB, SVG document from the storage by its name to XPS.
393
- #
394
- # @param name Document name.
395
- # @param [Hash] opts the optional parameters
396
- # @option opts [Integer] :width Resulting image width.
397
- # @option opts [Integer] :height Resulting image height.
398
- # @option opts [Integer] :left_margin Left resulting image margin.
399
- # @option opts [Integer] :right_margin Right resulting image margin.
400
- # @option opts [Integer] :top_margin Top resulting image margin.
401
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
402
- # @option opts [String] :folder The document folder.
403
- # @option opts [String] :storage The document storage.
404
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
405
- def get_convert_document_to_xps_with_http_info(name, opts = {})
406
- if @api_client.config.debug
407
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_xps ..."
408
- end
409
- # verify the required parameter 'name' is set
410
- if @api_client.config.client_side_validation && name.nil?
411
- fail ArgumentError, "Missing the required parameter 'name' when calling HtmlApi.get_convert_document_to_xps"
412
- end
413
- # resource path
414
- local_var_path = "/html/{name}/convert/xps".sub('{' + 'name' + '}', name.to_s)
415
-
416
- # query parameters
417
- query_params = {}
418
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
419
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
420
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
421
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
422
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
423
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
424
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
425
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
426
-
427
- # header parameters
428
- header_params = {}
429
- # HTTP header 'Accept' (if needed)
430
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
431
- # HTTP header 'Content-Type'
432
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
433
-
434
- # form parameters
435
- form_params = {}
436
-
437
- # http body (model)
438
- post_body = nil
439
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
440
- :header_params => header_params,
441
- :query_params => query_params,
442
- :form_params => form_params,
443
- :body => post_body,
444
- :return_type => 'File')
445
- if @api_client.config.debug
446
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_xps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
447
- end
448
- return data, status_code, headers
449
- end
450
-
451
- # Convert the HTML page from the web by its URL to XPS.
452
- #
453
- # @param source_url Source page URL.
454
- # @param [Hash] opts the optional parameters
455
- # @option opts [Integer] :width Resulting image width.
456
- # @option opts [Integer] :height Resulting image height.
457
- # @option opts [Integer] :left_margin Left resulting image margin.
458
- # @option opts [Integer] :right_margin Right resulting image margin.
459
- # @option opts [Integer] :top_margin Top resulting image margin.
460
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
461
- # @option opts [String] :folder The document folder.
462
- # @option opts [String] :storage The document storage.
463
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
464
- def get_convert_document_to_xps_by_url(source_url, opts = {})
465
- data, _status_code, _headers = get_convert_document_to_xps_by_url_with_http_info(source_url, opts)
466
- return {file: data, status: _status_code, headers: _headers}
467
- end
468
-
469
- # Convert the HTML page from the web by its URL to XPS.
470
- #
471
- # @param source_url Source page URL.
472
- # @param [Hash] opts the optional parameters
473
- # @option opts [Integer] :width Resulting image width.
474
- # @option opts [Integer] :height Resulting image height.
475
- # @option opts [Integer] :left_margin Left resulting image margin.
476
- # @option opts [Integer] :right_margin Right resulting image margin.
477
- # @option opts [Integer] :top_margin Top resulting image margin.
478
- # @option opts [Integer] :bottom_margin Bottom resulting image margin.
479
- # @option opts [String] :folder The document folder.
480
- # @option opts [String] :storage The document storage.
481
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
482
- def get_convert_document_to_xps_by_url_with_http_info(source_url, opts = {})
483
- if @api_client.config.debug
484
- @api_client.config.logger.debug "Calling API: HtmlApi.get_convert_document_to_xps_by_url ..."
485
- end
486
- # verify the required parameter 'source_url' is set
487
- if @api_client.config.client_side_validation && source_url.nil?
488
- fail ArgumentError, "Missing the required parameter 'source_url' when calling HtmlApi.get_convert_document_to_xps_by_url"
489
- end
490
- # resource path
491
- local_var_path = "/html/convert/xps"
492
-
493
- # query parameters
494
- query_params = {}
495
- query_params[:'sourceUrl'] = source_url
496
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
497
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
498
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
499
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
500
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
501
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
502
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
503
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
504
-
505
- # header parameters
506
- header_params = {}
507
- # HTTP header 'Accept' (if needed)
508
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
509
- # HTTP header 'Content-Type'
510
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
511
-
512
- # form parameters
513
- form_params = {}
514
-
515
- # http body (model)
516
- post_body = nil
517
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
518
- :header_params => header_params,
519
- :query_params => query_params,
520
- :form_params => form_params,
521
- :body => post_body,
522
- :return_type => 'File')
523
- if @api_client.config.debug
524
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_xps_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
525
- end
526
- return data, status_code, headers
527
- end
528
-
529
-
530
- # Converts the HTML, EPUB, SVG document (in request content) to the specified image format and uploads resulting file to storage.
531
- #
532
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.jpg)
533
- # @param out_format (jpeg, png, bmp, tiff, gif)
534
- # @param file A file to be converted.
535
- # @param [Hash] opts the optional parameters
536
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
537
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
538
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
539
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
540
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
541
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
542
- # @option opts [Integer] :resolution Resolution of resulting image. Default is 96 dpi.
543
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
544
- def post_convert_document_in_request_to_image(out_path, out_format, file, opts = {})
545
- data, _status_code, _headers = post_convert_document_in_request_to_image_with_http_info(out_path, out_format, file, opts)
546
- return {file: data, status: _status_code, headers: _headers}
547
- end
548
-
549
- # Converts the HTML, EPUB, SVG document (in request content) to the specified image format and uploads resulting file to storage.
550
- #
551
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.jpg)
552
- # @param out_format (jpeg, png, bmp, tiff, gif)
553
- # @param file A file to be converted.
554
- # @param [Hash] opts the optional parameters
555
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
556
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
557
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
558
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
559
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
560
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
561
- # @option opts [Integer] :resolution Resolution of resulting image. Default is 96 dpi.
562
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
563
- def post_convert_document_in_request_to_image_with_http_info(out_path, out_format, file, opts = {})
564
- if @api_client.config.debug
565
- @api_client.config.logger.debug "Calling API: ConversionApi.post_convert_document_in_request_to_image ..."
566
- end
567
- # verify the required parameter 'out_path' is set
568
- if @api_client.config.client_side_validation && out_path.nil?
569
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.post_convert_document_in_request_to_image"
570
- end
571
- # verify the required parameter 'out_format' is set
572
- if @api_client.config.client_side_validation && out_format.nil?
573
- fail ArgumentError, "Missing the required parameter 'out_format' when calling ConversionApi.post_convert_document_in_request_to_image"
574
- end
575
- # verify the required parameter 'file' is set
576
- if @api_client.config.client_side_validation && file.nil?
577
- fail ArgumentError, "Missing the required parameter 'file' when calling ConversionApi.post_convert_document_in_request_to_image"
578
- end
579
- # resource path
580
- local_var_path = "/html/convert/image/{outFormat}".sub('{' + 'outFormat' + '}', out_format.to_s)
581
-
582
- # query parameters
583
- query_params = {}
584
- query_params[:'outPath'] = out_path
585
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
586
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
587
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
588
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
589
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
590
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
591
- query_params[:'resolution'] = opts[:'resolution'] if !opts[:'resolution'].nil?
592
-
593
- # header parameters
594
- header_params = {}
595
- # HTTP header 'Accept' (if needed)
596
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
597
- # HTTP header 'Content-Type'
598
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
599
-
600
- # form parameters
601
- form_params = {
602
- file: File::open(file,'rb')
603
- }
604
- post_body = nil
605
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
606
- :header_params => header_params,
607
- :query_params => query_params,
608
- :form_params => form_params,
609
- :body => post_body,
610
- :return_type => 'File')
611
- if @api_client.config.debug
612
- @api_client.config.logger.debug "API called: ConversionApi#post_convert_document_in_request_to_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
613
- end
614
- return data, status_code, headers
615
- end
616
-
617
- # Converts the HTML, EPUB, SVG document (in request content) to PDF and uploads resulting file to storage.
618
- #
619
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.pdf)
620
- # @param file A file to be converted.
621
- # @param [Hash] opts the optional parameters
622
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
623
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
624
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
625
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
626
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
627
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
628
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
629
- def post_convert_document_in_request_to_pdf(out_path, file, opts = {})
630
- data, _status_code, _headers = post_convert_document_in_request_to_pdf_with_http_info(out_path, file, opts)
631
- return {file: data, status: _status_code, headers: _headers}
632
- end
633
-
634
- # Converts the HTML, EPUB, SVG document (in request content) to PDF and uploads resulting file to storage.
635
- #
636
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.pdf)
637
- # @param file A file to be converted.
638
- # @param [Hash] opts the optional parameters
639
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
640
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
641
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
642
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
643
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
644
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
645
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
646
- def post_convert_document_in_request_to_pdf_with_http_info(out_path, file, opts = {})
647
- if @api_client.config.debug
648
- @api_client.config.logger.debug "Calling API: ConversionApi.post_convert_document_in_request_to_pdf ..."
649
- end
650
- # verify the required parameter 'out_path' is set
651
- if @api_client.config.client_side_validation && out_path.nil?
652
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.post_convert_document_in_request_to_pdf"
653
- end
654
- # verify the required parameter 'file' is set
655
- if @api_client.config.client_side_validation && file.nil?
656
- fail ArgumentError, "Missing the required parameter 'file' when calling ConversionApi.post_convert_document_in_request_to_pdf"
657
- end
658
- # resource path
659
- local_var_path = "/html/convert/pdf"
660
-
661
- # query parameters
662
- query_params = {}
663
- query_params[:'outPath'] = out_path
664
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
665
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
666
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
667
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
668
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
669
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
670
-
671
- # header parameters
672
- header_params = {}
673
- # HTTP header 'Accept' (if needed)
674
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
675
- # HTTP header 'Content-Type'
676
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
677
-
678
- # form parameters
679
- form_params = {
680
- file: File::open(file,'rb')
681
- }
682
-
683
- # http body (model)
684
- post_body = nil
685
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
686
- :header_params => header_params,
687
- :query_params => query_params,
688
- :form_params => form_params,
689
- :body => post_body,
690
- :return_type => 'File')
691
- if @api_client.config.debug
692
- @api_client.config.logger.debug "API called: ConversionApi#post_convert_document_in_request_to_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
693
- end
694
- return data, status_code, headers
695
- end
696
-
697
- # Converts the HTML, EPUB, SVG document (in request content) to XPS and uploads resulting file to storage.
698
- #
699
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.xps)
700
- # @param file A file to be converted.
701
- # @param [Hash] opts the optional parameters
702
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
703
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
704
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
705
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
706
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
707
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
708
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
709
- def post_convert_document_in_request_to_xps(out_path, file, opts = {})
710
- data, _status_code, _headers = post_convert_document_in_request_to_xps_with_http_info(out_path, file, opts)
711
- return {file: data, status: _status_code, headers: _headers}
712
- end
713
-
714
- # Converts the HTML, EPUB, SVG document (in request content) to XPS and uploads resulting file to storage.
715
- #
716
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.xps)
717
- # @param file A file to be converted.
718
- # @param [Hash] opts the optional parameters
719
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
720
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
721
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
722
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
723
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
724
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
725
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
726
- def post_convert_document_in_request_to_xps_with_http_info(out_path, file, opts = {})
727
- if @api_client.config.debug
728
- @api_client.config.logger.debug "Calling API: ConversionApi.post_convert_document_in_request_to_xps ..."
729
- end
730
- # verify the required parameter 'out_path' is set
731
- if @api_client.config.client_side_validation && out_path.nil?
732
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.post_convert_document_in_request_to_xps"
733
- end
734
- # verify the required parameter 'file' is set
735
- if @api_client.config.client_side_validation && file.nil?
736
- fail ArgumentError, "Missing the required parameter 'file' when calling ConversionApi.post_convert_document_in_request_to_xps"
737
- end
738
- # resource path
739
- local_var_path = "/html/convert/xps"
740
-
741
- # query parameters
742
- query_params = {}
743
- query_params[:'outPath'] = out_path
744
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
745
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
746
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
747
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
748
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
749
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
750
-
751
- # header parameters
752
- header_params = {}
753
- # HTTP header 'Accept' (if needed)
754
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
755
- # HTTP header 'Content-Type'
756
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
757
-
758
- # form parameters
759
- form_params = {
760
- file: File::open(file,'rb')
761
- }
762
-
763
- # http body (model)
764
- post_body = nil
765
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
766
- :header_params => header_params,
767
- :query_params => query_params,
768
- :form_params => form_params,
769
- :body => post_body,
770
- :return_type => 'File')
771
- if @api_client.config.debug
772
- @api_client.config.logger.debug "API called: ConversionApi#post_convert_document_in_request_to_xps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
773
- end
774
- return data, status_code, headers
775
- end
776
-
777
- # Converts the HTML, EPUB, SVG document (located on storage) to the specified image format and uploads resulting file to storage.
778
- #
779
- # @param name Document name.
780
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.jpg)
781
- # @param out_format(jpeg, png, bmp, tiff, gif)
782
- # @param [Hash] opts the optional parameters
783
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
784
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
785
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
786
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
787
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
788
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
789
- # @option opts [Integer] :resolution Resolution of resulting image. Default is 96 dpi.
790
- # @option opts [String] :folder The source document folder.
791
- # @option opts [String] :storage The source and resulting document storage.
792
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
793
- def put_convert_document_to_image(name, out_path, out_format, opts = {})
794
- data, _status_code, _headers = put_convert_document_to_image_with_http_info(name, out_path, out_format, opts)
795
- return {file: data, status: _status_code, headers: _headers}
796
- end
797
-
798
- # Converts the HTML, EPUB, SVG document (located on storage) to the specified image format and uploads resulting file to storage.
799
- #
800
- # @param name Document name.
801
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.jpg)
802
- # @param out_format(jpeg, png, bmp, tiff, gif)
803
- # @param [Hash] opts the optional parameters
804
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
805
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
806
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
807
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
808
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
809
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
810
- # @option opts [Integer] :resolution Resolution of resulting image. Default is 96 dpi.
811
- # @option opts [String] :folder The source document folder.
812
- # @option opts [String] :storage The source and resulting document storage.
813
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
814
- def put_convert_document_to_image_with_http_info(name, out_path, out_format, opts = {})
815
- if @api_client.config.debug
816
- @api_client.config.logger.debug "Calling API: ConversionApi.put_convert_document_to_image ..."
817
- end
818
- # verify the required parameter 'name' is set
819
- if @api_client.config.client_side_validation && name.nil?
820
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.put_convert_document_to_image"
821
- end
822
- # verify the required parameter 'out_path' is set
823
- if @api_client.config.client_side_validation && out_path.nil?
824
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.put_convert_document_to_image"
825
- end
826
- # verify the required parameter 'out_format' is set
827
- if @api_client.config.client_side_validation && out_format.nil?
828
- fail ArgumentError, "Missing the required parameter 'out_format' when calling ConversionApi.put_convert_document_to_image"
829
- end
830
- # resource path
831
- local_var_path = "/html/{name}/convert/image/{outFormat}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'outFormat' + '}', out_format.to_s)
832
-
833
- # query parameters
834
- query_params = {}
835
- query_params[:'outPath'] = out_path
836
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
837
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
838
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
839
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
840
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
841
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
842
- query_params[:'resolution'] = opts[:'resolution'] if !opts[:'resolution'].nil?
843
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
844
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
845
-
846
- # header parameters
847
- header_params = {}
848
- # HTTP header 'Accept' (if needed)
849
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
850
- # HTTP header 'Content-Type'
851
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
852
-
853
- # form parameters
854
- form_params = {}
855
-
856
- # http body (model)
857
- post_body = nil
858
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
859
- :header_params => header_params,
860
- :query_params => query_params,
861
- :form_params => form_params,
862
- :body => post_body,
863
- :return_type => 'File')
864
- if @api_client.config.debug
865
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_document_to_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
866
- end
867
- return data, status_code, headers
868
- end
869
-
870
- # Converts the HTML, EPUB, SVG document (located on storage) to PDF and uploads resulting file to storage.
871
- #
872
- # @param name Document name.
873
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.pdf)
874
- # @param [Hash] opts the optional parameters
875
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
876
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
877
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
878
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
879
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
880
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
881
- # @option opts [String] :folder The source document folder.
882
- # @option opts [String] :storage The source and resulting document storage.
883
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
884
- def put_convert_document_to_pdf(name, out_path, opts = {})
885
- data, _status_code, _headers = put_convert_document_to_pdf_with_http_info(name, out_path, opts)
886
- return {file: data, status: _status_code, headers: _headers}
887
- end
888
-
889
- # Converts the HTML, EPUB, SVG document (located on storage) to PDF and uploads resulting file to storage.
890
- #
891
- # @param name Document name.
892
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.pdf)
893
- # @param [Hash] opts the optional parameters
894
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
895
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
896
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
897
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
898
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
899
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
900
- # @option opts [String] :folder The source document folder.
901
- # @option opts [String] :storage The source and resulting document storage.
902
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
903
- def put_convert_document_to_pdf_with_http_info(name, out_path, opts = {})
904
- if @api_client.config.debug
905
- @api_client.config.logger.debug "Calling API: ConversionApi.put_convert_document_to_pdf ..."
906
- end
907
- # verify the required parameter 'name' is set
908
- if @api_client.config.client_side_validation && name.nil?
909
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.put_convert_document_to_pdf"
910
- end
911
- # verify the required parameter 'out_path' is set
912
- if @api_client.config.client_side_validation && out_path.nil?
913
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.put_convert_document_to_pdf"
914
- end
915
- # resource path
916
- local_var_path = "/html/{name}/convert/pdf".sub('{' + 'name' + '}', name.to_s)
917
-
918
- # query parameters
919
- query_params = {}
920
- query_params[:'outPath'] = out_path
921
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
922
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
923
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
924
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
925
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
926
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
927
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
928
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
929
-
930
- # header parameters
931
- header_params = {}
932
- # HTTP header 'Accept' (if needed)
933
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
934
- # HTTP header 'Content-Type'
935
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
936
-
937
- # form parameters
938
- form_params = {}
939
-
940
- # http body (model)
941
- post_body = nil
942
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
943
- :header_params => header_params,
944
- :query_params => query_params,
945
- :form_params => form_params,
946
- :body => post_body,
947
- :return_type => 'File')
948
- if @api_client.config.debug
949
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_document_to_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
950
- end
951
- return data, status_code, headers
952
- end
953
-
954
- # Converts the HTML, EPUB, SVG document (located on storage) to XPS and uploads resulting file to storage.
955
- #
956
- # @param name Document name.
957
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.xps)
958
- # @param [Hash] opts the optional parameters
959
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
960
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
961
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
962
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
963
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
964
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
965
- # @option opts [String] :folder The source document folder.
966
- # @option opts [String] :storage The source and resulting document storage.
967
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
968
- def put_convert_document_to_xps(name, out_path, opts = {})
969
- data, _status_code, _headers = put_convert_document_to_xps_with_http_info(name, out_path, opts)
970
- return {file: data, status: _status_code, headers: _headers}
971
- end
972
-
973
- # Converts the HTML, EPUB, SVG document (located on storage) to XPS and uploads resulting file to storage.
974
- #
975
- # @param name Document name.
976
- # @param out_path Full resulting filename (ex. /folder1/folder2/result.xps)
977
- # @param [Hash] opts the optional parameters
978
- # @option opts [Integer] :width Resulting document page width in points (1/96 inch).
979
- # @option opts [Integer] :height Resulting document page height in points (1/96 inch).
980
- # @option opts [Integer] :left_margin Left resulting document page margin in points (1/96 inch).
981
- # @option opts [Integer] :right_margin Right resulting document page margin in points (1/96 inch).
982
- # @option opts [Integer] :top_margin Top resulting document page margin in points (1/96 inch).
983
- # @option opts [Integer] :bottom_margin Bottom resulting document page margin in points (1/96 inch).
984
- # @option opts [String] :folder The source document folder.
985
- # @option opts [String] :storage The source and resulting document storage.
986
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
987
- def put_convert_document_to_xps_with_http_info(name, out_path, opts = {})
988
- if @api_client.config.debug
989
- @api_client.config.logger.debug "Calling API: ConversionApi.put_convert_document_to_xps ..."
990
- end
991
- # verify the required parameter 'name' is set
992
- if @api_client.config.client_side_validation && name.nil?
993
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.put_convert_document_to_xps"
994
- end
995
- # verify the required parameter 'out_path' is set
996
- if @api_client.config.client_side_validation && out_path.nil?
997
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.put_convert_document_to_xps"
998
- end
999
- # resource path
1000
- local_var_path = "/html/{name}/convert/xps".sub('{' + 'name' + '}', name.to_s)
1001
-
1002
- # query parameters
1003
- query_params = {}
1004
- query_params[:'outPath'] = out_path
1005
- query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
1006
- query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
1007
- query_params[:'leftMargin'] = opts[:'left_margin'] if !opts[:'left_margin'].nil?
1008
- query_params[:'rightMargin'] = opts[:'right_margin'] if !opts[:'right_margin'].nil?
1009
- query_params[:'topMargin'] = opts[:'top_margin'] if !opts[:'top_margin'].nil?
1010
- query_params[:'bottomMargin'] = opts[:'bottom_margin'] if !opts[:'bottom_margin'].nil?
1011
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1012
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1013
-
1014
- # header parameters
1015
- header_params = {}
1016
- # HTTP header 'Accept' (if needed)
1017
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1018
- # HTTP header 'Content-Type'
1019
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1020
-
1021
- # form parameters
1022
- form_params = {}
1023
-
1024
- # http body (model)
1025
- post_body = nil
1026
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
1027
- :header_params => header_params,
1028
- :query_params => query_params,
1029
- :form_params => form_params,
1030
- :body => post_body,
1031
- :return_type => 'File')
1032
- if @api_client.config.debug
1033
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_document_to_xps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1034
- end
1035
- return data, status_code, headers
1036
- end
1037
-
1038
- # Converts the HTML page from Web by its URL to MHTML returns resulting file in response content.
1039
- # @param source_url Source page URL.
1040
- # @param [Hash] opts the optional parameters
1041
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1042
- def get_convert_document_to_mhtml_by_url(source_url, opts = {})
1043
- data, _status_code, _headers = get_convert_document_to_mhtml_by_url_with_http_info(source_url, opts)
1044
- return {file: data, status: _status_code, headers: _headers}
1045
- end
1046
-
1047
- # Converts the HTML page from Web by its URL to MHTML returns resulting file in response content.
1048
- # @param source_url Source page URL.
1049
- # @param [Hash] opts the optional parameters
1050
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1051
- def get_convert_document_to_mhtml_by_url_with_http_info(source_url, opts = {})
1052
- if @api_client.config.debug
1053
- @api_client.config.logger.debug 'Calling API: HtmlApi.get_convert_document_to_mhtml_by_url ...'
1054
- end
1055
- # verify the required parameter 'source_url' is set
1056
- if @api_client.config.client_side_validation && source_url.nil?
1057
- fail ArgumentError, "Missing the required parameter 'source_url' when calling HtmlApi.get_convert_document_to_mhtml_by_url"
1058
- end
1059
- # resource path
1060
- local_var_path = '/html/convert/mhtml'
1061
-
1062
- # query parameters
1063
- query_params = {}
1064
- query_params[:'sourceUrl'] = source_url
1065
-
1066
- # header parameters
1067
- header_params = {}
1068
- # HTTP header 'Accept' (if needed)
1069
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1070
- # HTTP header 'Content-Type'
1071
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1072
-
1073
- # form parameters
1074
- form_params = {}
1075
-
1076
- # http body (model)
1077
- post_body = nil
1078
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1079
- :header_params => header_params,
1080
- :query_params => query_params,
1081
- :form_params => form_params,
1082
- :body => post_body,
1083
- :return_type => 'File')
1084
- if @api_client.config.debug
1085
- @api_client.config.logger.debug "API called: HtmlApi#get_convert_document_to_mhtml_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1086
- end
1087
- return data, status_code, headers
1088
- end
1089
-
1090
- # Converts the HTML document (located on storage) to Markdown and returns resulting file in response content.
1091
- # @param name Document name.
1092
- # @param [Hash] opts the optional parameters
1093
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1094
- # @option opts [String] :folder Source document folder.
1095
- # @option opts [String] :storage Source document storage.
1096
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1097
- def get_convert_document_to_markdown(name, opts = {})
1098
- data, _status_code, _headers = get_convert_document_to_markdown_with_http_info(name, opts)
1099
- return {file: data, status: _status_code, headers: _headers}
1100
- end
1101
-
1102
- # Converts the HTML document (located on storage) to Markdown and returns resulting file in response content.
1103
- # @param name Document name.
1104
- # @param [Hash] opts the optional parameters
1105
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1106
- # @option opts [String] :folder Source document folder.
1107
- # @option opts [String] :storage Source document storage.
1108
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1109
- def get_convert_document_to_markdown_with_http_info(name, opts = {})
1110
- if @api_client.config.debug
1111
- @api_client.config.logger.debug 'Calling API: ConversionApi.get_convert_document_to_markdown ...'
1112
- end
1113
- # verify the required parameter 'name' is set
1114
- if @api_client.config.client_side_validation && name.nil?
1115
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.get_convert_document_to_markdown"
1116
- end
1117
- # resource path
1118
- local_var_path = '/html/{name}/convert/md'.sub('{' + 'name' + '}', name.to_s)
1119
-
1120
- # query parameters
1121
- query_params = {}
1122
- query_params[:'useGit'] = opts[:'use_git'] if !opts[:'use_git'].nil?
1123
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1124
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1125
-
1126
- # header parameters
1127
- header_params = {}
1128
- # HTTP header 'Accept' (if needed)
1129
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1130
- # HTTP header 'Content-Type'
1131
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1132
-
1133
- # form parameters
1134
- form_params = {}
1135
-
1136
- # http body (model)
1137
- post_body = nil
1138
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1139
- :header_params => header_params,
1140
- :query_params => query_params,
1141
- :form_params => form_params,
1142
- :body => post_body,
1143
- :return_type => 'File')
1144
- if @api_client.config.debug
1145
- @api_client.config.logger.debug "API called: ConversionApi#get_convert_document_to_markdown\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1146
- end
1147
- return data, status_code, headers
1148
- end
1149
-
1150
- # Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path.
1151
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.md)
1152
- # @param file A file to be converted.
1153
- # @param [Hash] opts the optional parameters
1154
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1155
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1156
- def post_convert_document_in_request_to_markdown(out_path, file, opts = {})
1157
- data, _status_code, _headers = post_convert_document_in_request_to_markdown_with_http_info(out_path, file, opts)
1158
- return {file: data, status: _status_code, headers: _headers}
1159
- end
1160
-
1161
- # Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path.
1162
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.md)
1163
- # @param file A file to be converted.
1164
- # @param [Hash] opts the optional parameters
1165
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1166
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1167
- def post_convert_document_in_request_to_markdown_with_http_info(out_path, file, opts = {})
1168
- if @api_client.config.debug
1169
- @api_client.config.logger.debug 'Calling API: ConversionApi.post_convert_document_in_request_to_markdown ...'
1170
- end
1171
- # verify the required parameter 'out_path' is set
1172
- if @api_client.config.client_side_validation && out_path.nil?
1173
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.post_convert_document_in_request_to_markdown"
1174
- end
1175
- # verify the required parameter 'file' is set
1176
- if @api_client.config.client_side_validation && file.nil?
1177
- fail ArgumentError, "Missing the required parameter 'file' when calling ConversionApi.post_convert_document_in_request_to_markdown"
1178
- end
1179
- # resource path
1180
- local_var_path = '/html/convert/md'
1181
-
1182
- # query parameters
1183
- query_params = {}
1184
- query_params[:'outPath'] = out_path
1185
- query_params[:'useGit'] = opts[:'use_git'] if !opts[:'use_git'].nil?
1186
-
1187
- # header parameters
1188
- header_params = {}
1189
- # HTTP header 'Accept' (if needed)
1190
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1191
- # HTTP header 'Content-Type'
1192
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
1193
-
1194
- # form parameters
1195
- form_params = {
1196
- file: File::open(file,'rb')
1197
- }
1198
-
1199
- # http body (model)
1200
- post_body = nil
1201
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1202
- :header_params => header_params,
1203
- :query_params => query_params,
1204
- :form_params => form_params,
1205
- :body => post_body,
1206
- :return_type => 'File')
1207
- if @api_client.config.debug
1208
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_document_in_request_to_markdown\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1209
- end
1210
- return data, status_code, headers
1211
- end
1212
-
1213
- # Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path.
1214
- # @param name Document name.
1215
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.md)
1216
- # @param [Hash] opts the optional parameters
1217
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1218
- # @option opts [String] :folder The source document folder.
1219
- # @option opts [String] :storage The source and resulting document storage.
1220
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1221
- def put_convert_document_to_markdown(name, out_path, opts = {})
1222
- data, _status_code, _headers = put_convert_document_to_markdown_with_http_info(name, out_path, opts)
1223
- return {file: data, status: _status_code, headers: _headers}
1224
- end
1225
-
1226
- # Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path.
1227
- # @param name Document name.
1228
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.md)
1229
- # @param [Hash] opts the optional parameters
1230
- # @option opts [String] :use_git Use Git Markdown flavor to save ("true" or "false"). (default to "false")
1231
- # @option opts [String] :folder The source document folder.
1232
- # @option opts [String] :storage The source and resulting document storage.
1233
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1234
- def put_convert_document_to_markdown_with_http_info(name, out_path, opts = {})
1235
- if @api_client.config.debug
1236
- @api_client.config.logger.debug 'Calling API: ConversionApi.put_convert_document_to_markdown ...'
1237
- end
1238
- # verify the required parameter 'name' is set
1239
- if @api_client.config.client_side_validation && name.nil?
1240
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.put_convert_document_to_markdown"
1241
- end
1242
- # verify the required parameter 'out_path' is set
1243
- if @api_client.config.client_side_validation && out_path.nil?
1244
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.put_convert_document_to_markdown"
1245
- end
1246
- # resource path
1247
- local_var_path = '/html/{name}/convert/md'.sub('{' + 'name' + '}', name.to_s)
1248
-
1249
- # query parameters
1250
- query_params = {}
1251
- query_params[:'outPath'] = out_path
1252
- query_params[:'useGit'] = opts[:'use_git'] if !opts[:'use_git'].nil?
1253
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1254
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1255
-
1256
- # header parameters
1257
- header_params = {}
1258
- # HTTP header 'Accept' (if needed)
1259
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1260
- # HTTP header 'Content-Type'
1261
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1262
-
1263
- # form parameters
1264
- form_params = {}
1265
-
1266
- # http body (model)
1267
- post_body = nil
1268
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
1269
- :header_params => header_params,
1270
- :query_params => query_params,
1271
- :form_params => form_params,
1272
- :body => post_body,
1273
- :return_type => 'File')
1274
- if @api_client.config.debug
1275
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_document_to_markdown\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1276
- end
1277
- return data, status_code, headers
1278
- end
1279
-
1280
- ################################################################################
1281
- # Import Api
1282
- ################################################################################
1283
-
1284
- # Converts the Markdown document (located on storage) to HTML and returns resulting file in response content.
1285
- # @param name Document name.
1286
- # @param [Hash] opts the optional parameters
1287
- # @option opts [String] :folder Source document folder.
1288
- # @option opts [String] :storage Source document storage.
1289
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1290
- def get_convert_markdown_to_html(name, opts = {})
1291
- data, _status_code, _headers = get_convert_markdown_to_html_with_http_info(name, opts)
1292
- return {file: data, status: _status_code, headers: _headers}
1293
- end
1294
-
1295
- # Converts the Markdown document (located on storage) to HTML and returns resulting file in response content.
1296
- # @param name Document name.
1297
- # @param [Hash] opts the optional parameters
1298
- # @option opts [String] :folder Source document folder.
1299
- # @option opts [String] :storage Source document storage.
1300
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1301
- def get_convert_markdown_to_html_with_http_info(name, opts = {})
1302
- if @api_client.config.debug
1303
- @api_client.config.logger.debug 'Calling API: ConversionApi.get_convert_markdown_to_html ...'
1304
- end
1305
- # verify the required parameter 'name' is set
1306
- if @api_client.config.client_side_validation && name.nil?
1307
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.get_convert_markdown_to_html"
1308
- end
1309
- # resource path
1310
- local_var_path = '/html/{name}/import/md'.sub('{' + 'name' + '}', name.to_s)
1311
-
1312
- # query parameters
1313
- query_params = {}
1314
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1315
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1316
-
1317
- # header parameters
1318
- header_params = {}
1319
- # HTTP header 'Accept' (if needed)
1320
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1321
- # HTTP header 'Content-Type'
1322
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1323
-
1324
- # form parameters
1325
- form_params = {}
1326
-
1327
- # http body (model)
1328
- post_body = nil
1329
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1330
- :header_params => header_params,
1331
- :query_params => query_params,
1332
- :form_params => form_params,
1333
- :body => post_body,
1334
- :return_type => 'File')
1335
- if @api_client.config.debug
1336
- @api_client.config.logger.debug "API called: ConversionApi#get_convert_markdown_to_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1337
- end
1338
- return data, status_code, headers
1339
- end
1340
-
1341
- # Converts the Markdown document (in request content) to HTML and uploads resulting file to storage by specified path.
1342
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.html)
1343
- # @param file A file to be converted.
1344
- # @param [Hash] opts the optional parameters
1345
- # @option opts [String] :storage Source document storage.
1346
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1347
- def post_convert_markdown_in_request_to_html(out_path, file, opts = {})
1348
- data, _status_code, _headers = post_convert_markdown_in_request_to_html_with_http_info(out_path, file, opts)
1349
- return {file: data, status: _status_code, headers: _headers}
1350
- end
1351
-
1352
- # Converts the Markdown document (in request content) to HTML and uploads resulting file to storage by specified path.
1353
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.html)
1354
- # @param file A file to be converted.
1355
- # @param [Hash] opts the optional parameters
1356
- # @option opts [String] :storage Source document storage.
1357
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1358
- def post_convert_markdown_in_request_to_html_with_http_info(out_path, file, opts = {})
1359
- if @api_client.config.debug
1360
- @api_client.config.logger.debug 'Calling API: ConversionApi.post_convert_markdown_in_request_to_html ...'
1361
- end
1362
- # verify the required parameter 'out_path' is set
1363
- if @api_client.config.client_side_validation && out_path.nil?
1364
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.post_convert_markdown_in_request_to_html"
1365
- end
1366
- # verify the required parameter 'file' is set
1367
- if @api_client.config.client_side_validation && file.nil?
1368
- fail ArgumentError, "Missing the required parameter 'file' when calling ConversionApi.post_convert_markdown_in_request_to_html"
1369
- end
1370
- # resource path
1371
- local_var_path = '/html/import/md'
1372
-
1373
- # query parameters
1374
- query_params = {}
1375
- query_params[:'outPath'] = out_path
1376
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1377
-
1378
- # header parameters
1379
- header_params = {}
1380
- # HTTP header 'Accept' (if needed)
1381
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1382
- # HTTP header 'Content-Type'
1383
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
1384
-
1385
- # form parameters
1386
- form_params = {
1387
- file: File::open(file,'rb')
1388
- }
1389
-
1390
- # http body (model)
1391
- post_body = nil
1392
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1393
- :header_params => header_params,
1394
- :query_params => query_params,
1395
- :form_params => form_params,
1396
- :body => post_body,
1397
- :return_type => 'File')
1398
- if @api_client.config.debug
1399
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_markdown_in_request_to_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1400
- end
1401
- return data, status_code, headers
1402
- end
1403
-
1404
- # Converts the Markdown document (located on storage) to HTML and uploads resulting file to storage by specified path.
1405
- # @param name Document name.
1406
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.html)
1407
- # @param [Hash] opts the optional parameters
1408
- # @option opts [String] :folder The source document folder.
1409
- # @option opts [String] :storage The source and resulting document storage.
1410
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1411
- def put_convert_markdown_to_html(name, out_path, opts = {})
1412
- data, _status_code, _headers = put_convert_markdown_to_html_with_http_info(name, out_path, opts)
1413
- return {file: data, status: _status_code, headers: _headers}
1414
- end
1415
-
1416
- # Converts the Markdown document (located on storage) to HTML and uploads resulting file to storage by specified path.
1417
- # @param name Document name.
1418
- # @param out_path Full resulting file path in the storage (ex. /folder1/folder2/result.html)
1419
- # @param [Hash] opts the optional parameters
1420
- # @option opts [String] :folder The source document folder.
1421
- # @option opts [String] :storage The source and resulting document storage.
1422
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1423
- def put_convert_markdown_to_html_with_http_info(name, out_path, opts = {})
1424
- if @api_client.config.debug
1425
- @api_client.config.logger.debug 'Calling API: ConversionApi.put_convert_markdown_to_html ...'
1426
- end
1427
- # verify the required parameter 'name' is set
1428
- if @api_client.config.client_side_validation && name.nil?
1429
- fail ArgumentError, "Missing the required parameter 'name' when calling ConversionApi.put_convert_markdown_to_html"
38
+ @storage_api = AsposeHtml::StorageApi.new args
39
+ end
40
+
41
+
42
+ # Converting the HTML, EPUB document from the local file and putting the result in the local file
43
+ #
44
+ # @param src Full path to source file.
45
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
46
+ # @param [Hash] options the optional parameters
47
+ # @option options [Integer] :width Resulting image width.
48
+ # @option opts [Integer] :height Resulting image height.
49
+ # @option opts [Integer] :left_margin Left resulting image margin.
50
+ # @option opts [Integer] :right_margin Right resulting image margin.
51
+ # @option opts [Integer] :top_margin Top resulting image margin.
52
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
53
+ # @option opts [Integer] :resolution Resolution of resulting image.
54
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
55
+ def convert_local_to_local(src, dst, options = nil)
56
+ return convert(src, dst, true, true, false, options)
57
+ end
58
+
59
+ # Converting the HTML, EPUB document from the local file and putting the result in the storage
60
+ #
61
+ # @param src Full path to source file.
62
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
63
+ # @param storage Storage name. Default storage is nil.
64
+ # @param [Hash] options the optional parameters
65
+ # @option options [Integer] :width Resulting image width.
66
+ # @option opts [Integer] :height Resulting image height.
67
+ # @option opts [Integer] :left_margin Left resulting image margin.
68
+ # @option opts [Integer] :right_margin Right resulting image margin.
69
+ # @option opts [Integer] :top_margin Top resulting image margin.
70
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
71
+ # @option opts [Integer] :resolution Resolution of resulting image.
72
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
73
+ def convert_local_to_storage(src, dst, storage, options=nil)
74
+ return convert(src, dst, true, false, false, options, storage)
75
+ end
76
+
77
+ # Converting the HTML, EPUB document from the storage and putting the result in the local file
78
+ #
79
+ # @param src Full path to source file.
80
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
81
+ # @param storage Storage name. Default storage is nil.
82
+ # @param [Hash] options the optional parameters
83
+ # @option options [Integer] :width Resulting image width.
84
+ # @option opts [Integer] :height Resulting image height.
85
+ # @option opts [Integer] :left_margin Left resulting image margin.
86
+ # @option opts [Integer] :right_margin Right resulting image margin.
87
+ # @option opts [Integer] :top_margin Top resulting image margin.
88
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
89
+ # @option opts [Integer] :resolution Resolution of resulting image.
90
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
91
+ def convert_storage_to_local(src, dst, storage, options=nil)
92
+ return convert(src, dst, false, true, false, options, storage)
93
+ end
94
+
95
+ # Converting the HTML, EPUB document from the storage and putting the result in the storage
96
+ #
97
+ # @param src Full path to source file.
98
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
99
+ # @param storage Storage name. Default storage is nil.
100
+ # @param [Hash] options the optional parameters
101
+ # @option options [Integer] :width Resulting image width.
102
+ # @option opts [Integer] :height Resulting image height.
103
+ # @option opts [Integer] :left_margin Left resulting image margin.
104
+ # @option opts [Integer] :right_margin Right resulting image margin.
105
+ # @option opts [Integer] :top_margin Top resulting image margin.
106
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
107
+ # @option opts [Integer] :resolution Resolution of resulting image.
108
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
109
+ def convert_storage_to_storage(src, dst, storage, options=nil)
110
+ return convert(src, dst, false, false, false, options, storage)
111
+ end
112
+
113
+ # Converting the HTML page from URL and putting the result in the local file
114
+ #
115
+ # @param src URI of the website.
116
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
117
+ # @param [Hash] options the optional parameters
118
+ # @option options [Integer] :width Resulting image width.
119
+ # @option opts [Integer] :height Resulting image height.
120
+ # @option opts [Integer] :left_margin Left resulting image margin.
121
+ # @option opts [Integer] :right_margin Right resulting image margin.
122
+ # @option opts [Integer] :top_margin Top resulting image margin.
123
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
124
+ # @option opts [Integer] :resolution Resolution of resulting image.
125
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
126
+ def convert_url_to_local(src, dst, options=nil)
127
+ return convert(src, dst, false, true, true, options)
128
+ end
129
+
130
+ # Converting the HTML page from URL and putting the result in the storage
131
+ #
132
+ # @param src URI of the website.
133
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
134
+ # @param storage Storage name. Default storage is nil.
135
+ # @param [Hash] options the optional parameters
136
+ # @option options [Integer] :width Resulting image width.
137
+ # @option opts [Integer] :height Resulting image height.
138
+ # @option opts [Integer] :left_margin Left resulting image margin.
139
+ # @option opts [Integer] :right_margin Right resulting image margin.
140
+ # @option opts [Integer] :top_margin Top resulting image margin.
141
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
142
+ # @option opts [Integer] :resolution Resolution of resulting image.
143
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
144
+ def convert_url_to_storage(src, dst, storage, options=nil)
145
+ return convert(src, dst, false, false, true, options, storage)
146
+ end
147
+
148
+ # Converting the HTML document to various formats
149
+ #
150
+ # @param src Source file or URL.
151
+ # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
152
+ # @param src_in_local Flag, true if source in the local file.
153
+ # @param dst_in_local Flag, true if result in the local file.
154
+ # @param is_url Flag, true if source is website.
155
+ # @param [Hash] options the optional parameters
156
+ # @option options [Integer] :width Resulting image width.
157
+ # @option opts [Integer] :height Resulting image height.
158
+ # @option opts [Integer] :left_margin Left resulting image margin.
159
+ # @option opts [Integer] :right_margin Right resulting image margin.
160
+ # @option opts [Integer] :top_margin Top resulting image margin.
161
+ # @option opts [Integer] :bottom_margin Bottom resulting image margin.
162
+ # @option opts [Integer] :resolution Resolution of resulting image.
163
+ # @param storage_name Storage name. Default storage is nil.
164
+ # @return [ConversionResult] Result of conversion. See ConversionResult object.
165
+ def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)
166
+ if src_in_local
167
+ res = @storage_api.upload_file("/", src)
168
+ if res.uploaded.length != 1 || res.errors.length != 0
169
+ fail ApiError.new('Unable to upload file')
170
+ end
171
+ file_in_storage = res.uploaded[0]
172
+ else
173
+ file_in_storage = src
174
+ end
175
+
176
+ out_file = File.basename(dst)
177
+ out_file = dst unless dst_in_local
178
+
179
+ input_format = 'html'
180
+ input_format = get_input_format(src) unless is_url
181
+
182
+ output_format = File.extname(dst).strip.downcase[1..-1]
183
+
184
+ if output_format == 'jpg'
185
+ output_format = 'jpeg'
186
+ elsif output_format == 'mht'
187
+ output_format = 'mhtml'
188
+ elsif output_format == 'tif'
189
+ output_format = 'tiff'
190
+ end
191
+
192
+ local_var_path = "/html/conversion/{from}-{to}".sub('{' + 'from' + '}', input_format.to_s).sub('{' + 'to' + '}', output_format.to_s)
193
+
194
+ post_body = {}
195
+ post_body[:'inputPath'] = file_in_storage.to_s
196
+ post_body[:'outputFile'] = out_file.to_s
197
+ post_body[:'storageName'] = storage_name.to_s
198
+
199
+ if !options.nil?
200
+ post_body[:'options'] = {}
201
+ post_body[:'options'][:'width'] = options[:'width'] if !options[:'width'].nil?
202
+ post_body[:'options'][:'height'] = options[:'height'] if !options[:'height'].nil?
203
+ post_body[:'options'][:'leftMargin'] = options[:'left_margin'] if !options[:'left_margin'].nil?
204
+ post_body[:'options'][:'rightMargin'] = options[:'right_margin'] if !options[:'right_margin'].nil?
205
+ post_body[:'options'][:'topMargin'] = options[:'top_margin'] if !options[:'top_margin'].nil?
206
+ post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] if !options[:'bottom_margin'].nil?
207
+ post_body[:'options'][:'resolution'] = options[:'resolution'] if !options[:'resolution'].nil?
1430
208
  end
1431
- # verify the required parameter 'out_path' is set
1432
- if @api_client.config.client_side_validation && out_path.nil?
1433
- fail ArgumentError, "Missing the required parameter 'out_path' when calling ConversionApi.put_convert_markdown_to_html"
1434
- end
1435
- # resource path
1436
- local_var_path = '/html/{name}/import/md'.sub('{' + 'name' + '}', name.to_s)
1437
209
 
1438
- # query parameters
1439
210
  query_params = {}
1440
- query_params[:'outPath'] = out_path
1441
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1442
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1443
211
 
1444
212
  # header parameters
1445
213
  header_params = {}
@@ -1451,622 +219,80 @@ module AsposeHtml
1451
219
  # form parameters
1452
220
  form_params = {}
1453
221
 
1454
- # http body (model)
1455
- post_body = nil
1456
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
1457
- :header_params => header_params,
1458
- :query_params => query_params,
1459
- :form_params => form_params,
1460
- :body => post_body,
1461
- :return_type => 'File')
1462
- if @api_client.config.debug
1463
- @api_client.config.logger.debug "API called: ConversionApi#put_convert_markdown_to_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1464
- end
1465
- return data, status_code, headers
1466
- end
1467
-
1468
- ################################################################################
1469
- # Document Api
1470
- ################################################################################
1471
-
1472
- # Return all HTML page with linked resources packaged as a ZIP archive by the source page URL.
1473
- #
1474
- # @param source_url Source page URL.
1475
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1476
- def get_document_by_url(source_url)
1477
- data, _status_code, _headers = get_document_by_url_with_http_info(source_url)
1478
- return {file: data, status: _status_code, headers: _headers}
1479
- end
1480
-
1481
- # Return all HTML page with linked resources packaged as a ZIP archive by the source page URL.
1482
- #
1483
- # @param source_url Source page URL.
1484
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1485
- def get_document_by_url_with_http_info(source_url)
1486
- if @api_client.config.debug
1487
- @api_client.config.logger.debug 'Calling API: DocumentApi.get_document_by_url ...'
1488
- end
1489
- # verify the required parameter 'source_url' is set
1490
- if @api_client.config.client_side_validation && source_url.nil?
1491
- fail ArgumentError, "Missing the required parameter 'source_url' when calling DocumentApi.get_document_by_url"
1492
- end
1493
- # resource path
1494
- local_var_path = '/html/download'
1495
-
1496
- # query parameters
1497
- query_params = {}
1498
- query_params[:'sourceUrl'] = source_url
1499
-
1500
- # header parameters
1501
- header_params = {}
1502
- # HTTP header 'Accept' (if needed)
1503
- header_params['Accept'] = @api_client.select_header_accept(['application/zip'])
1504
- # HTTP header 'Content-Type'
1505
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1506
-
1507
- # form parameters
1508
- form_params = {}
1509
-
1510
- # http body (model)
1511
- post_body = nil
1512
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1513
- :header_params => header_params,
1514
- :query_params => query_params,
1515
- :form_params => form_params,
1516
- :body => post_body,
1517
- :return_type => 'File')
1518
- if @api_client.config.debug
1519
- @api_client.config.logger.debug "API called: DocumentApi#get_document_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1520
- end
1521
- return data, status_code, headers
1522
- end
1523
-
1524
- # Return list of HTML fragments matching the specified XPath query.
1525
- # @param name The document name.
1526
- # @param x_path XPath query string.
1527
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1528
- # @param [Hash] opts the optional parameters
1529
- # @option opts [String] :storage The document storage.
1530
- # @option opts [String] :folder The document folder.
1531
- # @return [File]
1532
- def document_get_document_fragment_by_x_path(name, x_path, out_format, opts = {})
1533
- data, _status_code, _headers = document_get_document_fragment_by_x_path_with_http_info(name, x_path, out_format, opts)
1534
- data
1535
- end
1536
-
1537
-
1538
- # Return list of HTML fragments matching the specified XPath query.
1539
- #
1540
- # @param name The document name.
1541
- # @param x_path XPath query string.
1542
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1543
- # @param [Hash] opts the optional parameters
1544
- # @option opts [String] :storage The document storage.
1545
- # @option opts [String] :folder The document folder.
1546
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1547
- def get_document_fragment_by_x_path(name, x_path, out_format, opts = {})
1548
- data, _status_code, _headers = get_document_fragment_by_x_path_with_http_info(name, x_path, out_format, opts)
1549
- return {file: data, status: _status_code, headers: _headers}
1550
- end
1551
-
1552
- # Return list of HTML fragments matching the specified XPath query.
1553
- #
1554
- # @param name The document name.
1555
- # @param x_path XPath query string.
1556
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1557
- # @param [Hash] opts the optional parameters
1558
- # @option opts [String] :storage The document storage.
1559
- # @option opts [String] :folder The document folder.
1560
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1561
- def get_document_fragment_by_x_path_with_http_info(name, x_path, out_format, opts = {})
1562
- if @api_client.config.debug
1563
- @api_client.config.logger.debug "Calling API: HtmlApi.get_document_fragment_by_x_path ..."
1564
- end
1565
- # verify the required parameter 'name' is set
1566
- if @api_client.config.client_side_validation && name.nil?
1567
- fail ArgumentError, "Missing the required parameter 'name' when calling HtmlApi.get_document_fragment_by_x_path"
1568
- end
1569
- # verify the required parameter 'x_path' is set
1570
- if @api_client.config.client_side_validation && x_path.nil?
1571
- fail ArgumentError, "Missing the required parameter 'x_path' when calling HtmlApi.get_document_fragment_by_x_path"
1572
- end
1573
- # verify the required parameter 'out_format' is set
1574
- if @api_client.config.client_side_validation && out_format.nil?
1575
- fail ArgumentError, "Missing the required parameter 'out_format' when calling HtmlApi.get_document_fragment_by_x_path"
1576
- end
1577
- # resource path
1578
- local_var_path = "/html/{name}/fragments/{outFormat}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'outFormat' + '}', out_format.to_s)
1579
-
1580
- # query parameters
1581
- query_params = {}
1582
- query_params[:'xPath'] = x_path
1583
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1584
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1585
-
1586
- # header parameters
1587
- header_params = {}
1588
- # HTTP header 'Accept' (if needed)
1589
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1590
- # HTTP header 'Content-Type'
1591
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1592
-
1593
- # form parameters
1594
- form_params = {}
1595
-
1596
- # http body (model)
1597
- post_body = nil
1598
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
222
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1599
223
  :header_params => header_params,
1600
224
  :query_params => query_params,
1601
225
  :form_params => form_params,
1602
226
  :body => post_body,
1603
- :return_type => 'File')
1604
- if @api_client.config.debug
1605
- @api_client.config.logger.debug "API called: HtmlApi#get_document_fragment_by_x_path\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1606
- end
1607
- return data, status_code, headers
1608
- end
1609
-
1610
- # Return list of HTML fragments matching the specified XPath query by the source page URL.
1611
- #
1612
- # @param source_url Source page URL.
1613
- # @param x_path XPath query string.
1614
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1615
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1616
- def get_document_fragment_by_x_path_by_url(source_url, x_path, out_format)
1617
- data, _status_code, _headers = get_document_fragment_by_x_path_by_url_with_http_info(source_url, x_path, out_format)
1618
- return {file: data, status: _status_code, headers: _headers}
1619
- end
1620
-
1621
- # Return list of HTML fragments matching the specified XPath query by the source page URL.
1622
- #
1623
- # @param source_url Source page URL.
1624
- # @param x_path XPath query string.
1625
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1626
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1627
- def get_document_fragment_by_x_path_by_url_with_http_info(source_url, x_path, out_format)
227
+ :return_type => 'ConversionResult')
1628
228
  if @api_client.config.debug
1629
- @api_client.config.logger.debug "Calling API: DocumentApi.get_document_fragment_by_x_path_by_url ..."
229
+ @api_client.config.logger.debug "API called: Create task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1630
230
  end
1631
- # verify the required parameter 'source_url' is set
1632
- if @api_client.config.client_side_validation && source_url.nil?
1633
- fail ArgumentError, "Missing the required parameter 'source_url' when calling DocumentApi.get_document_fragment_by_x_path_by_url"
1634
- end
1635
- # verify the required parameter 'x_path' is set
1636
- if @api_client.config.client_side_validation && x_path.nil?
1637
- fail ArgumentError, "Missing the required parameter 'x_path' when calling DocumentApi.get_document_fragment_by_x_path_by_url"
1638
- end
1639
- # verify the required parameter 'out_format' is set
1640
- if @api_client.config.client_side_validation && out_format.nil?
1641
- fail ArgumentError, "Missing the required parameter 'out_format' when calling DocumentApi.get_document_fragment_by_x_path_by_url"
1642
- end
1643
- # resource path
1644
- local_var_path = "/html/fragments/{outFormat}".sub('{' + 'outFormat' + '}', out_format.to_s)
1645
-
1646
- # query parameters
1647
- query_params = {}
1648
- query_params[:'sourceUrl'] = source_url
1649
- query_params[:'xPath'] = x_path
1650
-
1651
- # header parameters
1652
- header_params = {}
1653
- # HTTP header 'Accept' (if needed)
1654
- header_params['Accept'] = @api_client.select_header_accept(['application/zip'])
1655
- # HTTP header 'Content-Type'
1656
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1657
-
1658
- # form parameters
1659
- form_params = {}
1660
231
 
1661
- # http body (model)
1662
- post_body = nil
1663
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1664
- :header_params => header_params,
1665
- :query_params => query_params,
1666
- :form_params => form_params,
1667
- :body => post_body,
1668
- :return_type => 'File')
1669
- if @api_client.config.debug
1670
- @api_client.config.logger.debug "API called: DocumentApi#get_document_fragment_by_x_path_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
232
+ if status_code != 200
233
+ fail ApiError.new('Conversion failed')
1671
234
  end
1672
- return data, status_code, headers
1673
- end
1674
-
1675
- # Return list of HTML fragments matching the specified CSS selector.
1676
- #
1677
- # @param name The document name.
1678
- # @param selector CSS selector string.
1679
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1680
- # @param [Hash] opts the optional parameters
1681
- # @option opts [String] :folder The document folder.
1682
- # @option opts [String] :storage The document storage.
1683
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1684
- def get_document_fragments_by_css_selector(name, selector, out_format, opts = {})
1685
- data, _status_code, _headers = get_document_fragments_by_css_selector_with_http_info(name, selector, out_format, opts)
1686
- return {file: data, status: _status_code, headers: _headers}
1687
- end
1688
235
 
1689
- # Return list of HTML fragments matching the specified CSS selector.
1690
- #
1691
- # @param name The document name.
1692
- # @param selector CSS selector string.
1693
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1694
- # @param [Hash] opts the optional parameters
1695
- # @option opts [String] :folder The document folder.
1696
- # @option opts [String] :storage The document storage.
1697
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1698
- def get_document_fragments_by_css_selector_with_http_info(name, selector, out_format, opts = {})
1699
- if @api_client.config.debug
1700
- @api_client.config.logger.debug "Calling API: DocumentApi.get_document_fragments_by_css_selector ..."
1701
- end
1702
- # verify the required parameter 'name' is set
1703
- if @api_client.config.client_side_validation && name.nil?
1704
- fail ArgumentError, "Missing the required parameter 'name' when calling DocumentApi.get_document_fragments_by_css_selector"
1705
- end
1706
- # verify the required parameter 'selector' is set
1707
- if @api_client.config.client_side_validation && selector.nil?
1708
- fail ArgumentError, "Missing the required parameter 'selector' when calling DocumentApi.get_document_fragments_by_css_selector"
1709
- end
1710
- # verify the required parameter 'out_format' is set
1711
- if @api_client.config.client_side_validation && out_format.nil?
1712
- fail ArgumentError, "Missing the required parameter 'out_format' when calling DocumentApi.get_document_fragments_by_css_selector"
236
+ while true
237
+ data, status_code, headers = get_status(data.id)
238
+ fail ApiError.new('Conversion failed') if data.code != 200 or data.status == 'faulted' or data.status == 'canceled'
239
+ break if data.status == 'completed'
240
+ sleep 3
1713
241
  end
1714
- # resource path
1715
- local_var_path = "/html/{name}/fragments/css/{outFormat}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'outFormat' + '}', out_format.to_s)
1716
-
1717
- # query parameters
1718
- query_params = {}
1719
- query_params[:'selector'] = selector
1720
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1721
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1722
-
1723
- # header parameters
1724
- header_params = {}
1725
- # HTTP header 'Accept' (if needed)
1726
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1727
- # HTTP header 'Content-Type'
1728
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1729
242
 
1730
- # form parameters
1731
- form_params = {}
1732
-
1733
- # http body (model)
1734
- post_body = nil
1735
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1736
- :header_params => header_params,
1737
- :query_params => query_params,
1738
- :form_params => form_params,
1739
- :body => post_body,
1740
- :return_type => 'File')
1741
- if @api_client.config.debug
1742
- @api_client.config.logger.debug "API called: DocumentApi#get_document_fragments_by_css_selector\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
243
+ if dst_in_local
244
+ out_folder = File.dirname(dst)
245
+ d = @storage_api.download_file(data.file)
246
+ out_name = out_folder + '/' + File.basename(data.file)
247
+ File.rename(d, out_name)
248
+ data.file = out_name
1743
249
  end
1744
- return data, status_code, headers
1745
- end
1746
250
 
1747
- # Return list of HTML fragments matching the specified CSS selector by the source page URL.
1748
- #
1749
- # @param source_url Source page URL.
1750
- # @param selector CSS selector string.
1751
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1752
- # @param [Hash] opts the optional parameters
1753
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1754
- def get_document_fragments_by_css_selector_by_url(source_url, selector, out_format, opts = {})
1755
- data, _status_code, _headers = get_document_fragments_by_css_selector_by_url_with_http_info(source_url, selector, out_format, opts)
1756
- return {file: data, status: _status_code, headers: _headers}
251
+ data
1757
252
  end
1758
253
 
1759
- # Return list of HTML fragments matching the specified CSS selector by the source page URL.
1760
- #
1761
- # @param source_url Source page URL.
1762
- # @param selector CSS selector string.
1763
- # @param out_format Output format. Possible values: &#39;plain&#39; and &#39;json&#39;.
1764
- # @param [Hash] opts the optional parameters
1765
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1766
- def get_document_fragments_by_css_selector_by_url_with_http_info(source_url, selector, out_format, opts = {})
1767
- if @api_client.config.debug
1768
- @api_client.config.logger.debug "Calling API: DocumentApi.get_document_fragments_by_css_selector_by_url ..."
1769
- end
1770
- # verify the required parameter 'source_url' is set
1771
- if @api_client.config.client_side_validation && source_url.nil?
1772
- fail ArgumentError, "Missing the required parameter 'source_url' when calling DocumentApi.get_document_fragments_by_css_selector_by_url"
1773
- end
1774
- # verify the required parameter 'selector' is set
1775
- if @api_client.config.client_side_validation && selector.nil?
1776
- fail ArgumentError, "Missing the required parameter 'selector' when calling DocumentApi.get_document_fragments_by_css_selector_by_url"
1777
- end
1778
- # verify the required parameter 'out_format' is set
1779
- if @api_client.config.client_side_validation && out_format.nil?
1780
- fail ArgumentError, "Missing the required parameter 'out_format' when calling DocumentApi.get_document_fragments_by_css_selector_by_url"
1781
- end
1782
- # resource path
1783
- local_var_path = "/html/fragments/css/{outFormat}".sub('{' + 'outFormat' + '}', out_format.to_s)
1784
-
1785
- # query parameters
1786
- query_params = {}
1787
- query_params[:'sourceUrl'] = source_url
1788
- query_params[:'selector'] = selector
254
+ def get_status(id)
1789
255
 
256
+ local_var_path = "/html/conversion/{id}".sub('{' + 'id' + '}', id.to_s)
1790
257
  # header parameters
1791
258
  header_params = {}
1792
259
  # HTTP header 'Accept' (if needed)
1793
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
260
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1794
261
  # HTTP header 'Content-Type'
1795
262
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1796
263
 
1797
- # form parameters
1798
- form_params = {}
1799
-
1800
- # http body (model)
1801
- post_body = nil
1802
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1803
- :header_params => header_params,
1804
- :query_params => query_params,
1805
- :form_params => form_params,
1806
- :body => post_body,
1807
- :return_type => 'File')
1808
- if @api_client.config.debug
1809
- @api_client.config.logger.debug "API called: DocumentApi#get_document_fragments_by_css_selector_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1810
- end
1811
- return data, status_code, headers
1812
- end
1813
-
1814
- # Return all HTML document images packaged as a ZIP archive.
1815
- #
1816
- # @param name The document name.
1817
- # @param [Hash] opts the optional parameters
1818
- # @option opts [String] :folder The document folder.
1819
- # @option opts [String] :storage The document storage.
1820
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1821
- def get_document_images(name, opts = {})
1822
- data, _status_code, _headers = get_document_images_with_http_info(name, opts)
1823
- return {file: data, status: _status_code, headers: _headers}
1824
- end
1825
-
1826
- # Return all HTML document images packaged as a ZIP archive.
1827
- #
1828
- # @param name The document name.
1829
- # @param [Hash] opts the optional parameters
1830
- # @option opts [String] :folder The document folder.
1831
- # @option opts [String] :storage The document storage.
1832
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1833
- def get_document_images_with_http_info(name, opts = {})
1834
- if @api_client.config.debug
1835
- @api_client.config.logger.debug "Calling API: HtmlApi.get_document_images ..."
1836
- end
1837
- # verify the required parameter 'name' is set
1838
- if @api_client.config.client_side_validation && name.nil?
1839
- fail ArgumentError, "Missing the required parameter 'name' when calling HtmlApi.get_document_images"
1840
- end
1841
- # resource path
1842
- local_var_path = "/html/{name}/images/all".sub('{' + 'name' + '}', name.to_s)
1843
-
1844
- # query parameters
1845
264
  query_params = {}
1846
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1847
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1848
-
1849
- # header parameters
1850
- header_params = {}
1851
- # HTTP header 'Accept' (if needed)
1852
- header_params['Accept'] = @api_client.select_header_accept(['application/zip'])
1853
- # HTTP header 'Content-Type'
1854
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1855
-
1856
- # form parameters
1857
265
  form_params = {}
1858
-
1859
- # http body (model)
1860
266
  post_body = nil
1861
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1862
- :header_params => header_params,
1863
- :query_params => query_params,
1864
- :form_params => form_params,
1865
- :body => post_body,
1866
- :return_type => 'File')
1867
- if @api_client.config.debug
1868
- @api_client.config.logger.debug "API called: HtmlApi#get_document_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1869
- end
1870
- return data, status_code, headers
1871
- end
1872
-
1873
-
1874
- # Return all HTML page images packaged as a ZIP archive by the source page URL.
1875
- #
1876
- # @param source_url Source page URL.
1877
- # @return [Hash] {file: data, status: _status_code, headers: _headers}
1878
- def get_document_images_by_url(source_url)
1879
- data, _status_code, _headers = get_document_images_by_url_with_http_info(source_url)
1880
- return {file: data, status: _status_code, headers: _headers}
1881
- end
1882
-
1883
- # Return all HTML page images packaged as a ZIP archive by the source page URL.
1884
- #
1885
- # @param source_url Source page URL.
1886
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1887
- def get_document_images_by_url_with_http_info(source_url)
1888
- if @api_client.config.debug
1889
- @api_client.config.logger.debug "Calling API: DocumentApi.get_document_images_by_url ..."
1890
- end
1891
- # verify the required parameter 'source_url' is set
1892
- if @api_client.config.client_side_validation && source_url.nil?
1893
- fail ArgumentError, "Missing the required parameter 'source_url' when calling DocumentApi.get_document_images_by_url"
1894
- end
1895
- # resource path
1896
- local_var_path = "/html/images/all"
1897
-
1898
- # query parameters
1899
- query_params = {}
1900
- query_params[:'sourceUrl'] = source_url
1901
-
1902
- # header parameters
1903
- header_params = {}
1904
- # HTTP header 'Accept' (if needed)
1905
- header_params['Accept'] = @api_client.select_header_accept(['application/zip'])
1906
- # HTTP header 'Content-Type'
1907
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1908
-
1909
- # form parameters
1910
- form_params = {}
1911
267
 
1912
- # http body (model)
1913
- post_body = nil
1914
268
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1915
269
  :header_params => header_params,
1916
270
  :query_params => query_params,
1917
271
  :form_params => form_params,
1918
272
  :body => post_body,
1919
- :return_type => 'File')
1920
- if @api_client.config.debug
1921
- @api_client.config.logger.debug "API called: DocumentApi#get_document_images_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1922
- end
1923
- return data, status_code, headers
1924
- end
273
+ :return_type => 'ConversionResult')
1925
274
 
1926
- # Populate HTML document template with data located as a file in the storage.
1927
- #
1928
- # @param template_name Template document name. Template document is HTML or zipped HTML.
1929
- # @param data_path Data source file path in the storage. Supported data format: XML
1930
- # @param [Hash] opts the optional parameters
1931
- # @option opts [String] :options Template merge options: reserved for further implementation.
1932
- # @option opts [String] :folder The template document folder.
1933
- # @option opts [String] :storage The template document and data source storage.
1934
- # @return [File]
1935
- def get_merge_html_template(template_name, data_path, opts = {})
1936
- data, _status_code, _headers = get_merge_html_template_with_http_info(template_name, data_path, opts)
1937
- return {file: data, status: _status_code, headers: _headers}
1938
275
  end
1939
276
 
1940
- # Populate HTML document template with data located as a file in the storage.
1941
- #
1942
- # @param template_name Template document name. Template document is HTML or zipped HTML.
1943
- # @param data_path Data source file path in the storage. Supported data format: XML
1944
- # @param [Hash] opts the optional parameters
1945
- # @option opts [String] :options Template merge options: reserved for further implementation.
1946
- # @option opts [String] :folder The template document folder.
1947
- # @option opts [String] :storage The template document and data source storage.
1948
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
1949
- def get_merge_html_template_with_http_info(template_name, data_path, opts = {})
1950
- if @api_client.config.debug
1951
- @api_client.config.logger.debug "Calling API: TemplateMergeApi.get_merge_html_template ..."
1952
- end
1953
- # verify the required parameter 'template_name' is set
1954
- if @api_client.config.client_side_validation && template_name.nil?
1955
- fail ArgumentError, "Missing the required parameter 'template_name' when calling TemplateMergeApi.get_merge_html_template"
1956
- end
1957
- # verify the required parameter 'data_path' is set
1958
- if @api_client.config.client_side_validation && data_path.nil?
1959
- fail ArgumentError, "Missing the required parameter 'data_path' when calling TemplateMergeApi.get_merge_html_template"
1960
- end
1961
- # resource path
1962
- local_var_path = "/html/{templateName}/merge".sub('{' + 'templateName' + '}', template_name.to_s)
1963
-
1964
- # query parameters
1965
- query_params = {}
1966
- query_params[:'dataPath'] = data_path
1967
- query_params[:'options'] = opts[:'options'] if !opts[:'options'].nil?
1968
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1969
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
1970
-
1971
- # header parameters
1972
- header_params = {}
1973
- # HTTP header 'Accept' (if needed)
1974
- header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
1975
- # HTTP header 'Content-Type'
1976
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1977
-
1978
- # form parameters
1979
- form_params = {}
1980
-
1981
- # http body (model)
1982
- post_body = nil
1983
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1984
- :header_params => header_params,
1985
- :query_params => query_params,
1986
- :form_params => form_params,
1987
- :body => post_body,
1988
- :return_type => 'File')
1989
- if @api_client.config.debug
1990
- @api_client.config.logger.debug "API called: TemplateMergeApi#get_merge_html_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
277
+ def get_input_format(path)
278
+ ext = File.extname(path).upcase
279
+ case ext
280
+ when '.HTML', '.HTM'
281
+ return 'html'
282
+ when '.MHT', '.MHTML'
283
+ return 'mht'
284
+ when '.XHTML', '.XML'
285
+ return 'xhtml'
286
+ when '.EPUB'
287
+ return 'epub'
288
+ when '.SVG'
289
+ return 'svg'
290
+ when '.MD'
291
+ return 'md'
292
+ else
293
+ return nil
1991
294
  end
1992
- return data, status_code, headers
1993
- end
1994
-
1995
- # Populate HTML document template with data from the request body. Result document will be saved to storage.
1996
- #
1997
- # @param template_name Template document name. Template document is HTML or zipped HTML.
1998
- # @param out_path Result document path.
1999
- # @param file A data file to populate template.
2000
- # @param [Hash] opts the optional parameters
2001
- # @option opts [String] :options Template merge options: reserved for further implementation.
2002
- # @option opts [String] :folder The template document folder.
2003
- # @option opts [String] :storage The template document and data source storage.
2004
- # @return [File]
2005
- def post_merge_html_template(template_name, out_path, file, opts = {})
2006
- data, _status_code, _headers = post_merge_html_template_with_http_info(template_name, out_path, file, opts)
2007
- return {file: data, status: _status_code, headers: _headers}
2008
295
  end
2009
296
 
2010
- # Populate HTML document template with data from the request body. Result document will be saved to storage.
2011
- #
2012
- # @param template_name Template document name. Template document is HTML or zipped HTML.
2013
- # @param out_path Result document path.
2014
- # @param file A data file to populate template.
2015
- # @param [Hash] opts the optional parameters
2016
- # @option opts [String] :options Template merge options: reserved for further implementation.
2017
- # @option opts [String] :folder The template document folder.
2018
- # @option opts [String] :storage The template document and data source storage.
2019
- # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
2020
- def post_merge_html_template_with_http_info(template_name, out_path, file, opts = {})
2021
- if @api_client.config.debug
2022
- @api_client.config.logger.debug "Calling API: TemplateMergeApi.post_merge_html_template ..."
2023
- end
2024
- # verify the required parameter 'template_name' is set
2025
- if @api_client.config.client_side_validation && template_name.nil?
2026
- fail ArgumentError, "Missing the required parameter 'template_name' when calling TemplateMergeApi.post_merge_html_template"
2027
- end
2028
- # verify the required parameter 'out_path' is set
2029
- if @api_client.config.client_side_validation && out_path.nil?
2030
- fail ArgumentError, "Missing the required parameter 'out_path' when calling TemplateMergeApi.post_merge_html_template"
2031
- end
2032
- # verify the required parameter 'file' is set
2033
- if @api_client.config.client_side_validation && file.nil?
2034
- fail ArgumentError, "Missing the required parameter 'file' when calling TemplateMergeApi.post_merge_html_template"
2035
- end
2036
- # resource path
2037
- local_var_path = "/html/{templateName}/merge".sub('{' + 'templateName' + '}', template_name.to_s)
2038
-
2039
- # query parameters
2040
- query_params = {}
2041
- query_params[:'outPath'] = out_path
2042
- query_params[:'options'] = opts[:'options'] if !opts[:'options'].nil?
2043
- query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
2044
- query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
2045
-
2046
- # header parameters
2047
- header_params = {}
2048
- # HTTP header 'Accept' (if needed)
2049
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2050
- # HTTP header 'Content-Type'
2051
- header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
2052
-
2053
- # form parameters
2054
- form_params = {
2055
- file: File::open(file,'rb')
2056
- }
2057
-
2058
- # http body (model)
2059
- post_body = nil
2060
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
2061
- :header_params => header_params,
2062
- :query_params => query_params,
2063
- :form_params => form_params,
2064
- :body => post_body,
2065
- :return_type => 'File')
2066
- if @api_client.config.debug
2067
- @api_client.config.logger.debug "API called: TemplateMergeApi#post_merge_html_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2068
- end
2069
- return data, status_code, headers
2070
- end
2071
297
  end
2072
298
  end