@laserfiche/lf-repository-api-client-v2 1.4.1 → 1.5.0
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/index.d.ts +625 -24
- package/dist/index.js +1135 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3293,6 +3293,7 @@ export class AccessControlClient {
|
|
|
3293
3293
|
/**
|
|
3294
3294
|
* - Full replace: the supplied entries replace the field's entire explicit ACL. Inherited entries are not accepted (field ACEs are never inherited). Address a trustee by trustee.sid or trustee.accountName (the SID wins when both are given; an account name is resolved to a SID server-side).
|
|
3295
3295
|
- The OAuth scope is coarse; the repository session enforces the real permission and returns 403 when the caller lacks the field's ChangePermissions right.
|
|
3296
|
+
- The entries property is required. A request body that does not include it is rejected with a 400; send an empty array to clear the list.
|
|
3296
3297
|
- Required OAuth scope: repository.Write
|
|
3297
3298
|
* @param args.repositoryId The requested repository ID.
|
|
3298
3299
|
* @param args.fieldId The field definition ID whose ACL to replace.
|
|
@@ -3587,6 +3588,7 @@ export class AccessControlClient {
|
|
|
3587
3588
|
}
|
|
3588
3589
|
/**
|
|
3589
3590
|
* - Full replace: the supplied entries replace the entire default field ACL. Inherited entries are not accepted. Address a trustee by trustee.sid or trustee.accountName (the SID wins when both are given).
|
|
3591
|
+
- The entries property is required. A request body that does not include it is rejected with a 400; send an empty array to clear the list.
|
|
3590
3592
|
- Required OAuth scope: repository.Write
|
|
3591
3593
|
* @param args.repositoryId The requested repository ID.
|
|
3592
3594
|
* @param args.request The access control entries to set as the default field ACL.
|
|
@@ -3787,6 +3789,7 @@ export class AccessControlClient {
|
|
|
3787
3789
|
- Each ACE identifies its trustee by trustee.sid or trustee.accountName (an account name is resolved to a SID server-side; the SID takes precedence when both are supplied). A trustee that needs both allowed and denied rights is expressed as two ACEs.
|
|
3788
3790
|
- The repository session enforces the underlying permission: changing an ACL requires the ChangePermissions right on the entry, and a 403 is returned when it is lacking. The repository.Write OAuth scope is necessary but not sufficient.
|
|
3789
3791
|
- Returns the entry's full ACL after the change.
|
|
3792
|
+
- The entries property is required. A request body that does not include it is rejected with a 400; send an empty array to clear the list.
|
|
3790
3793
|
- Required OAuth scope: repository.Write
|
|
3791
3794
|
* @param args.repositoryId The requested repository ID.
|
|
3792
3795
|
* @param args.entryId The entry whose access control list is replaced.
|
|
@@ -4186,6 +4189,7 @@ export class AccessControlClient {
|
|
|
4186
4189
|
/**
|
|
4187
4190
|
* - Full replace: the supplied entries replace the template's entire explicit ACL. Inherited entries are not accepted (template ACEs are never inherited). Address a trustee by trustee.sid or trustee.accountName (the SID wins when both are given; an account name is resolved to a SID server-side).
|
|
4188
4191
|
- The OAuth scope is coarse; the repository session enforces the real permission and returns 403 when the caller lacks the template's ChangePermissions right.
|
|
4192
|
+
- The entries property is required. A request body that does not include it is rejected with a 400; send an empty array to clear the list.
|
|
4189
4193
|
- Required OAuth scope: repository.Write
|
|
4190
4194
|
* @param args.repositoryId The requested repository ID.
|
|
4191
4195
|
* @param args.templateId The template definition ID whose ACL to replace.
|
|
@@ -4480,6 +4484,7 @@ export class AccessControlClient {
|
|
|
4480
4484
|
}
|
|
4481
4485
|
/**
|
|
4482
4486
|
* - Full replace: the supplied entries replace the entire default template ACL. Inherited entries are not accepted. Address a trustee by trustee.sid or trustee.accountName (the SID wins when both are given).
|
|
4487
|
+
- The entries property is required. A request body that does not include it is rejected with a 400; send an empty array to clear the list.
|
|
4483
4488
|
- Required OAuth scope: repository.Write
|
|
4484
4489
|
* @param args.repositoryId The requested repository ID.
|
|
4485
4490
|
* @param args.request The access control entries to set as the default template ACL.
|
|
@@ -5523,7 +5528,7 @@ export class EntriesClient {
|
|
|
5523
5528
|
* @param args.repositoryId The requested repository ID.
|
|
5524
5529
|
* @param args.entryId The ID of entry to export.
|
|
5525
5530
|
* @param args.request The request body.
|
|
5526
|
-
* @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when part=Edoc.
|
|
5531
|
+
* @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when part=Edoc or part=AlternateEdoc.
|
|
5527
5532
|
* @returns Operation was started successfully. Returned a long operation task ID.
|
|
5528
5533
|
*/
|
|
5529
5534
|
startExportEntry(args) {
|
|
@@ -6242,7 +6247,7 @@ export class EntriesClient {
|
|
|
6242
6247
|
* @param args.repositoryId The requested repository ID.
|
|
6243
6248
|
* @param args.entryId The ID of entry to export.
|
|
6244
6249
|
* @param args.request The request body.
|
|
6245
|
-
* @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc.
|
|
6250
|
+
* @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc or AlternateEdoc.
|
|
6246
6251
|
* @returns Export was successful. Returned a link to download the exported entry.
|
|
6247
6252
|
*/
|
|
6248
6253
|
exportEntry(args) {
|
|
@@ -6863,6 +6868,7 @@ export class EntriesClient {
|
|
|
6863
6868
|
* - Update the field values assigned to an entry.
|
|
6864
6869
|
- Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.
|
|
6865
6870
|
- This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset.
|
|
6871
|
+
- The fields property is required. A request body that does not include it is rejected with a 400; send an empty list to clear every field value.
|
|
6866
6872
|
- Required OAuth scope: repository.Write
|
|
6867
6873
|
* @param args.repositoryId The requested repository ID.
|
|
6868
6874
|
* @param args.entryId The entry ID of the entry that will have its fields updated.
|
|
@@ -7108,6 +7114,7 @@ export class EntriesClient {
|
|
|
7108
7114
|
* - Assign tags to an entry.
|
|
7109
7115
|
- Provide an entry ID and a list of tags to assign to that entry.
|
|
7110
7116
|
- This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry.
|
|
7117
|
+
- The tags property is required. A request body that does not include it is rejected with a 400; send an empty list to unassign every tag.
|
|
7111
7118
|
- Required OAuth scope: repository.Write
|
|
7112
7119
|
* @param args.repositoryId The requested repository ID.
|
|
7113
7120
|
* @param args.entryId The requested entry ID.
|
|
@@ -7227,6 +7234,7 @@ export class EntriesClient {
|
|
|
7227
7234
|
* - Assign links to an entry.
|
|
7228
7235
|
- Provide an entry ID and a list of links to assign to that entry.
|
|
7229
7236
|
- This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry.
|
|
7237
|
+
- The links property is required. A request body that does not include it is rejected with a 400; send an empty list to remove every link.
|
|
7230
7238
|
- Required OAuth scope: repository.Write
|
|
7231
7239
|
* @param args.repositoryId The request repository ID.
|
|
7232
7240
|
* @param args.entryId The requested entry ID.
|
|
@@ -8892,19 +8900,858 @@ export class EntriesClient {
|
|
|
8892
8900
|
}
|
|
8893
8901
|
return Promise.resolve(null);
|
|
8894
8902
|
}
|
|
8903
|
+
/**
|
|
8904
|
+
* - An alternate electronic document is a named binary stream stored alongside the document's primary electronic document, such as an audio recording, a source scan, or sidecar data. It travels with the document through copy, move, versioning, and briefcase operations.
|
|
8905
|
+
- Returns the name, MIME type, and size of each stream. This endpoint does not return the stream content.
|
|
8906
|
+
- Stream names are at most 15 characters long.
|
|
8907
|
+
- Streams are returned in ascending name order; that order is fixed and not configurable.
|
|
8908
|
+
- Streams reserved for internal use are not listed.
|
|
8909
|
+
- Default page size: 150. Allowed OData query options: Select | Count | Skip | SkipToken | Top | Prefer.
|
|
8910
|
+
- Required OAuth scope: repository.Read
|
|
8911
|
+
* @param args.repositoryId The requested repository ID.
|
|
8912
|
+
* @param args.entryId The requested document ID.
|
|
8913
|
+
* @param args.prefer (optional) An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.
|
|
8914
|
+
* @param args.select (optional) Limits the properties returned in the result.
|
|
8915
|
+
* @param args.top (optional) Limits the number of items returned from a collection. The maximum value is 150.
|
|
8916
|
+
* @param args.skip (optional) Excludes the specified number of items of the queried collection from the result.
|
|
8917
|
+
* @param args.count (optional) Indicates whether the total count of items within a collection are returned in the result.
|
|
8918
|
+
* @returns Successfully retrieved a paged listing of the document's alternate electronic documents.
|
|
8919
|
+
*/
|
|
8920
|
+
listAlternateEdocs(args) {
|
|
8921
|
+
let { repositoryId, entryId, prefer, select, top, skip, count } = args;
|
|
8922
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/AlternateEdocs?";
|
|
8923
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
8924
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
8925
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
8926
|
+
if (entryId === undefined || entryId === null)
|
|
8927
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
8928
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
8929
|
+
if (select !== undefined && select !== null)
|
|
8930
|
+
url_ += "$select=" + encodeURIComponent("" + select) + "&";
|
|
8931
|
+
if (top === null)
|
|
8932
|
+
throw new Error("The parameter 'top' cannot be null.");
|
|
8933
|
+
else if (top !== undefined)
|
|
8934
|
+
url_ += "$top=" + encodeURIComponent("" + top) + "&";
|
|
8935
|
+
if (skip === null)
|
|
8936
|
+
throw new Error("The parameter 'skip' cannot be null.");
|
|
8937
|
+
else if (skip !== undefined)
|
|
8938
|
+
url_ += "$skip=" + encodeURIComponent("" + skip) + "&";
|
|
8939
|
+
if (count === null)
|
|
8940
|
+
throw new Error("The parameter 'count' cannot be null.");
|
|
8941
|
+
else if (count !== undefined)
|
|
8942
|
+
url_ += "$count=" + encodeURIComponent("" + count) + "&";
|
|
8943
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
8944
|
+
let options_ = {
|
|
8945
|
+
method: "GET",
|
|
8946
|
+
headers: {
|
|
8947
|
+
"Accept": "application/json"
|
|
8948
|
+
}
|
|
8949
|
+
};
|
|
8950
|
+
if (prefer !== null && prefer !== undefined)
|
|
8951
|
+
options_.headers = Object.assign({}, options_.headers, { "Prefer": prefer !== undefined && prefer !== null ? "" + prefer : null });
|
|
8952
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
8953
|
+
return this.processListAlternateEdocs(_response);
|
|
8954
|
+
});
|
|
8955
|
+
}
|
|
8956
|
+
processListAlternateEdocs(response) {
|
|
8957
|
+
const status = response.status;
|
|
8958
|
+
let _headers = {};
|
|
8959
|
+
if (response.headers && response.headers.forEach) {
|
|
8960
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
8961
|
+
}
|
|
8962
|
+
;
|
|
8963
|
+
if (status === 200) {
|
|
8964
|
+
return response.text().then((_responseText) => {
|
|
8965
|
+
let result200 = null;
|
|
8966
|
+
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
8967
|
+
result200 = AlternateEdocInfoCollectionResponse.fromJS(resultData200);
|
|
8968
|
+
return result200;
|
|
8969
|
+
});
|
|
8970
|
+
}
|
|
8971
|
+
else if (status === 400) {
|
|
8972
|
+
return response.text().then((_responseText) => {
|
|
8973
|
+
let result400 = null;
|
|
8974
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
8975
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
8976
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
8977
|
+
});
|
|
8978
|
+
}
|
|
8979
|
+
else if (status === 401) {
|
|
8980
|
+
return response.text().then((_responseText) => {
|
|
8981
|
+
let result401 = null;
|
|
8982
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
8983
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
8984
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
8985
|
+
});
|
|
8986
|
+
}
|
|
8987
|
+
else if (status === 403) {
|
|
8988
|
+
return response.text().then((_responseText) => {
|
|
8989
|
+
let result403 = null;
|
|
8990
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
8991
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
8992
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
8993
|
+
});
|
|
8994
|
+
}
|
|
8995
|
+
else if (status === 404) {
|
|
8996
|
+
return response.text().then((_responseText) => {
|
|
8997
|
+
let result404 = null;
|
|
8998
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
8999
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9000
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9001
|
+
});
|
|
9002
|
+
}
|
|
9003
|
+
else if (status === 429) {
|
|
9004
|
+
return response.text().then((_responseText) => {
|
|
9005
|
+
let result429 = null;
|
|
9006
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9007
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9008
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9009
|
+
});
|
|
9010
|
+
}
|
|
9011
|
+
else if (status === 500) {
|
|
9012
|
+
return response.text().then((_responseText) => {
|
|
9013
|
+
let result500 = null;
|
|
9014
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9015
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9016
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9017
|
+
});
|
|
9018
|
+
}
|
|
9019
|
+
else if (status !== 200 && status !== 204) {
|
|
9020
|
+
return response.text().then((_responseText) => {
|
|
9021
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9022
|
+
});
|
|
9023
|
+
}
|
|
9024
|
+
return Promise.resolve(null);
|
|
9025
|
+
}
|
|
9026
|
+
/**
|
|
9027
|
+
* - Returns the name, MIME type, and size of the stream. This endpoint does not return the stream content.
|
|
9028
|
+
- The name is supplied as a query parameter rather than a path segment, because the legal character set includes characters that are significant to OData URI parsing.
|
|
9029
|
+
- Names match exactly. A name that differs only in letter case identifies a different stream on some repository configurations, so no case folding is applied.
|
|
9030
|
+
- Streams reserved for internal use are reported as not found.
|
|
9031
|
+
- Required OAuth scope: repository.Read
|
|
9032
|
+
* @param args.repositoryId The requested repository ID.
|
|
9033
|
+
* @param args.entryId The requested document ID.
|
|
9034
|
+
* @param args.name The name of the alternate electronic document. Matched exactly, so a name differing only in letter case is not found. Names reserved for internal use are also reported as not found.
|
|
9035
|
+
* @param args.select (optional) Limits the properties returned in the result.
|
|
9036
|
+
* @returns Successfully retrieved the metadata of the specified alternate electronic document.
|
|
9037
|
+
*/
|
|
9038
|
+
getAlternateEdocInfo(args) {
|
|
9039
|
+
let { repositoryId, entryId, name, select } = args;
|
|
9040
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/AlternateEdoc?";
|
|
9041
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9042
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9043
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9044
|
+
if (entryId === undefined || entryId === null)
|
|
9045
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9046
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9047
|
+
if (name === undefined)
|
|
9048
|
+
throw new Error("The parameter 'name' must be defined.");
|
|
9049
|
+
else if (name !== null)
|
|
9050
|
+
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
9051
|
+
if (select !== undefined && select !== null)
|
|
9052
|
+
url_ += "$select=" + encodeURIComponent("" + select) + "&";
|
|
9053
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9054
|
+
let options_ = {
|
|
9055
|
+
method: "GET",
|
|
9056
|
+
headers: {
|
|
9057
|
+
"Accept": "application/json"
|
|
9058
|
+
}
|
|
9059
|
+
};
|
|
9060
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9061
|
+
return this.processGetAlternateEdocInfo(_response);
|
|
9062
|
+
});
|
|
9063
|
+
}
|
|
9064
|
+
processGetAlternateEdocInfo(response) {
|
|
9065
|
+
const status = response.status;
|
|
9066
|
+
let _headers = {};
|
|
9067
|
+
if (response.headers && response.headers.forEach) {
|
|
9068
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9069
|
+
}
|
|
9070
|
+
;
|
|
9071
|
+
if (status === 200) {
|
|
9072
|
+
return response.text().then((_responseText) => {
|
|
9073
|
+
let result200 = null;
|
|
9074
|
+
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9075
|
+
result200 = AlternateEdocInfoResponse.fromJS(resultData200);
|
|
9076
|
+
return result200;
|
|
9077
|
+
});
|
|
9078
|
+
}
|
|
9079
|
+
else if (status === 400) {
|
|
9080
|
+
return response.text().then((_responseText) => {
|
|
9081
|
+
let result400 = null;
|
|
9082
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9083
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9084
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9085
|
+
});
|
|
9086
|
+
}
|
|
9087
|
+
else if (status === 401) {
|
|
9088
|
+
return response.text().then((_responseText) => {
|
|
9089
|
+
let result401 = null;
|
|
9090
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9091
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9092
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9093
|
+
});
|
|
9094
|
+
}
|
|
9095
|
+
else if (status === 403) {
|
|
9096
|
+
return response.text().then((_responseText) => {
|
|
9097
|
+
let result403 = null;
|
|
9098
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9099
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9100
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9101
|
+
});
|
|
9102
|
+
}
|
|
9103
|
+
else if (status === 404) {
|
|
9104
|
+
return response.text().then((_responseText) => {
|
|
9105
|
+
let result404 = null;
|
|
9106
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9107
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9108
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9109
|
+
});
|
|
9110
|
+
}
|
|
9111
|
+
else if (status === 429) {
|
|
9112
|
+
return response.text().then((_responseText) => {
|
|
9113
|
+
let result429 = null;
|
|
9114
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9115
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9116
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9117
|
+
});
|
|
9118
|
+
}
|
|
9119
|
+
else if (status === 500) {
|
|
9120
|
+
return response.text().then((_responseText) => {
|
|
9121
|
+
let result500 = null;
|
|
9122
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9123
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9124
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9125
|
+
});
|
|
9126
|
+
}
|
|
9127
|
+
else if (status !== 200 && status !== 204) {
|
|
9128
|
+
return response.text().then((_responseText) => {
|
|
9129
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9130
|
+
});
|
|
9131
|
+
}
|
|
9132
|
+
return Promise.resolve(null);
|
|
9133
|
+
}
|
|
9134
|
+
/**
|
|
9135
|
+
* - Writes a named binary stream stored alongside the document's primary electronic document, such as an audio recording, a source scan, or sidecar data. The stream is created when the document does not have one under that name, and its content fully replaced when it does. The primary electronic document, the pages, and the metadata are unaffected.
|
|
9136
|
+
- Send the content as multipart/form-data under the form field `file`. A zero-byte file is rejected; use the delete operation to remove an alternate electronic document.
|
|
9137
|
+
- The name is supplied as a query parameter rather than a path segment, because the legal character set includes characters that are significant to OData URI parsing.
|
|
9138
|
+
- Names are at most 15 characters long, and each character must be an ASCII letter, an ASCII digit, or one of `!@#$%^&()-+={}[]_~`.
|
|
9139
|
+
- Names match exactly. A name that differs only in letter case from one the document already has is rejected with 409 rather than written, because such a pair means different things on different repository configurations; reads and deletes stay exact-match.
|
|
9140
|
+
- Names reserved for internal use are rejected.
|
|
9141
|
+
- The optional `mimeType` form field sets the content's MIME type, at most 127 characters. When omitted it is derived from the uploaded file's content type and file name, falling back to `application/octet-stream`. The repository stores it lower-cased and without any parameters, so `Text/Plain; charset=utf-8` is stored as `text/plain`; the response reports the stored value.
|
|
9142
|
+
- Repeating an identical request is safe: the same content replaces itself.
|
|
9143
|
+
- Required OAuth scope: repository.Write
|
|
9144
|
+
* @param args.repositoryId The requested repository ID.
|
|
9145
|
+
* @param args.entryId The requested document ID.
|
|
9146
|
+
* @param args.name The name of the alternate electronic document. 1 to 15 characters, each an ASCII letter, an ASCII digit, or one of `!@#$%^&()-+={}[]_~`. An existing name has its content and MIME type replaced in full; a name differing from an existing one only in letter case is rejected with 409 and leaves that stream unchanged. Names reserved for internal use are rejected.
|
|
9147
|
+
* @param args.file (optional) The content to store. Any file type is accepted. A zero-byte file is rejected with 400; use the delete operation to remove an alternate electronic document.
|
|
9148
|
+
* @param args.mimeType (optional) Optional. The MIME type to set for the content, at most 127 characters. When omitted it is derived from the uploaded file's content type and file name, falling back to application/octet-stream. Stored lower-cased and without parameters, so Text/Plain; charset=utf-8 is stored as text/plain. Worth setting explicitly for audio and video, where the multipart content type is frequently generic or wrong.
|
|
9149
|
+
* @returns Successfully wrote the alternate electronic document. Returned its metadata as stored.
|
|
9150
|
+
*/
|
|
9151
|
+
writeAlternateEdoc(args) {
|
|
9152
|
+
let { repositoryId, entryId, name, file, mimeType } = args;
|
|
9153
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/AlternateEdoc?";
|
|
9154
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9155
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9156
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9157
|
+
if (entryId === undefined || entryId === null)
|
|
9158
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9159
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9160
|
+
if (name === undefined)
|
|
9161
|
+
throw new Error("The parameter 'name' must be defined.");
|
|
9162
|
+
else if (name !== null)
|
|
9163
|
+
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
9164
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9165
|
+
const content_ = new FormData();
|
|
9166
|
+
if (file === null || file === undefined)
|
|
9167
|
+
throw new Error("The parameter 'file' cannot be null.");
|
|
9168
|
+
else
|
|
9169
|
+
content_.append("file", file.data, file.fileName ? file.fileName : "file");
|
|
9170
|
+
if (mimeType !== null && mimeType !== undefined)
|
|
9171
|
+
content_.append("mimeType", mimeType.toString());
|
|
9172
|
+
let options_ = {
|
|
9173
|
+
body: content_,
|
|
9174
|
+
method: "PUT",
|
|
9175
|
+
headers: {
|
|
9176
|
+
"Accept": "application/json"
|
|
9177
|
+
}
|
|
9178
|
+
};
|
|
9179
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9180
|
+
return this.processWriteAlternateEdoc(_response);
|
|
9181
|
+
});
|
|
9182
|
+
}
|
|
9183
|
+
processWriteAlternateEdoc(response) {
|
|
9184
|
+
const status = response.status;
|
|
9185
|
+
let _headers = {};
|
|
9186
|
+
if (response.headers && response.headers.forEach) {
|
|
9187
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9188
|
+
}
|
|
9189
|
+
;
|
|
9190
|
+
if (status === 200) {
|
|
9191
|
+
return response.text().then((_responseText) => {
|
|
9192
|
+
let result200 = null;
|
|
9193
|
+
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9194
|
+
result200 = AlternateEdocInfoResponse.fromJS(resultData200);
|
|
9195
|
+
return result200;
|
|
9196
|
+
});
|
|
9197
|
+
}
|
|
9198
|
+
else if (status === 400) {
|
|
9199
|
+
return response.text().then((_responseText) => {
|
|
9200
|
+
let result400 = null;
|
|
9201
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9202
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9203
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9204
|
+
});
|
|
9205
|
+
}
|
|
9206
|
+
else if (status === 401) {
|
|
9207
|
+
return response.text().then((_responseText) => {
|
|
9208
|
+
let result401 = null;
|
|
9209
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9210
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9211
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9212
|
+
});
|
|
9213
|
+
}
|
|
9214
|
+
else if (status === 403) {
|
|
9215
|
+
return response.text().then((_responseText) => {
|
|
9216
|
+
let result403 = null;
|
|
9217
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9218
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9219
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9220
|
+
});
|
|
9221
|
+
}
|
|
9222
|
+
else if (status === 404) {
|
|
9223
|
+
return response.text().then((_responseText) => {
|
|
9224
|
+
let result404 = null;
|
|
9225
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9226
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9227
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9228
|
+
});
|
|
9229
|
+
}
|
|
9230
|
+
else if (status === 409) {
|
|
9231
|
+
return response.text().then((_responseText) => {
|
|
9232
|
+
let result409 = null;
|
|
9233
|
+
let resultData409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9234
|
+
result409 = ProblemDetails.fromJS(resultData409);
|
|
9235
|
+
return throwException("The document already has an alternate electronic document whose name differs only in letter case.", status, _responseText, _headers, result409);
|
|
9236
|
+
});
|
|
9237
|
+
}
|
|
9238
|
+
else if (status === 413) {
|
|
9239
|
+
return response.text().then((_responseText) => {
|
|
9240
|
+
let result413 = null;
|
|
9241
|
+
let resultData413 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9242
|
+
result413 = ProblemDetails.fromJS(resultData413);
|
|
9243
|
+
return throwException("Request is too large.", status, _responseText, _headers, result413);
|
|
9244
|
+
});
|
|
9245
|
+
}
|
|
9246
|
+
else if (status === 423) {
|
|
9247
|
+
return response.text().then((_responseText) => {
|
|
9248
|
+
let result423 = null;
|
|
9249
|
+
let resultData423 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9250
|
+
result423 = ProblemDetails.fromJS(resultData423);
|
|
9251
|
+
return throwException("Entry is locked", status, _responseText, _headers, result423);
|
|
9252
|
+
});
|
|
9253
|
+
}
|
|
9254
|
+
else if (status === 429) {
|
|
9255
|
+
return response.text().then((_responseText) => {
|
|
9256
|
+
let result429 = null;
|
|
9257
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9258
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9259
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9260
|
+
});
|
|
9261
|
+
}
|
|
9262
|
+
else if (status === 500) {
|
|
9263
|
+
return response.text().then((_responseText) => {
|
|
9264
|
+
let result500 = null;
|
|
9265
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9266
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9267
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9268
|
+
});
|
|
9269
|
+
}
|
|
9270
|
+
else if (status !== 200 && status !== 204) {
|
|
9271
|
+
return response.text().then((_responseText) => {
|
|
9272
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9273
|
+
});
|
|
9274
|
+
}
|
|
9275
|
+
return Promise.resolve(null);
|
|
9276
|
+
}
|
|
9277
|
+
/**
|
|
9278
|
+
* - Deletes a named binary stream stored alongside the document's primary electronic document. The primary electronic document, the pages, and the metadata are unaffected.
|
|
9279
|
+
- The name is supplied as a query parameter rather than a path segment, because the legal character set includes characters that are significant to OData URI parsing.
|
|
9280
|
+
- Names match exactly. A name that differs only in letter case identifies a different stream on some repository configurations, so no case folding is applied.
|
|
9281
|
+
- A name the document has no stream for is reported as not found.
|
|
9282
|
+
- Names reserved for internal use are rejected.
|
|
9283
|
+
- Required OAuth scope: repository.Write
|
|
9284
|
+
* @param args.repositoryId The requested repository ID.
|
|
9285
|
+
* @param args.entryId The requested document ID.
|
|
9286
|
+
* @param args.name The name of the alternate electronic document. Matched exactly, so a name differing only in letter case is not found. Names reserved for internal use are rejected.
|
|
9287
|
+
* @returns Successfully deleted the alternate electronic document.
|
|
9288
|
+
*/
|
|
9289
|
+
deleteAlternateEdoc(args) {
|
|
9290
|
+
let { repositoryId, entryId, name } = args;
|
|
9291
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/AlternateEdoc?";
|
|
9292
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9293
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9294
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9295
|
+
if (entryId === undefined || entryId === null)
|
|
9296
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9297
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9298
|
+
if (name === undefined)
|
|
9299
|
+
throw new Error("The parameter 'name' must be defined.");
|
|
9300
|
+
else if (name !== null)
|
|
9301
|
+
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
9302
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9303
|
+
let options_ = {
|
|
9304
|
+
method: "DELETE",
|
|
9305
|
+
headers: {}
|
|
9306
|
+
};
|
|
9307
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9308
|
+
return this.processDeleteAlternateEdoc(_response);
|
|
9309
|
+
});
|
|
9310
|
+
}
|
|
9311
|
+
processDeleteAlternateEdoc(response) {
|
|
9312
|
+
const status = response.status;
|
|
9313
|
+
let _headers = {};
|
|
9314
|
+
if (response.headers && response.headers.forEach) {
|
|
9315
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9316
|
+
}
|
|
9317
|
+
;
|
|
9318
|
+
if (status === 204) {
|
|
9319
|
+
return response.text().then((_responseText) => {
|
|
9320
|
+
return;
|
|
9321
|
+
});
|
|
9322
|
+
}
|
|
9323
|
+
else if (status === 400) {
|
|
9324
|
+
return response.text().then((_responseText) => {
|
|
9325
|
+
let result400 = null;
|
|
9326
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9327
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9328
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9329
|
+
});
|
|
9330
|
+
}
|
|
9331
|
+
else if (status === 401) {
|
|
9332
|
+
return response.text().then((_responseText) => {
|
|
9333
|
+
let result401 = null;
|
|
9334
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9335
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9336
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9337
|
+
});
|
|
9338
|
+
}
|
|
9339
|
+
else if (status === 403) {
|
|
9340
|
+
return response.text().then((_responseText) => {
|
|
9341
|
+
let result403 = null;
|
|
9342
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9343
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9344
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9345
|
+
});
|
|
9346
|
+
}
|
|
9347
|
+
else if (status === 404) {
|
|
9348
|
+
return response.text().then((_responseText) => {
|
|
9349
|
+
let result404 = null;
|
|
9350
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9351
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9352
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9353
|
+
});
|
|
9354
|
+
}
|
|
9355
|
+
else if (status === 423) {
|
|
9356
|
+
return response.text().then((_responseText) => {
|
|
9357
|
+
let result423 = null;
|
|
9358
|
+
let resultData423 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9359
|
+
result423 = ProblemDetails.fromJS(resultData423);
|
|
9360
|
+
return throwException("Entry is locked", status, _responseText, _headers, result423);
|
|
9361
|
+
});
|
|
9362
|
+
}
|
|
9363
|
+
else if (status === 429) {
|
|
9364
|
+
return response.text().then((_responseText) => {
|
|
9365
|
+
let result429 = null;
|
|
9366
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9367
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9368
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9369
|
+
});
|
|
9370
|
+
}
|
|
9371
|
+
else if (status === 500) {
|
|
9372
|
+
return response.text().then((_responseText) => {
|
|
9373
|
+
let result500 = null;
|
|
9374
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9375
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9376
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9377
|
+
});
|
|
9378
|
+
}
|
|
9379
|
+
else if (status !== 200 && status !== 204) {
|
|
9380
|
+
return response.text().then((_responseText) => {
|
|
9381
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9382
|
+
});
|
|
9383
|
+
}
|
|
9384
|
+
return Promise.resolve(null);
|
|
9385
|
+
}
|
|
9386
|
+
/**
|
|
9387
|
+
* - Writes a named binary stream stored alongside the document's primary electronic document from a file uploaded in chunks, for content too large to send in a single request. The stream is created when the document does not have one under that name, and its content fully replaced when it does. The primary electronic document, the pages, and the metadata are unaffected.
|
|
9388
|
+
- Upload the content first: call CreateMultipartUploadUrls, write each chunk to the URLs it returns, then pass the same `uploadId` and the ETags here. There is no size limit at this tier beyond the one the upload itself enforces.
|
|
9389
|
+
- This operation runs in the background. It returns **202 Accepted** with a task ID; poll `/Tasks?taskIds={taskId}` for progress and the result. Use the PUT operation instead for content small enough to send at once, which completes synchronously.
|
|
9390
|
+
- The name is supplied as a query parameter rather than a path segment, because the legal character set includes characters that are significant to OData URI parsing.
|
|
9391
|
+
- Names are at most 15 characters long, and each character must be an ASCII letter, an ASCII digit, or one of `!@#$%^&()-+={}[]_~`.
|
|
9392
|
+
- Names match exactly. A name that differs only in letter case from one the document already has is rejected with 409 rather than written, because such a pair means different things on different repository configurations.
|
|
9393
|
+
- Names reserved for internal use are rejected.
|
|
9394
|
+
- The name, the MIME type and the case rule are all checked before the operation is accepted, so those errors come back on this request rather than on the task.
|
|
9395
|
+
- The optional `mimeType` sets the content's MIME type, at most 127 characters. When omitted it is taken from the MIME type supplied to CreateMultipartUploadUrls. The repository stores it lower-cased and without any parameters, so `Text/Plain; charset=utf-8` is stored as `text/plain`.
|
|
9396
|
+
- Required OAuth scope: repository.Write
|
|
9397
|
+
* @param args.repositoryId The requested repository ID.
|
|
9398
|
+
* @param args.entryId The requested document ID.
|
|
9399
|
+
* @param args.name The name of the alternate electronic document. 1 to 15 characters, each an ASCII letter, an ASCII digit, or one of `!@#$%^&()-+={}[]_~`. An existing name has its content and MIME type replaced in full; a name differing from an existing one only in letter case is rejected with 409 and leaves that stream unchanged. Names reserved for internal use are rejected. The name is validated before the operation is accepted, so a name error is returned on this request rather than on the task.
|
|
9400
|
+
* @param args.request The upload to assemble, and the MIME type to record.
|
|
9401
|
+
* @returns Successfully started the write alternate electronic document from uploaded parts operation. Returns a task ID for polling progress.
|
|
9402
|
+
*/
|
|
9403
|
+
writeAltEdocUploadedParts(args) {
|
|
9404
|
+
let { repositoryId, entryId, name, request } = args;
|
|
9405
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/AlternateEdoc/WriteUploadedParts?";
|
|
9406
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9407
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9408
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9409
|
+
if (entryId === undefined || entryId === null)
|
|
9410
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9411
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9412
|
+
if (name === undefined)
|
|
9413
|
+
throw new Error("The parameter 'name' must be defined.");
|
|
9414
|
+
else if (name !== null)
|
|
9415
|
+
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
9416
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9417
|
+
const content_ = JSON.stringify(request);
|
|
9418
|
+
let options_ = {
|
|
9419
|
+
body: content_,
|
|
9420
|
+
method: "POST",
|
|
9421
|
+
headers: {
|
|
9422
|
+
"Content-Type": "application/json",
|
|
9423
|
+
"Accept": "application/json"
|
|
9424
|
+
}
|
|
9425
|
+
};
|
|
9426
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9427
|
+
return this.processWriteAltEdocUploadedParts(_response);
|
|
9428
|
+
});
|
|
9429
|
+
}
|
|
9430
|
+
processWriteAltEdocUploadedParts(response) {
|
|
9431
|
+
const status = response.status;
|
|
9432
|
+
let _headers = {};
|
|
9433
|
+
if (response.headers && response.headers.forEach) {
|
|
9434
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9435
|
+
}
|
|
9436
|
+
;
|
|
9437
|
+
if (status === 202) {
|
|
9438
|
+
return response.text().then((_responseText) => {
|
|
9439
|
+
let result202 = null;
|
|
9440
|
+
let resultData202 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9441
|
+
result202 = StartTaskResponse.fromJS(resultData202);
|
|
9442
|
+
return result202;
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9445
|
+
else if (status === 400) {
|
|
9446
|
+
return response.text().then((_responseText) => {
|
|
9447
|
+
let result400 = null;
|
|
9448
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9449
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9450
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9451
|
+
});
|
|
9452
|
+
}
|
|
9453
|
+
else if (status === 401) {
|
|
9454
|
+
return response.text().then((_responseText) => {
|
|
9455
|
+
let result401 = null;
|
|
9456
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9457
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9458
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9459
|
+
});
|
|
9460
|
+
}
|
|
9461
|
+
else if (status === 403) {
|
|
9462
|
+
return response.text().then((_responseText) => {
|
|
9463
|
+
let result403 = null;
|
|
9464
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9465
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9466
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9467
|
+
});
|
|
9468
|
+
}
|
|
9469
|
+
else if (status === 404) {
|
|
9470
|
+
return response.text().then((_responseText) => {
|
|
9471
|
+
let result404 = null;
|
|
9472
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9473
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9474
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9475
|
+
});
|
|
9476
|
+
}
|
|
9477
|
+
else if (status === 409) {
|
|
9478
|
+
return response.text().then((_responseText) => {
|
|
9479
|
+
let result409 = null;
|
|
9480
|
+
let resultData409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9481
|
+
result409 = ProblemDetails.fromJS(resultData409);
|
|
9482
|
+
return throwException("The document already has an alternate electronic document whose name differs only in letter case.", status, _responseText, _headers, result409);
|
|
9483
|
+
});
|
|
9484
|
+
}
|
|
9485
|
+
else if (status === 423) {
|
|
9486
|
+
return response.text().then((_responseText) => {
|
|
9487
|
+
let result423 = null;
|
|
9488
|
+
let resultData423 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9489
|
+
result423 = ProblemDetails.fromJS(resultData423);
|
|
9490
|
+
return throwException("Entry is locked", status, _responseText, _headers, result423);
|
|
9491
|
+
});
|
|
9492
|
+
}
|
|
9493
|
+
else if (status === 429) {
|
|
9494
|
+
return response.text().then((_responseText) => {
|
|
9495
|
+
let result429 = null;
|
|
9496
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9497
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9498
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9499
|
+
});
|
|
9500
|
+
}
|
|
9501
|
+
else if (status === 500) {
|
|
9502
|
+
return response.text().then((_responseText) => {
|
|
9503
|
+
let result500 = null;
|
|
9504
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9505
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9506
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9507
|
+
});
|
|
9508
|
+
}
|
|
9509
|
+
else if (status !== 200 && status !== 204) {
|
|
9510
|
+
return response.text().then((_responseText) => {
|
|
9511
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9512
|
+
});
|
|
9513
|
+
}
|
|
9514
|
+
return Promise.resolve(null);
|
|
9515
|
+
}
|
|
8895
9516
|
/**
|
|
8896
9517
|
* - Returns the raw image data for the specified page as a binary stream.
|
|
8897
9518
|
- pageNumber is 1-based.
|
|
8898
9519
|
- Required OAuth scope: repository.Read
|
|
8899
9520
|
* @param args.repositoryId The requested repository ID.
|
|
8900
9521
|
* @param args.entryId The requested document ID.
|
|
8901
|
-
* @param args.pageNumber The 1-based page number of the page to retrieve the image for.
|
|
9522
|
+
* @param args.pageNumber The 1-based page number of the page to retrieve the image for.
|
|
9523
|
+
* @param args.select (optional) Limits the properties returned in the result.
|
|
9524
|
+
* @returns Successfully retrieved the image content for the specified page.
|
|
9525
|
+
*/
|
|
9526
|
+
getPageImage(args) {
|
|
9527
|
+
let { repositoryId, entryId, pageNumber, select } = args;
|
|
9528
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/Image?";
|
|
9529
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9530
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9531
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9532
|
+
if (entryId === undefined || entryId === null)
|
|
9533
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9534
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9535
|
+
if (pageNumber === undefined || pageNumber === null)
|
|
9536
|
+
throw new Error("The parameter 'pageNumber' must be defined.");
|
|
9537
|
+
url_ = url_.replace("{pageNumber}", encodeURIComponent("" + pageNumber));
|
|
9538
|
+
if (select !== undefined && select !== null)
|
|
9539
|
+
url_ += "$select=" + encodeURIComponent("" + select) + "&";
|
|
9540
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9541
|
+
let options_ = {
|
|
9542
|
+
method: "GET",
|
|
9543
|
+
headers: {
|
|
9544
|
+
"Accept": "application/octet-stream"
|
|
9545
|
+
}
|
|
9546
|
+
};
|
|
9547
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9548
|
+
return this.processGetPageImage(_response);
|
|
9549
|
+
});
|
|
9550
|
+
}
|
|
9551
|
+
processGetPageImage(response) {
|
|
9552
|
+
const status = response.status;
|
|
9553
|
+
let _headers = {};
|
|
9554
|
+
if (response.headers && response.headers.forEach) {
|
|
9555
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9556
|
+
}
|
|
9557
|
+
;
|
|
9558
|
+
if (status === 200 || status === 206) {
|
|
9559
|
+
const contentDisposition = response.headers ? response.headers.get("content-disposition") : undefined;
|
|
9560
|
+
let fileNameMatch = contentDisposition ? /filename\*=(?:(\\?['"])(.*?)\1|(?:[^\s]+'.*?')?([^;\n]*))/g.exec(contentDisposition) : undefined;
|
|
9561
|
+
let fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[3] || fileNameMatch[2] : undefined;
|
|
9562
|
+
if (fileName) {
|
|
9563
|
+
fileName = decodeURIComponent(fileName);
|
|
9564
|
+
}
|
|
9565
|
+
else {
|
|
9566
|
+
fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
9567
|
+
fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
9568
|
+
}
|
|
9569
|
+
return response.blob().then(blob => { return { fileName: fileName, data: blob, status: status, headers: _headers }; });
|
|
9570
|
+
}
|
|
9571
|
+
else if (status === 400) {
|
|
9572
|
+
return response.text().then((_responseText) => {
|
|
9573
|
+
let result400 = null;
|
|
9574
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9575
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9576
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9577
|
+
});
|
|
9578
|
+
}
|
|
9579
|
+
else if (status === 401) {
|
|
9580
|
+
return response.text().then((_responseText) => {
|
|
9581
|
+
let result401 = null;
|
|
9582
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9583
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9584
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9585
|
+
});
|
|
9586
|
+
}
|
|
9587
|
+
else if (status === 403) {
|
|
9588
|
+
return response.text().then((_responseText) => {
|
|
9589
|
+
let result403 = null;
|
|
9590
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9591
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9592
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9593
|
+
});
|
|
9594
|
+
}
|
|
9595
|
+
else if (status === 404) {
|
|
9596
|
+
return response.text().then((_responseText) => {
|
|
9597
|
+
let result404 = null;
|
|
9598
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9599
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9600
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9601
|
+
});
|
|
9602
|
+
}
|
|
9603
|
+
else if (status === 429) {
|
|
9604
|
+
return response.text().then((_responseText) => {
|
|
9605
|
+
let result429 = null;
|
|
9606
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9607
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9608
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9609
|
+
});
|
|
9610
|
+
}
|
|
9611
|
+
else if (status === 500) {
|
|
9612
|
+
return response.text().then((_responseText) => {
|
|
9613
|
+
let result500 = null;
|
|
9614
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9615
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9616
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9617
|
+
});
|
|
9618
|
+
}
|
|
9619
|
+
else if (status !== 200 && status !== 204) {
|
|
9620
|
+
return response.text().then((_responseText) => {
|
|
9621
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9622
|
+
});
|
|
9623
|
+
}
|
|
9624
|
+
return Promise.resolve(null);
|
|
9625
|
+
}
|
|
9626
|
+
/**
|
|
9627
|
+
* - Returns the text content for the specified page.
|
|
9628
|
+
- pageNumber is 1-based.
|
|
9629
|
+
- Required OAuth scope: repository.Read
|
|
9630
|
+
* @param args.repositoryId The requested repository ID.
|
|
9631
|
+
* @param args.entryId The requested document ID.
|
|
9632
|
+
* @param args.pageNumber The 1-based page number of the page to retrieve the text for.
|
|
9633
|
+
* @param args.select (optional) Limits the properties returned in the result.
|
|
9634
|
+
* @returns Successfully retrieved the text content for the specified page.
|
|
9635
|
+
*/
|
|
9636
|
+
getPageText(args) {
|
|
9637
|
+
let { repositoryId, entryId, pageNumber, select } = args;
|
|
9638
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/Text?";
|
|
9639
|
+
if (repositoryId === undefined || repositoryId === null)
|
|
9640
|
+
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9641
|
+
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
9642
|
+
if (entryId === undefined || entryId === null)
|
|
9643
|
+
throw new Error("The parameter 'entryId' must be defined.");
|
|
9644
|
+
url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
|
|
9645
|
+
if (pageNumber === undefined || pageNumber === null)
|
|
9646
|
+
throw new Error("The parameter 'pageNumber' must be defined.");
|
|
9647
|
+
url_ = url_.replace("{pageNumber}", encodeURIComponent("" + pageNumber));
|
|
9648
|
+
if (select !== undefined && select !== null)
|
|
9649
|
+
url_ += "$select=" + encodeURIComponent("" + select) + "&";
|
|
9650
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
9651
|
+
let options_ = {
|
|
9652
|
+
method: "GET",
|
|
9653
|
+
headers: {
|
|
9654
|
+
"Accept": "application/json"
|
|
9655
|
+
}
|
|
9656
|
+
};
|
|
9657
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
9658
|
+
return this.processGetPageText(_response);
|
|
9659
|
+
});
|
|
9660
|
+
}
|
|
9661
|
+
processGetPageText(response) {
|
|
9662
|
+
const status = response.status;
|
|
9663
|
+
let _headers = {};
|
|
9664
|
+
if (response.headers && response.headers.forEach) {
|
|
9665
|
+
response.headers.forEach((v, k) => _headers[k] = v);
|
|
9666
|
+
}
|
|
9667
|
+
;
|
|
9668
|
+
if (status === 200) {
|
|
9669
|
+
return response.text().then((_responseText) => {
|
|
9670
|
+
let result200 = null;
|
|
9671
|
+
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9672
|
+
result200 = PageTextResponse.fromJS(resultData200);
|
|
9673
|
+
return result200;
|
|
9674
|
+
});
|
|
9675
|
+
}
|
|
9676
|
+
else if (status === 400) {
|
|
9677
|
+
return response.text().then((_responseText) => {
|
|
9678
|
+
let result400 = null;
|
|
9679
|
+
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9680
|
+
result400 = ProblemDetails.fromJS(resultData400);
|
|
9681
|
+
return throwException("Invalid or bad request.", status, _responseText, _headers, result400);
|
|
9682
|
+
});
|
|
9683
|
+
}
|
|
9684
|
+
else if (status === 401) {
|
|
9685
|
+
return response.text().then((_responseText) => {
|
|
9686
|
+
let result401 = null;
|
|
9687
|
+
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9688
|
+
result401 = ProblemDetails.fromJS(resultData401);
|
|
9689
|
+
return throwException("Access token is invalid or expired.", status, _responseText, _headers, result401);
|
|
9690
|
+
});
|
|
9691
|
+
}
|
|
9692
|
+
else if (status === 403) {
|
|
9693
|
+
return response.text().then((_responseText) => {
|
|
9694
|
+
let result403 = null;
|
|
9695
|
+
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9696
|
+
result403 = ProblemDetails.fromJS(resultData403);
|
|
9697
|
+
return throwException("Access denied for the operation.", status, _responseText, _headers, result403);
|
|
9698
|
+
});
|
|
9699
|
+
}
|
|
9700
|
+
else if (status === 404) {
|
|
9701
|
+
return response.text().then((_responseText) => {
|
|
9702
|
+
let result404 = null;
|
|
9703
|
+
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9704
|
+
result404 = ProblemDetails.fromJS(resultData404);
|
|
9705
|
+
return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
|
|
9706
|
+
});
|
|
9707
|
+
}
|
|
9708
|
+
else if (status === 429) {
|
|
9709
|
+
return response.text().then((_responseText) => {
|
|
9710
|
+
let result429 = null;
|
|
9711
|
+
let resultData429 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9712
|
+
result429 = ProblemDetails.fromJS(resultData429);
|
|
9713
|
+
return throwException("Rate limit is reached.", status, _responseText, _headers, result429);
|
|
9714
|
+
});
|
|
9715
|
+
}
|
|
9716
|
+
else if (status === 500) {
|
|
9717
|
+
return response.text().then((_responseText) => {
|
|
9718
|
+
let result500 = null;
|
|
9719
|
+
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9720
|
+
result500 = ProblemDetails.fromJS(resultData500);
|
|
9721
|
+
return throwException("An unexpected server-side error occurred.", status, _responseText, _headers, result500);
|
|
9722
|
+
});
|
|
9723
|
+
}
|
|
9724
|
+
else if (status !== 200 && status !== 204) {
|
|
9725
|
+
return response.text().then((_responseText) => {
|
|
9726
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
9727
|
+
});
|
|
9728
|
+
}
|
|
9729
|
+
return Promise.resolve(null);
|
|
9730
|
+
}
|
|
9731
|
+
/**
|
|
9732
|
+
* - Returns the offsets, in the text of the page, of the words the rectangle covers, together with that text.
|
|
9733
|
+
- All four rectangle parameters are required. Omitting one is a 400 rather than a coordinate of 0, because a rectangle silently moved to the edge of the page answers with a span the caller never asked about.
|
|
9734
|
+
- Coordinates are in raw page image pixels, with the origin at the top left of the unrotated image: X is measured in imageXResolution columns and Y in imageYResolution rows, which can differ from one another, and the image is the one described by imageWidth, imageHeight, imageXResolution, imageYResolution and imageRotationAngle on ListPageInfos. The page's own rotation is not applied, so a viewer that displays the page rotated or scaled must convert its own coordinates back to this space before calling.
|
|
9735
|
+
- A word counts as covered when the rectangle contains it, is contained by it, or overlaps it by at least 2 pixels and half of both its width and its height. A rectangle that lies entirely within the word on one axis - a thin stripe drawn through it - only has to clear the half threshold on the other axis. This is the same rule the Laserfiche viewers apply to a hand-drawn selection.
|
|
9736
|
+
- textStart is the offset of the first character of the span and textEnd is the offset one past its last character, so textEnd - textStart is the length of the span. This is the convention Web Access stores in text-linked highlight and redaction annotations, so the values can be written straight back to CreateAnnotation. Offsets are UTF-16 code unit indices into the text returned by GetPageText, including its line breaks.
|
|
9737
|
+
- The span runs from the first covered word to the last, so text can include characters that lie between covered words. text always equals the page text from textStart to textEnd.
|
|
9738
|
+
- When the rectangle covers no words, hasTextSpan is false, textStart and textEnd are both -1, text is empty and wordCount is 0. -1 is also the value the annotation surface uses for a span that is not linked to text.
|
|
9739
|
+
- Returns 404 when the page has no text or no word locations. A page has word locations when hasWordLocations is true on ListPageInfos; text is generated by GenerateText.
|
|
9740
|
+
- Returns 400 when the page carries more word locations than the server supports, which is 20,000 by default.
|
|
9741
|
+
- Required OAuth scope: repository.Read
|
|
9742
|
+
* @param args.repositoryId The requested repository ID.
|
|
9743
|
+
* @param args.entryId The requested document ID.
|
|
9744
|
+
* @param args.pageNumber The 1-based page number of the page to search.
|
|
9745
|
+
* @param args.x The X coordinate of the left edge of the rectangle, in page image pixels. Required, and may not be negative.
|
|
9746
|
+
* @param args.y The Y coordinate of the top edge of the rectangle, in page image pixels. Required, and may not be negative.
|
|
9747
|
+
* @param args.width The width of the rectangle, in page image pixels. Required, and must be at least 1.
|
|
9748
|
+
* @param args.height The height of the rectangle, in page image pixels. Required, and must be at least 1.
|
|
8902
9749
|
* @param args.select (optional) Limits the properties returned in the result.
|
|
8903
|
-
* @returns Successfully retrieved the
|
|
9750
|
+
* @returns Successfully retrieved the page text span covered by the specified rectangle.
|
|
8904
9751
|
*/
|
|
8905
|
-
|
|
8906
|
-
let { repositoryId, entryId, pageNumber, select } = args;
|
|
8907
|
-
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/
|
|
9752
|
+
getPageTextOffsets(args) {
|
|
9753
|
+
let { repositoryId, entryId, pageNumber, x, y, width, height, select } = args;
|
|
9754
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/Text/Offsets?";
|
|
8908
9755
|
if (repositoryId === undefined || repositoryId === null)
|
|
8909
9756
|
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
8910
9757
|
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
@@ -8914,38 +9761,49 @@ export class EntriesClient {
|
|
|
8914
9761
|
if (pageNumber === undefined || pageNumber === null)
|
|
8915
9762
|
throw new Error("The parameter 'pageNumber' must be defined.");
|
|
8916
9763
|
url_ = url_.replace("{pageNumber}", encodeURIComponent("" + pageNumber));
|
|
9764
|
+
if (x === undefined)
|
|
9765
|
+
throw new Error("The parameter 'x' must be defined.");
|
|
9766
|
+
else if (x !== null)
|
|
9767
|
+
url_ += "x=" + encodeURIComponent("" + x) + "&";
|
|
9768
|
+
if (y === undefined)
|
|
9769
|
+
throw new Error("The parameter 'y' must be defined.");
|
|
9770
|
+
else if (y !== null)
|
|
9771
|
+
url_ += "y=" + encodeURIComponent("" + y) + "&";
|
|
9772
|
+
if (width === undefined)
|
|
9773
|
+
throw new Error("The parameter 'width' must be defined.");
|
|
9774
|
+
else if (width !== null)
|
|
9775
|
+
url_ += "width=" + encodeURIComponent("" + width) + "&";
|
|
9776
|
+
if (height === undefined)
|
|
9777
|
+
throw new Error("The parameter 'height' must be defined.");
|
|
9778
|
+
else if (height !== null)
|
|
9779
|
+
url_ += "height=" + encodeURIComponent("" + height) + "&";
|
|
8917
9780
|
if (select !== undefined && select !== null)
|
|
8918
9781
|
url_ += "$select=" + encodeURIComponent("" + select) + "&";
|
|
8919
9782
|
url_ = url_.replace(/[?&]$/, "");
|
|
8920
9783
|
let options_ = {
|
|
8921
9784
|
method: "GET",
|
|
8922
9785
|
headers: {
|
|
8923
|
-
"Accept": "application/
|
|
9786
|
+
"Accept": "application/json"
|
|
8924
9787
|
}
|
|
8925
9788
|
};
|
|
8926
9789
|
return this.http.fetch(url_, options_).then((_response) => {
|
|
8927
|
-
return this.
|
|
9790
|
+
return this.processGetPageTextOffsets(_response);
|
|
8928
9791
|
});
|
|
8929
9792
|
}
|
|
8930
|
-
|
|
9793
|
+
processGetPageTextOffsets(response) {
|
|
8931
9794
|
const status = response.status;
|
|
8932
9795
|
let _headers = {};
|
|
8933
9796
|
if (response.headers && response.headers.forEach) {
|
|
8934
9797
|
response.headers.forEach((v, k) => _headers[k] = v);
|
|
8935
9798
|
}
|
|
8936
9799
|
;
|
|
8937
|
-
if (status === 200
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
}
|
|
8944
|
-
else {
|
|
8945
|
-
fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
8946
|
-
fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
8947
|
-
}
|
|
8948
|
-
return response.blob().then(blob => { return { fileName: fileName, data: blob, status: status, headers: _headers }; });
|
|
9800
|
+
if (status === 200) {
|
|
9801
|
+
return response.text().then((_responseText) => {
|
|
9802
|
+
let result200 = null;
|
|
9803
|
+
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9804
|
+
result200 = PageTextOffsetsResponse.fromJS(resultData200);
|
|
9805
|
+
return result200;
|
|
9806
|
+
});
|
|
8949
9807
|
}
|
|
8950
9808
|
else if (status === 400) {
|
|
8951
9809
|
return response.text().then((_responseText) => {
|
|
@@ -9003,18 +9861,23 @@ export class EntriesClient {
|
|
|
9003
9861
|
return Promise.resolve(null);
|
|
9004
9862
|
}
|
|
9005
9863
|
/**
|
|
9006
|
-
* - Returns the text
|
|
9007
|
-
-
|
|
9864
|
+
* - Returns every word of the page, in reading order, with its text offsets and its rectangle on the page image. This is the data the hasWordLocations and locationsDataSize properties on ListPageInfos advertise.
|
|
9865
|
+
- The whole page is returned in one response; there is no paging, because the order of the words is itself part of the data. A page carrying more word locations than the server supports, which is 20,000 by default, is refused with a 400 rather than truncated.
|
|
9866
|
+
- Coordinates are in raw page image pixels, with the origin at the top left of the unrotated image: X is measured in imageXResolution columns and Y in imageYResolution rows, which can differ from one another. The envelope repeats the page image geometry so the coordinates can be interpreted without a second call, and imageRotationAngle is reported but not applied - overlay code must apply its own rotation and scaling.
|
|
9867
|
+
- textStart is the offset of the first character of the word and textEnd is the offset one past its last character, so textEnd - textStart is the length of the word. Offsets are UTF-16 code unit indices into the text returned by GetPageText, including its line breaks, and use the same convention as the text-linked highlight and redaction annotations.
|
|
9868
|
+
- To find the rectangles that render a text span [spanStart, spanEnd), such as the span stored on an existing highlight or redaction annotation, take every entry where word.textStart < spanEnd and word.textEnd > spanStart, and use those entries' rectangles. Entries that overlap vertically are on the same line of text, so horizontally adjacent boxes within such a group can be merged into one box per line.
|
|
9869
|
+
- width and height can both be 0 for a location OCR produced for a word it could not place. Such entries are still returned, because the order of the words is what pairs them with the page text.
|
|
9870
|
+
- Returns 404 when the page has no text or no word locations. Word locations are produced by GenerateText along with the page text.
|
|
9008
9871
|
- Required OAuth scope: repository.Read
|
|
9009
9872
|
* @param args.repositoryId The requested repository ID.
|
|
9010
9873
|
* @param args.entryId The requested document ID.
|
|
9011
|
-
* @param args.pageNumber The 1-based page number of the page to retrieve the
|
|
9874
|
+
* @param args.pageNumber The 1-based page number of the page to retrieve the word locations for.
|
|
9012
9875
|
* @param args.select (optional) Limits the properties returned in the result.
|
|
9013
|
-
* @returns Successfully retrieved the
|
|
9876
|
+
* @returns Successfully retrieved the word locations for the specified page.
|
|
9014
9877
|
*/
|
|
9015
|
-
|
|
9878
|
+
listPageWordLocations(args) {
|
|
9016
9879
|
let { repositoryId, entryId, pageNumber, select } = args;
|
|
9017
|
-
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/
|
|
9880
|
+
let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages/{pageNumber}/WordLocations?";
|
|
9018
9881
|
if (repositoryId === undefined || repositoryId === null)
|
|
9019
9882
|
throw new Error("The parameter 'repositoryId' must be defined.");
|
|
9020
9883
|
url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
|
|
@@ -9034,10 +9897,10 @@ export class EntriesClient {
|
|
|
9034
9897
|
}
|
|
9035
9898
|
};
|
|
9036
9899
|
return this.http.fetch(url_, options_).then((_response) => {
|
|
9037
|
-
return this.
|
|
9900
|
+
return this.processListPageWordLocations(_response);
|
|
9038
9901
|
});
|
|
9039
9902
|
}
|
|
9040
|
-
|
|
9903
|
+
processListPageWordLocations(response) {
|
|
9041
9904
|
const status = response.status;
|
|
9042
9905
|
let _headers = {};
|
|
9043
9906
|
if (response.headers && response.headers.forEach) {
|
|
@@ -9048,7 +9911,7 @@ export class EntriesClient {
|
|
|
9048
9911
|
return response.text().then((_responseText) => {
|
|
9049
9912
|
let result200 = null;
|
|
9050
9913
|
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
9051
|
-
result200 =
|
|
9914
|
+
result200 = PageWordLocationsResponse.fromJS(resultData200);
|
|
9052
9915
|
return result200;
|
|
9053
9916
|
});
|
|
9054
9917
|
}
|
|
@@ -19360,6 +20223,7 @@ export class StartExportEntryRequest {
|
|
|
19360
20223
|
this.auditReasonId = _data["auditReasonId"];
|
|
19361
20224
|
this.auditReasonComment = _data["auditReasonComment"] !== undefined ? _data["auditReasonComment"] : "";
|
|
19362
20225
|
this.part = _data["part"];
|
|
20226
|
+
this.alternateEdocName = _data["alternateEdocName"];
|
|
19363
20227
|
this.imageOptions = _data["imageOptions"] ? ExportEntryRequestImageOptions.fromJS(_data["imageOptions"]) : undefined;
|
|
19364
20228
|
this.textOptions = _data["textOptions"] ? ExportEntryRequestTextOptions.fromJS(_data["textOptions"]) : undefined;
|
|
19365
20229
|
}
|
|
@@ -19375,6 +20239,7 @@ export class StartExportEntryRequest {
|
|
|
19375
20239
|
data["auditReasonId"] = this.auditReasonId;
|
|
19376
20240
|
data["auditReasonComment"] = this.auditReasonComment;
|
|
19377
20241
|
data["part"] = this.part;
|
|
20242
|
+
data["alternateEdocName"] = this.alternateEdocName;
|
|
19378
20243
|
data["imageOptions"] = this.imageOptions ? this.imageOptions.toJSON() : undefined;
|
|
19379
20244
|
data["textOptions"] = this.textOptions ? this.textOptions.toJSON() : undefined;
|
|
19380
20245
|
return data;
|
|
@@ -19386,6 +20251,7 @@ export var ExportEntryRequestPart;
|
|
|
19386
20251
|
ExportEntryRequestPart["Image"] = "Image";
|
|
19387
20252
|
ExportEntryRequestPart["Text"] = "Text";
|
|
19388
20253
|
ExportEntryRequestPart["Edoc"] = "Edoc";
|
|
20254
|
+
ExportEntryRequestPart["AlternateEdoc"] = "AlternateEdoc";
|
|
19389
20255
|
})(ExportEntryRequestPart || (ExportEntryRequestPart = {}));
|
|
19390
20256
|
/** Represents the options when exporting the image part of an entry. */
|
|
19391
20257
|
export class ExportEntryRequestImageOptions {
|
|
@@ -19790,6 +20656,7 @@ export class Document extends Entry {
|
|
|
19790
20656
|
this.totalDocumentSize = _data["totalDocumentSize"];
|
|
19791
20657
|
this.extension = _data["extension"];
|
|
19792
20658
|
this.isElectronicDocument = _data["isElectronicDocument"];
|
|
20659
|
+
this.hasAlternateEdocs = _data["hasAlternateEdocs"];
|
|
19793
20660
|
this.isRecord = _data["isRecord"];
|
|
19794
20661
|
this.mimeType = _data["mimeType"];
|
|
19795
20662
|
this.pageCount = _data["pageCount"];
|
|
@@ -19815,6 +20682,7 @@ export class Document extends Entry {
|
|
|
19815
20682
|
data["totalDocumentSize"] = this.totalDocumentSize;
|
|
19816
20683
|
data["extension"] = this.extension;
|
|
19817
20684
|
data["isElectronicDocument"] = this.isElectronicDocument;
|
|
20685
|
+
data["hasAlternateEdocs"] = this.hasAlternateEdocs;
|
|
19818
20686
|
data["isRecord"] = this.isRecord;
|
|
19819
20687
|
data["mimeType"] = this.mimeType;
|
|
19820
20688
|
data["pageCount"] = this.pageCount;
|
|
@@ -20026,6 +20894,7 @@ export class ExportEntryRequest {
|
|
|
20026
20894
|
this.auditReasonId = _data["auditReasonId"];
|
|
20027
20895
|
this.auditReasonComment = _data["auditReasonComment"] !== undefined ? _data["auditReasonComment"] : "";
|
|
20028
20896
|
this.part = _data["part"];
|
|
20897
|
+
this.alternateEdocName = _data["alternateEdocName"];
|
|
20029
20898
|
this.imageOptions = _data["imageOptions"] ? ExportEntryRequestImageOptions.fromJS(_data["imageOptions"]) : undefined;
|
|
20030
20899
|
this.textOptions = _data["textOptions"] ? ExportEntryRequestTextOptions.fromJS(_data["textOptions"]) : undefined;
|
|
20031
20900
|
}
|
|
@@ -20041,6 +20910,7 @@ export class ExportEntryRequest {
|
|
|
20041
20910
|
data["auditReasonId"] = this.auditReasonId;
|
|
20042
20911
|
data["auditReasonComment"] = this.auditReasonComment;
|
|
20043
20912
|
data["part"] = this.part;
|
|
20913
|
+
data["alternateEdocName"] = this.alternateEdocName;
|
|
20044
20914
|
data["imageOptions"] = this.imageOptions ? this.imageOptions.toJSON() : undefined;
|
|
20045
20915
|
data["textOptions"] = this.textOptions ? this.textOptions.toJSON() : undefined;
|
|
20046
20916
|
return data;
|
|
@@ -20915,6 +21785,118 @@ export class PageInfoResponse {
|
|
|
20915
21785
|
return data;
|
|
20916
21786
|
}
|
|
20917
21787
|
}
|
|
21788
|
+
/** Response containing a collection of AlternateEdocInfoResponse. */
|
|
21789
|
+
export class AlternateEdocInfoCollectionResponse {
|
|
21790
|
+
constructor(data) {
|
|
21791
|
+
if (data) {
|
|
21792
|
+
for (var property in data) {
|
|
21793
|
+
if (data.hasOwnProperty(property))
|
|
21794
|
+
this[property] = data[property];
|
|
21795
|
+
}
|
|
21796
|
+
}
|
|
21797
|
+
}
|
|
21798
|
+
init(_data) {
|
|
21799
|
+
if (_data) {
|
|
21800
|
+
this.odataNextLink = _data["@odata.nextLink"];
|
|
21801
|
+
this.odataCount = _data["@odata.count"];
|
|
21802
|
+
if (Array.isArray(_data["value"])) {
|
|
21803
|
+
this.value = [];
|
|
21804
|
+
for (let item of _data["value"])
|
|
21805
|
+
this.value.push(AlternateEdocInfoResponse.fromJS(item));
|
|
21806
|
+
}
|
|
21807
|
+
}
|
|
21808
|
+
}
|
|
21809
|
+
static fromJS(data) {
|
|
21810
|
+
data = typeof data === 'object' ? data : {};
|
|
21811
|
+
let result = new AlternateEdocInfoCollectionResponse();
|
|
21812
|
+
result.init(data);
|
|
21813
|
+
return result;
|
|
21814
|
+
}
|
|
21815
|
+
toJSON(data) {
|
|
21816
|
+
data = typeof data === 'object' ? data : {};
|
|
21817
|
+
data["@odata.nextLink"] = this.odataNextLink;
|
|
21818
|
+
data["@odata.count"] = this.odataCount;
|
|
21819
|
+
if (Array.isArray(this.value)) {
|
|
21820
|
+
data["value"] = [];
|
|
21821
|
+
for (let item of this.value)
|
|
21822
|
+
data["value"].push(item.toJSON());
|
|
21823
|
+
}
|
|
21824
|
+
return data;
|
|
21825
|
+
}
|
|
21826
|
+
}
|
|
21827
|
+
/** Describes one alternate electronic document stream attached to a document. */
|
|
21828
|
+
export class AlternateEdocInfoResponse {
|
|
21829
|
+
constructor(data) {
|
|
21830
|
+
if (data) {
|
|
21831
|
+
for (var property in data) {
|
|
21832
|
+
if (data.hasOwnProperty(property))
|
|
21833
|
+
this[property] = data[property];
|
|
21834
|
+
}
|
|
21835
|
+
}
|
|
21836
|
+
}
|
|
21837
|
+
init(_data) {
|
|
21838
|
+
if (_data) {
|
|
21839
|
+
this.name = _data["name"];
|
|
21840
|
+
this.mimeType = _data["mimeType"];
|
|
21841
|
+
this.size = _data["size"];
|
|
21842
|
+
}
|
|
21843
|
+
}
|
|
21844
|
+
static fromJS(data) {
|
|
21845
|
+
data = typeof data === 'object' ? data : {};
|
|
21846
|
+
let result = new AlternateEdocInfoResponse();
|
|
21847
|
+
result.init(data);
|
|
21848
|
+
return result;
|
|
21849
|
+
}
|
|
21850
|
+
toJSON(data) {
|
|
21851
|
+
data = typeof data === 'object' ? data : {};
|
|
21852
|
+
data["name"] = this.name;
|
|
21853
|
+
data["mimeType"] = this.mimeType;
|
|
21854
|
+
data["size"] = this.size;
|
|
21855
|
+
return data;
|
|
21856
|
+
}
|
|
21857
|
+
}
|
|
21858
|
+
/** Request body for writing an alternate electronic document from previously uploaded parts. */
|
|
21859
|
+
export class WriteAltEdocUploadedPartsRequest {
|
|
21860
|
+
constructor(data) {
|
|
21861
|
+
if (data) {
|
|
21862
|
+
for (var property in data) {
|
|
21863
|
+
if (data.hasOwnProperty(property))
|
|
21864
|
+
this[property] = data[property];
|
|
21865
|
+
}
|
|
21866
|
+
}
|
|
21867
|
+
if (!data) {
|
|
21868
|
+
this.partETags = [];
|
|
21869
|
+
}
|
|
21870
|
+
}
|
|
21871
|
+
init(_data) {
|
|
21872
|
+
if (_data) {
|
|
21873
|
+
this.uploadId = _data["uploadId"];
|
|
21874
|
+
if (Array.isArray(_data["partETags"])) {
|
|
21875
|
+
this.partETags = [];
|
|
21876
|
+
for (let item of _data["partETags"])
|
|
21877
|
+
this.partETags.push(item);
|
|
21878
|
+
}
|
|
21879
|
+
this.mimeType = _data["mimeType"];
|
|
21880
|
+
}
|
|
21881
|
+
}
|
|
21882
|
+
static fromJS(data) {
|
|
21883
|
+
data = typeof data === 'object' ? data : {};
|
|
21884
|
+
let result = new WriteAltEdocUploadedPartsRequest();
|
|
21885
|
+
result.init(data);
|
|
21886
|
+
return result;
|
|
21887
|
+
}
|
|
21888
|
+
toJSON(data) {
|
|
21889
|
+
data = typeof data === 'object' ? data : {};
|
|
21890
|
+
data["uploadId"] = this.uploadId;
|
|
21891
|
+
if (Array.isArray(this.partETags)) {
|
|
21892
|
+
data["partETags"] = [];
|
|
21893
|
+
for (let item of this.partETags)
|
|
21894
|
+
data["partETags"].push(item);
|
|
21895
|
+
}
|
|
21896
|
+
data["mimeType"] = this.mimeType;
|
|
21897
|
+
return data;
|
|
21898
|
+
}
|
|
21899
|
+
}
|
|
20918
21900
|
export class PageTextResponse {
|
|
20919
21901
|
constructor(data) {
|
|
20920
21902
|
if (data) {
|
|
@@ -20941,6 +21923,127 @@ export class PageTextResponse {
|
|
|
20941
21923
|
return data;
|
|
20942
21924
|
}
|
|
20943
21925
|
}
|
|
21926
|
+
/** The page text span covered by a rectangle drawn on a page image. */
|
|
21927
|
+
export class PageTextOffsetsResponse {
|
|
21928
|
+
constructor(data) {
|
|
21929
|
+
if (data) {
|
|
21930
|
+
for (var property in data) {
|
|
21931
|
+
if (data.hasOwnProperty(property))
|
|
21932
|
+
this[property] = data[property];
|
|
21933
|
+
}
|
|
21934
|
+
}
|
|
21935
|
+
}
|
|
21936
|
+
init(_data) {
|
|
21937
|
+
if (_data) {
|
|
21938
|
+
this.hasTextSpan = _data["hasTextSpan"];
|
|
21939
|
+
this.textStart = _data["textStart"];
|
|
21940
|
+
this.textEnd = _data["textEnd"];
|
|
21941
|
+
this.text = _data["text"];
|
|
21942
|
+
this.wordCount = _data["wordCount"];
|
|
21943
|
+
}
|
|
21944
|
+
}
|
|
21945
|
+
static fromJS(data) {
|
|
21946
|
+
data = typeof data === 'object' ? data : {};
|
|
21947
|
+
let result = new PageTextOffsetsResponse();
|
|
21948
|
+
result.init(data);
|
|
21949
|
+
return result;
|
|
21950
|
+
}
|
|
21951
|
+
toJSON(data) {
|
|
21952
|
+
data = typeof data === 'object' ? data : {};
|
|
21953
|
+
data["hasTextSpan"] = this.hasTextSpan;
|
|
21954
|
+
data["textStart"] = this.textStart;
|
|
21955
|
+
data["textEnd"] = this.textEnd;
|
|
21956
|
+
data["text"] = this.text;
|
|
21957
|
+
data["wordCount"] = this.wordCount;
|
|
21958
|
+
return data;
|
|
21959
|
+
}
|
|
21960
|
+
}
|
|
21961
|
+
/** The word locations of a page, together with the page image geometry the coordinates are expressed in. */
|
|
21962
|
+
export class PageWordLocationsResponse {
|
|
21963
|
+
constructor(data) {
|
|
21964
|
+
if (data) {
|
|
21965
|
+
for (var property in data) {
|
|
21966
|
+
if (data.hasOwnProperty(property))
|
|
21967
|
+
this[property] = data[property];
|
|
21968
|
+
}
|
|
21969
|
+
}
|
|
21970
|
+
}
|
|
21971
|
+
init(_data) {
|
|
21972
|
+
if (_data) {
|
|
21973
|
+
this.pageNumber = _data["pageNumber"];
|
|
21974
|
+
this.imageWidth = _data["imageWidth"];
|
|
21975
|
+
this.imageHeight = _data["imageHeight"];
|
|
21976
|
+
this.imageXResolution = _data["imageXResolution"];
|
|
21977
|
+
this.imageYResolution = _data["imageYResolution"];
|
|
21978
|
+
this.imageRotationAngle = _data["imageRotationAngle"];
|
|
21979
|
+
if (Array.isArray(_data["wordLocations"])) {
|
|
21980
|
+
this.wordLocations = [];
|
|
21981
|
+
for (let item of _data["wordLocations"])
|
|
21982
|
+
this.wordLocations.push(PageWordLocation.fromJS(item));
|
|
21983
|
+
}
|
|
21984
|
+
}
|
|
21985
|
+
}
|
|
21986
|
+
static fromJS(data) {
|
|
21987
|
+
data = typeof data === 'object' ? data : {};
|
|
21988
|
+
let result = new PageWordLocationsResponse();
|
|
21989
|
+
result.init(data);
|
|
21990
|
+
return result;
|
|
21991
|
+
}
|
|
21992
|
+
toJSON(data) {
|
|
21993
|
+
data = typeof data === 'object' ? data : {};
|
|
21994
|
+
data["pageNumber"] = this.pageNumber;
|
|
21995
|
+
data["imageWidth"] = this.imageWidth;
|
|
21996
|
+
data["imageHeight"] = this.imageHeight;
|
|
21997
|
+
data["imageXResolution"] = this.imageXResolution;
|
|
21998
|
+
data["imageYResolution"] = this.imageYResolution;
|
|
21999
|
+
data["imageRotationAngle"] = this.imageRotationAngle;
|
|
22000
|
+
if (Array.isArray(this.wordLocations)) {
|
|
22001
|
+
data["wordLocations"] = [];
|
|
22002
|
+
for (let item of this.wordLocations)
|
|
22003
|
+
data["wordLocations"].push(item.toJSON());
|
|
22004
|
+
}
|
|
22005
|
+
return data;
|
|
22006
|
+
}
|
|
22007
|
+
}
|
|
22008
|
+
/** One word of a page, with its position in the page text and its rectangle on the page image. */
|
|
22009
|
+
export class PageWordLocation {
|
|
22010
|
+
constructor(data) {
|
|
22011
|
+
if (data) {
|
|
22012
|
+
for (var property in data) {
|
|
22013
|
+
if (data.hasOwnProperty(property))
|
|
22014
|
+
this[property] = data[property];
|
|
22015
|
+
}
|
|
22016
|
+
}
|
|
22017
|
+
}
|
|
22018
|
+
init(_data) {
|
|
22019
|
+
if (_data) {
|
|
22020
|
+
this.word = _data["word"];
|
|
22021
|
+
this.textStart = _data["textStart"];
|
|
22022
|
+
this.textEnd = _data["textEnd"];
|
|
22023
|
+
this.x = _data["x"];
|
|
22024
|
+
this.y = _data["y"];
|
|
22025
|
+
this.width = _data["width"];
|
|
22026
|
+
this.height = _data["height"];
|
|
22027
|
+
}
|
|
22028
|
+
}
|
|
22029
|
+
static fromJS(data) {
|
|
22030
|
+
data = typeof data === 'object' ? data : {};
|
|
22031
|
+
let result = new PageWordLocation();
|
|
22032
|
+
result.init(data);
|
|
22033
|
+
return result;
|
|
22034
|
+
}
|
|
22035
|
+
toJSON(data) {
|
|
22036
|
+
data = typeof data === 'object' ? data : {};
|
|
22037
|
+
data["word"] = this.word;
|
|
22038
|
+
data["textStart"] = this.textStart;
|
|
22039
|
+
data["textEnd"] = this.textEnd;
|
|
22040
|
+
data["x"] = this.x;
|
|
22041
|
+
data["y"] = this.y;
|
|
22042
|
+
data["width"] = this.width;
|
|
22043
|
+
data["height"] = this.height;
|
|
22044
|
+
return data;
|
|
22045
|
+
}
|
|
22046
|
+
}
|
|
20944
22047
|
/** Request body for listing dynamic field values for an entry. */
|
|
20945
22048
|
export class ListDynamicFieldValuesRequest {
|
|
20946
22049
|
constructor(data) {
|
|
@@ -22434,6 +23537,7 @@ export var TaskType;
|
|
|
22434
23537
|
TaskType["ExportEntry"] = "ExportEntry";
|
|
22435
23538
|
TaskType["ImportUploadedParts"] = "ImportUploadedParts";
|
|
22436
23539
|
TaskType["SearchEntry"] = "SearchEntry";
|
|
23540
|
+
TaskType["WriteAltEdocUploadedParts"] = "WriteAltEdocUploadedParts";
|
|
22437
23541
|
})(TaskType || (TaskType = {}));
|
|
22438
23542
|
/** An enumeration of possible statuses for a long operation task. */
|
|
22439
23543
|
export var TaskStatus;
|