@cloudpdf/sdk 3.0.0-next.4 → 3.0.0-next.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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/errors/BadGatewayError.d.ts +7 -0
- package/dist/cjs/api/errors/BadGatewayError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/documents/client/Client.d.ts +23 -0
- package/dist/cjs/api/resources/documents/client/Client.js +69 -0
- package/dist/cjs/api/resources/documents/client/requests/DocumentsImportFromRequest.d.ts +37 -0
- package/dist/cjs/api/resources/documents/client/requests/DocumentsImportFromRequest.js +15 -0
- package/dist/cjs/api/resources/documents/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/documents/client/requests/index.js +3 -1
- package/dist/cjs/api/resources/documents/types/DocumentsImportFromRequestSource.d.ts +14 -0
- package/dist/cjs/api/resources/documents/types/DocumentsImportFromRequestSource.js +3 -0
- package/dist/cjs/api/resources/documents/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/documents/types/index.js +1 -0
- package/dist/cjs/api/types/DocText200Response.d.ts +1 -0
- package/dist/cjs/api/types/DocumentsImportFrom200Response.d.ts +43 -0
- package/dist/cjs/api/types/DocumentsImportFrom200Response.js +27 -0
- package/dist/cjs/api/types/DocumentsImportFrom202Response.d.ts +43 -0
- package/dist/cjs/api/types/DocumentsImportFrom202Response.js +27 -0
- package/dist/cjs/api/types/DocumentsImportFrom400Response.d.ts +9 -0
- package/dist/cjs/api/types/DocumentsImportFrom400Response.js +3 -0
- package/dist/cjs/api/types/DocumentsImportFrom403Response.d.ts +9 -0
- package/dist/cjs/api/types/DocumentsImportFrom403Response.js +3 -0
- package/dist/cjs/api/types/DocumentsImportFrom502Response.d.ts +9 -0
- package/dist/cjs/api/types/DocumentsImportFrom502Response.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/errors/BadGatewayError.d.mts +7 -0
- package/dist/esm/api/errors/BadGatewayError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/documents/client/Client.d.mts +23 -0
- package/dist/esm/api/resources/documents/client/Client.mjs +69 -0
- package/dist/esm/api/resources/documents/client/requests/DocumentsImportFromRequest.d.mts +37 -0
- package/dist/esm/api/resources/documents/client/requests/DocumentsImportFromRequest.mjs +12 -0
- package/dist/esm/api/resources/documents/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/documents/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/documents/types/DocumentsImportFromRequestSource.d.mts +14 -0
- package/dist/esm/api/resources/documents/types/DocumentsImportFromRequestSource.mjs +2 -0
- package/dist/esm/api/resources/documents/types/index.d.mts +1 -0
- package/dist/esm/api/resources/documents/types/index.mjs +1 -0
- package/dist/esm/api/types/DocText200Response.d.mts +1 -0
- package/dist/esm/api/types/DocumentsImportFrom200Response.d.mts +43 -0
- package/dist/esm/api/types/DocumentsImportFrom200Response.mjs +24 -0
- package/dist/esm/api/types/DocumentsImportFrom202Response.d.mts +43 -0
- package/dist/esm/api/types/DocumentsImportFrom202Response.mjs +24 -0
- package/dist/esm/api/types/DocumentsImportFrom400Response.d.mts +9 -0
- package/dist/esm/api/types/DocumentsImportFrom400Response.mjs +2 -0
- package/dist/esm/api/types/DocumentsImportFrom403Response.d.mts +9 -0
- package/dist/esm/api/types/DocumentsImportFrom403Response.mjs +2 -0
- package/dist/esm/api/types/DocumentsImportFrom502Response.d.mts +9 -0
- package/dist/esm/api/types/DocumentsImportFrom502Response.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +69 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@cloudpdf/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "3.0.0-next.
|
|
47
|
-
"User-Agent": "@cloudpdf/sdk/3.0.0-next.
|
|
46
|
+
"X-Fern-SDK-Version": "3.0.0-next.6",
|
|
47
|
+
"User-Agent": "@cloudpdf/sdk/3.0.0-next.6",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
2
|
+
import * as errors from "../../errors/index.js";
|
|
3
|
+
import type * as CloudPDF from "../index.js";
|
|
4
|
+
export declare class BadGatewayError extends errors.CloudPDFError {
|
|
5
|
+
readonly body: CloudPDF.DocumentsImportFrom502Response;
|
|
6
|
+
constructor(body: CloudPDF.DocumentsImportFrom502Response, rawResponse?: core.RawResponse);
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.BadGatewayError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
+
class BadGatewayError extends errors.CloudPDFError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "BadGatewayError",
|
|
43
|
+
statusCode: 502,
|
|
44
|
+
body: body,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = "BadGatewayError";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.BadGatewayError = BadGatewayError;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BadGatewayError.js"), exports);
|
|
17
18
|
__exportStar(require("./BadRequestError.js"), exports);
|
|
18
19
|
__exportStar(require("./ConflictError.js"), exports);
|
|
19
20
|
__exportStar(require("./ForbiddenError.js"), exports);
|
|
@@ -113,6 +113,29 @@ export declare class DocumentsClient {
|
|
|
113
113
|
*/
|
|
114
114
|
uploadProxy(request: CloudPDF.UploadProxyDocumentsRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsUploadProxy200Response>;
|
|
115
115
|
private __uploadProxy;
|
|
116
|
+
/**
|
|
117
|
+
* Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
118
|
+
*
|
|
119
|
+
* @param {CloudPDF.DocumentsImportFromRequest} request
|
|
120
|
+
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
|
+
*
|
|
122
|
+
* @throws {@link CloudPDF.BadRequestError}
|
|
123
|
+
* @throws {@link CloudPDF.ForbiddenError}
|
|
124
|
+
* @throws {@link CloudPDF.BadGatewayError}
|
|
125
|
+
* @throws {@link errors.CloudPDFError}
|
|
126
|
+
* @throws {@link errors.CloudPDFTimeoutError}
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.documents.importFrom({
|
|
130
|
+
* tenantId: "tenantId",
|
|
131
|
+
* source: {
|
|
132
|
+
* kind: "url",
|
|
133
|
+
* url: "url"
|
|
134
|
+
* }
|
|
135
|
+
* })
|
|
136
|
+
*/
|
|
137
|
+
importFrom(request: CloudPDF.DocumentsImportFromRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsImportFrom200Response>;
|
|
138
|
+
private __importFrom;
|
|
116
139
|
/**
|
|
117
140
|
* @param {CloudPDF.DocumentsInitRequest} request
|
|
118
141
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -453,6 +453,75 @@ class DocumentsClient {
|
|
|
453
453
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/{id}/upload-proxy");
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
458
|
+
*
|
|
459
|
+
* @param {CloudPDF.DocumentsImportFromRequest} request
|
|
460
|
+
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
461
|
+
*
|
|
462
|
+
* @throws {@link CloudPDF.BadRequestError}
|
|
463
|
+
* @throws {@link CloudPDF.ForbiddenError}
|
|
464
|
+
* @throws {@link CloudPDF.BadGatewayError}
|
|
465
|
+
* @throws {@link errors.CloudPDFError}
|
|
466
|
+
* @throws {@link errors.CloudPDFTimeoutError}
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* await client.documents.importFrom({
|
|
470
|
+
* tenantId: "tenantId",
|
|
471
|
+
* source: {
|
|
472
|
+
* kind: "url",
|
|
473
|
+
* url: "url"
|
|
474
|
+
* }
|
|
475
|
+
* })
|
|
476
|
+
*/
|
|
477
|
+
importFrom(request, requestOptions) {
|
|
478
|
+
return core.HttpResponsePromise.fromPromise(this.__importFrom(request, requestOptions));
|
|
479
|
+
}
|
|
480
|
+
__importFrom(request, requestOptions) {
|
|
481
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
482
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
483
|
+
const { tenantId } = request, _body = __rest(request, ["tenantId"]);
|
|
484
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
485
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
486
|
+
const _response = yield core.fetcher({
|
|
487
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/tenants/${core.url.encodePathParam(tenantId)}/documents/import`),
|
|
488
|
+
method: "POST",
|
|
489
|
+
headers: _headers,
|
|
490
|
+
contentType: "application/json",
|
|
491
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
492
|
+
requestType: "json",
|
|
493
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
494
|
+
timeoutMs: ((_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) !== null && _e !== void 0 ? _e : 60) * 1000,
|
|
495
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
496
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
497
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
498
|
+
logging: this._options.logging,
|
|
499
|
+
});
|
|
500
|
+
if (_response.ok) {
|
|
501
|
+
return {
|
|
502
|
+
data: _response.body,
|
|
503
|
+
rawResponse: _response.rawResponse,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
if (_response.error.reason === "status-code") {
|
|
507
|
+
switch (_response.error.statusCode) {
|
|
508
|
+
case 400:
|
|
509
|
+
throw new CloudPDF.BadRequestError(_response.error.body, _response.rawResponse);
|
|
510
|
+
case 403:
|
|
511
|
+
throw new CloudPDF.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
512
|
+
case 502:
|
|
513
|
+
throw new CloudPDF.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
514
|
+
default:
|
|
515
|
+
throw new errors.CloudPDFError({
|
|
516
|
+
statusCode: _response.error.statusCode,
|
|
517
|
+
body: _response.error.body,
|
|
518
|
+
rawResponse: _response.rawResponse,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/import");
|
|
523
|
+
});
|
|
524
|
+
}
|
|
456
525
|
/**
|
|
457
526
|
* @param {CloudPDF.DocumentsInitRequest} request
|
|
458
527
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type * as CloudPDF from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* tenantId: "tenantId",
|
|
6
|
+
* source: {
|
|
7
|
+
* kind: "url",
|
|
8
|
+
* url: "url"
|
|
9
|
+
* }
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface DocumentsImportFromRequest {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
source: CloudPDF.DocumentsImportFromRequestSource;
|
|
15
|
+
expected?: DocumentsImportFromRequest.Expected;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
idempotencyKey?: string;
|
|
18
|
+
dedupMode?: DocumentsImportFromRequest.DedupMode;
|
|
19
|
+
docId?: string;
|
|
20
|
+
mode?: DocumentsImportFromRequest.Mode;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace DocumentsImportFromRequest {
|
|
23
|
+
interface Expected {
|
|
24
|
+
sizeBytes?: number | undefined;
|
|
25
|
+
sha256?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
const DedupMode: {
|
|
28
|
+
readonly AlwaysCreate: "always-create";
|
|
29
|
+
readonly ReuseExisting: "reuse-existing";
|
|
30
|
+
};
|
|
31
|
+
type DedupMode = (typeof DedupMode)[keyof typeof DedupMode];
|
|
32
|
+
const Mode: {
|
|
33
|
+
readonly Sync: "sync";
|
|
34
|
+
readonly Async: "async";
|
|
35
|
+
};
|
|
36
|
+
type Mode = (typeof Mode)[keyof typeof Mode];
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DocumentsImportFromRequest = void 0;
|
|
5
|
+
var DocumentsImportFromRequest;
|
|
6
|
+
(function (DocumentsImportFromRequest) {
|
|
7
|
+
DocumentsImportFromRequest.DedupMode = {
|
|
8
|
+
AlwaysCreate: "always-create",
|
|
9
|
+
ReuseExisting: "reuse-existing",
|
|
10
|
+
};
|
|
11
|
+
DocumentsImportFromRequest.Mode = {
|
|
12
|
+
Sync: "sync",
|
|
13
|
+
Async: "async",
|
|
14
|
+
};
|
|
15
|
+
})(DocumentsImportFromRequest || (exports.DocumentsImportFromRequest = DocumentsImportFromRequest = {}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { DeleteDocumentsRequest } from "./DeleteDocumentsRequest.js";
|
|
2
2
|
export type { DocumentsCommitRequest } from "./DocumentsCommitRequest.js";
|
|
3
|
+
export { DocumentsImportFromRequest } from "./DocumentsImportFromRequest.js";
|
|
3
4
|
export { DocumentsInitRequest } from "./DocumentsInitRequest.js";
|
|
4
5
|
export type { DownloadDocumentsRequest } from "./DownloadDocumentsRequest.js";
|
|
5
6
|
export type { GetDocumentsRequest } from "./GetDocumentsRequest.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentsInitRequest = void 0;
|
|
3
|
+
exports.DocumentsInitRequest = exports.DocumentsImportFromRequest = void 0;
|
|
4
|
+
var DocumentsImportFromRequest_js_1 = require("./DocumentsImportFromRequest.js");
|
|
5
|
+
Object.defineProperty(exports, "DocumentsImportFromRequest", { enumerable: true, get: function () { return DocumentsImportFromRequest_js_1.DocumentsImportFromRequest; } });
|
|
4
6
|
var DocumentsInitRequest_js_1 = require("./DocumentsInitRequest.js");
|
|
5
7
|
Object.defineProperty(exports, "DocumentsInitRequest", { enumerable: true, get: function () { return DocumentsInitRequest_js_1.DocumentsInitRequest; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as CloudPDF from "../../../index.js";
|
|
2
|
+
export type DocumentsImportFromRequestSource = CloudPDF.DocumentsImportFromRequestSource.Url | CloudPDF.DocumentsImportFromRequestSource.Connection;
|
|
3
|
+
export declare namespace DocumentsImportFromRequestSource {
|
|
4
|
+
interface Url {
|
|
5
|
+
kind: "url";
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
interface Connection {
|
|
9
|
+
kind: "connection";
|
|
10
|
+
connectionId: string;
|
|
11
|
+
key: string;
|
|
12
|
+
revision?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DocumentsImportFromRequestSource.js"), exports);
|
|
17
18
|
__exportStar(require("./ListDocumentsRequestState.js"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface DocumentsImportFrom200Response {
|
|
2
|
+
tag: DocumentsImportFrom200Response.Tag;
|
|
3
|
+
document: DocumentsImportFrom200Response.Document;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace DocumentsImportFrom200Response {
|
|
6
|
+
const Tag: {
|
|
7
|
+
readonly Imported: "imported";
|
|
8
|
+
readonly Deduped: "deduped";
|
|
9
|
+
readonly Accepted: "accepted";
|
|
10
|
+
};
|
|
11
|
+
type Tag = (typeof Tag)[keyof typeof Tag];
|
|
12
|
+
interface Document {
|
|
13
|
+
id: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
state: Document.State;
|
|
16
|
+
baseSha: string | null;
|
|
17
|
+
storageSizeBytes: number | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
idempotencyKey: string | null;
|
|
20
|
+
failureReason: string | null;
|
|
21
|
+
thumbnailState?: Document.ThumbnailState | undefined;
|
|
22
|
+
thumbnailUrl?: (string | null) | undefined;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
createdBy: string | null;
|
|
26
|
+
}
|
|
27
|
+
namespace Document {
|
|
28
|
+
const State: {
|
|
29
|
+
readonly Pending: "pending";
|
|
30
|
+
readonly Ready: "ready";
|
|
31
|
+
readonly Failed: "failed";
|
|
32
|
+
readonly Deleting: "deleting";
|
|
33
|
+
};
|
|
34
|
+
type State = (typeof State)[keyof typeof State];
|
|
35
|
+
const ThumbnailState: {
|
|
36
|
+
readonly Pending: "pending";
|
|
37
|
+
readonly Ready: "ready";
|
|
38
|
+
readonly Locked: "locked";
|
|
39
|
+
readonly Failed: "failed";
|
|
40
|
+
};
|
|
41
|
+
type ThumbnailState = (typeof ThumbnailState)[keyof typeof ThumbnailState];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DocumentsImportFrom200Response = void 0;
|
|
5
|
+
var DocumentsImportFrom200Response;
|
|
6
|
+
(function (DocumentsImportFrom200Response) {
|
|
7
|
+
DocumentsImportFrom200Response.Tag = {
|
|
8
|
+
Imported: "imported",
|
|
9
|
+
Deduped: "deduped",
|
|
10
|
+
Accepted: "accepted",
|
|
11
|
+
};
|
|
12
|
+
let Document;
|
|
13
|
+
(function (Document) {
|
|
14
|
+
Document.State = {
|
|
15
|
+
Pending: "pending",
|
|
16
|
+
Ready: "ready",
|
|
17
|
+
Failed: "failed",
|
|
18
|
+
Deleting: "deleting",
|
|
19
|
+
};
|
|
20
|
+
Document.ThumbnailState = {
|
|
21
|
+
Pending: "pending",
|
|
22
|
+
Ready: "ready",
|
|
23
|
+
Locked: "locked",
|
|
24
|
+
Failed: "failed",
|
|
25
|
+
};
|
|
26
|
+
})(Document = DocumentsImportFrom200Response.Document || (DocumentsImportFrom200Response.Document = {}));
|
|
27
|
+
})(DocumentsImportFrom200Response || (exports.DocumentsImportFrom200Response = DocumentsImportFrom200Response = {}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface DocumentsImportFrom202Response {
|
|
2
|
+
tag: DocumentsImportFrom202Response.Tag;
|
|
3
|
+
document: DocumentsImportFrom202Response.Document;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace DocumentsImportFrom202Response {
|
|
6
|
+
const Tag: {
|
|
7
|
+
readonly Imported: "imported";
|
|
8
|
+
readonly Deduped: "deduped";
|
|
9
|
+
readonly Accepted: "accepted";
|
|
10
|
+
};
|
|
11
|
+
type Tag = (typeof Tag)[keyof typeof Tag];
|
|
12
|
+
interface Document {
|
|
13
|
+
id: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
state: Document.State;
|
|
16
|
+
baseSha: string | null;
|
|
17
|
+
storageSizeBytes: number | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
idempotencyKey: string | null;
|
|
20
|
+
failureReason: string | null;
|
|
21
|
+
thumbnailState?: Document.ThumbnailState | undefined;
|
|
22
|
+
thumbnailUrl?: (string | null) | undefined;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
createdBy: string | null;
|
|
26
|
+
}
|
|
27
|
+
namespace Document {
|
|
28
|
+
const State: {
|
|
29
|
+
readonly Pending: "pending";
|
|
30
|
+
readonly Ready: "ready";
|
|
31
|
+
readonly Failed: "failed";
|
|
32
|
+
readonly Deleting: "deleting";
|
|
33
|
+
};
|
|
34
|
+
type State = (typeof State)[keyof typeof State];
|
|
35
|
+
const ThumbnailState: {
|
|
36
|
+
readonly Pending: "pending";
|
|
37
|
+
readonly Ready: "ready";
|
|
38
|
+
readonly Locked: "locked";
|
|
39
|
+
readonly Failed: "failed";
|
|
40
|
+
};
|
|
41
|
+
type ThumbnailState = (typeof ThumbnailState)[keyof typeof ThumbnailState];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DocumentsImportFrom202Response = void 0;
|
|
5
|
+
var DocumentsImportFrom202Response;
|
|
6
|
+
(function (DocumentsImportFrom202Response) {
|
|
7
|
+
DocumentsImportFrom202Response.Tag = {
|
|
8
|
+
Imported: "imported",
|
|
9
|
+
Deduped: "deduped",
|
|
10
|
+
Accepted: "accepted",
|
|
11
|
+
};
|
|
12
|
+
let Document;
|
|
13
|
+
(function (Document) {
|
|
14
|
+
Document.State = {
|
|
15
|
+
Pending: "pending",
|
|
16
|
+
Ready: "ready",
|
|
17
|
+
Failed: "failed",
|
|
18
|
+
Deleting: "deleting",
|
|
19
|
+
};
|
|
20
|
+
Document.ThumbnailState = {
|
|
21
|
+
Pending: "pending",
|
|
22
|
+
Ready: "ready",
|
|
23
|
+
Locked: "locked",
|
|
24
|
+
Failed: "failed",
|
|
25
|
+
};
|
|
26
|
+
})(Document = DocumentsImportFrom202Response.Document || (DocumentsImportFrom202Response.Document = {}));
|
|
27
|
+
})(DocumentsImportFrom202Response || (exports.DocumentsImportFrom202Response = DocumentsImportFrom202Response = {}));
|
|
@@ -145,6 +145,11 @@ export * from "./DocumentsDownload404Response.js";
|
|
|
145
145
|
export * from "./DocumentsGet200Response.js";
|
|
146
146
|
export * from "./DocumentsGet403Response.js";
|
|
147
147
|
export * from "./DocumentsGet404Response.js";
|
|
148
|
+
export * from "./DocumentsImportFrom200Response.js";
|
|
149
|
+
export * from "./DocumentsImportFrom202Response.js";
|
|
150
|
+
export * from "./DocumentsImportFrom400Response.js";
|
|
151
|
+
export * from "./DocumentsImportFrom403Response.js";
|
|
152
|
+
export * from "./DocumentsImportFrom502Response.js";
|
|
148
153
|
export * from "./DocumentsInit200Response.js";
|
|
149
154
|
export * from "./DocumentsInit200ResponseCreatedUpload.js";
|
|
150
155
|
export * from "./DocumentsInit200ResponseResumedUpload.js";
|
|
@@ -161,6 +161,11 @@ __exportStar(require("./DocumentsDownload404Response.js"), exports);
|
|
|
161
161
|
__exportStar(require("./DocumentsGet200Response.js"), exports);
|
|
162
162
|
__exportStar(require("./DocumentsGet403Response.js"), exports);
|
|
163
163
|
__exportStar(require("./DocumentsGet404Response.js"), exports);
|
|
164
|
+
__exportStar(require("./DocumentsImportFrom200Response.js"), exports);
|
|
165
|
+
__exportStar(require("./DocumentsImportFrom202Response.js"), exports);
|
|
166
|
+
__exportStar(require("./DocumentsImportFrom400Response.js"), exports);
|
|
167
|
+
__exportStar(require("./DocumentsImportFrom403Response.js"), exports);
|
|
168
|
+
__exportStar(require("./DocumentsImportFrom502Response.js"), exports);
|
|
164
169
|
__exportStar(require("./DocumentsInit200Response.js"), exports);
|
|
165
170
|
__exportStar(require("./DocumentsInit200ResponseCreatedUpload.js"), exports);
|
|
166
171
|
__exportStar(require("./DocumentsInit200ResponseResumedUpload.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.0.0-next.
|
|
1
|
+
export declare const SDK_VERSION = "3.0.0-next.6";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@cloudpdf/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "3.0.0-next.
|
|
10
|
-
"User-Agent": "@cloudpdf/sdk/3.0.0-next.
|
|
9
|
+
"X-Fern-SDK-Version": "3.0.0-next.6",
|
|
10
|
+
"User-Agent": "@cloudpdf/sdk/3.0.0-next.6",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as core from "../../core/index.mjs";
|
|
2
|
+
import * as errors from "../../errors/index.mjs";
|
|
3
|
+
import type * as CloudPDF from "../index.mjs";
|
|
4
|
+
export declare class BadGatewayError extends errors.CloudPDFError {
|
|
5
|
+
readonly body: CloudPDF.DocumentsImportFrom502Response;
|
|
6
|
+
constructor(body: CloudPDF.DocumentsImportFrom502Response, rawResponse?: core.RawResponse);
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../errors/index.mjs";
|
|
3
|
+
export class BadGatewayError extends errors.CloudPDFError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "BadGatewayError",
|
|
7
|
+
statusCode: 502,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = "BadGatewayError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -113,6 +113,29 @@ export declare class DocumentsClient {
|
|
|
113
113
|
*/
|
|
114
114
|
uploadProxy(request: CloudPDF.UploadProxyDocumentsRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsUploadProxy200Response>;
|
|
115
115
|
private __uploadProxy;
|
|
116
|
+
/**
|
|
117
|
+
* Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
118
|
+
*
|
|
119
|
+
* @param {CloudPDF.DocumentsImportFromRequest} request
|
|
120
|
+
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
|
+
*
|
|
122
|
+
* @throws {@link CloudPDF.BadRequestError}
|
|
123
|
+
* @throws {@link CloudPDF.ForbiddenError}
|
|
124
|
+
* @throws {@link CloudPDF.BadGatewayError}
|
|
125
|
+
* @throws {@link errors.CloudPDFError}
|
|
126
|
+
* @throws {@link errors.CloudPDFTimeoutError}
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.documents.importFrom({
|
|
130
|
+
* tenantId: "tenantId",
|
|
131
|
+
* source: {
|
|
132
|
+
* kind: "url",
|
|
133
|
+
* url: "url"
|
|
134
|
+
* }
|
|
135
|
+
* })
|
|
136
|
+
*/
|
|
137
|
+
importFrom(request: CloudPDF.DocumentsImportFromRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsImportFrom200Response>;
|
|
138
|
+
private __importFrom;
|
|
116
139
|
/**
|
|
117
140
|
* @param {CloudPDF.DocumentsInitRequest} request
|
|
118
141
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -417,6 +417,75 @@ export class DocumentsClient {
|
|
|
417
417
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/{id}/upload-proxy");
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
422
|
+
*
|
|
423
|
+
* @param {CloudPDF.DocumentsImportFromRequest} request
|
|
424
|
+
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
425
|
+
*
|
|
426
|
+
* @throws {@link CloudPDF.BadRequestError}
|
|
427
|
+
* @throws {@link CloudPDF.ForbiddenError}
|
|
428
|
+
* @throws {@link CloudPDF.BadGatewayError}
|
|
429
|
+
* @throws {@link errors.CloudPDFError}
|
|
430
|
+
* @throws {@link errors.CloudPDFTimeoutError}
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* await client.documents.importFrom({
|
|
434
|
+
* tenantId: "tenantId",
|
|
435
|
+
* source: {
|
|
436
|
+
* kind: "url",
|
|
437
|
+
* url: "url"
|
|
438
|
+
* }
|
|
439
|
+
* })
|
|
440
|
+
*/
|
|
441
|
+
importFrom(request, requestOptions) {
|
|
442
|
+
return core.HttpResponsePromise.fromPromise(this.__importFrom(request, requestOptions));
|
|
443
|
+
}
|
|
444
|
+
__importFrom(request, requestOptions) {
|
|
445
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
446
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
447
|
+
const { tenantId } = request, _body = __rest(request, ["tenantId"]);
|
|
448
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
449
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
450
|
+
const _response = yield core.fetcher({
|
|
451
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/tenants/${core.url.encodePathParam(tenantId)}/documents/import`),
|
|
452
|
+
method: "POST",
|
|
453
|
+
headers: _headers,
|
|
454
|
+
contentType: "application/json",
|
|
455
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
456
|
+
requestType: "json",
|
|
457
|
+
body: mergeAdditionalBodyParameters(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
458
|
+
timeoutMs: ((_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) !== null && _e !== void 0 ? _e : 60) * 1000,
|
|
459
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
460
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
461
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
462
|
+
logging: this._options.logging,
|
|
463
|
+
});
|
|
464
|
+
if (_response.ok) {
|
|
465
|
+
return {
|
|
466
|
+
data: _response.body,
|
|
467
|
+
rawResponse: _response.rawResponse,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if (_response.error.reason === "status-code") {
|
|
471
|
+
switch (_response.error.statusCode) {
|
|
472
|
+
case 400:
|
|
473
|
+
throw new CloudPDF.BadRequestError(_response.error.body, _response.rawResponse);
|
|
474
|
+
case 403:
|
|
475
|
+
throw new CloudPDF.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
476
|
+
case 502:
|
|
477
|
+
throw new CloudPDF.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
478
|
+
default:
|
|
479
|
+
throw new errors.CloudPDFError({
|
|
480
|
+
statusCode: _response.error.statusCode,
|
|
481
|
+
body: _response.error.body,
|
|
482
|
+
rawResponse: _response.rawResponse,
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/import");
|
|
487
|
+
});
|
|
488
|
+
}
|
|
420
489
|
/**
|
|
421
490
|
* @param {CloudPDF.DocumentsInitRequest} request
|
|
422
491
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type * as CloudPDF from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* tenantId: "tenantId",
|
|
6
|
+
* source: {
|
|
7
|
+
* kind: "url",
|
|
8
|
+
* url: "url"
|
|
9
|
+
* }
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface DocumentsImportFromRequest {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
source: CloudPDF.DocumentsImportFromRequestSource;
|
|
15
|
+
expected?: DocumentsImportFromRequest.Expected;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
idempotencyKey?: string;
|
|
18
|
+
dedupMode?: DocumentsImportFromRequest.DedupMode;
|
|
19
|
+
docId?: string;
|
|
20
|
+
mode?: DocumentsImportFromRequest.Mode;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace DocumentsImportFromRequest {
|
|
23
|
+
interface Expected {
|
|
24
|
+
sizeBytes?: number | undefined;
|
|
25
|
+
sha256?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
const DedupMode: {
|
|
28
|
+
readonly AlwaysCreate: "always-create";
|
|
29
|
+
readonly ReuseExisting: "reuse-existing";
|
|
30
|
+
};
|
|
31
|
+
type DedupMode = (typeof DedupMode)[keyof typeof DedupMode];
|
|
32
|
+
const Mode: {
|
|
33
|
+
readonly Sync: "sync";
|
|
34
|
+
readonly Async: "async";
|
|
35
|
+
};
|
|
36
|
+
type Mode = (typeof Mode)[keyof typeof Mode];
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var DocumentsImportFromRequest;
|
|
3
|
+
(function (DocumentsImportFromRequest) {
|
|
4
|
+
DocumentsImportFromRequest.DedupMode = {
|
|
5
|
+
AlwaysCreate: "always-create",
|
|
6
|
+
ReuseExisting: "reuse-existing",
|
|
7
|
+
};
|
|
8
|
+
DocumentsImportFromRequest.Mode = {
|
|
9
|
+
Sync: "sync",
|
|
10
|
+
Async: "async",
|
|
11
|
+
};
|
|
12
|
+
})(DocumentsImportFromRequest || (DocumentsImportFromRequest = {}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { DeleteDocumentsRequest } from "./DeleteDocumentsRequest.mjs";
|
|
2
2
|
export type { DocumentsCommitRequest } from "./DocumentsCommitRequest.mjs";
|
|
3
|
+
export { DocumentsImportFromRequest } from "./DocumentsImportFromRequest.mjs";
|
|
3
4
|
export { DocumentsInitRequest } from "./DocumentsInitRequest.mjs";
|
|
4
5
|
export type { DownloadDocumentsRequest } from "./DownloadDocumentsRequest.mjs";
|
|
5
6
|
export type { GetDocumentsRequest } from "./GetDocumentsRequest.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as CloudPDF from "../../../index.mjs";
|
|
2
|
+
export type DocumentsImportFromRequestSource = CloudPDF.DocumentsImportFromRequestSource.Url | CloudPDF.DocumentsImportFromRequestSource.Connection;
|
|
3
|
+
export declare namespace DocumentsImportFromRequestSource {
|
|
4
|
+
interface Url {
|
|
5
|
+
kind: "url";
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
interface Connection {
|
|
9
|
+
kind: "connection";
|
|
10
|
+
connectionId: string;
|
|
11
|
+
key: string;
|
|
12
|
+
revision?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface DocumentsImportFrom200Response {
|
|
2
|
+
tag: DocumentsImportFrom200Response.Tag;
|
|
3
|
+
document: DocumentsImportFrom200Response.Document;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace DocumentsImportFrom200Response {
|
|
6
|
+
const Tag: {
|
|
7
|
+
readonly Imported: "imported";
|
|
8
|
+
readonly Deduped: "deduped";
|
|
9
|
+
readonly Accepted: "accepted";
|
|
10
|
+
};
|
|
11
|
+
type Tag = (typeof Tag)[keyof typeof Tag];
|
|
12
|
+
interface Document {
|
|
13
|
+
id: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
state: Document.State;
|
|
16
|
+
baseSha: string | null;
|
|
17
|
+
storageSizeBytes: number | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
idempotencyKey: string | null;
|
|
20
|
+
failureReason: string | null;
|
|
21
|
+
thumbnailState?: Document.ThumbnailState | undefined;
|
|
22
|
+
thumbnailUrl?: (string | null) | undefined;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
createdBy: string | null;
|
|
26
|
+
}
|
|
27
|
+
namespace Document {
|
|
28
|
+
const State: {
|
|
29
|
+
readonly Pending: "pending";
|
|
30
|
+
readonly Ready: "ready";
|
|
31
|
+
readonly Failed: "failed";
|
|
32
|
+
readonly Deleting: "deleting";
|
|
33
|
+
};
|
|
34
|
+
type State = (typeof State)[keyof typeof State];
|
|
35
|
+
const ThumbnailState: {
|
|
36
|
+
readonly Pending: "pending";
|
|
37
|
+
readonly Ready: "ready";
|
|
38
|
+
readonly Locked: "locked";
|
|
39
|
+
readonly Failed: "failed";
|
|
40
|
+
};
|
|
41
|
+
type ThumbnailState = (typeof ThumbnailState)[keyof typeof ThumbnailState];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var DocumentsImportFrom200Response;
|
|
3
|
+
(function (DocumentsImportFrom200Response) {
|
|
4
|
+
DocumentsImportFrom200Response.Tag = {
|
|
5
|
+
Imported: "imported",
|
|
6
|
+
Deduped: "deduped",
|
|
7
|
+
Accepted: "accepted",
|
|
8
|
+
};
|
|
9
|
+
let Document;
|
|
10
|
+
(function (Document) {
|
|
11
|
+
Document.State = {
|
|
12
|
+
Pending: "pending",
|
|
13
|
+
Ready: "ready",
|
|
14
|
+
Failed: "failed",
|
|
15
|
+
Deleting: "deleting",
|
|
16
|
+
};
|
|
17
|
+
Document.ThumbnailState = {
|
|
18
|
+
Pending: "pending",
|
|
19
|
+
Ready: "ready",
|
|
20
|
+
Locked: "locked",
|
|
21
|
+
Failed: "failed",
|
|
22
|
+
};
|
|
23
|
+
})(Document = DocumentsImportFrom200Response.Document || (DocumentsImportFrom200Response.Document = {}));
|
|
24
|
+
})(DocumentsImportFrom200Response || (DocumentsImportFrom200Response = {}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface DocumentsImportFrom202Response {
|
|
2
|
+
tag: DocumentsImportFrom202Response.Tag;
|
|
3
|
+
document: DocumentsImportFrom202Response.Document;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace DocumentsImportFrom202Response {
|
|
6
|
+
const Tag: {
|
|
7
|
+
readonly Imported: "imported";
|
|
8
|
+
readonly Deduped: "deduped";
|
|
9
|
+
readonly Accepted: "accepted";
|
|
10
|
+
};
|
|
11
|
+
type Tag = (typeof Tag)[keyof typeof Tag];
|
|
12
|
+
interface Document {
|
|
13
|
+
id: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
state: Document.State;
|
|
16
|
+
baseSha: string | null;
|
|
17
|
+
storageSizeBytes: number | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
idempotencyKey: string | null;
|
|
20
|
+
failureReason: string | null;
|
|
21
|
+
thumbnailState?: Document.ThumbnailState | undefined;
|
|
22
|
+
thumbnailUrl?: (string | null) | undefined;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
createdBy: string | null;
|
|
26
|
+
}
|
|
27
|
+
namespace Document {
|
|
28
|
+
const State: {
|
|
29
|
+
readonly Pending: "pending";
|
|
30
|
+
readonly Ready: "ready";
|
|
31
|
+
readonly Failed: "failed";
|
|
32
|
+
readonly Deleting: "deleting";
|
|
33
|
+
};
|
|
34
|
+
type State = (typeof State)[keyof typeof State];
|
|
35
|
+
const ThumbnailState: {
|
|
36
|
+
readonly Pending: "pending";
|
|
37
|
+
readonly Ready: "ready";
|
|
38
|
+
readonly Locked: "locked";
|
|
39
|
+
readonly Failed: "failed";
|
|
40
|
+
};
|
|
41
|
+
type ThumbnailState = (typeof ThumbnailState)[keyof typeof ThumbnailState];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var DocumentsImportFrom202Response;
|
|
3
|
+
(function (DocumentsImportFrom202Response) {
|
|
4
|
+
DocumentsImportFrom202Response.Tag = {
|
|
5
|
+
Imported: "imported",
|
|
6
|
+
Deduped: "deduped",
|
|
7
|
+
Accepted: "accepted",
|
|
8
|
+
};
|
|
9
|
+
let Document;
|
|
10
|
+
(function (Document) {
|
|
11
|
+
Document.State = {
|
|
12
|
+
Pending: "pending",
|
|
13
|
+
Ready: "ready",
|
|
14
|
+
Failed: "failed",
|
|
15
|
+
Deleting: "deleting",
|
|
16
|
+
};
|
|
17
|
+
Document.ThumbnailState = {
|
|
18
|
+
Pending: "pending",
|
|
19
|
+
Ready: "ready",
|
|
20
|
+
Locked: "locked",
|
|
21
|
+
Failed: "failed",
|
|
22
|
+
};
|
|
23
|
+
})(Document = DocumentsImportFrom202Response.Document || (DocumentsImportFrom202Response.Document = {}));
|
|
24
|
+
})(DocumentsImportFrom202Response || (DocumentsImportFrom202Response = {}));
|
|
@@ -145,6 +145,11 @@ export * from "./DocumentsDownload404Response.mjs";
|
|
|
145
145
|
export * from "./DocumentsGet200Response.mjs";
|
|
146
146
|
export * from "./DocumentsGet403Response.mjs";
|
|
147
147
|
export * from "./DocumentsGet404Response.mjs";
|
|
148
|
+
export * from "./DocumentsImportFrom200Response.mjs";
|
|
149
|
+
export * from "./DocumentsImportFrom202Response.mjs";
|
|
150
|
+
export * from "./DocumentsImportFrom400Response.mjs";
|
|
151
|
+
export * from "./DocumentsImportFrom403Response.mjs";
|
|
152
|
+
export * from "./DocumentsImportFrom502Response.mjs";
|
|
148
153
|
export * from "./DocumentsInit200Response.mjs";
|
|
149
154
|
export * from "./DocumentsInit200ResponseCreatedUpload.mjs";
|
|
150
155
|
export * from "./DocumentsInit200ResponseResumedUpload.mjs";
|
|
@@ -145,6 +145,11 @@ export * from "./DocumentsDownload404Response.mjs";
|
|
|
145
145
|
export * from "./DocumentsGet200Response.mjs";
|
|
146
146
|
export * from "./DocumentsGet403Response.mjs";
|
|
147
147
|
export * from "./DocumentsGet404Response.mjs";
|
|
148
|
+
export * from "./DocumentsImportFrom200Response.mjs";
|
|
149
|
+
export * from "./DocumentsImportFrom202Response.mjs";
|
|
150
|
+
export * from "./DocumentsImportFrom400Response.mjs";
|
|
151
|
+
export * from "./DocumentsImportFrom403Response.mjs";
|
|
152
|
+
export * from "./DocumentsImportFrom502Response.mjs";
|
|
148
153
|
export * from "./DocumentsInit200Response.mjs";
|
|
149
154
|
export * from "./DocumentsInit200ResponseCreatedUpload.mjs";
|
|
150
155
|
export * from "./DocumentsInit200ResponseResumedUpload.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.0.0-next.
|
|
1
|
+
export declare const SDK_VERSION = "3.0.0-next.6";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "3.0.0-next.
|
|
1
|
+
export const SDK_VERSION = "3.0.0-next.6";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -1431,6 +1431,75 @@ await client.documents.uploadProxy({
|
|
|
1431
1431
|
</dl>
|
|
1432
1432
|
|
|
1433
1433
|
|
|
1434
|
+
</dd>
|
|
1435
|
+
</dl>
|
|
1436
|
+
</details>
|
|
1437
|
+
|
|
1438
|
+
<details><summary><code>client.documents.<a href="/src/api/resources/documents/client/Client.ts">importFrom</a>({ ...params }) -> CloudPDF.DocumentsImportFrom200Response</code></summary>
|
|
1439
|
+
<dl>
|
|
1440
|
+
<dd>
|
|
1441
|
+
|
|
1442
|
+
#### 📝 Description
|
|
1443
|
+
|
|
1444
|
+
<dl>
|
|
1445
|
+
<dd>
|
|
1446
|
+
|
|
1447
|
+
<dl>
|
|
1448
|
+
<dd>
|
|
1449
|
+
|
|
1450
|
+
Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).
|
|
1451
|
+
</dd>
|
|
1452
|
+
</dl>
|
|
1453
|
+
</dd>
|
|
1454
|
+
</dl>
|
|
1455
|
+
|
|
1456
|
+
#### 🔌 Usage
|
|
1457
|
+
|
|
1458
|
+
<dl>
|
|
1459
|
+
<dd>
|
|
1460
|
+
|
|
1461
|
+
<dl>
|
|
1462
|
+
<dd>
|
|
1463
|
+
|
|
1464
|
+
```typescript
|
|
1465
|
+
await client.documents.importFrom({
|
|
1466
|
+
tenantId: "tenantId",
|
|
1467
|
+
source: {
|
|
1468
|
+
kind: "url",
|
|
1469
|
+
url: "url"
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
```
|
|
1474
|
+
</dd>
|
|
1475
|
+
</dl>
|
|
1476
|
+
</dd>
|
|
1477
|
+
</dl>
|
|
1478
|
+
|
|
1479
|
+
#### ⚙️ Parameters
|
|
1480
|
+
|
|
1481
|
+
<dl>
|
|
1482
|
+
<dd>
|
|
1483
|
+
|
|
1484
|
+
<dl>
|
|
1485
|
+
<dd>
|
|
1486
|
+
|
|
1487
|
+
**request:** `CloudPDF.DocumentsImportFromRequest`
|
|
1488
|
+
|
|
1489
|
+
</dd>
|
|
1490
|
+
</dl>
|
|
1491
|
+
|
|
1492
|
+
<dl>
|
|
1493
|
+
<dd>
|
|
1494
|
+
|
|
1495
|
+
**requestOptions:** `DocumentsClient.RequestOptions`
|
|
1496
|
+
|
|
1497
|
+
</dd>
|
|
1498
|
+
</dl>
|
|
1499
|
+
</dd>
|
|
1500
|
+
</dl>
|
|
1501
|
+
|
|
1502
|
+
|
|
1434
1503
|
</dd>
|
|
1435
1504
|
</dl>
|
|
1436
1505
|
</details>
|