cloudpdf 3.0.0.alpha.1 → 3.0.0.alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.fern/metadata.json +2 -2
- data/README.md +5 -5
- data/lib/CloudPDF/client.rb +5 -0
- data/lib/CloudPDF/documents/client.rb +71 -5
- data/lib/CloudPDF/documents/types/documents_import_from_request.rb +25 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_dedup_mode.rb +14 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_expected.rb +13 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_mode.rb +14 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_source.rb +17 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_source_connection.rb +15 -0
- data/lib/CloudPDF/documents/types/documents_import_from_request_source_url.rb +11 -0
- data/lib/CloudPDF/documents/types/documents_init_request.rb +2 -0
- data/lib/CloudPDF/documents/types/documents_init_request_upload_preference.rb +15 -0
- data/lib/CloudPDF/documents/types/upload_proxy_documents_request.rb +15 -0
- data/lib/CloudPDF/shares/client.rb +264 -0
- data/lib/CloudPDF/shares/types/delete_shares_request.rb +13 -0
- data/lib/CloudPDF/shares/types/get_shares_request.rb +13 -0
- data/lib/CloudPDF/shares/types/list_shares_request.rb +17 -0
- data/lib/CloudPDF/shares/types/shares_create_request.rb +25 -0
- data/lib/CloudPDF/shares/types/shares_exchange_request.rb +13 -0
- data/lib/CloudPDF/shares/types/shares_update_request.rb +25 -0
- data/lib/CloudPDF/tenants/client.rb +117 -0
- data/lib/CloudPDF/tenants/types/resume_tenants_request.rb +11 -0
- data/lib/CloudPDF/tenants/types/tenants_suspend_request.rb +13 -0
- data/lib/CloudPDF/tenants/types/usage_tenants_request.rb +13 -0
- data/lib/CloudPDF/types/doc_annotations_create400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_annotations_create404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_annotations_delete404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_annotations_list200response_annotations_item_caret.rb +4 -0
- data/lib/CloudPDF/types/doc_annotations_list200response_annotations_item_caret_unrotated_rect.rb +15 -0
- data/lib/CloudPDF/types/doc_annotations_list404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_annotations_update400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_annotations_update404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_download_response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_export_data_response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_get404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_import_data400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_import_data404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_reset404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_set_value400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_forms_set_value404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_head404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_manifest404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_metadata_get404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_delete400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_delete404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_flatten400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_flatten404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_move400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_move404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_rotate400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_pages_rotate404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_redactions_apply400response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_redactions_apply404response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_render_response_code.rb +1 -0
- data/lib/CloudPDF/types/doc_text200response.rb +2 -0
- data/lib/CloudPDF/types/doc_text404response_code.rb +1 -0
- data/lib/CloudPDF/types/documents_import_from200response.rb +11 -0
- data/lib/CloudPDF/types/documents_import_from200response_document.rb +33 -0
- data/lib/CloudPDF/types/documents_import_from200response_document_state.rb +14 -0
- data/lib/CloudPDF/types/documents_import_from200response_document_thumbnail_state.rb +14 -0
- data/lib/CloudPDF/types/documents_import_from200response_tag.rb +13 -0
- data/lib/CloudPDF/types/documents_import_from202response.rb +11 -0
- data/lib/CloudPDF/types/documents_import_from202response_document.rb +33 -0
- data/lib/CloudPDF/types/documents_import_from202response_document_state.rb +14 -0
- data/lib/CloudPDF/types/documents_import_from202response_document_thumbnail_state.rb +14 -0
- data/lib/CloudPDF/types/documents_import_from202response_tag.rb +13 -0
- data/lib/CloudPDF/types/documents_import_from400response.rb +9 -0
- data/lib/CloudPDF/types/{documents_upload_direct400response_error.rb → documents_import_from400response_error.rb} +1 -1
- data/lib/CloudPDF/types/documents_import_from403response.rb +9 -0
- data/lib/CloudPDF/types/documents_import_from403response_error.rb +11 -0
- data/lib/CloudPDF/types/documents_import_from502response.rb +9 -0
- data/lib/CloudPDF/types/documents_import_from502response_error.rb +11 -0
- data/lib/CloudPDF/types/documents_init200response_created_upload.rb +1 -1
- data/lib/CloudPDF/types/{documents_init200response_created_upload_direct.rb → documents_init200response_created_upload_proxy.rb} +1 -1
- data/lib/CloudPDF/types/documents_init200response_resumed_upload.rb +1 -1
- data/lib/CloudPDF/types/{documents_init200response_resumed_upload_direct.rb → documents_init200response_resumed_upload_proxy.rb} +1 -1
- data/lib/CloudPDF/types/{documents_upload_direct200response.rb → documents_upload_proxy200response.rb} +1 -1
- data/lib/CloudPDF/types/documents_upload_proxy400response.rb +9 -0
- data/lib/CloudPDF/types/documents_upload_proxy400response_error.rb +11 -0
- data/lib/CloudPDF/types/documents_upload_proxy409response.rb +9 -0
- data/lib/CloudPDF/types/documents_upload_proxy409response_error.rb +11 -0
- data/lib/CloudPDF/types/engine_error_payload_code.rb +1 -0
- data/lib/CloudPDF/types/shares_create200response.rb +9 -0
- data/lib/CloudPDF/types/shares_create200response_share.rb +37 -0
- data/lib/CloudPDF/types/shares_create400response.rb +9 -0
- data/lib/CloudPDF/types/shares_create400response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_create403response.rb +9 -0
- data/lib/CloudPDF/types/shares_create403response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_create404response.rb +9 -0
- data/lib/CloudPDF/types/shares_create404response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_delete_response.rb +9 -0
- data/lib/CloudPDF/types/shares_delete_response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_exchange200response.rb +15 -0
- data/lib/CloudPDF/types/shares_exchange400response.rb +9 -0
- data/lib/CloudPDF/types/shares_exchange400response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_exchange403response.rb +9 -0
- data/lib/CloudPDF/types/shares_exchange403response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_exchange404response.rb +9 -0
- data/lib/CloudPDF/types/shares_exchange404response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_exchange410response.rb +9 -0
- data/lib/CloudPDF/types/shares_exchange410response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_exchange422response.rb +9 -0
- data/lib/CloudPDF/types/shares_exchange422response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_get200response.rb +9 -0
- data/lib/CloudPDF/types/shares_get200response_share.rb +37 -0
- data/lib/CloudPDF/types/shares_get404response.rb +9 -0
- data/lib/CloudPDF/types/shares_get404response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_list200response.rb +11 -0
- data/lib/CloudPDF/types/shares_list200response_shares_item.rb +37 -0
- data/lib/CloudPDF/types/shares_list400response.rb +9 -0
- data/lib/CloudPDF/types/shares_list400response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_update200response.rb +9 -0
- data/lib/CloudPDF/types/shares_update200response_share.rb +37 -0
- data/lib/CloudPDF/types/shares_update400response.rb +9 -0
- data/lib/CloudPDF/types/shares_update400response_error.rb +11 -0
- data/lib/CloudPDF/types/shares_update404response.rb +9 -0
- data/lib/CloudPDF/types/shares_update404response_error.rb +11 -0
- data/lib/CloudPDF/types/tenants_create200response_tenant.rb +2 -0
- data/lib/CloudPDF/types/tenants_create200response_tenant_status.rb +12 -0
- data/lib/CloudPDF/types/tenants_get200response_tenant.rb +2 -0
- data/lib/CloudPDF/types/tenants_get200response_tenant_status.rb +12 -0
- data/lib/CloudPDF/types/tenants_list200response_tenants_item.rb +2 -0
- data/lib/CloudPDF/types/tenants_list200response_tenants_item_status.rb +12 -0
- data/lib/CloudPDF/types/tenants_resume_response.rb +9 -0
- data/lib/CloudPDF/types/tenants_resume_response_error.rb +11 -0
- data/lib/CloudPDF/types/tenants_suspend_response.rb +9 -0
- data/lib/CloudPDF/types/tenants_suspend_response_error.rb +11 -0
- data/lib/CloudPDF/types/tenants_usage200response.rb +15 -0
- data/lib/CloudPDF/types/tenants_usage200response_metrics.rb +13 -0
- data/lib/CloudPDF/types/tenants_usage400response.rb +9 -0
- data/lib/CloudPDF/types/tenants_usage400response_error.rb +11 -0
- data/lib/CloudPDF/types/tenants_usage404response.rb +9 -0
- data/lib/CloudPDF/types/tenants_usage404response_error.rb +11 -0
- data/lib/CloudPDF/types/tokens_issue_request_doc.rb +2 -0
- data/lib/CloudPDF/types/tokens_issue_request_tenant_scope_item_one.rb +1 -0
- data/lib/CloudPDF/version.rb +1 -1
- data/lib/cloudpdf.rb +91 -5
- data/reference.md +904 -24
- metadata +93 -7
- data/lib/CloudPDF/types/documents_upload_direct400response.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5ec1e3dcbab2e8a86b62c6b12abf143cb910cd761c7a84a79f0dd08f29742d4
|
|
4
|
+
data.tar.gz: 6dd84973a69330b662550ab141cd9fdacd402b897719acae2ec646ce8e7d1c17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f60322255839de8146968d7606a00509e4450ab4b155792c1da310abe26b7663eebdce558b044f112d7eb2edfd1457f786b8a36997e5d27127cb2fc0a21704f
|
|
7
|
+
data.tar.gz: 988f29c2e2dd314c287372ff7b84bd21f8ffa8cab5254c50ef2081f74a521214b48975232b0583abce87e1d79addccbb1ce6b8202228696542a28e9c52c77835
|
data/.fern/metadata.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"generatorConfig": {
|
|
6
6
|
"moduleName": "CloudPDF"
|
|
7
7
|
},
|
|
8
|
-
"originGitCommit": "
|
|
8
|
+
"originGitCommit": "32635f40577b214f6a6b3189a2271425c3a574fd",
|
|
9
9
|
"originGitCommitIsDirty": false,
|
|
10
10
|
"invokedBy": "ci",
|
|
11
|
-
"requestedVersion": "3.0.0.alpha.
|
|
11
|
+
"requestedVersion": "3.0.0.alpha.6",
|
|
12
12
|
"ciProvider": "github"
|
|
13
13
|
}
|
data/README.md
CHANGED
|
@@ -30,7 +30,7 @@ require "cloudpdf"
|
|
|
30
30
|
|
|
31
31
|
client = CloudPDF::Client.new(token: "<token>")
|
|
32
32
|
|
|
33
|
-
client.
|
|
33
|
+
client.shares.exchange(share_token: "shareToken")
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Environments
|
|
@@ -58,7 +58,7 @@ client = CloudPDF::Client.new(
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
begin
|
|
61
|
-
result = client.
|
|
61
|
+
result = client.shares.exchange
|
|
62
62
|
rescue CloudPDF::Errors::TimeoutError
|
|
63
63
|
puts "API didn't respond before our timeout elapsed"
|
|
64
64
|
rescue CloudPDF::Errors::ServiceUnavailableError
|
|
@@ -108,7 +108,7 @@ The SDK defaults to a 60 second timeout. Use the `timeout` option to configure t
|
|
|
108
108
|
```ruby
|
|
109
109
|
require "cloudpdf"
|
|
110
110
|
|
|
111
|
-
response = client.
|
|
111
|
+
response = client.shares.exchange(
|
|
112
112
|
...,
|
|
113
113
|
timeout: 30 # 30 second timeout
|
|
114
114
|
)
|
|
@@ -121,7 +121,7 @@ If you would like to send additional headers as part of the request, use the `ad
|
|
|
121
121
|
```ruby
|
|
122
122
|
require "cloudpdf"
|
|
123
123
|
|
|
124
|
-
response = client.
|
|
124
|
+
response = client.shares.exchange(
|
|
125
125
|
...,
|
|
126
126
|
request_options: {
|
|
127
127
|
additional_headers: {
|
|
@@ -138,7 +138,7 @@ If you would like to send additional query parameters as part of the request, us
|
|
|
138
138
|
```ruby
|
|
139
139
|
require "cloudpdf"
|
|
140
140
|
|
|
141
|
-
response = client.
|
|
141
|
+
response = client.shares.exchange(
|
|
142
142
|
...,
|
|
143
143
|
request_options: {
|
|
144
144
|
additional_query_parameters: {
|
data/lib/CloudPDF/client.rb
CHANGED
|
@@ -28,6 +28,11 @@ module CloudPDF
|
|
|
28
28
|
@doc ||= CloudPDF::Doc::Client.new(client: @raw_client)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# @return [CloudPDF::Shares::Client]
|
|
32
|
+
def shares
|
|
33
|
+
@shares ||= CloudPDF::Shares::Client.new(client: @raw_client)
|
|
34
|
+
end
|
|
35
|
+
|
|
31
36
|
# @return [CloudPDF::Tenants::Client]
|
|
32
37
|
def tenants
|
|
33
38
|
@tenants ||= CloudPDF::Tenants::Client.new(client: @raw_client)
|
|
@@ -249,8 +249,11 @@ module CloudPDF
|
|
|
249
249
|
raise error_class.new(response.body, code: code)
|
|
250
250
|
end
|
|
251
251
|
|
|
252
|
+
# This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto
|
|
253
|
+
# mode prefers a presigned object-store PUT whenever available.
|
|
254
|
+
#
|
|
252
255
|
# @param request_options [Hash]
|
|
253
|
-
# @param params [
|
|
256
|
+
# @param params [void]
|
|
254
257
|
# @option request_options [String] :base_url
|
|
255
258
|
# @option request_options [Hash{String => Object}] :additional_headers
|
|
256
259
|
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
@@ -258,14 +261,77 @@ module CloudPDF
|
|
|
258
261
|
# @option request_options [Integer] :timeout_in_seconds
|
|
259
262
|
# @option params [String] :tenant_id
|
|
260
263
|
# @option params [String] :id
|
|
264
|
+
# @option params [#read] :file
|
|
261
265
|
#
|
|
262
|
-
# @
|
|
263
|
-
|
|
266
|
+
# @example
|
|
267
|
+
# client.documents.upload_proxy(
|
|
268
|
+
# tenant_id: "tenantId",
|
|
269
|
+
# id: "id",
|
|
270
|
+
# file: File.open("document.pdf", "rb")
|
|
271
|
+
# )
|
|
272
|
+
#
|
|
273
|
+
# @return [CloudPDF::Types::DocumentsUploadProxy200Response]
|
|
274
|
+
def upload_proxy(request_options: {}, **params)
|
|
264
275
|
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
276
|
+
body = Internal::Multipart::FormData.new
|
|
277
|
+
|
|
278
|
+
raise ArgumentError, "file is required" unless params[:file]
|
|
279
|
+
body.add_file(name: "file", file: params[:file], content_type: "application/pdf")
|
|
280
|
+
|
|
281
|
+
request = CloudPDF::Internal::Multipart::Request.new(
|
|
282
|
+
base_url: request_options[:base_url],
|
|
283
|
+
method: "POST",
|
|
284
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/documents/#{URI.encode_uri_component(params[:id].to_s)}/upload-proxy",
|
|
285
|
+
body: body,
|
|
286
|
+
request_options: request_options
|
|
287
|
+
)
|
|
288
|
+
begin
|
|
289
|
+
response = @client.send(request)
|
|
290
|
+
rescue Net::HTTPRequestTimeout
|
|
291
|
+
raise CloudPDF::Errors::TimeoutError
|
|
292
|
+
end
|
|
293
|
+
code = response.code.to_i
|
|
294
|
+
if code.between?(200, 299)
|
|
295
|
+
CloudPDF::Types::DocumentsUploadProxy200Response.load(response.body)
|
|
296
|
+
else
|
|
297
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
298
|
+
raise error_class.new(response.body, code: code)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or
|
|
303
|
+
# failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the
|
|
304
|
+
# transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates
|
|
305
|
+
# scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source
|
|
306
|
+
# is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to
|
|
307
|
+
# resume the same document. URL sources are capabilities and never echoed back. Connection sources name
|
|
308
|
+
# operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment
|
|
309
|
+
# configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
310
|
+
#
|
|
311
|
+
# @param request_options [Hash]
|
|
312
|
+
# @param params [CloudPDF::Documents::Types::DocumentsImportFromRequest]
|
|
313
|
+
# @option request_options [String] :base_url
|
|
314
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
315
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
316
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
317
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
318
|
+
# @option params [String] :tenant_id
|
|
319
|
+
#
|
|
320
|
+
# @example
|
|
321
|
+
# client.documents.import_from(tenant_id: "tenantId")
|
|
322
|
+
#
|
|
323
|
+
# @return [CloudPDF::Types::DocumentsImportFrom200Response]
|
|
324
|
+
def import_from(request_options: {}, **params)
|
|
325
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
326
|
+
request_data = CloudPDF::Documents::Types::DocumentsImportFromRequest.new(params).to_h
|
|
327
|
+
non_body_param_names = %w[tenantId]
|
|
328
|
+
body = request_data.except(*non_body_param_names)
|
|
329
|
+
|
|
265
330
|
request = CloudPDF::Internal::JSON::Request.new(
|
|
266
331
|
base_url: request_options[:base_url],
|
|
267
332
|
method: "POST",
|
|
268
|
-
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/documents
|
|
333
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/documents/import",
|
|
334
|
+
body: body,
|
|
269
335
|
request_options: request_options
|
|
270
336
|
)
|
|
271
337
|
begin
|
|
@@ -275,7 +341,7 @@ module CloudPDF
|
|
|
275
341
|
end
|
|
276
342
|
code = response.code.to_i
|
|
277
343
|
if code.between?(200, 299)
|
|
278
|
-
CloudPDF::Types::
|
|
344
|
+
CloudPDF::Types::DocumentsImportFrom200Response.load(response.body)
|
|
279
345
|
else
|
|
280
346
|
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
281
347
|
raise error_class.new(response.body, code: code)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
class DocumentsImportFromRequest < Internal::Types::Model
|
|
7
|
+
field :tenant_id, -> { String }, optional: false, nullable: false, api_name: "tenantId"
|
|
8
|
+
|
|
9
|
+
field :source, -> { CloudPDF::Documents::Types::DocumentsImportFromRequestSource }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :expected, -> { CloudPDF::Documents::Types::DocumentsImportFromRequestExpected }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :idempotency_key, -> { String }, optional: true, nullable: false, api_name: "idempotencyKey"
|
|
16
|
+
|
|
17
|
+
field :dedup_mode, -> { CloudPDF::Documents::Types::DocumentsImportFromRequestDedupMode }, optional: true, nullable: false, api_name: "dedupMode"
|
|
18
|
+
|
|
19
|
+
field :doc_id, -> { String }, optional: true, nullable: false, api_name: "docId"
|
|
20
|
+
|
|
21
|
+
field :mode, -> { CloudPDF::Documents::Types::DocumentsImportFromRequestMode }, optional: true, nullable: false
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
module DocumentsImportFromRequestDedupMode
|
|
7
|
+
extend CloudPDF::Internal::Types::Enum
|
|
8
|
+
|
|
9
|
+
ALWAYS_CREATE = "always-create"
|
|
10
|
+
REUSE_EXISTING = "reuse-existing"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
class DocumentsImportFromRequestExpected < Internal::Types::Model
|
|
7
|
+
field :size_bytes, -> { Integer }, optional: true, nullable: false, api_name: "sizeBytes"
|
|
8
|
+
|
|
9
|
+
field :sha256, -> { String }, optional: true, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
class DocumentsImportFromRequestSource < Internal::Types::Model
|
|
7
|
+
extend CloudPDF::Internal::Types::Union
|
|
8
|
+
|
|
9
|
+
discriminant :kind
|
|
10
|
+
|
|
11
|
+
member -> { CloudPDF::Documents::Types::DocumentsImportFromRequestSourceURL }, key: "URL"
|
|
12
|
+
|
|
13
|
+
member -> { CloudPDF::Documents::Types::DocumentsImportFromRequestSourceConnection }, key: "CONNECTION"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
class DocumentsImportFromRequestSourceConnection < Internal::Types::Model
|
|
7
|
+
field :connection_id, -> { String }, optional: false, nullable: false, api_name: "connectionId"
|
|
8
|
+
|
|
9
|
+
field :key, -> { String }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :revision, -> { String }, optional: true, nullable: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -19,6 +19,8 @@ module CloudPDF
|
|
|
19
19
|
field :doc_id, -> { String }, optional: true, nullable: false, api_name: "docId"
|
|
20
20
|
|
|
21
21
|
field :upload_ttl_sec, -> { Integer }, optional: true, nullable: false, api_name: "uploadTtlSec"
|
|
22
|
+
|
|
23
|
+
field :upload_preference, -> { CloudPDF::Documents::Types::DocumentsInitRequestUploadPreference }, optional: true, nullable: false, api_name: "uploadPreference"
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
module DocumentsInitRequestUploadPreference
|
|
7
|
+
extend CloudPDF::Internal::Types::Enum
|
|
8
|
+
|
|
9
|
+
AUTO = "auto"
|
|
10
|
+
PRESIGNED = "presigned"
|
|
11
|
+
PROXY = "proxy"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Documents
|
|
5
|
+
module Types
|
|
6
|
+
class UploadProxyDocumentsRequest < Internal::Types::Model
|
|
7
|
+
field :tenant_id, -> { String }, optional: false, nullable: false, api_name: "tenantId"
|
|
8
|
+
|
|
9
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :file, -> { Object }, optional: false, nullable: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Shares
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [CloudPDF::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked,
|
|
14
|
+
# and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired
|
|
15
|
+
# until `password` is supplied. Mounted only when the deployment can sign (HS256 mode).
|
|
16
|
+
#
|
|
17
|
+
# @param request_options [Hash]
|
|
18
|
+
# @param params [CloudPDF::Shares::Types::SharesExchangeRequest]
|
|
19
|
+
# @option request_options [String] :base_url
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
21
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
22
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
23
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# client.shares.exchange(share_token: "shareToken")
|
|
27
|
+
#
|
|
28
|
+
# @return [CloudPDF::Types::SharesExchange200Response]
|
|
29
|
+
def exchange(request_options: {}, **params)
|
|
30
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
31
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
32
|
+
base_url: request_options[:base_url],
|
|
33
|
+
method: "POST",
|
|
34
|
+
path: "v1/share-sessions",
|
|
35
|
+
body: CloudPDF::Shares::Types::SharesExchangeRequest.new(params).to_h,
|
|
36
|
+
request_options: request_options
|
|
37
|
+
)
|
|
38
|
+
begin
|
|
39
|
+
response = @client.send(request)
|
|
40
|
+
rescue Net::HTTPRequestTimeout
|
|
41
|
+
raise CloudPDF::Errors::TimeoutError
|
|
42
|
+
end
|
|
43
|
+
code = response.code.to_i
|
|
44
|
+
if code.between?(200, 299)
|
|
45
|
+
CloudPDF::Types::SharesExchange200Response.load(response.body)
|
|
46
|
+
else
|
|
47
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
48
|
+
raise error_class.new(response.body, code: code)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @param request_options [Hash]
|
|
53
|
+
# @param params [Hash]
|
|
54
|
+
# @option request_options [String] :base_url
|
|
55
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
56
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
57
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
58
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
59
|
+
# @option params [String] :tenant_id
|
|
60
|
+
# @option params [Integer, nil] :limit
|
|
61
|
+
# @option params [String, nil] :cursor
|
|
62
|
+
# @option params [String, nil] :doc_id
|
|
63
|
+
#
|
|
64
|
+
# @example
|
|
65
|
+
# client.shares.list(tenant_id: "tenantId")
|
|
66
|
+
#
|
|
67
|
+
# @return [CloudPDF::Types::SharesList200Response]
|
|
68
|
+
def list(request_options: {}, **params)
|
|
69
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
70
|
+
query_params = {}
|
|
71
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
72
|
+
query_params["cursor"] = params[:cursor] if params.key?(:cursor)
|
|
73
|
+
query_params["docId"] = params[:doc_id] if params.key?(:doc_id)
|
|
74
|
+
|
|
75
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
76
|
+
base_url: request_options[:base_url],
|
|
77
|
+
method: "GET",
|
|
78
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/shares",
|
|
79
|
+
query: query_params,
|
|
80
|
+
request_options: request_options
|
|
81
|
+
)
|
|
82
|
+
begin
|
|
83
|
+
response = @client.send(request)
|
|
84
|
+
rescue Net::HTTPRequestTimeout
|
|
85
|
+
raise CloudPDF::Errors::TimeoutError
|
|
86
|
+
end
|
|
87
|
+
code = response.code.to_i
|
|
88
|
+
if code.between?(200, 299)
|
|
89
|
+
CloudPDF::Types::SharesList200Response.load(response.body)
|
|
90
|
+
else
|
|
91
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
92
|
+
raise error_class.new(response.body, code: code)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) —
|
|
97
|
+
# exchange mints session JWTs, so grants exist only where minting does.
|
|
98
|
+
#
|
|
99
|
+
# @param request_options [Hash]
|
|
100
|
+
# @param params [CloudPDF::Shares::Types::SharesCreateRequest]
|
|
101
|
+
# @option request_options [String] :base_url
|
|
102
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
103
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
104
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
105
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
106
|
+
# @option params [String] :tenant_id
|
|
107
|
+
#
|
|
108
|
+
# @example
|
|
109
|
+
# client.shares.create(
|
|
110
|
+
# tenant_id: "tenantId",
|
|
111
|
+
# doc_id: "docId",
|
|
112
|
+
# scope: ["scope"]
|
|
113
|
+
# )
|
|
114
|
+
#
|
|
115
|
+
# @return [CloudPDF::Types::SharesCreate200Response]
|
|
116
|
+
def create(request_options: {}, **params)
|
|
117
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
118
|
+
request_data = CloudPDF::Shares::Types::SharesCreateRequest.new(params).to_h
|
|
119
|
+
non_body_param_names = %w[tenantId]
|
|
120
|
+
body = request_data.except(*non_body_param_names)
|
|
121
|
+
|
|
122
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
123
|
+
base_url: request_options[:base_url],
|
|
124
|
+
method: "POST",
|
|
125
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/shares",
|
|
126
|
+
body: body,
|
|
127
|
+
request_options: request_options
|
|
128
|
+
)
|
|
129
|
+
begin
|
|
130
|
+
response = @client.send(request)
|
|
131
|
+
rescue Net::HTTPRequestTimeout
|
|
132
|
+
raise CloudPDF::Errors::TimeoutError
|
|
133
|
+
end
|
|
134
|
+
code = response.code.to_i
|
|
135
|
+
if code.between?(200, 299)
|
|
136
|
+
CloudPDF::Types::SharesCreate200Response.load(response.body)
|
|
137
|
+
else
|
|
138
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
139
|
+
raise error_class.new(response.body, code: code)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# @param request_options [Hash]
|
|
144
|
+
# @param params [Hash]
|
|
145
|
+
# @option request_options [String] :base_url
|
|
146
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
147
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
148
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
149
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
150
|
+
# @option params [String] :tenant_id
|
|
151
|
+
# @option params [String] :share_id
|
|
152
|
+
#
|
|
153
|
+
# @example
|
|
154
|
+
# client.shares.get(
|
|
155
|
+
# tenant_id: "tenantId",
|
|
156
|
+
# share_id: "shareId"
|
|
157
|
+
# )
|
|
158
|
+
#
|
|
159
|
+
# @return [CloudPDF::Types::SharesGet200Response]
|
|
160
|
+
def get(request_options: {}, **params)
|
|
161
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
162
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
163
|
+
base_url: request_options[:base_url],
|
|
164
|
+
method: "GET",
|
|
165
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/shares/#{URI.encode_uri_component(params[:share_id].to_s)}",
|
|
166
|
+
request_options: request_options
|
|
167
|
+
)
|
|
168
|
+
begin
|
|
169
|
+
response = @client.send(request)
|
|
170
|
+
rescue Net::HTTPRequestTimeout
|
|
171
|
+
raise CloudPDF::Errors::TimeoutError
|
|
172
|
+
end
|
|
173
|
+
code = response.code.to_i
|
|
174
|
+
if code.between?(200, 299)
|
|
175
|
+
CloudPDF::Types::SharesGet200Response.load(response.body)
|
|
176
|
+
else
|
|
177
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
178
|
+
raise error_class.new(response.body, code: code)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# @param request_options [Hash]
|
|
183
|
+
# @param params [Hash]
|
|
184
|
+
# @option request_options [String] :base_url
|
|
185
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
186
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
187
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
188
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
189
|
+
# @option params [String] :tenant_id
|
|
190
|
+
# @option params [String] :share_id
|
|
191
|
+
#
|
|
192
|
+
# @example
|
|
193
|
+
# client.shares.delete(
|
|
194
|
+
# tenant_id: "tenantId",
|
|
195
|
+
# share_id: "shareId"
|
|
196
|
+
# )
|
|
197
|
+
#
|
|
198
|
+
# @return [untyped]
|
|
199
|
+
def delete(request_options: {}, **params)
|
|
200
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
201
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
202
|
+
base_url: request_options[:base_url],
|
|
203
|
+
method: "DELETE",
|
|
204
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/shares/#{URI.encode_uri_component(params[:share_id].to_s)}",
|
|
205
|
+
request_options: request_options
|
|
206
|
+
)
|
|
207
|
+
begin
|
|
208
|
+
response = @client.send(request)
|
|
209
|
+
rescue Net::HTTPRequestTimeout
|
|
210
|
+
raise CloudPDF::Errors::TimeoutError
|
|
211
|
+
end
|
|
212
|
+
code = response.code.to_i
|
|
213
|
+
return if code.between?(200, 299)
|
|
214
|
+
|
|
215
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
216
|
+
raise error_class.new(response.body, code: code)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# @param request_options [Hash]
|
|
220
|
+
# @param params [CloudPDF::Shares::Types::SharesUpdateRequest]
|
|
221
|
+
# @option request_options [String] :base_url
|
|
222
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
223
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
224
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
225
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
226
|
+
# @option params [String] :tenant_id
|
|
227
|
+
# @option params [String] :share_id
|
|
228
|
+
#
|
|
229
|
+
# @example
|
|
230
|
+
# client.shares.update(
|
|
231
|
+
# tenant_id: "tenantId",
|
|
232
|
+
# share_id: "shareId"
|
|
233
|
+
# )
|
|
234
|
+
#
|
|
235
|
+
# @return [CloudPDF::Types::SharesUpdate200Response]
|
|
236
|
+
def update(request_options: {}, **params)
|
|
237
|
+
params = CloudPDF::Internal::Types::Utils.normalize_keys(params)
|
|
238
|
+
request_data = CloudPDF::Shares::Types::SharesUpdateRequest.new(params).to_h
|
|
239
|
+
non_body_param_names = %w[tenantId shareId]
|
|
240
|
+
body = request_data.except(*non_body_param_names)
|
|
241
|
+
|
|
242
|
+
request = CloudPDF::Internal::JSON::Request.new(
|
|
243
|
+
base_url: request_options[:base_url],
|
|
244
|
+
method: "PATCH",
|
|
245
|
+
path: "v1/tenants/#{URI.encode_uri_component(params[:tenant_id].to_s)}/shares/#{URI.encode_uri_component(params[:share_id].to_s)}",
|
|
246
|
+
body: body,
|
|
247
|
+
request_options: request_options
|
|
248
|
+
)
|
|
249
|
+
begin
|
|
250
|
+
response = @client.send(request)
|
|
251
|
+
rescue Net::HTTPRequestTimeout
|
|
252
|
+
raise CloudPDF::Errors::TimeoutError
|
|
253
|
+
end
|
|
254
|
+
code = response.code.to_i
|
|
255
|
+
if code.between?(200, 299)
|
|
256
|
+
CloudPDF::Types::SharesUpdate200Response.load(response.body)
|
|
257
|
+
else
|
|
258
|
+
error_class = CloudPDF::Errors::ResponseError.subclass_for_code(code)
|
|
259
|
+
raise error_class.new(response.body, code: code)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Shares
|
|
5
|
+
module Types
|
|
6
|
+
class DeleteSharesRequest < Internal::Types::Model
|
|
7
|
+
field :tenant_id, -> { String }, optional: false, nullable: false, api_name: "tenantId"
|
|
8
|
+
|
|
9
|
+
field :share_id, -> { String }, optional: false, nullable: false, api_name: "shareId"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Shares
|
|
5
|
+
module Types
|
|
6
|
+
class GetSharesRequest < Internal::Types::Model
|
|
7
|
+
field :tenant_id, -> { String }, optional: false, nullable: false, api_name: "tenantId"
|
|
8
|
+
|
|
9
|
+
field :share_id, -> { String }, optional: false, nullable: false, api_name: "shareId"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CloudPDF
|
|
4
|
+
module Shares
|
|
5
|
+
module Types
|
|
6
|
+
class ListSharesRequest < Internal::Types::Model
|
|
7
|
+
field :tenant_id, -> { String }, optional: false, nullable: false, api_name: "tenantId"
|
|
8
|
+
|
|
9
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :cursor, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :doc_id, -> { String }, optional: true, nullable: false, api_name: "docId"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|