@markupai/api 1.2.0 → 1.4.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/README.md +0 -18
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +7 -2
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/styleGuides/client/Client.d.ts +4 -6
- package/dist/cjs/api/resources/styleGuides/client/Client.js +11 -8
- package/dist/cjs/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.ts +13 -0
- package/dist/cjs/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +2 -0
- package/dist/cjs/api/resources/styleGuides/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/terminology/client/Client.d.ts +333 -0
- package/dist/cjs/api/resources/terminology/client/Client.js +1314 -0
- package/dist/cjs/api/resources/terminology/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/terminology/client/index.js +17 -0
- package/dist/cjs/api/resources/terminology/client/requests/BodyTerminologyImportTerminology.d.ts +17 -0
- package/dist/cjs/api/resources/terminology/client/requests/BodyTerminologyImportTerminology.js +5 -0
- package/dist/cjs/api/resources/{styleGuides/client/requests/BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.d.ts → terminology/client/requests/DomainCreateRequest.d.ts} +2 -2
- package/dist/cjs/api/resources/terminology/client/requests/DomainCreateRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/DomainUpdateRequest.d.ts +11 -0
- package/dist/cjs/api/resources/terminology/client/requests/DomainUpdateRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermSetCreateRequest.d.ts +15 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermSetCreateRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermSetUpdateRequest.d.ts +11 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermSetUpdateRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermUpdateRequest.d.ts +15 -0
- package/dist/cjs/api/resources/terminology/client/requests/TermUpdateRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologyListDomainsRequest.d.ts +19 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologyListDomainsRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologyListTermSetsRequest.d.ts +21 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologyListTermSetsRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologySearchTerminologyRequest.d.ts +14 -0
- package/dist/cjs/api/resources/terminology/client/requests/TerminologySearchTerminologyRequest.js +5 -0
- package/dist/cjs/api/resources/terminology/client/requests/index.d.ts +9 -0
- package/dist/cjs/api/resources/terminology/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/terminology/index.d.ts +1 -0
- package/dist/cjs/api/resources/terminology/index.js +17 -0
- package/dist/cjs/api/types/ConsistencyCategory.d.ts +1 -4
- package/dist/cjs/api/types/ConsistencyCategory.js +0 -3
- package/dist/cjs/api/types/DomainResponse.d.ts +13 -0
- package/dist/cjs/api/types/DomainResponse.js +5 -0
- package/dist/cjs/api/types/DomainSummary.d.ts +7 -0
- package/dist/cjs/api/types/DomainSummary.js +5 -0
- package/dist/cjs/api/types/ImportSummary.d.ts +12 -0
- package/dist/cjs/api/types/ImportSummary.js +5 -0
- package/dist/cjs/api/types/Issue.d.ts +1 -0
- package/dist/cjs/api/types/MatchedTerm.d.ts +7 -0
- package/dist/cjs/api/types/MatchedTerm.js +5 -0
- package/dist/cjs/api/types/PaginatedDomainsResponse.d.ts +11 -0
- package/dist/cjs/api/types/PaginatedDomainsResponse.js +5 -0
- package/dist/cjs/api/types/PaginatedTermSetsResponse.d.ts +15 -0
- package/dist/cjs/api/types/PaginatedTermSetsResponse.js +5 -0
- package/dist/cjs/api/types/Severity.d.ts +9 -0
- package/dist/cjs/api/types/Severity.js +11 -0
- package/dist/cjs/api/types/StyleGuideResponse.d.ts +2 -0
- package/dist/cjs/api/types/Suggestion.d.ts +1 -0
- package/dist/cjs/api/types/TermCreateRequest.d.ts +11 -0
- package/dist/cjs/api/types/TermCreateRequest.js +5 -0
- package/dist/cjs/api/types/TermDetail.d.ts +16 -0
- package/dist/cjs/api/types/TermDetail.js +5 -0
- package/dist/cjs/api/types/TermItem.d.ts +7 -0
- package/dist/cjs/api/types/TermItem.js +5 -0
- package/dist/cjs/api/types/TermResponse.d.ts +16 -0
- package/dist/cjs/api/types/TermResponse.js +5 -0
- package/dist/cjs/api/types/TermSetResponse.d.ts +14 -0
- package/dist/cjs/api/types/TermSetResponse.js +5 -0
- package/dist/cjs/api/types/TermSetResult.d.ts +9 -0
- package/dist/cjs/api/types/TermSetResult.js +5 -0
- package/dist/cjs/api/types/TermSetWithTerms.d.ts +17 -0
- package/dist/cjs/api/types/TermSetWithTerms.js +5 -0
- package/dist/cjs/api/types/TermType.d.ts +12 -0
- package/dist/cjs/api/types/TermType.js +11 -0
- package/dist/cjs/api/types/TerminologySearchResponse.d.ts +7 -0
- package/dist/cjs/api/types/TerminologySearchResponse.js +5 -0
- package/dist/cjs/api/types/index.d.ts +16 -0
- package/dist/cjs/api/types/index.js +16 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/styleGuides/client/Client.d.mts +4 -6
- package/dist/esm/api/resources/styleGuides/client/Client.mjs +11 -8
- package/dist/esm/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.mts +13 -0
- package/dist/esm/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.mts +2 -0
- package/dist/esm/api/resources/styleGuides/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/terminology/client/Client.d.mts +333 -0
- package/dist/esm/api/resources/terminology/client/Client.mjs +1277 -0
- package/dist/esm/api/resources/terminology/client/index.d.mts +2 -0
- package/dist/esm/api/resources/terminology/client/index.mjs +1 -0
- package/dist/esm/api/resources/terminology/client/requests/BodyTerminologyImportTerminology.d.mts +17 -0
- package/dist/esm/api/resources/terminology/client/requests/BodyTerminologyImportTerminology.mjs +4 -0
- package/dist/esm/api/resources/{styleGuides/client/requests/BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.d.mts → terminology/client/requests/DomainCreateRequest.d.mts} +2 -2
- package/dist/esm/api/resources/terminology/client/requests/DomainCreateRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/DomainUpdateRequest.d.mts +11 -0
- package/dist/esm/api/resources/terminology/client/requests/DomainUpdateRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TermSetCreateRequest.d.mts +15 -0
- package/dist/esm/api/resources/terminology/client/requests/TermSetCreateRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TermSetUpdateRequest.d.mts +11 -0
- package/dist/esm/api/resources/terminology/client/requests/TermSetUpdateRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TermUpdateRequest.d.mts +15 -0
- package/dist/esm/api/resources/terminology/client/requests/TermUpdateRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologyListDomainsRequest.d.mts +19 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologyListDomainsRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologyListTermSetsRequest.d.mts +21 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologyListTermSetsRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologySearchTerminologyRequest.d.mts +14 -0
- package/dist/esm/api/resources/terminology/client/requests/TerminologySearchTerminologyRequest.mjs +4 -0
- package/dist/esm/api/resources/terminology/client/requests/index.d.mts +9 -0
- package/dist/esm/api/resources/terminology/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/terminology/index.d.mts +1 -0
- package/dist/esm/api/resources/terminology/index.mjs +1 -0
- package/dist/esm/api/types/ConsistencyCategory.d.mts +1 -4
- package/dist/esm/api/types/ConsistencyCategory.mjs +0 -3
- package/dist/esm/api/types/DomainResponse.d.mts +13 -0
- package/dist/esm/api/types/DomainResponse.mjs +4 -0
- package/dist/esm/api/types/DomainSummary.d.mts +7 -0
- package/dist/esm/api/types/DomainSummary.mjs +4 -0
- package/dist/esm/api/types/ImportSummary.d.mts +12 -0
- package/dist/esm/api/types/ImportSummary.mjs +4 -0
- package/dist/esm/api/types/Issue.d.mts +1 -0
- package/dist/esm/api/types/MatchedTerm.d.mts +7 -0
- package/dist/esm/api/types/MatchedTerm.mjs +4 -0
- package/dist/esm/api/types/PaginatedDomainsResponse.d.mts +11 -0
- package/dist/esm/api/types/PaginatedDomainsResponse.mjs +4 -0
- package/dist/esm/api/types/PaginatedTermSetsResponse.d.mts +15 -0
- package/dist/esm/api/types/PaginatedTermSetsResponse.mjs +4 -0
- package/dist/esm/api/types/Severity.d.mts +9 -0
- package/dist/esm/api/types/Severity.mjs +8 -0
- package/dist/esm/api/types/StyleGuideResponse.d.mts +2 -0
- package/dist/esm/api/types/Suggestion.d.mts +1 -0
- package/dist/esm/api/types/TermCreateRequest.d.mts +11 -0
- package/dist/esm/api/types/TermCreateRequest.mjs +4 -0
- package/dist/esm/api/types/TermDetail.d.mts +16 -0
- package/dist/esm/api/types/TermDetail.mjs +4 -0
- package/dist/esm/api/types/TermItem.d.mts +7 -0
- package/dist/esm/api/types/TermItem.mjs +4 -0
- package/dist/esm/api/types/TermResponse.d.mts +16 -0
- package/dist/esm/api/types/TermResponse.mjs +4 -0
- package/dist/esm/api/types/TermSetResponse.d.mts +14 -0
- package/dist/esm/api/types/TermSetResponse.mjs +4 -0
- package/dist/esm/api/types/TermSetResult.d.mts +9 -0
- package/dist/esm/api/types/TermSetResult.mjs +4 -0
- package/dist/esm/api/types/TermSetWithTerms.d.mts +17 -0
- package/dist/esm/api/types/TermSetWithTerms.mjs +4 -0
- package/dist/esm/api/types/TermType.d.mts +12 -0
- package/dist/esm/api/types/TermType.mjs +8 -0
- package/dist/esm/api/types/TerminologySearchResponse.d.mts +7 -0
- package/dist/esm/api/types/TerminologySearchResponse.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +16 -0
- package/dist/esm/api/types/index.mjs +16 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +998 -5
- /package/dist/cjs/api/resources/styleGuides/client/requests/{BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.js → BodyStyleGuidesUpdateStyleGuide.js} +0 -0
- /package/dist/esm/api/resources/styleGuides/client/requests/{BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.mjs → BodyStyleGuidesUpdateStyleGuide.mjs} +0 -0
|
@@ -0,0 +1,1277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../core/index.mjs";
|
|
15
|
+
import * as MarkupAI from "../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
18
|
+
/**
|
|
19
|
+
* Manage term sets and terms.
|
|
20
|
+
*/
|
|
21
|
+
export class Terminology {
|
|
22
|
+
constructor(_options) {
|
|
23
|
+
this._options = _options;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Exports all term sets, terms and domains to CSV. The exported CSV follows the same format as the CSV import.
|
|
27
|
+
*
|
|
28
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
31
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
32
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await client.terminology.exportTerminology()
|
|
36
|
+
*/
|
|
37
|
+
exportTerminology(requestOptions) {
|
|
38
|
+
return core.HttpResponsePromise.fromPromise(this.__exportTerminology(requestOptions));
|
|
39
|
+
}
|
|
40
|
+
__exportTerminology(requestOptions) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
var _a, _b, _c, _d;
|
|
43
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
44
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
45
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology"),
|
|
46
|
+
method: "GET",
|
|
47
|
+
headers: _headers,
|
|
48
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
49
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
50
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
51
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
52
|
+
});
|
|
53
|
+
if (_response.ok) {
|
|
54
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
55
|
+
}
|
|
56
|
+
if (_response.error.reason === "status-code") {
|
|
57
|
+
switch (_response.error.statusCode) {
|
|
58
|
+
case 401:
|
|
59
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
60
|
+
case 403:
|
|
61
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
62
|
+
case 500:
|
|
63
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
64
|
+
default:
|
|
65
|
+
throw new errors.MarkupAIError({
|
|
66
|
+
statusCode: _response.error.statusCode,
|
|
67
|
+
body: _response.error.body,
|
|
68
|
+
rawResponse: _response.rawResponse,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
switch (_response.error.reason) {
|
|
73
|
+
case "non-json":
|
|
74
|
+
throw new errors.MarkupAIError({
|
|
75
|
+
statusCode: _response.error.statusCode,
|
|
76
|
+
body: _response.error.rawBody,
|
|
77
|
+
rawResponse: _response.rawResponse,
|
|
78
|
+
});
|
|
79
|
+
case "timeout":
|
|
80
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology.");
|
|
81
|
+
case "unknown":
|
|
82
|
+
throw new errors.MarkupAIError({
|
|
83
|
+
message: _response.error.errorMessage,
|
|
84
|
+
rawResponse: _response.rawResponse,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Uploads a CSV or ACTIF XML file and imports terminology.
|
|
91
|
+
*
|
|
92
|
+
* **CSV Format Requirements:**
|
|
93
|
+
* - CSV must include columns: Prohibited, Preferred, Context-Dependent, Instructions, Domains
|
|
94
|
+
* - The first row must contain the column headers in the exact same order as shown above
|
|
95
|
+
* - Multiple values within a single cell should be separated by semicolons with a space (e.g., term1; term2; term3)
|
|
96
|
+
* - Empty cells are allowed
|
|
97
|
+
* - The CSV import format is the same as the CSV export format.
|
|
98
|
+
*
|
|
99
|
+
* @param {MarkupAI.BodyTerminologyImportTerminology} request
|
|
100
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
101
|
+
*
|
|
102
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
103
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
104
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
105
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* import { createReadStream } from "fs";
|
|
109
|
+
* await client.terminology.importTerminology({
|
|
110
|
+
* file: fs.createReadStream("/path/to/your/file"),
|
|
111
|
+
* delete_existing: true
|
|
112
|
+
* })
|
|
113
|
+
*/
|
|
114
|
+
importTerminology(request, requestOptions) {
|
|
115
|
+
return core.HttpResponsePromise.fromPromise(this.__importTerminology(request, requestOptions));
|
|
116
|
+
}
|
|
117
|
+
__importTerminology(request, requestOptions) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
var _a, _b, _c, _d;
|
|
120
|
+
const _queryParams = {};
|
|
121
|
+
if (request.delete_existing != null) {
|
|
122
|
+
_queryParams["delete_existing"] = request.delete_existing.toString();
|
|
123
|
+
}
|
|
124
|
+
const _request = yield core.newFormData();
|
|
125
|
+
yield _request.appendFile("file", request.file);
|
|
126
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
127
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
128
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
129
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology"),
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: _headers,
|
|
132
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
133
|
+
requestType: "file",
|
|
134
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
135
|
+
body: _maybeEncodedRequest.body,
|
|
136
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
137
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
138
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
139
|
+
});
|
|
140
|
+
if (_response.ok) {
|
|
141
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
142
|
+
}
|
|
143
|
+
if (_response.error.reason === "status-code") {
|
|
144
|
+
switch (_response.error.statusCode) {
|
|
145
|
+
case 401:
|
|
146
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
147
|
+
case 403:
|
|
148
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
149
|
+
case 422:
|
|
150
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
151
|
+
case 500:
|
|
152
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
153
|
+
default:
|
|
154
|
+
throw new errors.MarkupAIError({
|
|
155
|
+
statusCode: _response.error.statusCode,
|
|
156
|
+
body: _response.error.body,
|
|
157
|
+
rawResponse: _response.rawResponse,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
switch (_response.error.reason) {
|
|
162
|
+
case "non-json":
|
|
163
|
+
throw new errors.MarkupAIError({
|
|
164
|
+
statusCode: _response.error.statusCode,
|
|
165
|
+
body: _response.error.rawBody,
|
|
166
|
+
rawResponse: _response.rawResponse,
|
|
167
|
+
});
|
|
168
|
+
case "timeout":
|
|
169
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling POST /v1/terminology.");
|
|
170
|
+
case "unknown":
|
|
171
|
+
throw new errors.MarkupAIError({
|
|
172
|
+
message: _response.error.errorMessage,
|
|
173
|
+
rawResponse: _response.rawResponse,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Searches the text for relevant terminology and returns matched term sets.
|
|
180
|
+
*
|
|
181
|
+
* Term sets are matched if any word sequence (up to 5 words) in the text is similar to one of the terms of the term set.
|
|
182
|
+
* The similarity measure used is a trigram similarity of 0.5 or higher between the word sequence and the term.
|
|
183
|
+
*
|
|
184
|
+
* @param {MarkupAI.TerminologySearchTerminologyRequest} request
|
|
185
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
186
|
+
*
|
|
187
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
188
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
189
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
190
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* await client.terminology.searchTerminology({
|
|
194
|
+
* query: "query"
|
|
195
|
+
* })
|
|
196
|
+
*/
|
|
197
|
+
searchTerminology(request, requestOptions) {
|
|
198
|
+
return core.HttpResponsePromise.fromPromise(this.__searchTerminology(request, requestOptions));
|
|
199
|
+
}
|
|
200
|
+
__searchTerminology(request, requestOptions) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
const { query, domain_ids: domainIds } = request;
|
|
204
|
+
const _queryParams = {};
|
|
205
|
+
_queryParams["query"] = query;
|
|
206
|
+
if (domainIds != null) {
|
|
207
|
+
if (Array.isArray(domainIds)) {
|
|
208
|
+
_queryParams["domain_ids"] = domainIds.map((item) => item);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
_queryParams["domain_ids"] = domainIds;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
215
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
216
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology/search"),
|
|
217
|
+
method: "GET",
|
|
218
|
+
headers: _headers,
|
|
219
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
220
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
221
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
222
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
223
|
+
});
|
|
224
|
+
if (_response.ok) {
|
|
225
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
226
|
+
}
|
|
227
|
+
if (_response.error.reason === "status-code") {
|
|
228
|
+
switch (_response.error.statusCode) {
|
|
229
|
+
case 401:
|
|
230
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
231
|
+
case 403:
|
|
232
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
233
|
+
case 422:
|
|
234
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
235
|
+
case 500:
|
|
236
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
237
|
+
default:
|
|
238
|
+
throw new errors.MarkupAIError({
|
|
239
|
+
statusCode: _response.error.statusCode,
|
|
240
|
+
body: _response.error.body,
|
|
241
|
+
rawResponse: _response.rawResponse,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
switch (_response.error.reason) {
|
|
246
|
+
case "non-json":
|
|
247
|
+
throw new errors.MarkupAIError({
|
|
248
|
+
statusCode: _response.error.statusCode,
|
|
249
|
+
body: _response.error.rawBody,
|
|
250
|
+
rawResponse: _response.rawResponse,
|
|
251
|
+
});
|
|
252
|
+
case "timeout":
|
|
253
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/search.");
|
|
254
|
+
case "unknown":
|
|
255
|
+
throw new errors.MarkupAIError({
|
|
256
|
+
message: _response.error.errorMessage,
|
|
257
|
+
rawResponse: _response.rawResponse,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Get a pageable list of term sets with all their associated terms and domains.
|
|
264
|
+
*
|
|
265
|
+
* The search filter searches the term set instructions and term text fields.
|
|
266
|
+
*
|
|
267
|
+
* @param {MarkupAI.TerminologyListTermSetsRequest} request
|
|
268
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
269
|
+
*
|
|
270
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
271
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
272
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
273
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* await client.terminology.listTermSets({
|
|
277
|
+
* page: 1,
|
|
278
|
+
* page_size: 1,
|
|
279
|
+
* search_term: "search_term"
|
|
280
|
+
* })
|
|
281
|
+
*/
|
|
282
|
+
listTermSets(request = {}, requestOptions) {
|
|
283
|
+
return core.HttpResponsePromise.fromPromise(this.__listTermSets(request, requestOptions));
|
|
284
|
+
}
|
|
285
|
+
__listTermSets() {
|
|
286
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
287
|
+
var _a, _b, _c, _d;
|
|
288
|
+
const { page, page_size: pageSize, search_term: searchTerm, domain_ids: domainIds } = request;
|
|
289
|
+
const _queryParams = {};
|
|
290
|
+
if (page != null) {
|
|
291
|
+
_queryParams["page"] = page.toString();
|
|
292
|
+
}
|
|
293
|
+
if (pageSize != null) {
|
|
294
|
+
_queryParams["page_size"] = pageSize.toString();
|
|
295
|
+
}
|
|
296
|
+
if (searchTerm != null) {
|
|
297
|
+
_queryParams["search_term"] = searchTerm;
|
|
298
|
+
}
|
|
299
|
+
if (domainIds != null) {
|
|
300
|
+
if (Array.isArray(domainIds)) {
|
|
301
|
+
_queryParams["domain_ids"] = domainIds.map((item) => item);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
_queryParams["domain_ids"] = domainIds;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
308
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
309
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology/term-sets"),
|
|
310
|
+
method: "GET",
|
|
311
|
+
headers: _headers,
|
|
312
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
313
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
315
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
316
|
+
});
|
|
317
|
+
if (_response.ok) {
|
|
318
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
319
|
+
}
|
|
320
|
+
if (_response.error.reason === "status-code") {
|
|
321
|
+
switch (_response.error.statusCode) {
|
|
322
|
+
case 401:
|
|
323
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
324
|
+
case 403:
|
|
325
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
326
|
+
case 422:
|
|
327
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
328
|
+
case 500:
|
|
329
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
330
|
+
default:
|
|
331
|
+
throw new errors.MarkupAIError({
|
|
332
|
+
statusCode: _response.error.statusCode,
|
|
333
|
+
body: _response.error.body,
|
|
334
|
+
rawResponse: _response.rawResponse,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
switch (_response.error.reason) {
|
|
339
|
+
case "non-json":
|
|
340
|
+
throw new errors.MarkupAIError({
|
|
341
|
+
statusCode: _response.error.statusCode,
|
|
342
|
+
body: _response.error.rawBody,
|
|
343
|
+
rawResponse: _response.rawResponse,
|
|
344
|
+
});
|
|
345
|
+
case "timeout":
|
|
346
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/term-sets.");
|
|
347
|
+
case "unknown":
|
|
348
|
+
throw new errors.MarkupAIError({
|
|
349
|
+
message: _response.error.errorMessage,
|
|
350
|
+
rawResponse: _response.rawResponse,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Create a new term set. Terms and domains are linked to term sets.
|
|
357
|
+
* The term set instructions text will be used to determine whether a term should be flagged in the text and what the term replacement should be.
|
|
358
|
+
*
|
|
359
|
+
* @param {MarkupAI.TermSetCreateRequest} request
|
|
360
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
361
|
+
*
|
|
362
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
363
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
364
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
365
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* await client.terminology.createTermSet({
|
|
369
|
+
* instructions: "instructions"
|
|
370
|
+
* })
|
|
371
|
+
*/
|
|
372
|
+
createTermSet(request, requestOptions) {
|
|
373
|
+
return core.HttpResponsePromise.fromPromise(this.__createTermSet(request, requestOptions));
|
|
374
|
+
}
|
|
375
|
+
__createTermSet(request, requestOptions) {
|
|
376
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
377
|
+
var _a, _b, _c, _d;
|
|
378
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
379
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
380
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology/term-sets"),
|
|
381
|
+
method: "POST",
|
|
382
|
+
headers: _headers,
|
|
383
|
+
contentType: "application/json",
|
|
384
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
385
|
+
requestType: "json",
|
|
386
|
+
body: request,
|
|
387
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
388
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
389
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
390
|
+
});
|
|
391
|
+
if (_response.ok) {
|
|
392
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
393
|
+
}
|
|
394
|
+
if (_response.error.reason === "status-code") {
|
|
395
|
+
switch (_response.error.statusCode) {
|
|
396
|
+
case 401:
|
|
397
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
398
|
+
case 403:
|
|
399
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
400
|
+
case 422:
|
|
401
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
402
|
+
case 500:
|
|
403
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
404
|
+
default:
|
|
405
|
+
throw new errors.MarkupAIError({
|
|
406
|
+
statusCode: _response.error.statusCode,
|
|
407
|
+
body: _response.error.body,
|
|
408
|
+
rawResponse: _response.rawResponse,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
switch (_response.error.reason) {
|
|
413
|
+
case "non-json":
|
|
414
|
+
throw new errors.MarkupAIError({
|
|
415
|
+
statusCode: _response.error.statusCode,
|
|
416
|
+
body: _response.error.rawBody,
|
|
417
|
+
rawResponse: _response.rawResponse,
|
|
418
|
+
});
|
|
419
|
+
case "timeout":
|
|
420
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling POST /v1/terminology/term-sets.");
|
|
421
|
+
case "unknown":
|
|
422
|
+
throw new errors.MarkupAIError({
|
|
423
|
+
message: _response.error.errorMessage,
|
|
424
|
+
rawResponse: _response.rawResponse,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @param {string} termSetId - UUID of the term set
|
|
431
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
432
|
+
*
|
|
433
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
434
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
435
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
436
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* await client.terminology.getTermSet("term_set_id")
|
|
440
|
+
*/
|
|
441
|
+
getTermSet(termSetId, requestOptions) {
|
|
442
|
+
return core.HttpResponsePromise.fromPromise(this.__getTermSet(termSetId, requestOptions));
|
|
443
|
+
}
|
|
444
|
+
__getTermSet(termSetId, requestOptions) {
|
|
445
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
446
|
+
var _a, _b, _c, _d;
|
|
447
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
448
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
449
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}`),
|
|
450
|
+
method: "GET",
|
|
451
|
+
headers: _headers,
|
|
452
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
453
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
454
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
455
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
456
|
+
});
|
|
457
|
+
if (_response.ok) {
|
|
458
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
459
|
+
}
|
|
460
|
+
if (_response.error.reason === "status-code") {
|
|
461
|
+
switch (_response.error.statusCode) {
|
|
462
|
+
case 401:
|
|
463
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
464
|
+
case 403:
|
|
465
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
466
|
+
case 422:
|
|
467
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
468
|
+
case 500:
|
|
469
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
470
|
+
default:
|
|
471
|
+
throw new errors.MarkupAIError({
|
|
472
|
+
statusCode: _response.error.statusCode,
|
|
473
|
+
body: _response.error.body,
|
|
474
|
+
rawResponse: _response.rawResponse,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
switch (_response.error.reason) {
|
|
479
|
+
case "non-json":
|
|
480
|
+
throw new errors.MarkupAIError({
|
|
481
|
+
statusCode: _response.error.statusCode,
|
|
482
|
+
body: _response.error.rawBody,
|
|
483
|
+
rawResponse: _response.rawResponse,
|
|
484
|
+
});
|
|
485
|
+
case "timeout":
|
|
486
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/term-sets/{term_set_id}.");
|
|
487
|
+
case "unknown":
|
|
488
|
+
throw new errors.MarkupAIError({
|
|
489
|
+
message: _response.error.errorMessage,
|
|
490
|
+
rawResponse: _response.rawResponse,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* @param {string} termSetId - UUID of the term set
|
|
497
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
498
|
+
*
|
|
499
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
500
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
501
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
502
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* await client.terminology.deleteTermSet("term_set_id")
|
|
506
|
+
*/
|
|
507
|
+
deleteTermSet(termSetId, requestOptions) {
|
|
508
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteTermSet(termSetId, requestOptions));
|
|
509
|
+
}
|
|
510
|
+
__deleteTermSet(termSetId, requestOptions) {
|
|
511
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
512
|
+
var _a, _b, _c, _d;
|
|
513
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
514
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
515
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}`),
|
|
516
|
+
method: "DELETE",
|
|
517
|
+
headers: _headers,
|
|
518
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
519
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
520
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
521
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
522
|
+
});
|
|
523
|
+
if (_response.ok) {
|
|
524
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
525
|
+
}
|
|
526
|
+
if (_response.error.reason === "status-code") {
|
|
527
|
+
switch (_response.error.statusCode) {
|
|
528
|
+
case 401:
|
|
529
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
530
|
+
case 403:
|
|
531
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
532
|
+
case 422:
|
|
533
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
534
|
+
case 500:
|
|
535
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
536
|
+
default:
|
|
537
|
+
throw new errors.MarkupAIError({
|
|
538
|
+
statusCode: _response.error.statusCode,
|
|
539
|
+
body: _response.error.body,
|
|
540
|
+
rawResponse: _response.rawResponse,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
switch (_response.error.reason) {
|
|
545
|
+
case "non-json":
|
|
546
|
+
throw new errors.MarkupAIError({
|
|
547
|
+
statusCode: _response.error.statusCode,
|
|
548
|
+
body: _response.error.rawBody,
|
|
549
|
+
rawResponse: _response.rawResponse,
|
|
550
|
+
});
|
|
551
|
+
case "timeout":
|
|
552
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling DELETE /v1/terminology/term-sets/{term_set_id}.");
|
|
553
|
+
case "unknown":
|
|
554
|
+
throw new errors.MarkupAIError({
|
|
555
|
+
message: _response.error.errorMessage,
|
|
556
|
+
rawResponse: _response.rawResponse,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* @param {string} termSetId - UUID of the term set
|
|
563
|
+
* @param {MarkupAI.TermSetUpdateRequest} request
|
|
564
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
565
|
+
*
|
|
566
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
567
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
568
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
569
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* await client.terminology.updateTermSet("term_set_id")
|
|
573
|
+
*/
|
|
574
|
+
updateTermSet(termSetId, request = {}, requestOptions) {
|
|
575
|
+
return core.HttpResponsePromise.fromPromise(this.__updateTermSet(termSetId, request, requestOptions));
|
|
576
|
+
}
|
|
577
|
+
__updateTermSet(termSetId_1) {
|
|
578
|
+
return __awaiter(this, arguments, void 0, function* (termSetId, request = {}, requestOptions) {
|
|
579
|
+
var _a, _b, _c, _d;
|
|
580
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
581
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
582
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}`),
|
|
583
|
+
method: "PATCH",
|
|
584
|
+
headers: _headers,
|
|
585
|
+
contentType: "application/json",
|
|
586
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
587
|
+
requestType: "json",
|
|
588
|
+
body: request,
|
|
589
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
590
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
591
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
592
|
+
});
|
|
593
|
+
if (_response.ok) {
|
|
594
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
595
|
+
}
|
|
596
|
+
if (_response.error.reason === "status-code") {
|
|
597
|
+
switch (_response.error.statusCode) {
|
|
598
|
+
case 401:
|
|
599
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
600
|
+
case 403:
|
|
601
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
602
|
+
case 422:
|
|
603
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
604
|
+
case 500:
|
|
605
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
606
|
+
default:
|
|
607
|
+
throw new errors.MarkupAIError({
|
|
608
|
+
statusCode: _response.error.statusCode,
|
|
609
|
+
body: _response.error.body,
|
|
610
|
+
rawResponse: _response.rawResponse,
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
switch (_response.error.reason) {
|
|
615
|
+
case "non-json":
|
|
616
|
+
throw new errors.MarkupAIError({
|
|
617
|
+
statusCode: _response.error.statusCode,
|
|
618
|
+
body: _response.error.rawBody,
|
|
619
|
+
rawResponse: _response.rawResponse,
|
|
620
|
+
});
|
|
621
|
+
case "timeout":
|
|
622
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling PATCH /v1/terminology/term-sets/{term_set_id}.");
|
|
623
|
+
case "unknown":
|
|
624
|
+
throw new errors.MarkupAIError({
|
|
625
|
+
message: _response.error.errorMessage,
|
|
626
|
+
rawResponse: _response.rawResponse,
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Create terms that should be matched in the text. The term types are:
|
|
633
|
+
*
|
|
634
|
+
* * **preferred**: this is the preferred term for the associated term set
|
|
635
|
+
* * **prohibited**: this term should not be used to talk about the term set
|
|
636
|
+
* * **context_dependent**: this term is correct in certain cases, but incorrect in others, the instructions field of the term set should explain when the term is correct and when it is incorrect
|
|
637
|
+
*
|
|
638
|
+
* @param {string} termSetId - UUID of the term set
|
|
639
|
+
* @param {MarkupAI.TermCreateRequest} request
|
|
640
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
641
|
+
*
|
|
642
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
643
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
644
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
645
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* await client.terminology.createTerm("term_set_id", {
|
|
649
|
+
* term: "term",
|
|
650
|
+
* type: "preferred"
|
|
651
|
+
* })
|
|
652
|
+
*/
|
|
653
|
+
createTerm(termSetId, request, requestOptions) {
|
|
654
|
+
return core.HttpResponsePromise.fromPromise(this.__createTerm(termSetId, request, requestOptions));
|
|
655
|
+
}
|
|
656
|
+
__createTerm(termSetId, request, requestOptions) {
|
|
657
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
658
|
+
var _a, _b, _c, _d;
|
|
659
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
660
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
661
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}/terms`),
|
|
662
|
+
method: "POST",
|
|
663
|
+
headers: _headers,
|
|
664
|
+
contentType: "application/json",
|
|
665
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
666
|
+
requestType: "json",
|
|
667
|
+
body: request,
|
|
668
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
669
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
670
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
671
|
+
});
|
|
672
|
+
if (_response.ok) {
|
|
673
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
674
|
+
}
|
|
675
|
+
if (_response.error.reason === "status-code") {
|
|
676
|
+
switch (_response.error.statusCode) {
|
|
677
|
+
case 401:
|
|
678
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
679
|
+
case 403:
|
|
680
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
681
|
+
case 422:
|
|
682
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
683
|
+
case 500:
|
|
684
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
685
|
+
default:
|
|
686
|
+
throw new errors.MarkupAIError({
|
|
687
|
+
statusCode: _response.error.statusCode,
|
|
688
|
+
body: _response.error.body,
|
|
689
|
+
rawResponse: _response.rawResponse,
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
switch (_response.error.reason) {
|
|
694
|
+
case "non-json":
|
|
695
|
+
throw new errors.MarkupAIError({
|
|
696
|
+
statusCode: _response.error.statusCode,
|
|
697
|
+
body: _response.error.rawBody,
|
|
698
|
+
rawResponse: _response.rawResponse,
|
|
699
|
+
});
|
|
700
|
+
case "timeout":
|
|
701
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling POST /v1/terminology/term-sets/{term_set_id}/terms.");
|
|
702
|
+
case "unknown":
|
|
703
|
+
throw new errors.MarkupAIError({
|
|
704
|
+
message: _response.error.errorMessage,
|
|
705
|
+
rawResponse: _response.rawResponse,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* @param {string} termSetId - UUID of the term set
|
|
712
|
+
* @param {string} termId - UUID of the term
|
|
713
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
714
|
+
*
|
|
715
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
716
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
717
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
718
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* await client.terminology.getTerm("term_set_id", "term_id")
|
|
722
|
+
*/
|
|
723
|
+
getTerm(termSetId, termId, requestOptions) {
|
|
724
|
+
return core.HttpResponsePromise.fromPromise(this.__getTerm(termSetId, termId, requestOptions));
|
|
725
|
+
}
|
|
726
|
+
__getTerm(termSetId, termId, requestOptions) {
|
|
727
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
+
var _a, _b, _c, _d;
|
|
729
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
730
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
731
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}/terms/${encodeURIComponent(termId)}`),
|
|
732
|
+
method: "GET",
|
|
733
|
+
headers: _headers,
|
|
734
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
735
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
736
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
737
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
738
|
+
});
|
|
739
|
+
if (_response.ok) {
|
|
740
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
741
|
+
}
|
|
742
|
+
if (_response.error.reason === "status-code") {
|
|
743
|
+
switch (_response.error.statusCode) {
|
|
744
|
+
case 401:
|
|
745
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
746
|
+
case 403:
|
|
747
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
748
|
+
case 422:
|
|
749
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
750
|
+
case 500:
|
|
751
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
752
|
+
default:
|
|
753
|
+
throw new errors.MarkupAIError({
|
|
754
|
+
statusCode: _response.error.statusCode,
|
|
755
|
+
body: _response.error.body,
|
|
756
|
+
rawResponse: _response.rawResponse,
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
switch (_response.error.reason) {
|
|
761
|
+
case "non-json":
|
|
762
|
+
throw new errors.MarkupAIError({
|
|
763
|
+
statusCode: _response.error.statusCode,
|
|
764
|
+
body: _response.error.rawBody,
|
|
765
|
+
rawResponse: _response.rawResponse,
|
|
766
|
+
});
|
|
767
|
+
case "timeout":
|
|
768
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/term-sets/{term_set_id}/terms/{term_id}.");
|
|
769
|
+
case "unknown":
|
|
770
|
+
throw new errors.MarkupAIError({
|
|
771
|
+
message: _response.error.errorMessage,
|
|
772
|
+
rawResponse: _response.rawResponse,
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* @param {string} termSetId - UUID of the term set
|
|
779
|
+
* @param {string} termId - UUID of the term
|
|
780
|
+
* @param {MarkupAI.TermUpdateRequest} request
|
|
781
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
782
|
+
*
|
|
783
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
784
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
785
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
786
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
787
|
+
*
|
|
788
|
+
* @example
|
|
789
|
+
* await client.terminology.updateTerm("term_set_id", "term_id", {
|
|
790
|
+
* term: "term",
|
|
791
|
+
* type: "preferred"
|
|
792
|
+
* })
|
|
793
|
+
*/
|
|
794
|
+
updateTerm(termSetId, termId, request, requestOptions) {
|
|
795
|
+
return core.HttpResponsePromise.fromPromise(this.__updateTerm(termSetId, termId, request, requestOptions));
|
|
796
|
+
}
|
|
797
|
+
__updateTerm(termSetId, termId, request, requestOptions) {
|
|
798
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
799
|
+
var _a, _b, _c, _d;
|
|
800
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
801
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
802
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}/terms/${encodeURIComponent(termId)}`),
|
|
803
|
+
method: "PUT",
|
|
804
|
+
headers: _headers,
|
|
805
|
+
contentType: "application/json",
|
|
806
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
807
|
+
requestType: "json",
|
|
808
|
+
body: request,
|
|
809
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
810
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
811
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
812
|
+
});
|
|
813
|
+
if (_response.ok) {
|
|
814
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
815
|
+
}
|
|
816
|
+
if (_response.error.reason === "status-code") {
|
|
817
|
+
switch (_response.error.statusCode) {
|
|
818
|
+
case 401:
|
|
819
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
820
|
+
case 403:
|
|
821
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
822
|
+
case 422:
|
|
823
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
824
|
+
case 500:
|
|
825
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
826
|
+
default:
|
|
827
|
+
throw new errors.MarkupAIError({
|
|
828
|
+
statusCode: _response.error.statusCode,
|
|
829
|
+
body: _response.error.body,
|
|
830
|
+
rawResponse: _response.rawResponse,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
switch (_response.error.reason) {
|
|
835
|
+
case "non-json":
|
|
836
|
+
throw new errors.MarkupAIError({
|
|
837
|
+
statusCode: _response.error.statusCode,
|
|
838
|
+
body: _response.error.rawBody,
|
|
839
|
+
rawResponse: _response.rawResponse,
|
|
840
|
+
});
|
|
841
|
+
case "timeout":
|
|
842
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling PUT /v1/terminology/term-sets/{term_set_id}/terms/{term_id}.");
|
|
843
|
+
case "unknown":
|
|
844
|
+
throw new errors.MarkupAIError({
|
|
845
|
+
message: _response.error.errorMessage,
|
|
846
|
+
rawResponse: _response.rawResponse,
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* @param {string} termSetId - UUID of the term set
|
|
853
|
+
* @param {string} termId - UUID of the term
|
|
854
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
855
|
+
*
|
|
856
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
857
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
858
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
859
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* await client.terminology.deleteTerm("term_set_id", "term_id")
|
|
863
|
+
*/
|
|
864
|
+
deleteTerm(termSetId, termId, requestOptions) {
|
|
865
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteTerm(termSetId, termId, requestOptions));
|
|
866
|
+
}
|
|
867
|
+
__deleteTerm(termSetId, termId, requestOptions) {
|
|
868
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
869
|
+
var _a, _b, _c, _d;
|
|
870
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
871
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
872
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/term-sets/${encodeURIComponent(termSetId)}/terms/${encodeURIComponent(termId)}`),
|
|
873
|
+
method: "DELETE",
|
|
874
|
+
headers: _headers,
|
|
875
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
876
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
877
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
878
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
879
|
+
});
|
|
880
|
+
if (_response.ok) {
|
|
881
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
882
|
+
}
|
|
883
|
+
if (_response.error.reason === "status-code") {
|
|
884
|
+
switch (_response.error.statusCode) {
|
|
885
|
+
case 401:
|
|
886
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
887
|
+
case 403:
|
|
888
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
889
|
+
case 422:
|
|
890
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
891
|
+
case 500:
|
|
892
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
893
|
+
default:
|
|
894
|
+
throw new errors.MarkupAIError({
|
|
895
|
+
statusCode: _response.error.statusCode,
|
|
896
|
+
body: _response.error.body,
|
|
897
|
+
rawResponse: _response.rawResponse,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
switch (_response.error.reason) {
|
|
902
|
+
case "non-json":
|
|
903
|
+
throw new errors.MarkupAIError({
|
|
904
|
+
statusCode: _response.error.statusCode,
|
|
905
|
+
body: _response.error.rawBody,
|
|
906
|
+
rawResponse: _response.rawResponse,
|
|
907
|
+
});
|
|
908
|
+
case "timeout":
|
|
909
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling DELETE /v1/terminology/term-sets/{term_set_id}/terms/{term_id}.");
|
|
910
|
+
case "unknown":
|
|
911
|
+
throw new errors.MarkupAIError({
|
|
912
|
+
message: _response.error.errorMessage,
|
|
913
|
+
rawResponse: _response.rawResponse,
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* @param {MarkupAI.TerminologyListDomainsRequest} request
|
|
920
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
921
|
+
*
|
|
922
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
923
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
924
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
925
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* await client.terminology.listDomains({
|
|
929
|
+
* page: 1,
|
|
930
|
+
* page_size: 1,
|
|
931
|
+
* search: "search"
|
|
932
|
+
* })
|
|
933
|
+
*/
|
|
934
|
+
listDomains(request = {}, requestOptions) {
|
|
935
|
+
return core.HttpResponsePromise.fromPromise(this.__listDomains(request, requestOptions));
|
|
936
|
+
}
|
|
937
|
+
__listDomains() {
|
|
938
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
939
|
+
var _a, _b, _c, _d;
|
|
940
|
+
const { page, page_size: pageSize, search } = request;
|
|
941
|
+
const _queryParams = {};
|
|
942
|
+
if (page != null) {
|
|
943
|
+
_queryParams["page"] = page.toString();
|
|
944
|
+
}
|
|
945
|
+
if (pageSize != null) {
|
|
946
|
+
_queryParams["page_size"] = pageSize.toString();
|
|
947
|
+
}
|
|
948
|
+
if (search != null) {
|
|
949
|
+
_queryParams["search"] = search;
|
|
950
|
+
}
|
|
951
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
952
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
953
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology/domains"),
|
|
954
|
+
method: "GET",
|
|
955
|
+
headers: _headers,
|
|
956
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
957
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
958
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
959
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
960
|
+
});
|
|
961
|
+
if (_response.ok) {
|
|
962
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
963
|
+
}
|
|
964
|
+
if (_response.error.reason === "status-code") {
|
|
965
|
+
switch (_response.error.statusCode) {
|
|
966
|
+
case 401:
|
|
967
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
968
|
+
case 403:
|
|
969
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
970
|
+
case 422:
|
|
971
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
972
|
+
case 500:
|
|
973
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
974
|
+
default:
|
|
975
|
+
throw new errors.MarkupAIError({
|
|
976
|
+
statusCode: _response.error.statusCode,
|
|
977
|
+
body: _response.error.body,
|
|
978
|
+
rawResponse: _response.rawResponse,
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
switch (_response.error.reason) {
|
|
983
|
+
case "non-json":
|
|
984
|
+
throw new errors.MarkupAIError({
|
|
985
|
+
statusCode: _response.error.statusCode,
|
|
986
|
+
body: _response.error.rawBody,
|
|
987
|
+
rawResponse: _response.rawResponse,
|
|
988
|
+
});
|
|
989
|
+
case "timeout":
|
|
990
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/domains.");
|
|
991
|
+
case "unknown":
|
|
992
|
+
throw new errors.MarkupAIError({
|
|
993
|
+
message: _response.error.errorMessage,
|
|
994
|
+
rawResponse: _response.rawResponse,
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* @param {MarkupAI.DomainCreateRequest} request
|
|
1001
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
1002
|
+
*
|
|
1003
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
1004
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
1005
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
1006
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
1007
|
+
*
|
|
1008
|
+
* @example
|
|
1009
|
+
* await client.terminology.createDomain({
|
|
1010
|
+
* name: "name"
|
|
1011
|
+
* })
|
|
1012
|
+
*/
|
|
1013
|
+
createDomain(request, requestOptions) {
|
|
1014
|
+
return core.HttpResponsePromise.fromPromise(this.__createDomain(request, requestOptions));
|
|
1015
|
+
}
|
|
1016
|
+
__createDomain(request, requestOptions) {
|
|
1017
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1018
|
+
var _a, _b, _c, _d;
|
|
1019
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1020
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
1021
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, "v1/terminology/domains"),
|
|
1022
|
+
method: "POST",
|
|
1023
|
+
headers: _headers,
|
|
1024
|
+
contentType: "application/json",
|
|
1025
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1026
|
+
requestType: "json",
|
|
1027
|
+
body: request,
|
|
1028
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
1029
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
1030
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1031
|
+
});
|
|
1032
|
+
if (_response.ok) {
|
|
1033
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1034
|
+
}
|
|
1035
|
+
if (_response.error.reason === "status-code") {
|
|
1036
|
+
switch (_response.error.statusCode) {
|
|
1037
|
+
case 401:
|
|
1038
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1039
|
+
case 403:
|
|
1040
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1041
|
+
case 422:
|
|
1042
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1043
|
+
case 500:
|
|
1044
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1045
|
+
default:
|
|
1046
|
+
throw new errors.MarkupAIError({
|
|
1047
|
+
statusCode: _response.error.statusCode,
|
|
1048
|
+
body: _response.error.body,
|
|
1049
|
+
rawResponse: _response.rawResponse,
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
switch (_response.error.reason) {
|
|
1054
|
+
case "non-json":
|
|
1055
|
+
throw new errors.MarkupAIError({
|
|
1056
|
+
statusCode: _response.error.statusCode,
|
|
1057
|
+
body: _response.error.rawBody,
|
|
1058
|
+
rawResponse: _response.rawResponse,
|
|
1059
|
+
});
|
|
1060
|
+
case "timeout":
|
|
1061
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling POST /v1/terminology/domains.");
|
|
1062
|
+
case "unknown":
|
|
1063
|
+
throw new errors.MarkupAIError({
|
|
1064
|
+
message: _response.error.errorMessage,
|
|
1065
|
+
rawResponse: _response.rawResponse,
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* @param {string} domainId - UUID of the domain
|
|
1072
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
1073
|
+
*
|
|
1074
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
1075
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
1076
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
1077
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* await client.terminology.getDomain("domain_id")
|
|
1081
|
+
*/
|
|
1082
|
+
getDomain(domainId, requestOptions) {
|
|
1083
|
+
return core.HttpResponsePromise.fromPromise(this.__getDomain(domainId, requestOptions));
|
|
1084
|
+
}
|
|
1085
|
+
__getDomain(domainId, requestOptions) {
|
|
1086
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1087
|
+
var _a, _b, _c, _d;
|
|
1088
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1089
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
1090
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/domains/${encodeURIComponent(domainId)}`),
|
|
1091
|
+
method: "GET",
|
|
1092
|
+
headers: _headers,
|
|
1093
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1094
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
1095
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
1096
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1097
|
+
});
|
|
1098
|
+
if (_response.ok) {
|
|
1099
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1100
|
+
}
|
|
1101
|
+
if (_response.error.reason === "status-code") {
|
|
1102
|
+
switch (_response.error.statusCode) {
|
|
1103
|
+
case 401:
|
|
1104
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1105
|
+
case 403:
|
|
1106
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1107
|
+
case 422:
|
|
1108
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1109
|
+
case 500:
|
|
1110
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1111
|
+
default:
|
|
1112
|
+
throw new errors.MarkupAIError({
|
|
1113
|
+
statusCode: _response.error.statusCode,
|
|
1114
|
+
body: _response.error.body,
|
|
1115
|
+
rawResponse: _response.rawResponse,
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
switch (_response.error.reason) {
|
|
1120
|
+
case "non-json":
|
|
1121
|
+
throw new errors.MarkupAIError({
|
|
1122
|
+
statusCode: _response.error.statusCode,
|
|
1123
|
+
body: _response.error.rawBody,
|
|
1124
|
+
rawResponse: _response.rawResponse,
|
|
1125
|
+
});
|
|
1126
|
+
case "timeout":
|
|
1127
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling GET /v1/terminology/domains/{domain_id}.");
|
|
1128
|
+
case "unknown":
|
|
1129
|
+
throw new errors.MarkupAIError({
|
|
1130
|
+
message: _response.error.errorMessage,
|
|
1131
|
+
rawResponse: _response.rawResponse,
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* @param {string} domainId - UUID of the domain
|
|
1138
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
1139
|
+
*
|
|
1140
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
1141
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
1142
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
1143
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
1144
|
+
*
|
|
1145
|
+
* @example
|
|
1146
|
+
* await client.terminology.deleteDomain("domain_id")
|
|
1147
|
+
*/
|
|
1148
|
+
deleteDomain(domainId, requestOptions) {
|
|
1149
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteDomain(domainId, requestOptions));
|
|
1150
|
+
}
|
|
1151
|
+
__deleteDomain(domainId, requestOptions) {
|
|
1152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1153
|
+
var _a, _b, _c, _d;
|
|
1154
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1155
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
1156
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/domains/${encodeURIComponent(domainId)}`),
|
|
1157
|
+
method: "DELETE",
|
|
1158
|
+
headers: _headers,
|
|
1159
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1160
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
1161
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
1162
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1163
|
+
});
|
|
1164
|
+
if (_response.ok) {
|
|
1165
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
1166
|
+
}
|
|
1167
|
+
if (_response.error.reason === "status-code") {
|
|
1168
|
+
switch (_response.error.statusCode) {
|
|
1169
|
+
case 401:
|
|
1170
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1171
|
+
case 403:
|
|
1172
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1173
|
+
case 422:
|
|
1174
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1175
|
+
case 500:
|
|
1176
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1177
|
+
default:
|
|
1178
|
+
throw new errors.MarkupAIError({
|
|
1179
|
+
statusCode: _response.error.statusCode,
|
|
1180
|
+
body: _response.error.body,
|
|
1181
|
+
rawResponse: _response.rawResponse,
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
switch (_response.error.reason) {
|
|
1186
|
+
case "non-json":
|
|
1187
|
+
throw new errors.MarkupAIError({
|
|
1188
|
+
statusCode: _response.error.statusCode,
|
|
1189
|
+
body: _response.error.rawBody,
|
|
1190
|
+
rawResponse: _response.rawResponse,
|
|
1191
|
+
});
|
|
1192
|
+
case "timeout":
|
|
1193
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling DELETE /v1/terminology/domains/{domain_id}.");
|
|
1194
|
+
case "unknown":
|
|
1195
|
+
throw new errors.MarkupAIError({
|
|
1196
|
+
message: _response.error.errorMessage,
|
|
1197
|
+
rawResponse: _response.rawResponse,
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* @param {string} domainId - UUID of the domain
|
|
1204
|
+
* @param {MarkupAI.DomainUpdateRequest} request
|
|
1205
|
+
* @param {Terminology.RequestOptions} requestOptions - Request-specific configuration.
|
|
1206
|
+
*
|
|
1207
|
+
* @throws {@link MarkupAI.UnauthorizedError}
|
|
1208
|
+
* @throws {@link MarkupAI.ForbiddenError}
|
|
1209
|
+
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
1210
|
+
* @throws {@link MarkupAI.InternalServerError}
|
|
1211
|
+
*
|
|
1212
|
+
* @example
|
|
1213
|
+
* await client.terminology.updateDomain("domain_id")
|
|
1214
|
+
*/
|
|
1215
|
+
updateDomain(domainId, request = {}, requestOptions) {
|
|
1216
|
+
return core.HttpResponsePromise.fromPromise(this.__updateDomain(domainId, request, requestOptions));
|
|
1217
|
+
}
|
|
1218
|
+
__updateDomain(domainId_1) {
|
|
1219
|
+
return __awaiter(this, arguments, void 0, function* (domainId, request = {}, requestOptions) {
|
|
1220
|
+
var _a, _b, _c, _d;
|
|
1221
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1222
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
1223
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.MarkupAIEnvironment.Default, `v1/terminology/domains/${encodeURIComponent(domainId)}`),
|
|
1224
|
+
method: "PATCH",
|
|
1225
|
+
headers: _headers,
|
|
1226
|
+
contentType: "application/json",
|
|
1227
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1228
|
+
requestType: "json",
|
|
1229
|
+
body: request,
|
|
1230
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
1231
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
1232
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1233
|
+
});
|
|
1234
|
+
if (_response.ok) {
|
|
1235
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1236
|
+
}
|
|
1237
|
+
if (_response.error.reason === "status-code") {
|
|
1238
|
+
switch (_response.error.statusCode) {
|
|
1239
|
+
case 401:
|
|
1240
|
+
throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1241
|
+
case 403:
|
|
1242
|
+
throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1243
|
+
case 422:
|
|
1244
|
+
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1245
|
+
case 500:
|
|
1246
|
+
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1247
|
+
default:
|
|
1248
|
+
throw new errors.MarkupAIError({
|
|
1249
|
+
statusCode: _response.error.statusCode,
|
|
1250
|
+
body: _response.error.body,
|
|
1251
|
+
rawResponse: _response.rawResponse,
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
switch (_response.error.reason) {
|
|
1256
|
+
case "non-json":
|
|
1257
|
+
throw new errors.MarkupAIError({
|
|
1258
|
+
statusCode: _response.error.statusCode,
|
|
1259
|
+
body: _response.error.rawBody,
|
|
1260
|
+
rawResponse: _response.rawResponse,
|
|
1261
|
+
});
|
|
1262
|
+
case "timeout":
|
|
1263
|
+
throw new errors.MarkupAITimeoutError("Timeout exceeded when calling PATCH /v1/terminology/domains/{domain_id}.");
|
|
1264
|
+
case "unknown":
|
|
1265
|
+
throw new errors.MarkupAIError({
|
|
1266
|
+
message: _response.error.errorMessage,
|
|
1267
|
+
rawResponse: _response.rawResponse,
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
_getAuthorizationHeader() {
|
|
1273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1274
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}
|