@magda/typescript-common 1.1.0-arm64.0 → 1.1.0-rc.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/AspectBuilder.d.ts +7 -0
- package/dist/AspectBuilder.js +3 -0
- package/dist/AspectBuilder.js.map +1 -0
- package/dist/AspectCreationFailure.d.ts +5 -0
- package/dist/AspectCreationFailure.js +10 -0
- package/dist/AspectCreationFailure.js.map +1 -0
- package/dist/AsyncPage.d.ts +18 -0
- package/dist/AsyncPage.js +140 -0
- package/dist/AsyncPage.js.map +1 -0
- package/dist/ConnectionResult.d.ts +16 -0
- package/dist/ConnectionResult.js +77 -0
- package/dist/ConnectionResult.js.map +1 -0
- package/dist/ConnectorRecordId.d.ts +15 -0
- package/dist/ConnectorRecordId.js +46 -0
- package/dist/ConnectorRecordId.js.map +1 -0
- package/dist/JsonConnector.d.ts +195 -0
- package/dist/JsonConnector.js +427 -0
- package/dist/JsonConnector.js.map +1 -0
- package/dist/JsonTransformer.d.ts +112 -0
- package/dist/JsonTransformer.js +225 -0
- package/dist/JsonTransformer.js.map +1 -0
- package/dist/OpaCompileResponseParser.d.ts +480 -0
- package/dist/OpaCompileResponseParser.js +1134 -0
- package/dist/OpaCompileResponseParser.js.map +1 -0
- package/dist/RecordCreationFailure.d.ts +7 -0
- package/dist/RecordCreationFailure.js +11 -0
- package/dist/RecordCreationFailure.js.map +1 -0
- package/dist/SimpleOpaSQLTranslator.d.ts +14 -0
- package/dist/SimpleOpaSQLTranslator.js +79 -0
- package/dist/SimpleOpaSQLTranslator.js.map +1 -0
- package/dist/addTrailingSlash.d.ts +1 -0
- package/dist/addTrailingSlash.js +15 -0
- package/dist/addTrailingSlash.js.map +1 -0
- package/dist/appendUrlSegments.d.ts +2 -0
- package/dist/appendUrlSegments.js +18 -0
- package/dist/appendUrlSegments.js.map +1 -0
- package/dist/authorization-api/AccessControlError.d.ts +4 -0
- package/dist/authorization-api/AccessControlError.js +13 -0
- package/dist/authorization-api/AccessControlError.js.map +1 -0
- package/dist/authorization-api/ApiClient.d.ts +141 -0
- package/dist/authorization-api/ApiClient.js +335 -0
- package/dist/authorization-api/ApiClient.js.map +1 -0
- package/dist/authorization-api/AuthError.d.ts +4 -0
- package/dist/authorization-api/AuthError.js +13 -0
- package/dist/authorization-api/AuthError.js.map +1 -0
- package/dist/authorization-api/GenericError.d.ts +9 -0
- package/dist/authorization-api/GenericError.js +17 -0
- package/dist/authorization-api/GenericError.js.map +1 -0
- package/dist/authorization-api/authMiddleware.d.ts +7 -0
- package/dist/authorization-api/authMiddleware.js +52 -0
- package/dist/authorization-api/authMiddleware.js.map +1 -0
- package/dist/authorization-api/model.d.ts +99 -0
- package/dist/authorization-api/model.js +3 -0
- package/dist/authorization-api/model.js.map +1 -0
- package/dist/coerceJson.d.ts +2 -0
- package/dist/coerceJson.js +13 -0
- package/dist/coerceJson.js.map +1 -0
- package/dist/createServiceError.d.ts +19 -0
- package/dist/createServiceError.js +45 -0
- package/dist/createServiceError.js.map +1 -0
- package/dist/delay.d.ts +2 -0
- package/dist/delay.js +9 -0
- package/dist/delay.js.map +1 -0
- package/dist/express/status.d.ts +30 -0
- package/dist/express/status.js +180 -0
- package/dist/express/status.js.map +1 -0
- package/dist/formatServiceError.d.ts +1 -0
- package/dist/formatServiceError.js +23 -0
- package/dist/formatServiceError.js.map +1 -0
- package/dist/generated/registry/api.d.ts +596 -0
- package/dist/generated/registry/api.js +2060 -0
- package/dist/generated/registry/api.js.map +1 -0
- package/dist/getAbsoluteUrl.d.ts +12 -0
- package/dist/getAbsoluteUrl.js +35 -0
- package/dist/getAbsoluteUrl.js.map +1 -0
- package/dist/getBasePathFromUrl.d.ts +10 -0
- package/dist/getBasePathFromUrl.js +27 -0
- package/dist/getBasePathFromUrl.js.map +1 -0
- package/dist/markdownToHtml.d.ts +3 -0
- package/dist/markdownToHtml.js +38 -0
- package/dist/markdownToHtml.js.map +1 -0
- package/dist/opa/OpaTypes.d.ts +41 -0
- package/dist/opa/OpaTypes.js +3 -0
- package/dist/opa/OpaTypes.js.map +1 -0
- package/dist/opa/getAuthDecision.d.ts +19 -0
- package/dist/opa/getAuthDecision.js +94 -0
- package/dist/opa/getAuthDecision.js.map +1 -0
- package/dist/opa/queryOpa.d.ts +1 -0
- package/dist/opa/queryOpa.js +41 -0
- package/dist/opa/queryOpa.js.map +1 -0
- package/dist/registry/AuthorizedRegistryClient.d.ts +29 -0
- package/dist/registry/AuthorizedRegistryClient.js +115 -0
- package/dist/registry/AuthorizedRegistryClient.js.map +1 -0
- package/dist/registry/RegistryClient.d.ts +36 -0
- package/dist/registry/RegistryClient.js +59 -0
- package/dist/registry/RegistryClient.js.map +1 -0
- package/dist/registry/TenantConsts.d.ts +31 -0
- package/dist/registry/TenantConsts.js +35 -0
- package/dist/registry/TenantConsts.js.map +1 -0
- package/dist/registry-manual/api.d.ts +9 -0
- package/dist/registry-manual/api.js +10 -0
- package/dist/registry-manual/api.js.map +1 -0
- package/dist/request.d.ts +3 -0
- package/dist/request.js +19 -0
- package/dist/request.js.map +1 -0
- package/dist/retry.d.ts +1 -0
- package/dist/retry.js +21 -0
- package/dist/retry.js.map +1 -0
- package/dist/retryBackoff.d.ts +1 -0
- package/dist/retryBackoff.js +21 -0
- package/dist/retryBackoff.js.map +1 -0
- package/dist/runLater.d.ts +1 -0
- package/dist/runLater.js +16 -0
- package/dist/runLater.js.map +1 -0
- package/dist/session/GetUserId.d.ts +5 -0
- package/dist/session/GetUserId.js +41 -0
- package/dist/session/GetUserId.js.map +1 -0
- package/dist/session/GetUserSession.d.ts +3 -0
- package/dist/session/GetUserSession.js +22 -0
- package/dist/session/GetUserSession.js.map +1 -0
- package/dist/session/addJwtSecretFromEnvVar.d.ts +14 -0
- package/dist/session/addJwtSecretFromEnvVar.js +23 -0
- package/dist/session/addJwtSecretFromEnvVar.js.map +1 -0
- package/dist/session/buildJwt.d.ts +1 -0
- package/dist/session/buildJwt.js +8 -0
- package/dist/session/buildJwt.js.map +1 -0
- package/dist/session/cookieUtils.d.ts +16 -0
- package/dist/session/cookieUtils.js +19 -0
- package/dist/session/cookieUtils.js.map +1 -0
- package/dist/session/destroySession.d.ts +10 -0
- package/dist/session/destroySession.js +44 -0
- package/dist/session/destroySession.js.map +1 -0
- package/dist/session/getSessionId.d.ts +2 -0
- package/dist/session/getSessionId.js +28 -0
- package/dist/session/getSessionId.js.map +1 -0
- package/dist/tenant-api/AuthorizedTenantClient.d.ts +25 -0
- package/dist/tenant-api/AuthorizedTenantClient.js +61 -0
- package/dist/tenant-api/AuthorizedTenantClient.js.map +1 -0
- package/dist/tenant-api/Tenant.d.ts +17 -0
- package/dist/tenant-api/Tenant.js +10 -0
- package/dist/tenant-api/Tenant.js.map +1 -0
- package/dist/test/JsonConnector.spec.d.ts +1 -0
- package/dist/test/JsonConnector.spec.js +352 -0
- package/dist/test/JsonConnector.spec.js.map +1 -0
- package/dist/test/JsonTransformer.spec.d.ts +1 -0
- package/dist/test/JsonTransformer.spec.js +98 -0
- package/dist/test/JsonTransformer.spec.js.map +1 -0
- package/dist/test/arbitraries.d.ts +98 -0
- package/dist/test/arbitraries.js +264 -0
- package/dist/test/arbitraries.js.map +1 -0
- package/dist/test/aspect-templates/organization-details.d.ts +4 -0
- package/dist/test/aspect-templates/organization-details.js +11 -0
- package/dist/test/aspect-templates/organization-details.js.map +1 -0
- package/dist/test/buildApiClient.spec.d.ts +1 -0
- package/dist/test/buildApiClient.spec.js +177 -0
- package/dist/test/buildApiClient.spec.js.map +1 -0
- package/dist/test/buildAuthorizedTenantClient.spec.d.ts +1 -0
- package/dist/test/buildAuthorizedTenantClient.spec.js +60 -0
- package/dist/test/buildAuthorizedTenantClient.spec.js.map +1 -0
- package/dist/test/connectors/MockExpressServer.d.ts +5 -0
- package/dist/test/connectors/MockExpressServer.js +28 -0
- package/dist/test/connectors/MockExpressServer.js.map +1 -0
- package/dist/test/connectors/MockRegistry.d.ts +7 -0
- package/dist/test/connectors/MockRegistry.js +93 -0
- package/dist/test/connectors/MockRegistry.js.map +1 -0
- package/dist/test/connectors/runConnectorTest.d.ts +5 -0
- package/dist/test/connectors/runConnectorTest.js +106 -0
- package/dist/test/connectors/runConnectorTest.js.map +1 -0
- package/dist/test/db/getTestDBConfig.d.ts +7 -0
- package/dist/test/db/getTestDBConfig.js +13 -0
- package/dist/test/db/getTestDBConfig.js.map +1 -0
- package/dist/test/db/runMigrationSql.d.ts +9 -0
- package/dist/test/db/runMigrationSql.js +82 -0
- package/dist/test/db/runMigrationSql.js.map +1 -0
- package/dist/test/express/status.spec.d.ts +1 -0
- package/dist/test/express/status.spec.js +160 -0
- package/dist/test/express/status.spec.js.map +1 -0
- package/dist/test/fakeArgv.d.ts +2 -0
- package/dist/test/fakeArgv.js +7 -0
- package/dist/test/fakeArgv.js.map +1 -0
- package/dist/test/getAuthDecision.spec.d.ts +1 -0
- package/dist/test/getAuthDecision.spec.js +22 -0
- package/dist/test/getAuthDecision.spec.js.map +1 -0
- package/dist/test/getBasePathFromUrl.spec.d.ts +1 -0
- package/dist/test/getBasePathFromUrl.spec.js +25 -0
- package/dist/test/getBasePathFromUrl.spec.js.map +1 -0
- package/dist/test/jsverify.d.ts +2 -0
- package/dist/test/jsverify.js +8 -0
- package/dist/test/jsverify.js.map +1 -0
- package/dist/test/mockAuthApiHost.d.ts +14 -0
- package/dist/test/mockAuthApiHost.js +174 -0
- package/dist/test/mockAuthApiHost.js.map +1 -0
- package/dist/test/mockAuthorization.d.ts +3 -0
- package/dist/test/mockAuthorization.js +24 -0
- package/dist/test/mockAuthorization.js.map +1 -0
- package/dist/test/mockTenantDataStore.d.ts +8 -0
- package/dist/test/mockTenantDataStore.js +41 -0
- package/dist/test/mockTenantDataStore.js.map +1 -0
- package/dist/test/mockUserDataStore.d.ts +11 -0
- package/dist/test/mockUserDataStore.js +56 -0
- package/dist/test/mockUserDataStore.js.map +1 -0
- package/dist/test/registry/buildAuthorizedClient.spec.d.ts +1 -0
- package/dist/test/registry/buildAuthorizedClient.spec.js +101 -0
- package/dist/test/registry/buildAuthorizedClient.spec.js.map +1 -0
- package/dist/test/sampleOpaResponse.json +480 -0
- package/dist/test/sampleOpaResponseSimple.json +173 -0
- package/dist/test/sampleOpaResponseUnconditionalTrue.json +193 -0
- package/dist/test/sampleOpaResponseUnconditionalTrueWithDefaultRule.json +303 -0
- package/dist/test/sampleOpaResponseWithDefaultRule.json +303 -0
- package/dist/test/session/buildJwt.spec.d.ts +1 -0
- package/dist/test/session/buildJwt.spec.js +50 -0
- package/dist/test/session/buildJwt.spec.js.map +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsAndOwnerTest.spec.d.ts +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsAndOwnerTest.spec.js +64 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsAndOwnerTest.spec.js.map +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsTest.spec.d.ts +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsTest.spec.js +52 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaGroupsTest.spec.js.map +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaOwnerTest.spec.d.ts +1 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaOwnerTest.spec.js +36 -0
- package/dist/test/session/buildJwtForRegistryEsriOpaOwnerTest.spec.js.map +1 -0
- package/dist/test/testAsyncPage.spec.d.ts +1 -0
- package/dist/test/testAsyncPage.spec.js +463 -0
- package/dist/test/testAsyncPage.spec.js.map +1 -0
- package/dist/test/testOpaCompileResponseParser.spec.d.ts +1 -0
- package/dist/test/testOpaCompileResponseParser.spec.js +148 -0
- package/dist/test/testOpaCompileResponseParser.spec.js.map +1 -0
- package/dist/test/util.d.ts +1 -0
- package/dist/test/util.js +8 -0
- package/dist/test/util.js.map +1 -0
- package/dist/util/arrayToMaybe.d.ts +2 -0
- package/dist/util/arrayToMaybe.js +8 -0
- package/dist/util/arrayToMaybe.js.map +1 -0
- package/dist/util/cleanOrgTitle.d.ts +1 -0
- package/dist/util/cleanOrgTitle.js +13 -0
- package/dist/util/cleanOrgTitle.js.map +1 -0
- package/dist/util/escapeRegExp.d.ts +2 -0
- package/dist/util/escapeRegExp.js +5 -0
- package/dist/util/escapeRegExp.js.map +1 -0
- package/dist/util/getMinikubeIP.d.ts +1 -0
- package/dist/util/getMinikubeIP.js +13 -0
- package/dist/util/getMinikubeIP.js.map +1 -0
- package/dist/util/isUuid.d.ts +2 -0
- package/dist/util/isUuid.js +6 -0
- package/dist/util/isUuid.js.map +1 -0
- package/dist/util/unionToThrowable.d.ts +1 -0
- package/dist/util/unionToThrowable.js +12 -0
- package/dist/util/unionToThrowable.js.map +1 -0
- package/dist/utilityTypes.d.ts +1 -0
- package/dist/utilityTypes.js +3 -0
- package/dist/utilityTypes.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,2060 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
5
|
+
*
|
|
6
|
+
* OpenAPI spec version: 0.1
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by the swagger code generator program.
|
|
10
|
+
* https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.WebHooksApi = exports.WebHooksApiApiKeys = exports.RecordsApi = exports.RecordsApiApiKeys = exports.RecordHistoryApi = exports.RecordHistoryApiApiKeys = exports.RecordAspectsApi = exports.RecordAspectsApiApiKeys = exports.AspectDefinitionsApi = exports.AspectDefinitionsApiApiKeys = exports.VoidAuth = exports.OAuth = exports.ApiKeyAuth = exports.HttpBasicAuth = exports.WebHookConfig = exports.WebHookAcknowledgementResponse = exports.WebHookAcknowledgement = exports.WebHook = exports.RegistryEvent = exports.RecordSummary = exports.Record = exports.Operation = exports.MultipleDeleteResult = exports.JsValue = exports.JsObject = exports.EventsPage = exports.DeleteResult = exports.CountResponse = exports.AspectDefinition = exports.ApiError = void 0;
|
|
15
|
+
const request = require("request");
|
|
16
|
+
let defaultBasePath = 'http://localhost/api/v0/registry/';
|
|
17
|
+
// ===============================================
|
|
18
|
+
// This file is autogenerated - Please do not edit
|
|
19
|
+
// ===============================================
|
|
20
|
+
/* tslint:disable:no-unused-variable */
|
|
21
|
+
class ApiError {
|
|
22
|
+
}
|
|
23
|
+
exports.ApiError = ApiError;
|
|
24
|
+
/**
|
|
25
|
+
* A type of aspect in the registry, unique for a tenant.
|
|
26
|
+
*/
|
|
27
|
+
class AspectDefinition {
|
|
28
|
+
}
|
|
29
|
+
exports.AspectDefinition = AspectDefinition;
|
|
30
|
+
class CountResponse {
|
|
31
|
+
}
|
|
32
|
+
exports.CountResponse = CountResponse;
|
|
33
|
+
class DeleteResult {
|
|
34
|
+
}
|
|
35
|
+
exports.DeleteResult = DeleteResult;
|
|
36
|
+
/**
|
|
37
|
+
* A page of events.
|
|
38
|
+
*/
|
|
39
|
+
class EventsPage {
|
|
40
|
+
}
|
|
41
|
+
exports.EventsPage = EventsPage;
|
|
42
|
+
class JsObject {
|
|
43
|
+
}
|
|
44
|
+
exports.JsObject = JsObject;
|
|
45
|
+
class JsValue {
|
|
46
|
+
}
|
|
47
|
+
exports.JsValue = JsValue;
|
|
48
|
+
class MultipleDeleteResult {
|
|
49
|
+
}
|
|
50
|
+
exports.MultipleDeleteResult = MultipleDeleteResult;
|
|
51
|
+
class Operation {
|
|
52
|
+
}
|
|
53
|
+
exports.Operation = Operation;
|
|
54
|
+
/**
|
|
55
|
+
* A record in the registry, usually including data for one or more aspects, unique for a tenant.
|
|
56
|
+
*/
|
|
57
|
+
class Record {
|
|
58
|
+
}
|
|
59
|
+
exports.Record = Record;
|
|
60
|
+
/**
|
|
61
|
+
* A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
|
|
62
|
+
*/
|
|
63
|
+
class RecordSummary {
|
|
64
|
+
}
|
|
65
|
+
exports.RecordSummary = RecordSummary;
|
|
66
|
+
class RegistryEvent {
|
|
67
|
+
}
|
|
68
|
+
exports.RegistryEvent = RegistryEvent;
|
|
69
|
+
class WebHook {
|
|
70
|
+
}
|
|
71
|
+
exports.WebHook = WebHook;
|
|
72
|
+
/**
|
|
73
|
+
* Asynchronously acknowledges receipt of a web hook notification.
|
|
74
|
+
*/
|
|
75
|
+
class WebHookAcknowledgement {
|
|
76
|
+
}
|
|
77
|
+
exports.WebHookAcknowledgement = WebHookAcknowledgement;
|
|
78
|
+
/**
|
|
79
|
+
* The response to an asynchronous web hook acknowledgement.
|
|
80
|
+
*/
|
|
81
|
+
class WebHookAcknowledgementResponse {
|
|
82
|
+
}
|
|
83
|
+
exports.WebHookAcknowledgementResponse = WebHookAcknowledgementResponse;
|
|
84
|
+
class WebHookConfig {
|
|
85
|
+
}
|
|
86
|
+
exports.WebHookConfig = WebHookConfig;
|
|
87
|
+
class HttpBasicAuth {
|
|
88
|
+
applyToRequest(requestOptions) {
|
|
89
|
+
requestOptions.auth = {
|
|
90
|
+
username: this.username, password: this.password
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.HttpBasicAuth = HttpBasicAuth;
|
|
95
|
+
class ApiKeyAuth {
|
|
96
|
+
constructor(location, paramName) {
|
|
97
|
+
this.location = location;
|
|
98
|
+
this.paramName = paramName;
|
|
99
|
+
}
|
|
100
|
+
applyToRequest(requestOptions) {
|
|
101
|
+
if (this.location == "query") {
|
|
102
|
+
requestOptions.qs[this.paramName] = this.apiKey;
|
|
103
|
+
}
|
|
104
|
+
else if (this.location == "header" && requestOptions && requestOptions.headers) {
|
|
105
|
+
requestOptions.headers[this.paramName] = this.apiKey;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.ApiKeyAuth = ApiKeyAuth;
|
|
110
|
+
class OAuth {
|
|
111
|
+
applyToRequest(requestOptions) {
|
|
112
|
+
if (requestOptions && requestOptions.headers) {
|
|
113
|
+
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.OAuth = OAuth;
|
|
118
|
+
class VoidAuth {
|
|
119
|
+
applyToRequest(_) {
|
|
120
|
+
// Do nothing
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.VoidAuth = VoidAuth;
|
|
124
|
+
var AspectDefinitionsApiApiKeys;
|
|
125
|
+
(function (AspectDefinitionsApiApiKeys) {
|
|
126
|
+
})(AspectDefinitionsApiApiKeys = exports.AspectDefinitionsApiApiKeys || (exports.AspectDefinitionsApiApiKeys = {}));
|
|
127
|
+
class AspectDefinitionsApi {
|
|
128
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
129
|
+
this.basePath = defaultBasePath;
|
|
130
|
+
this.defaultHeaders = {};
|
|
131
|
+
this._useQuerystring = false;
|
|
132
|
+
this.authentications = {
|
|
133
|
+
'default': new VoidAuth(),
|
|
134
|
+
};
|
|
135
|
+
if (password) {
|
|
136
|
+
if (basePath) {
|
|
137
|
+
this.basePath = basePath;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
if (basePathOrUsername) {
|
|
142
|
+
this.basePath = basePathOrUsername;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
set useQuerystring(value) {
|
|
147
|
+
this._useQuerystring = value;
|
|
148
|
+
}
|
|
149
|
+
setApiKey(key, value) {
|
|
150
|
+
this.authentications[AspectDefinitionsApiApiKeys[key]].apiKey = value;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a new aspect
|
|
154
|
+
*
|
|
155
|
+
* @param xMagdaTenantId 0
|
|
156
|
+
* @param aspect The definition of the new aspect.
|
|
157
|
+
* @param xMagdaSession Magda internal session id
|
|
158
|
+
*/
|
|
159
|
+
create(xMagdaTenantId, aspect, xMagdaSession) {
|
|
160
|
+
const localVarPath = this.basePath + '/aspects';
|
|
161
|
+
let queryParameters = {};
|
|
162
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
163
|
+
let formParams = {};
|
|
164
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
165
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
166
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling create.');
|
|
167
|
+
}
|
|
168
|
+
// verify required parameter 'aspect' is not null or undefined
|
|
169
|
+
if (aspect === null || aspect === undefined) {
|
|
170
|
+
throw new Error('Required parameter aspect was null or undefined when calling create.');
|
|
171
|
+
}
|
|
172
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
173
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
174
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling create.');
|
|
175
|
+
}
|
|
176
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
177
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
178
|
+
let useFormData = false;
|
|
179
|
+
let requestOptions = {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
qs: queryParameters,
|
|
182
|
+
headers: headerParams,
|
|
183
|
+
uri: localVarPath,
|
|
184
|
+
useQuerystring: this._useQuerystring,
|
|
185
|
+
json: true,
|
|
186
|
+
body: aspect,
|
|
187
|
+
};
|
|
188
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
189
|
+
if (Object.keys(formParams).length) {
|
|
190
|
+
if (useFormData) {
|
|
191
|
+
requestOptions.formData = formParams;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
requestOptions.form = formParams;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
request(requestOptions, (error, response, body) => {
|
|
199
|
+
if (error) {
|
|
200
|
+
reject(error);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
204
|
+
resolve({ response: response, body: body });
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
reject({ response: response, body: body });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get a list of all aspects
|
|
215
|
+
*
|
|
216
|
+
* @param xMagdaTenantId 0
|
|
217
|
+
*/
|
|
218
|
+
getAll(xMagdaTenantId) {
|
|
219
|
+
const localVarPath = this.basePath + '/aspects';
|
|
220
|
+
let queryParameters = {};
|
|
221
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
222
|
+
let formParams = {};
|
|
223
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
224
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
225
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAll.');
|
|
226
|
+
}
|
|
227
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
228
|
+
let useFormData = false;
|
|
229
|
+
let requestOptions = {
|
|
230
|
+
method: 'GET',
|
|
231
|
+
qs: queryParameters,
|
|
232
|
+
headers: headerParams,
|
|
233
|
+
uri: localVarPath,
|
|
234
|
+
useQuerystring: this._useQuerystring,
|
|
235
|
+
json: true,
|
|
236
|
+
};
|
|
237
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
238
|
+
if (Object.keys(formParams).length) {
|
|
239
|
+
if (useFormData) {
|
|
240
|
+
requestOptions.formData = formParams;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
requestOptions.form = formParams;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return new Promise((resolve, reject) => {
|
|
247
|
+
request(requestOptions, (error, response, body) => {
|
|
248
|
+
if (error) {
|
|
249
|
+
reject(error);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
253
|
+
resolve({ response: response, body: body });
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
reject({ response: response, body: body });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Get an aspect by ID
|
|
264
|
+
*
|
|
265
|
+
* @param xMagdaTenantId 0
|
|
266
|
+
* @param id ID of the aspect to be fetched.
|
|
267
|
+
*/
|
|
268
|
+
getById(xMagdaTenantId, id) {
|
|
269
|
+
const localVarPath = this.basePath + '/aspects/{id}'
|
|
270
|
+
.replace('{' + 'id' + '}', String(id));
|
|
271
|
+
let queryParameters = {};
|
|
272
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
273
|
+
let formParams = {};
|
|
274
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
275
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
276
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getById.');
|
|
277
|
+
}
|
|
278
|
+
// verify required parameter 'id' is not null or undefined
|
|
279
|
+
if (id === null || id === undefined) {
|
|
280
|
+
throw new Error('Required parameter id was null or undefined when calling getById.');
|
|
281
|
+
}
|
|
282
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
283
|
+
let useFormData = false;
|
|
284
|
+
let requestOptions = {
|
|
285
|
+
method: 'GET',
|
|
286
|
+
qs: queryParameters,
|
|
287
|
+
headers: headerParams,
|
|
288
|
+
uri: localVarPath,
|
|
289
|
+
useQuerystring: this._useQuerystring,
|
|
290
|
+
json: true,
|
|
291
|
+
};
|
|
292
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
293
|
+
if (Object.keys(formParams).length) {
|
|
294
|
+
if (useFormData) {
|
|
295
|
+
requestOptions.formData = formParams;
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
requestOptions.form = formParams;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return new Promise((resolve, reject) => {
|
|
302
|
+
request(requestOptions, (error, response, body) => {
|
|
303
|
+
if (error) {
|
|
304
|
+
reject(error);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
308
|
+
resolve({ response: response, body: body });
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
reject({ response: response, body: body });
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Modify an aspect by applying a JSON Patch
|
|
319
|
+
* The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
|
|
320
|
+
* @param xMagdaTenantId 0
|
|
321
|
+
* @param id ID of the aspect to be saved.
|
|
322
|
+
* @param aspectPatch The RFC 6902 patch to apply to the aspect.
|
|
323
|
+
* @param xMagdaSession Magda internal session id
|
|
324
|
+
*/
|
|
325
|
+
patchById(xMagdaTenantId, id, aspectPatch, xMagdaSession) {
|
|
326
|
+
const localVarPath = this.basePath + '/aspects/{id}'
|
|
327
|
+
.replace('{' + 'id' + '}', String(id));
|
|
328
|
+
let queryParameters = {};
|
|
329
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
330
|
+
let formParams = {};
|
|
331
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
332
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
333
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling patchById.');
|
|
334
|
+
}
|
|
335
|
+
// verify required parameter 'id' is not null or undefined
|
|
336
|
+
if (id === null || id === undefined) {
|
|
337
|
+
throw new Error('Required parameter id was null or undefined when calling patchById.');
|
|
338
|
+
}
|
|
339
|
+
// verify required parameter 'aspectPatch' is not null or undefined
|
|
340
|
+
if (aspectPatch === null || aspectPatch === undefined) {
|
|
341
|
+
throw new Error('Required parameter aspectPatch was null or undefined when calling patchById.');
|
|
342
|
+
}
|
|
343
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
344
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
345
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling patchById.');
|
|
346
|
+
}
|
|
347
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
348
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
349
|
+
let useFormData = false;
|
|
350
|
+
let requestOptions = {
|
|
351
|
+
method: 'PATCH',
|
|
352
|
+
qs: queryParameters,
|
|
353
|
+
headers: headerParams,
|
|
354
|
+
uri: localVarPath,
|
|
355
|
+
useQuerystring: this._useQuerystring,
|
|
356
|
+
json: true,
|
|
357
|
+
body: aspectPatch,
|
|
358
|
+
};
|
|
359
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
360
|
+
if (Object.keys(formParams).length) {
|
|
361
|
+
if (useFormData) {
|
|
362
|
+
requestOptions.formData = formParams;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
requestOptions.form = formParams;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return new Promise((resolve, reject) => {
|
|
369
|
+
request(requestOptions, (error, response, body) => {
|
|
370
|
+
if (error) {
|
|
371
|
+
reject(error);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
375
|
+
resolve({ response: response, body: body });
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
reject({ response: response, body: body });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Modify an aspect by ID
|
|
386
|
+
* Modifies the aspect with a given ID. If an aspect with the ID does not yet exist, it is created.
|
|
387
|
+
* @param xMagdaTenantId 0
|
|
388
|
+
* @param id ID of the aspect to be saved.
|
|
389
|
+
* @param aspect The aspect to save.
|
|
390
|
+
* @param xMagdaSession Magda internal session id
|
|
391
|
+
*/
|
|
392
|
+
putById(xMagdaTenantId, id, aspect, xMagdaSession) {
|
|
393
|
+
const localVarPath = this.basePath + '/aspects/{id}'
|
|
394
|
+
.replace('{' + 'id' + '}', String(id));
|
|
395
|
+
let queryParameters = {};
|
|
396
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
397
|
+
let formParams = {};
|
|
398
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
399
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
400
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling putById.');
|
|
401
|
+
}
|
|
402
|
+
// verify required parameter 'id' is not null or undefined
|
|
403
|
+
if (id === null || id === undefined) {
|
|
404
|
+
throw new Error('Required parameter id was null or undefined when calling putById.');
|
|
405
|
+
}
|
|
406
|
+
// verify required parameter 'aspect' is not null or undefined
|
|
407
|
+
if (aspect === null || aspect === undefined) {
|
|
408
|
+
throw new Error('Required parameter aspect was null or undefined when calling putById.');
|
|
409
|
+
}
|
|
410
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
411
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
412
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling putById.');
|
|
413
|
+
}
|
|
414
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
415
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
416
|
+
let useFormData = false;
|
|
417
|
+
let requestOptions = {
|
|
418
|
+
method: 'PUT',
|
|
419
|
+
qs: queryParameters,
|
|
420
|
+
headers: headerParams,
|
|
421
|
+
uri: localVarPath,
|
|
422
|
+
useQuerystring: this._useQuerystring,
|
|
423
|
+
json: true,
|
|
424
|
+
body: aspect,
|
|
425
|
+
};
|
|
426
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
427
|
+
if (Object.keys(formParams).length) {
|
|
428
|
+
if (useFormData) {
|
|
429
|
+
requestOptions.formData = formParams;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
requestOptions.form = formParams;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return new Promise((resolve, reject) => {
|
|
436
|
+
request(requestOptions, (error, response, body) => {
|
|
437
|
+
if (error) {
|
|
438
|
+
reject(error);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
442
|
+
resolve({ response: response, body: body });
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
reject({ response: response, body: body });
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
exports.AspectDefinitionsApi = AspectDefinitionsApi;
|
|
453
|
+
var RecordAspectsApiApiKeys;
|
|
454
|
+
(function (RecordAspectsApiApiKeys) {
|
|
455
|
+
})(RecordAspectsApiApiKeys = exports.RecordAspectsApiApiKeys || (exports.RecordAspectsApiApiKeys = {}));
|
|
456
|
+
class RecordAspectsApi {
|
|
457
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
458
|
+
this.basePath = defaultBasePath;
|
|
459
|
+
this.defaultHeaders = {};
|
|
460
|
+
this._useQuerystring = false;
|
|
461
|
+
this.authentications = {
|
|
462
|
+
'default': new VoidAuth(),
|
|
463
|
+
};
|
|
464
|
+
if (password) {
|
|
465
|
+
if (basePath) {
|
|
466
|
+
this.basePath = basePath;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
if (basePathOrUsername) {
|
|
471
|
+
this.basePath = basePathOrUsername;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
set useQuerystring(value) {
|
|
476
|
+
this._useQuerystring = value;
|
|
477
|
+
}
|
|
478
|
+
setApiKey(key, value) {
|
|
479
|
+
this.authentications[RecordAspectsApiApiKeys[key]].apiKey = value;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Delete a record aspect by ID
|
|
483
|
+
* Deletes a record aspect.
|
|
484
|
+
* @param recordId ID of the record for which to delete an aspect.
|
|
485
|
+
* @param aspectId ID of the aspect to delete.
|
|
486
|
+
* @param xMagdaSession Magda internal session id
|
|
487
|
+
* @param xMagdaTenantId 0
|
|
488
|
+
*/
|
|
489
|
+
deleteById(recordId, aspectId, xMagdaSession, xMagdaTenantId) {
|
|
490
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects/{aspectId}'
|
|
491
|
+
.replace('{' + 'recordId' + '}', String(recordId))
|
|
492
|
+
.replace('{' + 'aspectId' + '}', String(aspectId));
|
|
493
|
+
let queryParameters = {};
|
|
494
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
495
|
+
let formParams = {};
|
|
496
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
497
|
+
if (recordId === null || recordId === undefined) {
|
|
498
|
+
throw new Error('Required parameter recordId was null or undefined when calling deleteById.');
|
|
499
|
+
}
|
|
500
|
+
// verify required parameter 'aspectId' is not null or undefined
|
|
501
|
+
if (aspectId === null || aspectId === undefined) {
|
|
502
|
+
throw new Error('Required parameter aspectId was null or undefined when calling deleteById.');
|
|
503
|
+
}
|
|
504
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
505
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
506
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling deleteById.');
|
|
507
|
+
}
|
|
508
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
509
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
510
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling deleteById.');
|
|
511
|
+
}
|
|
512
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
513
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
514
|
+
let useFormData = false;
|
|
515
|
+
let requestOptions = {
|
|
516
|
+
method: 'DELETE',
|
|
517
|
+
qs: queryParameters,
|
|
518
|
+
headers: headerParams,
|
|
519
|
+
uri: localVarPath,
|
|
520
|
+
useQuerystring: this._useQuerystring,
|
|
521
|
+
json: true,
|
|
522
|
+
};
|
|
523
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
524
|
+
if (Object.keys(formParams).length) {
|
|
525
|
+
if (useFormData) {
|
|
526
|
+
requestOptions.formData = formParams;
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
requestOptions.form = formParams;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return new Promise((resolve, reject) => {
|
|
533
|
+
request(requestOptions, (error, response, body) => {
|
|
534
|
+
if (error) {
|
|
535
|
+
reject(error);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
539
|
+
resolve({ response: response, body: body });
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
reject({ response: response, body: body });
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Get a record aspect by ID
|
|
550
|
+
*
|
|
551
|
+
* @param xMagdaTenantId 0
|
|
552
|
+
* @param recordId ID of the record for which to fetch an aspect.
|
|
553
|
+
* @param aspectId ID of the aspect to fetch.
|
|
554
|
+
* @param xMagdaSession Magda internal session id
|
|
555
|
+
*/
|
|
556
|
+
getById(xMagdaTenantId, recordId, aspectId, xMagdaSession) {
|
|
557
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects/{aspectId}'
|
|
558
|
+
.replace('{' + 'recordId' + '}', String(recordId))
|
|
559
|
+
.replace('{' + 'aspectId' + '}', String(aspectId));
|
|
560
|
+
let queryParameters = {};
|
|
561
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
562
|
+
let formParams = {};
|
|
563
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
564
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
565
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getById.');
|
|
566
|
+
}
|
|
567
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
568
|
+
if (recordId === null || recordId === undefined) {
|
|
569
|
+
throw new Error('Required parameter recordId was null or undefined when calling getById.');
|
|
570
|
+
}
|
|
571
|
+
// verify required parameter 'aspectId' is not null or undefined
|
|
572
|
+
if (aspectId === null || aspectId === undefined) {
|
|
573
|
+
throw new Error('Required parameter aspectId was null or undefined when calling getById.');
|
|
574
|
+
}
|
|
575
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
576
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
577
|
+
let useFormData = false;
|
|
578
|
+
let requestOptions = {
|
|
579
|
+
method: 'GET',
|
|
580
|
+
qs: queryParameters,
|
|
581
|
+
headers: headerParams,
|
|
582
|
+
uri: localVarPath,
|
|
583
|
+
useQuerystring: this._useQuerystring,
|
|
584
|
+
json: true,
|
|
585
|
+
};
|
|
586
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
587
|
+
if (Object.keys(formParams).length) {
|
|
588
|
+
if (useFormData) {
|
|
589
|
+
requestOptions.formData = formParams;
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
requestOptions.form = formParams;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return new Promise((resolve, reject) => {
|
|
596
|
+
request(requestOptions, (error, response, body) => {
|
|
597
|
+
if (error) {
|
|
598
|
+
reject(error);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
602
|
+
resolve({ response: response, body: body });
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
reject({ response: response, body: body });
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Modify a record aspect by applying a JSON Patch
|
|
613
|
+
* The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
|
|
614
|
+
* @param recordId ID of the record for which to fetch an aspect.
|
|
615
|
+
* @param aspectId ID of the aspect to fetch.
|
|
616
|
+
* @param aspectPatch The RFC 6902 patch to apply to the aspect.
|
|
617
|
+
* @param xMagdaSession Magda internal session id
|
|
618
|
+
* @param xMagdaTenantId 0
|
|
619
|
+
*/
|
|
620
|
+
patchById(recordId, aspectId, aspectPatch, xMagdaSession, xMagdaTenantId) {
|
|
621
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects/{aspectId}'
|
|
622
|
+
.replace('{' + 'recordId' + '}', String(recordId))
|
|
623
|
+
.replace('{' + 'aspectId' + '}', String(aspectId));
|
|
624
|
+
let queryParameters = {};
|
|
625
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
626
|
+
let formParams = {};
|
|
627
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
628
|
+
if (recordId === null || recordId === undefined) {
|
|
629
|
+
throw new Error('Required parameter recordId was null or undefined when calling patchById.');
|
|
630
|
+
}
|
|
631
|
+
// verify required parameter 'aspectId' is not null or undefined
|
|
632
|
+
if (aspectId === null || aspectId === undefined) {
|
|
633
|
+
throw new Error('Required parameter aspectId was null or undefined when calling patchById.');
|
|
634
|
+
}
|
|
635
|
+
// verify required parameter 'aspectPatch' is not null or undefined
|
|
636
|
+
if (aspectPatch === null || aspectPatch === undefined) {
|
|
637
|
+
throw new Error('Required parameter aspectPatch was null or undefined when calling patchById.');
|
|
638
|
+
}
|
|
639
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
640
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
641
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling patchById.');
|
|
642
|
+
}
|
|
643
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
644
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
645
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling patchById.');
|
|
646
|
+
}
|
|
647
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
648
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
649
|
+
let useFormData = false;
|
|
650
|
+
let requestOptions = {
|
|
651
|
+
method: 'PATCH',
|
|
652
|
+
qs: queryParameters,
|
|
653
|
+
headers: headerParams,
|
|
654
|
+
uri: localVarPath,
|
|
655
|
+
useQuerystring: this._useQuerystring,
|
|
656
|
+
json: true,
|
|
657
|
+
body: aspectPatch,
|
|
658
|
+
};
|
|
659
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
660
|
+
if (Object.keys(formParams).length) {
|
|
661
|
+
if (useFormData) {
|
|
662
|
+
requestOptions.formData = formParams;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
requestOptions.form = formParams;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return new Promise((resolve, reject) => {
|
|
669
|
+
request(requestOptions, (error, response, body) => {
|
|
670
|
+
if (error) {
|
|
671
|
+
reject(error);
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
675
|
+
resolve({ response: response, body: body });
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
reject({ response: response, body: body });
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Modify a record aspect by ID
|
|
686
|
+
* Modifies a record aspect. If the aspect does not yet exist on this record, it is created.
|
|
687
|
+
* @param recordId ID of the record for which to update an aspect.
|
|
688
|
+
* @param aspectId ID of the aspect to update.
|
|
689
|
+
* @param aspect The record aspect to save.
|
|
690
|
+
* @param xMagdaSession Magda internal session id
|
|
691
|
+
* @param xMagdaTenantId 0
|
|
692
|
+
*/
|
|
693
|
+
putById(recordId, aspectId, aspect, xMagdaSession, xMagdaTenantId) {
|
|
694
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects/{aspectId}'
|
|
695
|
+
.replace('{' + 'recordId' + '}', String(recordId))
|
|
696
|
+
.replace('{' + 'aspectId' + '}', String(aspectId));
|
|
697
|
+
let queryParameters = {};
|
|
698
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
699
|
+
let formParams = {};
|
|
700
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
701
|
+
if (recordId === null || recordId === undefined) {
|
|
702
|
+
throw new Error('Required parameter recordId was null or undefined when calling putById.');
|
|
703
|
+
}
|
|
704
|
+
// verify required parameter 'aspectId' is not null or undefined
|
|
705
|
+
if (aspectId === null || aspectId === undefined) {
|
|
706
|
+
throw new Error('Required parameter aspectId was null or undefined when calling putById.');
|
|
707
|
+
}
|
|
708
|
+
// verify required parameter 'aspect' is not null or undefined
|
|
709
|
+
if (aspect === null || aspect === undefined) {
|
|
710
|
+
throw new Error('Required parameter aspect was null or undefined when calling putById.');
|
|
711
|
+
}
|
|
712
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
713
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
714
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling putById.');
|
|
715
|
+
}
|
|
716
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
717
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
718
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling putById.');
|
|
719
|
+
}
|
|
720
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
721
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
722
|
+
let useFormData = false;
|
|
723
|
+
let requestOptions = {
|
|
724
|
+
method: 'PUT',
|
|
725
|
+
qs: queryParameters,
|
|
726
|
+
headers: headerParams,
|
|
727
|
+
uri: localVarPath,
|
|
728
|
+
useQuerystring: this._useQuerystring,
|
|
729
|
+
json: true,
|
|
730
|
+
body: aspect,
|
|
731
|
+
};
|
|
732
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
733
|
+
if (Object.keys(formParams).length) {
|
|
734
|
+
if (useFormData) {
|
|
735
|
+
requestOptions.formData = formParams;
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
requestOptions.form = formParams;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return new Promise((resolve, reject) => {
|
|
742
|
+
request(requestOptions, (error, response, body) => {
|
|
743
|
+
if (error) {
|
|
744
|
+
reject(error);
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
748
|
+
resolve({ response: response, body: body });
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
reject({ response: response, body: body });
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
exports.RecordAspectsApi = RecordAspectsApi;
|
|
759
|
+
var RecordHistoryApiApiKeys;
|
|
760
|
+
(function (RecordHistoryApiApiKeys) {
|
|
761
|
+
})(RecordHistoryApiApiKeys = exports.RecordHistoryApiApiKeys || (exports.RecordHistoryApiApiKeys = {}));
|
|
762
|
+
class RecordHistoryApi {
|
|
763
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
764
|
+
this.basePath = defaultBasePath;
|
|
765
|
+
this.defaultHeaders = {};
|
|
766
|
+
this._useQuerystring = false;
|
|
767
|
+
this.authentications = {
|
|
768
|
+
'default': new VoidAuth(),
|
|
769
|
+
};
|
|
770
|
+
if (password) {
|
|
771
|
+
if (basePath) {
|
|
772
|
+
this.basePath = basePath;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
if (basePathOrUsername) {
|
|
777
|
+
this.basePath = basePathOrUsername;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
set useQuerystring(value) {
|
|
782
|
+
this._useQuerystring = value;
|
|
783
|
+
}
|
|
784
|
+
setApiKey(key, value) {
|
|
785
|
+
this.authentications[RecordHistoryApiApiKeys[key]].apiKey = value;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Get a list of all events affecting this record
|
|
789
|
+
*
|
|
790
|
+
* @param xMagdaTenantId 0
|
|
791
|
+
* @param recordId ID of the record for which to fetch history.
|
|
792
|
+
* @param xMagdaSession Magda internal session id
|
|
793
|
+
* @param pageToken A token that identifies the start of a page of events. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
|
|
794
|
+
* @param start The index of the first event to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
|
|
795
|
+
* @param limit The maximum number of events to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
|
|
796
|
+
* @param aspect The aspects for which to included in event history, specified as multiple occurrences of this query parameter.
|
|
797
|
+
* @param dereference true to automatically dereference links to other records; false to leave them as links. Dereferencing a link means including the record itself where the link would be. Dereferencing only happens one level deep, regardless of the value of this parameter.
|
|
798
|
+
*/
|
|
799
|
+
history(xMagdaTenantId, recordId, xMagdaSession, pageToken, start, limit, aspect, dereference) {
|
|
800
|
+
const localVarPath = this.basePath + '/records/{recordId}/history'
|
|
801
|
+
.replace('{' + 'recordId' + '}', String(recordId));
|
|
802
|
+
let queryParameters = {};
|
|
803
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
804
|
+
let formParams = {};
|
|
805
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
806
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
807
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling history.');
|
|
808
|
+
}
|
|
809
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
810
|
+
if (recordId === null || recordId === undefined) {
|
|
811
|
+
throw new Error('Required parameter recordId was null or undefined when calling history.');
|
|
812
|
+
}
|
|
813
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
814
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
815
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling history.');
|
|
816
|
+
}
|
|
817
|
+
if (pageToken !== undefined) {
|
|
818
|
+
queryParameters['pageToken'] = pageToken;
|
|
819
|
+
}
|
|
820
|
+
if (start !== undefined) {
|
|
821
|
+
queryParameters['start'] = start;
|
|
822
|
+
}
|
|
823
|
+
if (limit !== undefined) {
|
|
824
|
+
queryParameters['limit'] = limit;
|
|
825
|
+
}
|
|
826
|
+
if (aspect !== undefined) {
|
|
827
|
+
queryParameters['aspect'] = aspect;
|
|
828
|
+
}
|
|
829
|
+
if (dereference !== undefined) {
|
|
830
|
+
queryParameters['dereference'] = dereference;
|
|
831
|
+
}
|
|
832
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
833
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
834
|
+
let useFormData = false;
|
|
835
|
+
let requestOptions = {
|
|
836
|
+
method: 'GET',
|
|
837
|
+
qs: queryParameters,
|
|
838
|
+
headers: headerParams,
|
|
839
|
+
uri: localVarPath,
|
|
840
|
+
useQuerystring: this._useQuerystring,
|
|
841
|
+
json: true,
|
|
842
|
+
};
|
|
843
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
844
|
+
if (Object.keys(formParams).length) {
|
|
845
|
+
if (useFormData) {
|
|
846
|
+
requestOptions.formData = formParams;
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
requestOptions.form = formParams;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return new Promise((resolve, reject) => {
|
|
853
|
+
request(requestOptions, (error, response, body) => {
|
|
854
|
+
if (error) {
|
|
855
|
+
reject(error);
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
859
|
+
resolve({ response: response, body: body });
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
reject({ response: response, body: body });
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Get the version of a record that existed after a given event was applied
|
|
870
|
+
*
|
|
871
|
+
* @param xMagdaTenantId 0
|
|
872
|
+
* @param recordId ID of the record to fetch.
|
|
873
|
+
* @param eventId The ID of the last event to be applied to the record. The event with this ID need not actually apply to the record, in which case that last event prior to this even that does apply will be used.
|
|
874
|
+
*/
|
|
875
|
+
version(xMagdaTenantId, recordId, eventId) {
|
|
876
|
+
const localVarPath = this.basePath + '/records/{recordId}/history/{eventId}'
|
|
877
|
+
.replace('{' + 'recordId' + '}', String(recordId))
|
|
878
|
+
.replace('{' + 'eventId' + '}', String(eventId));
|
|
879
|
+
let queryParameters = {};
|
|
880
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
881
|
+
let formParams = {};
|
|
882
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
883
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
884
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling version.');
|
|
885
|
+
}
|
|
886
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
887
|
+
if (recordId === null || recordId === undefined) {
|
|
888
|
+
throw new Error('Required parameter recordId was null or undefined when calling version.');
|
|
889
|
+
}
|
|
890
|
+
// verify required parameter 'eventId' is not null or undefined
|
|
891
|
+
if (eventId === null || eventId === undefined) {
|
|
892
|
+
throw new Error('Required parameter eventId was null or undefined when calling version.');
|
|
893
|
+
}
|
|
894
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
895
|
+
let useFormData = false;
|
|
896
|
+
let requestOptions = {
|
|
897
|
+
method: 'GET',
|
|
898
|
+
qs: queryParameters,
|
|
899
|
+
headers: headerParams,
|
|
900
|
+
uri: localVarPath,
|
|
901
|
+
useQuerystring: this._useQuerystring,
|
|
902
|
+
json: true,
|
|
903
|
+
};
|
|
904
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
905
|
+
if (Object.keys(formParams).length) {
|
|
906
|
+
if (useFormData) {
|
|
907
|
+
requestOptions.formData = formParams;
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
requestOptions.form = formParams;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
return new Promise((resolve, reject) => {
|
|
914
|
+
request(requestOptions, (error, response, body) => {
|
|
915
|
+
if (error) {
|
|
916
|
+
reject(error);
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
920
|
+
resolve({ response: response, body: body });
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
reject({ response: response, body: body });
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
exports.RecordHistoryApi = RecordHistoryApi;
|
|
931
|
+
var RecordsApiApiKeys;
|
|
932
|
+
(function (RecordsApiApiKeys) {
|
|
933
|
+
})(RecordsApiApiKeys = exports.RecordsApiApiKeys || (exports.RecordsApiApiKeys = {}));
|
|
934
|
+
class RecordsApi {
|
|
935
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
936
|
+
this.basePath = defaultBasePath;
|
|
937
|
+
this.defaultHeaders = {};
|
|
938
|
+
this._useQuerystring = false;
|
|
939
|
+
this.authentications = {
|
|
940
|
+
'default': new VoidAuth(),
|
|
941
|
+
};
|
|
942
|
+
if (password) {
|
|
943
|
+
if (basePath) {
|
|
944
|
+
this.basePath = basePath;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
if (basePathOrUsername) {
|
|
949
|
+
this.basePath = basePathOrUsername;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
set useQuerystring(value) {
|
|
954
|
+
this._useQuerystring = value;
|
|
955
|
+
}
|
|
956
|
+
setApiKey(key, value) {
|
|
957
|
+
this.authentications[RecordsApiApiKeys[key]].apiKey = value;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Create a new record
|
|
961
|
+
*
|
|
962
|
+
* @param xMagdaTenantId 0
|
|
963
|
+
* @param record The definition of the new record.
|
|
964
|
+
* @param xMagdaSession Magda internal session id
|
|
965
|
+
*/
|
|
966
|
+
create(xMagdaTenantId, record, xMagdaSession) {
|
|
967
|
+
const localVarPath = this.basePath + '/records';
|
|
968
|
+
let queryParameters = {};
|
|
969
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
970
|
+
let formParams = {};
|
|
971
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
972
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
973
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling create.');
|
|
974
|
+
}
|
|
975
|
+
// verify required parameter 'record' is not null or undefined
|
|
976
|
+
if (record === null || record === undefined) {
|
|
977
|
+
throw new Error('Required parameter record was null or undefined when calling create.');
|
|
978
|
+
}
|
|
979
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
980
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
981
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling create.');
|
|
982
|
+
}
|
|
983
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
984
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
985
|
+
let useFormData = false;
|
|
986
|
+
let requestOptions = {
|
|
987
|
+
method: 'POST',
|
|
988
|
+
qs: queryParameters,
|
|
989
|
+
headers: headerParams,
|
|
990
|
+
uri: localVarPath,
|
|
991
|
+
useQuerystring: this._useQuerystring,
|
|
992
|
+
json: true,
|
|
993
|
+
body: record,
|
|
994
|
+
};
|
|
995
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
996
|
+
if (Object.keys(formParams).length) {
|
|
997
|
+
if (useFormData) {
|
|
998
|
+
requestOptions.formData = formParams;
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
requestOptions.form = formParams;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return new Promise((resolve, reject) => {
|
|
1005
|
+
request(requestOptions, (error, response, body) => {
|
|
1006
|
+
if (error) {
|
|
1007
|
+
reject(error);
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1011
|
+
resolve({ response: response, body: body });
|
|
1012
|
+
}
|
|
1013
|
+
else {
|
|
1014
|
+
reject({ response: response, body: body });
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Delete a record
|
|
1022
|
+
*
|
|
1023
|
+
* @param xMagdaTenantId 0
|
|
1024
|
+
* @param recordId ID of the record to delete.
|
|
1025
|
+
* @param xMagdaSession Magda internal session id
|
|
1026
|
+
*/
|
|
1027
|
+
deleteById(xMagdaTenantId, recordId, xMagdaSession) {
|
|
1028
|
+
const localVarPath = this.basePath + '/records/{recordId}'
|
|
1029
|
+
.replace('{' + 'recordId' + '}', String(recordId));
|
|
1030
|
+
let queryParameters = {};
|
|
1031
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1032
|
+
let formParams = {};
|
|
1033
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1034
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1035
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling deleteById.');
|
|
1036
|
+
}
|
|
1037
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
1038
|
+
if (recordId === null || recordId === undefined) {
|
|
1039
|
+
throw new Error('Required parameter recordId was null or undefined when calling deleteById.');
|
|
1040
|
+
}
|
|
1041
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1042
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1043
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling deleteById.');
|
|
1044
|
+
}
|
|
1045
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1046
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1047
|
+
let useFormData = false;
|
|
1048
|
+
let requestOptions = {
|
|
1049
|
+
method: 'DELETE',
|
|
1050
|
+
qs: queryParameters,
|
|
1051
|
+
headers: headerParams,
|
|
1052
|
+
uri: localVarPath,
|
|
1053
|
+
useQuerystring: this._useQuerystring,
|
|
1054
|
+
json: true,
|
|
1055
|
+
};
|
|
1056
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1057
|
+
if (Object.keys(formParams).length) {
|
|
1058
|
+
if (useFormData) {
|
|
1059
|
+
requestOptions.formData = formParams;
|
|
1060
|
+
}
|
|
1061
|
+
else {
|
|
1062
|
+
requestOptions.form = formParams;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
request(requestOptions, (error, response, body) => {
|
|
1067
|
+
if (error) {
|
|
1068
|
+
reject(error);
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1072
|
+
resolve({ response: response, body: body });
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
reject({ response: response, body: body });
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Get a list of all records
|
|
1083
|
+
*
|
|
1084
|
+
* @param xMagdaTenantId 0
|
|
1085
|
+
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
1086
|
+
* @param optionalAspect The optional aspects for which to retrieve data, specified as multiple occurrences of this query parameter. These aspects will be included in a record if available, but a record will be included even if it is missing these aspects.
|
|
1087
|
+
* @param pageToken A token that identifies the start of a page of results. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
|
|
1088
|
+
* @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
|
|
1089
|
+
* @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
|
|
1090
|
+
* @param dereference true to automatically dereference links to other records; false to leave them as links. Dereferencing a link means including the record itself where the link would be. Dereferencing only happens one level deep, regardless of the value of this parameter.
|
|
1091
|
+
* @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. NOTE: This is an early stage API and may change greatly in the future
|
|
1092
|
+
* @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. Queries passing via this parameter will be grouped with OR logic. NOTE: This is an early stage API and may change greatly in the future
|
|
1093
|
+
* @param orderBy Specify the field to sort the result. Aspect field can be supported in a format like aspectId.path.to.field
|
|
1094
|
+
* @param orderByDir Specify the order by direction. Either `asc` or `desc`
|
|
1095
|
+
* @param orderNullFirst Specify whether nulls appear before (`true`) or after (`false`) non-null values in the sort ordering.
|
|
1096
|
+
* @param xMagdaSession Magda internal session id
|
|
1097
|
+
*/
|
|
1098
|
+
getAll(xMagdaTenantId, aspect, optionalAspect, pageToken, start, limit, dereference, aspectQuery, aspectOrQuery, orderBy, orderByDir, orderNullFirst, xMagdaSession) {
|
|
1099
|
+
const localVarPath = this.basePath + '/records';
|
|
1100
|
+
let queryParameters = {};
|
|
1101
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1102
|
+
let formParams = {};
|
|
1103
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1104
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1105
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAll.');
|
|
1106
|
+
}
|
|
1107
|
+
if (aspect !== undefined) {
|
|
1108
|
+
queryParameters['aspect'] = aspect;
|
|
1109
|
+
}
|
|
1110
|
+
if (optionalAspect !== undefined) {
|
|
1111
|
+
queryParameters['optionalAspect'] = optionalAspect;
|
|
1112
|
+
}
|
|
1113
|
+
if (pageToken !== undefined) {
|
|
1114
|
+
queryParameters['pageToken'] = pageToken;
|
|
1115
|
+
}
|
|
1116
|
+
if (start !== undefined) {
|
|
1117
|
+
queryParameters['start'] = start;
|
|
1118
|
+
}
|
|
1119
|
+
if (limit !== undefined) {
|
|
1120
|
+
queryParameters['limit'] = limit;
|
|
1121
|
+
}
|
|
1122
|
+
if (dereference !== undefined) {
|
|
1123
|
+
queryParameters['dereference'] = dereference;
|
|
1124
|
+
}
|
|
1125
|
+
if (aspectQuery !== undefined) {
|
|
1126
|
+
queryParameters['aspectQuery'] = aspectQuery;
|
|
1127
|
+
}
|
|
1128
|
+
if (aspectOrQuery !== undefined) {
|
|
1129
|
+
queryParameters['aspectOrQuery'] = aspectOrQuery;
|
|
1130
|
+
}
|
|
1131
|
+
if (orderBy !== undefined) {
|
|
1132
|
+
queryParameters['orderBy'] = orderBy;
|
|
1133
|
+
}
|
|
1134
|
+
if (orderByDir !== undefined) {
|
|
1135
|
+
queryParameters['orderByDir'] = orderByDir;
|
|
1136
|
+
}
|
|
1137
|
+
if (orderNullFirst !== undefined) {
|
|
1138
|
+
queryParameters['orderNullFirst'] = orderNullFirst;
|
|
1139
|
+
}
|
|
1140
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1141
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1142
|
+
let useFormData = false;
|
|
1143
|
+
let requestOptions = {
|
|
1144
|
+
method: 'GET',
|
|
1145
|
+
qs: queryParameters,
|
|
1146
|
+
headers: headerParams,
|
|
1147
|
+
uri: localVarPath,
|
|
1148
|
+
useQuerystring: this._useQuerystring,
|
|
1149
|
+
json: true,
|
|
1150
|
+
};
|
|
1151
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1152
|
+
if (Object.keys(formParams).length) {
|
|
1153
|
+
if (useFormData) {
|
|
1154
|
+
requestOptions.formData = formParams;
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
requestOptions.form = formParams;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
return new Promise((resolve, reject) => {
|
|
1161
|
+
request(requestOptions, (error, response, body) => {
|
|
1162
|
+
if (error) {
|
|
1163
|
+
reject(error);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1167
|
+
resolve({ response: response, body: body });
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
reject({ response: response, body: body });
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Get a list of all records as summaries
|
|
1178
|
+
*
|
|
1179
|
+
* @param xMagdaTenantId 0
|
|
1180
|
+
* @param pageToken A token that identifies the start of a page of results. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
|
|
1181
|
+
* @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
|
|
1182
|
+
* @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
|
|
1183
|
+
* @param xMagdaSession Magda internal session id
|
|
1184
|
+
*/
|
|
1185
|
+
getAllSummary(xMagdaTenantId, pageToken, start, limit, xMagdaSession) {
|
|
1186
|
+
const localVarPath = this.basePath + '/records/summary';
|
|
1187
|
+
let queryParameters = {};
|
|
1188
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1189
|
+
let formParams = {};
|
|
1190
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1191
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1192
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAllSummary.');
|
|
1193
|
+
}
|
|
1194
|
+
if (pageToken !== undefined) {
|
|
1195
|
+
queryParameters['pageToken'] = pageToken;
|
|
1196
|
+
}
|
|
1197
|
+
if (start !== undefined) {
|
|
1198
|
+
queryParameters['start'] = start;
|
|
1199
|
+
}
|
|
1200
|
+
if (limit !== undefined) {
|
|
1201
|
+
queryParameters['limit'] = limit;
|
|
1202
|
+
}
|
|
1203
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1204
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1205
|
+
let useFormData = false;
|
|
1206
|
+
let requestOptions = {
|
|
1207
|
+
method: 'GET',
|
|
1208
|
+
qs: queryParameters,
|
|
1209
|
+
headers: headerParams,
|
|
1210
|
+
uri: localVarPath,
|
|
1211
|
+
useQuerystring: this._useQuerystring,
|
|
1212
|
+
json: true,
|
|
1213
|
+
};
|
|
1214
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1215
|
+
if (Object.keys(formParams).length) {
|
|
1216
|
+
if (useFormData) {
|
|
1217
|
+
requestOptions.formData = formParams;
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
requestOptions.form = formParams;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
return new Promise((resolve, reject) => {
|
|
1224
|
+
request(requestOptions, (error, response, body) => {
|
|
1225
|
+
if (error) {
|
|
1226
|
+
reject(error);
|
|
1227
|
+
}
|
|
1228
|
+
else {
|
|
1229
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1230
|
+
resolve({ response: response, body: body });
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
reject({ response: response, body: body });
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Get a record by ID
|
|
1241
|
+
* Gets a complete record, including data for all aspects.
|
|
1242
|
+
* @param id ID of the record to be fetched.
|
|
1243
|
+
* @param xMagdaTenantId 0
|
|
1244
|
+
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
1245
|
+
* @param optionalAspect The optional aspects for which to retrieve data, specified as multiple occurrences of this query parameter. These aspects will be included in a record if available, but a record will be included even if it is missing these aspects.
|
|
1246
|
+
* @param dereference true to automatically dereference links to other records; false to leave them as links. Dereferencing a link means including the record itself where the link would be. Dereferencing only happens one level deep, regardless of the value of this parameter.
|
|
1247
|
+
* @param xMagdaSession Magda internal session id
|
|
1248
|
+
*/
|
|
1249
|
+
getById(id, xMagdaTenantId, aspect, optionalAspect, dereference, xMagdaSession) {
|
|
1250
|
+
const localVarPath = this.basePath + '/records/{id}'
|
|
1251
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1252
|
+
let queryParameters = {};
|
|
1253
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1254
|
+
let formParams = {};
|
|
1255
|
+
// verify required parameter 'id' is not null or undefined
|
|
1256
|
+
if (id === null || id === undefined) {
|
|
1257
|
+
throw new Error('Required parameter id was null or undefined when calling getById.');
|
|
1258
|
+
}
|
|
1259
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1260
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1261
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getById.');
|
|
1262
|
+
}
|
|
1263
|
+
if (aspect !== undefined) {
|
|
1264
|
+
queryParameters['aspect'] = aspect;
|
|
1265
|
+
}
|
|
1266
|
+
if (optionalAspect !== undefined) {
|
|
1267
|
+
queryParameters['optionalAspect'] = optionalAspect;
|
|
1268
|
+
}
|
|
1269
|
+
if (dereference !== undefined) {
|
|
1270
|
+
queryParameters['dereference'] = dereference;
|
|
1271
|
+
}
|
|
1272
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1273
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1274
|
+
let useFormData = false;
|
|
1275
|
+
let requestOptions = {
|
|
1276
|
+
method: 'GET',
|
|
1277
|
+
qs: queryParameters,
|
|
1278
|
+
headers: headerParams,
|
|
1279
|
+
uri: localVarPath,
|
|
1280
|
+
useQuerystring: this._useQuerystring,
|
|
1281
|
+
json: true,
|
|
1282
|
+
};
|
|
1283
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1284
|
+
if (Object.keys(formParams).length) {
|
|
1285
|
+
if (useFormData) {
|
|
1286
|
+
requestOptions.formData = formParams;
|
|
1287
|
+
}
|
|
1288
|
+
else {
|
|
1289
|
+
requestOptions.form = formParams;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return new Promise((resolve, reject) => {
|
|
1293
|
+
request(requestOptions, (error, response, body) => {
|
|
1294
|
+
if (error) {
|
|
1295
|
+
reject(error);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1299
|
+
resolve({ response: response, body: body });
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
reject({ response: response, body: body });
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Get a summary record by ID
|
|
1310
|
+
* Gets a summary record, including all the aspect ids for which this record has data.
|
|
1311
|
+
* @param id ID of the record to be fetched.
|
|
1312
|
+
* @param xMagdaTenantId 0
|
|
1313
|
+
* @param xMagdaSession Magda internal session id
|
|
1314
|
+
*/
|
|
1315
|
+
getByIdSummary(id, xMagdaTenantId, xMagdaSession) {
|
|
1316
|
+
const localVarPath = this.basePath + '/records/summary/{id}'
|
|
1317
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1318
|
+
let queryParameters = {};
|
|
1319
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1320
|
+
let formParams = {};
|
|
1321
|
+
// verify required parameter 'id' is not null or undefined
|
|
1322
|
+
if (id === null || id === undefined) {
|
|
1323
|
+
throw new Error('Required parameter id was null or undefined when calling getByIdSummary.');
|
|
1324
|
+
}
|
|
1325
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1326
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1327
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getByIdSummary.');
|
|
1328
|
+
}
|
|
1329
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1330
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1331
|
+
let useFormData = false;
|
|
1332
|
+
let requestOptions = {
|
|
1333
|
+
method: 'GET',
|
|
1334
|
+
qs: queryParameters,
|
|
1335
|
+
headers: headerParams,
|
|
1336
|
+
uri: localVarPath,
|
|
1337
|
+
useQuerystring: this._useQuerystring,
|
|
1338
|
+
json: true,
|
|
1339
|
+
};
|
|
1340
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1341
|
+
if (Object.keys(formParams).length) {
|
|
1342
|
+
if (useFormData) {
|
|
1343
|
+
requestOptions.formData = formParams;
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
requestOptions.form = formParams;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return new Promise((resolve, reject) => {
|
|
1350
|
+
request(requestOptions, (error, response, body) => {
|
|
1351
|
+
if (error) {
|
|
1352
|
+
reject(error);
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1356
|
+
resolve({ response: response, body: body });
|
|
1357
|
+
}
|
|
1358
|
+
else {
|
|
1359
|
+
reject({ response: response, body: body });
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Get the count of records matching the parameters. If no parameters are specified, the count will be approximate for performance reasons.
|
|
1367
|
+
*
|
|
1368
|
+
* @param xMagdaTenantId 0
|
|
1369
|
+
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
1370
|
+
* @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. NOTE: This is an early stage API and may change greatly in the future
|
|
1371
|
+
* @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. Queries passing via this parameter will be grouped with OR logic.
|
|
1372
|
+
* @param xMagdaSession Magda internal session id
|
|
1373
|
+
*/
|
|
1374
|
+
getCount(xMagdaTenantId, aspect, aspectQuery, aspectOrQuery, xMagdaSession) {
|
|
1375
|
+
const localVarPath = this.basePath + '/records/count';
|
|
1376
|
+
let queryParameters = {};
|
|
1377
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1378
|
+
let formParams = {};
|
|
1379
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1380
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1381
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getCount.');
|
|
1382
|
+
}
|
|
1383
|
+
if (aspect !== undefined) {
|
|
1384
|
+
queryParameters['aspect'] = aspect;
|
|
1385
|
+
}
|
|
1386
|
+
if (aspectQuery !== undefined) {
|
|
1387
|
+
queryParameters['aspectQuery'] = aspectQuery;
|
|
1388
|
+
}
|
|
1389
|
+
if (aspectOrQuery !== undefined) {
|
|
1390
|
+
queryParameters['aspectOrQuery'] = aspectOrQuery;
|
|
1391
|
+
}
|
|
1392
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1393
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1394
|
+
let useFormData = false;
|
|
1395
|
+
let requestOptions = {
|
|
1396
|
+
method: 'GET',
|
|
1397
|
+
qs: queryParameters,
|
|
1398
|
+
headers: headerParams,
|
|
1399
|
+
uri: localVarPath,
|
|
1400
|
+
useQuerystring: this._useQuerystring,
|
|
1401
|
+
json: true,
|
|
1402
|
+
};
|
|
1403
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1404
|
+
if (Object.keys(formParams).length) {
|
|
1405
|
+
if (useFormData) {
|
|
1406
|
+
requestOptions.formData = formParams;
|
|
1407
|
+
}
|
|
1408
|
+
else {
|
|
1409
|
+
requestOptions.form = formParams;
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
return new Promise((resolve, reject) => {
|
|
1413
|
+
request(requestOptions, (error, response, body) => {
|
|
1414
|
+
if (error) {
|
|
1415
|
+
reject(error);
|
|
1416
|
+
}
|
|
1417
|
+
else {
|
|
1418
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1419
|
+
resolve({ response: response, body: body });
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
reject({ response: response, body: body });
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Get a list tokens for paging through the records
|
|
1430
|
+
*
|
|
1431
|
+
* @param xMagdaTenantId 0
|
|
1432
|
+
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
1433
|
+
* @param limit The size of each page to get tokens for.
|
|
1434
|
+
* @param xMagdaSession Magda internal session id
|
|
1435
|
+
*/
|
|
1436
|
+
getPageTokens(xMagdaTenantId, aspect, limit, xMagdaSession) {
|
|
1437
|
+
const localVarPath = this.basePath + '/records/pagetokens';
|
|
1438
|
+
let queryParameters = {};
|
|
1439
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1440
|
+
let formParams = {};
|
|
1441
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1442
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1443
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getPageTokens.');
|
|
1444
|
+
}
|
|
1445
|
+
if (aspect !== undefined) {
|
|
1446
|
+
queryParameters['aspect'] = aspect;
|
|
1447
|
+
}
|
|
1448
|
+
if (limit !== undefined) {
|
|
1449
|
+
queryParameters['limit'] = limit;
|
|
1450
|
+
}
|
|
1451
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1452
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1453
|
+
let useFormData = false;
|
|
1454
|
+
let requestOptions = {
|
|
1455
|
+
method: 'GET',
|
|
1456
|
+
qs: queryParameters,
|
|
1457
|
+
headers: headerParams,
|
|
1458
|
+
uri: localVarPath,
|
|
1459
|
+
useQuerystring: this._useQuerystring,
|
|
1460
|
+
json: true,
|
|
1461
|
+
};
|
|
1462
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1463
|
+
if (Object.keys(formParams).length) {
|
|
1464
|
+
if (useFormData) {
|
|
1465
|
+
requestOptions.formData = formParams;
|
|
1466
|
+
}
|
|
1467
|
+
else {
|
|
1468
|
+
requestOptions.form = formParams;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
return new Promise((resolve, reject) => {
|
|
1472
|
+
request(requestOptions, (error, response, body) => {
|
|
1473
|
+
if (error) {
|
|
1474
|
+
reject(error);
|
|
1475
|
+
}
|
|
1476
|
+
else {
|
|
1477
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1478
|
+
resolve({ response: response, body: body });
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
reject({ response: response, body: body });
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Modify a record by applying a JSON Patch
|
|
1489
|
+
* The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
|
|
1490
|
+
* @param xMagdaTenantId 0
|
|
1491
|
+
* @param id ID of the aspect to be saved.
|
|
1492
|
+
* @param recordPatch The RFC 6902 patch to apply to the aspect.
|
|
1493
|
+
* @param xMagdaSession Magda internal session id
|
|
1494
|
+
*/
|
|
1495
|
+
patchById(xMagdaTenantId, id, recordPatch, xMagdaSession) {
|
|
1496
|
+
const localVarPath = this.basePath + '/records/{id}'
|
|
1497
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1498
|
+
let queryParameters = {};
|
|
1499
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1500
|
+
let formParams = {};
|
|
1501
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1502
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1503
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling patchById.');
|
|
1504
|
+
}
|
|
1505
|
+
// verify required parameter 'id' is not null or undefined
|
|
1506
|
+
if (id === null || id === undefined) {
|
|
1507
|
+
throw new Error('Required parameter id was null or undefined when calling patchById.');
|
|
1508
|
+
}
|
|
1509
|
+
// verify required parameter 'recordPatch' is not null or undefined
|
|
1510
|
+
if (recordPatch === null || recordPatch === undefined) {
|
|
1511
|
+
throw new Error('Required parameter recordPatch was null or undefined when calling patchById.');
|
|
1512
|
+
}
|
|
1513
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1514
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1515
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling patchById.');
|
|
1516
|
+
}
|
|
1517
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1518
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1519
|
+
let useFormData = false;
|
|
1520
|
+
let requestOptions = {
|
|
1521
|
+
method: 'PATCH',
|
|
1522
|
+
qs: queryParameters,
|
|
1523
|
+
headers: headerParams,
|
|
1524
|
+
uri: localVarPath,
|
|
1525
|
+
useQuerystring: this._useQuerystring,
|
|
1526
|
+
json: true,
|
|
1527
|
+
body: recordPatch,
|
|
1528
|
+
};
|
|
1529
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1530
|
+
if (Object.keys(formParams).length) {
|
|
1531
|
+
if (useFormData) {
|
|
1532
|
+
requestOptions.formData = formParams;
|
|
1533
|
+
}
|
|
1534
|
+
else {
|
|
1535
|
+
requestOptions.form = formParams;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return new Promise((resolve, reject) => {
|
|
1539
|
+
request(requestOptions, (error, response, body) => {
|
|
1540
|
+
if (error) {
|
|
1541
|
+
reject(error);
|
|
1542
|
+
}
|
|
1543
|
+
else {
|
|
1544
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1545
|
+
resolve({ response: response, body: body });
|
|
1546
|
+
}
|
|
1547
|
+
else {
|
|
1548
|
+
reject({ response: response, body: body });
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Modify a record by ID
|
|
1556
|
+
* Modifies a record. Aspects included in the request are created or updated, but missing aspects are not removed.
|
|
1557
|
+
* @param xMagdaTenantId 0
|
|
1558
|
+
* @param id ID of the record to be fetched.
|
|
1559
|
+
* @param record The record to save.
|
|
1560
|
+
* @param xMagdaSession Magda internal session id
|
|
1561
|
+
*/
|
|
1562
|
+
putById(xMagdaTenantId, id, record, xMagdaSession) {
|
|
1563
|
+
const localVarPath = this.basePath + '/records/{id}'
|
|
1564
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1565
|
+
let queryParameters = {};
|
|
1566
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1567
|
+
let formParams = {};
|
|
1568
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1569
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1570
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling putById.');
|
|
1571
|
+
}
|
|
1572
|
+
// verify required parameter 'id' is not null or undefined
|
|
1573
|
+
if (id === null || id === undefined) {
|
|
1574
|
+
throw new Error('Required parameter id was null or undefined when calling putById.');
|
|
1575
|
+
}
|
|
1576
|
+
// verify required parameter 'record' is not null or undefined
|
|
1577
|
+
if (record === null || record === undefined) {
|
|
1578
|
+
throw new Error('Required parameter record was null or undefined when calling putById.');
|
|
1579
|
+
}
|
|
1580
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1581
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1582
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling putById.');
|
|
1583
|
+
}
|
|
1584
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1585
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1586
|
+
let useFormData = false;
|
|
1587
|
+
let requestOptions = {
|
|
1588
|
+
method: 'PUT',
|
|
1589
|
+
qs: queryParameters,
|
|
1590
|
+
headers: headerParams,
|
|
1591
|
+
uri: localVarPath,
|
|
1592
|
+
useQuerystring: this._useQuerystring,
|
|
1593
|
+
json: true,
|
|
1594
|
+
body: record,
|
|
1595
|
+
};
|
|
1596
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1597
|
+
if (Object.keys(formParams).length) {
|
|
1598
|
+
if (useFormData) {
|
|
1599
|
+
requestOptions.formData = formParams;
|
|
1600
|
+
}
|
|
1601
|
+
else {
|
|
1602
|
+
requestOptions.form = formParams;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
return new Promise((resolve, reject) => {
|
|
1606
|
+
request(requestOptions, (error, response, body) => {
|
|
1607
|
+
if (error) {
|
|
1608
|
+
reject(error);
|
|
1609
|
+
}
|
|
1610
|
+
else {
|
|
1611
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1612
|
+
resolve({ response: response, body: body });
|
|
1613
|
+
}
|
|
1614
|
+
else {
|
|
1615
|
+
reject({ response: response, body: body });
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Trim by source tag
|
|
1623
|
+
* Trims records with the provided source that DON'T have the supplied source tag
|
|
1624
|
+
* @param xMagdaTenantId 0
|
|
1625
|
+
* @param sourceTagToPreserve Source tag of the records to PRESERVE.
|
|
1626
|
+
* @param sourceId Source id of the records to delete.
|
|
1627
|
+
* @param xMagdaSession Magda internal session id
|
|
1628
|
+
*/
|
|
1629
|
+
trimBySourceTag(xMagdaTenantId, sourceTagToPreserve, sourceId, xMagdaSession) {
|
|
1630
|
+
const localVarPath = this.basePath + '/records';
|
|
1631
|
+
let queryParameters = {};
|
|
1632
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1633
|
+
let formParams = {};
|
|
1634
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
1635
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
1636
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling trimBySourceTag.');
|
|
1637
|
+
}
|
|
1638
|
+
// verify required parameter 'sourceTagToPreserve' is not null or undefined
|
|
1639
|
+
if (sourceTagToPreserve === null || sourceTagToPreserve === undefined) {
|
|
1640
|
+
throw new Error('Required parameter sourceTagToPreserve was null or undefined when calling trimBySourceTag.');
|
|
1641
|
+
}
|
|
1642
|
+
// verify required parameter 'sourceId' is not null or undefined
|
|
1643
|
+
if (sourceId === null || sourceId === undefined) {
|
|
1644
|
+
throw new Error('Required parameter sourceId was null or undefined when calling trimBySourceTag.');
|
|
1645
|
+
}
|
|
1646
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1647
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1648
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling trimBySourceTag.');
|
|
1649
|
+
}
|
|
1650
|
+
if (sourceTagToPreserve !== undefined) {
|
|
1651
|
+
queryParameters['sourceTagToPreserve'] = sourceTagToPreserve;
|
|
1652
|
+
}
|
|
1653
|
+
if (sourceId !== undefined) {
|
|
1654
|
+
queryParameters['sourceId'] = sourceId;
|
|
1655
|
+
}
|
|
1656
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
1657
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1658
|
+
let useFormData = false;
|
|
1659
|
+
let requestOptions = {
|
|
1660
|
+
method: 'DELETE',
|
|
1661
|
+
qs: queryParameters,
|
|
1662
|
+
headers: headerParams,
|
|
1663
|
+
uri: localVarPath,
|
|
1664
|
+
useQuerystring: this._useQuerystring,
|
|
1665
|
+
json: true,
|
|
1666
|
+
};
|
|
1667
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1668
|
+
if (Object.keys(formParams).length) {
|
|
1669
|
+
if (useFormData) {
|
|
1670
|
+
requestOptions.formData = formParams;
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
requestOptions.form = formParams;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
return new Promise((resolve, reject) => {
|
|
1677
|
+
request(requestOptions, (error, response, body) => {
|
|
1678
|
+
if (error) {
|
|
1679
|
+
reject(error);
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1683
|
+
resolve({ response: response, body: body });
|
|
1684
|
+
}
|
|
1685
|
+
else {
|
|
1686
|
+
reject({ response: response, body: body });
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
exports.RecordsApi = RecordsApi;
|
|
1694
|
+
var WebHooksApiApiKeys;
|
|
1695
|
+
(function (WebHooksApiApiKeys) {
|
|
1696
|
+
})(WebHooksApiApiKeys = exports.WebHooksApiApiKeys || (exports.WebHooksApiApiKeys = {}));
|
|
1697
|
+
class WebHooksApi {
|
|
1698
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
1699
|
+
this.basePath = defaultBasePath;
|
|
1700
|
+
this.defaultHeaders = {};
|
|
1701
|
+
this._useQuerystring = false;
|
|
1702
|
+
this.authentications = {
|
|
1703
|
+
'default': new VoidAuth(),
|
|
1704
|
+
};
|
|
1705
|
+
if (password) {
|
|
1706
|
+
if (basePath) {
|
|
1707
|
+
this.basePath = basePath;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
if (basePathOrUsername) {
|
|
1712
|
+
this.basePath = basePathOrUsername;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
set useQuerystring(value) {
|
|
1717
|
+
this._useQuerystring = value;
|
|
1718
|
+
}
|
|
1719
|
+
setApiKey(key, value) {
|
|
1720
|
+
this.authentications[WebHooksApiApiKeys[key]].apiKey = value;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Acknowledge a previously-deferred web hook
|
|
1724
|
+
* Acknowledges a previously-deferred web hook with a given ID. Acknowledging a previously-POSTed web hook will cause the next, if any, to be sent.
|
|
1725
|
+
* @param id ID of the web hook to be acknowledged.
|
|
1726
|
+
* @param acknowledgement The details of the acknowledgement.
|
|
1727
|
+
* @param xMagdaSession Magda internal session id
|
|
1728
|
+
*/
|
|
1729
|
+
ack(id, acknowledgement, xMagdaSession) {
|
|
1730
|
+
const localVarPath = this.basePath + '/hooks/{id}/ack'
|
|
1731
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1732
|
+
let queryParameters = {};
|
|
1733
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1734
|
+
let formParams = {};
|
|
1735
|
+
// verify required parameter 'id' is not null or undefined
|
|
1736
|
+
if (id === null || id === undefined) {
|
|
1737
|
+
throw new Error('Required parameter id was null or undefined when calling ack.');
|
|
1738
|
+
}
|
|
1739
|
+
// verify required parameter 'acknowledgement' is not null or undefined
|
|
1740
|
+
if (acknowledgement === null || acknowledgement === undefined) {
|
|
1741
|
+
throw new Error('Required parameter acknowledgement was null or undefined when calling ack.');
|
|
1742
|
+
}
|
|
1743
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1744
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1745
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling ack.');
|
|
1746
|
+
}
|
|
1747
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1748
|
+
let useFormData = false;
|
|
1749
|
+
let requestOptions = {
|
|
1750
|
+
method: 'POST',
|
|
1751
|
+
qs: queryParameters,
|
|
1752
|
+
headers: headerParams,
|
|
1753
|
+
uri: localVarPath,
|
|
1754
|
+
useQuerystring: this._useQuerystring,
|
|
1755
|
+
json: true,
|
|
1756
|
+
body: acknowledgement,
|
|
1757
|
+
};
|
|
1758
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1759
|
+
if (Object.keys(formParams).length) {
|
|
1760
|
+
if (useFormData) {
|
|
1761
|
+
requestOptions.formData = formParams;
|
|
1762
|
+
}
|
|
1763
|
+
else {
|
|
1764
|
+
requestOptions.form = formParams;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
return new Promise((resolve, reject) => {
|
|
1768
|
+
request(requestOptions, (error, response, body) => {
|
|
1769
|
+
if (error) {
|
|
1770
|
+
reject(error);
|
|
1771
|
+
}
|
|
1772
|
+
else {
|
|
1773
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1774
|
+
resolve({ response: response, body: body });
|
|
1775
|
+
}
|
|
1776
|
+
else {
|
|
1777
|
+
reject({ response: response, body: body });
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Create a new web hook
|
|
1785
|
+
*
|
|
1786
|
+
* @param hook The definition of the new web hook.
|
|
1787
|
+
* @param xMagdaSession Magda internal session id
|
|
1788
|
+
*/
|
|
1789
|
+
create(hook, xMagdaSession) {
|
|
1790
|
+
const localVarPath = this.basePath + '/hooks';
|
|
1791
|
+
let queryParameters = {};
|
|
1792
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1793
|
+
let formParams = {};
|
|
1794
|
+
// verify required parameter 'hook' is not null or undefined
|
|
1795
|
+
if (hook === null || hook === undefined) {
|
|
1796
|
+
throw new Error('Required parameter hook was null or undefined when calling create.');
|
|
1797
|
+
}
|
|
1798
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1799
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1800
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling create.');
|
|
1801
|
+
}
|
|
1802
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1803
|
+
let useFormData = false;
|
|
1804
|
+
let requestOptions = {
|
|
1805
|
+
method: 'POST',
|
|
1806
|
+
qs: queryParameters,
|
|
1807
|
+
headers: headerParams,
|
|
1808
|
+
uri: localVarPath,
|
|
1809
|
+
useQuerystring: this._useQuerystring,
|
|
1810
|
+
json: true,
|
|
1811
|
+
body: hook,
|
|
1812
|
+
};
|
|
1813
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1814
|
+
if (Object.keys(formParams).length) {
|
|
1815
|
+
if (useFormData) {
|
|
1816
|
+
requestOptions.formData = formParams;
|
|
1817
|
+
}
|
|
1818
|
+
else {
|
|
1819
|
+
requestOptions.form = formParams;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
return new Promise((resolve, reject) => {
|
|
1823
|
+
request(requestOptions, (error, response, body) => {
|
|
1824
|
+
if (error) {
|
|
1825
|
+
reject(error);
|
|
1826
|
+
}
|
|
1827
|
+
else {
|
|
1828
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1829
|
+
resolve({ response: response, body: body });
|
|
1830
|
+
}
|
|
1831
|
+
else {
|
|
1832
|
+
reject({ response: response, body: body });
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Delete a web hook
|
|
1840
|
+
*
|
|
1841
|
+
* @param hookId ID of the web hook to delete.
|
|
1842
|
+
* @param xMagdaSession Magda internal session id
|
|
1843
|
+
*/
|
|
1844
|
+
deleteById(hookId, xMagdaSession) {
|
|
1845
|
+
const localVarPath = this.basePath + '/hooks/{hookId}'
|
|
1846
|
+
.replace('{' + 'hookId' + '}', String(hookId));
|
|
1847
|
+
let queryParameters = {};
|
|
1848
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1849
|
+
let formParams = {};
|
|
1850
|
+
// verify required parameter 'hookId' is not null or undefined
|
|
1851
|
+
if (hookId === null || hookId === undefined) {
|
|
1852
|
+
throw new Error('Required parameter hookId was null or undefined when calling deleteById.');
|
|
1853
|
+
}
|
|
1854
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1855
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1856
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling deleteById.');
|
|
1857
|
+
}
|
|
1858
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1859
|
+
let useFormData = false;
|
|
1860
|
+
let requestOptions = {
|
|
1861
|
+
method: 'DELETE',
|
|
1862
|
+
qs: queryParameters,
|
|
1863
|
+
headers: headerParams,
|
|
1864
|
+
uri: localVarPath,
|
|
1865
|
+
useQuerystring: this._useQuerystring,
|
|
1866
|
+
json: true,
|
|
1867
|
+
};
|
|
1868
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1869
|
+
if (Object.keys(formParams).length) {
|
|
1870
|
+
if (useFormData) {
|
|
1871
|
+
requestOptions.formData = formParams;
|
|
1872
|
+
}
|
|
1873
|
+
else {
|
|
1874
|
+
requestOptions.form = formParams;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
return new Promise((resolve, reject) => {
|
|
1878
|
+
request(requestOptions, (error, response, body) => {
|
|
1879
|
+
if (error) {
|
|
1880
|
+
reject(error);
|
|
1881
|
+
}
|
|
1882
|
+
else {
|
|
1883
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1884
|
+
resolve({ response: response, body: body });
|
|
1885
|
+
}
|
|
1886
|
+
else {
|
|
1887
|
+
reject({ response: response, body: body });
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Get a list of all web hooks
|
|
1895
|
+
*
|
|
1896
|
+
* @param xMagdaSession Magda internal session id
|
|
1897
|
+
*/
|
|
1898
|
+
getAll(xMagdaSession) {
|
|
1899
|
+
const localVarPath = this.basePath + '/hooks';
|
|
1900
|
+
let queryParameters = {};
|
|
1901
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1902
|
+
let formParams = {};
|
|
1903
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1904
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1905
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling getAll.');
|
|
1906
|
+
}
|
|
1907
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1908
|
+
let useFormData = false;
|
|
1909
|
+
let requestOptions = {
|
|
1910
|
+
method: 'GET',
|
|
1911
|
+
qs: queryParameters,
|
|
1912
|
+
headers: headerParams,
|
|
1913
|
+
uri: localVarPath,
|
|
1914
|
+
useQuerystring: this._useQuerystring,
|
|
1915
|
+
json: true,
|
|
1916
|
+
};
|
|
1917
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1918
|
+
if (Object.keys(formParams).length) {
|
|
1919
|
+
if (useFormData) {
|
|
1920
|
+
requestOptions.formData = formParams;
|
|
1921
|
+
}
|
|
1922
|
+
else {
|
|
1923
|
+
requestOptions.form = formParams;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
return new Promise((resolve, reject) => {
|
|
1927
|
+
request(requestOptions, (error, response, body) => {
|
|
1928
|
+
if (error) {
|
|
1929
|
+
reject(error);
|
|
1930
|
+
}
|
|
1931
|
+
else {
|
|
1932
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1933
|
+
resolve({ response: response, body: body });
|
|
1934
|
+
}
|
|
1935
|
+
else {
|
|
1936
|
+
reject({ response: response, body: body });
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Get a web hook by ID
|
|
1944
|
+
*
|
|
1945
|
+
* @param id ID of the web hook to be fetched.
|
|
1946
|
+
* @param xMagdaSession Magda internal session id
|
|
1947
|
+
*/
|
|
1948
|
+
getById(id, xMagdaSession) {
|
|
1949
|
+
const localVarPath = this.basePath + '/hooks/{id}'
|
|
1950
|
+
.replace('{' + 'id' + '}', String(id));
|
|
1951
|
+
let queryParameters = {};
|
|
1952
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1953
|
+
let formParams = {};
|
|
1954
|
+
// verify required parameter 'id' is not null or undefined
|
|
1955
|
+
if (id === null || id === undefined) {
|
|
1956
|
+
throw new Error('Required parameter id was null or undefined when calling getById.');
|
|
1957
|
+
}
|
|
1958
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
1959
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
1960
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling getById.');
|
|
1961
|
+
}
|
|
1962
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
1963
|
+
let useFormData = false;
|
|
1964
|
+
let requestOptions = {
|
|
1965
|
+
method: 'GET',
|
|
1966
|
+
qs: queryParameters,
|
|
1967
|
+
headers: headerParams,
|
|
1968
|
+
uri: localVarPath,
|
|
1969
|
+
useQuerystring: this._useQuerystring,
|
|
1970
|
+
json: true,
|
|
1971
|
+
};
|
|
1972
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
1973
|
+
if (Object.keys(formParams).length) {
|
|
1974
|
+
if (useFormData) {
|
|
1975
|
+
requestOptions.formData = formParams;
|
|
1976
|
+
}
|
|
1977
|
+
else {
|
|
1978
|
+
requestOptions.form = formParams;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
return new Promise((resolve, reject) => {
|
|
1982
|
+
request(requestOptions, (error, response, body) => {
|
|
1983
|
+
if (error) {
|
|
1984
|
+
reject(error);
|
|
1985
|
+
}
|
|
1986
|
+
else {
|
|
1987
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1988
|
+
resolve({ response: response, body: body });
|
|
1989
|
+
}
|
|
1990
|
+
else {
|
|
1991
|
+
reject({ response: response, body: body });
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Modify a web hook by ID
|
|
1999
|
+
* Modifies the web hook with a given ID. If a web hook with the ID does not yet exist, it is created.
|
|
2000
|
+
* @param id ID of the aspect to be saved.
|
|
2001
|
+
* @param hook The web hook to save.
|
|
2002
|
+
* @param xMagdaSession Magda internal session id
|
|
2003
|
+
*/
|
|
2004
|
+
putById(id, hook, xMagdaSession) {
|
|
2005
|
+
const localVarPath = this.basePath + '/hooks/{id}'
|
|
2006
|
+
.replace('{' + 'id' + '}', String(id));
|
|
2007
|
+
let queryParameters = {};
|
|
2008
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
2009
|
+
let formParams = {};
|
|
2010
|
+
// verify required parameter 'id' is not null or undefined
|
|
2011
|
+
if (id === null || id === undefined) {
|
|
2012
|
+
throw new Error('Required parameter id was null or undefined when calling putById.');
|
|
2013
|
+
}
|
|
2014
|
+
// verify required parameter 'hook' is not null or undefined
|
|
2015
|
+
if (hook === null || hook === undefined) {
|
|
2016
|
+
throw new Error('Required parameter hook was null or undefined when calling putById.');
|
|
2017
|
+
}
|
|
2018
|
+
// verify required parameter 'xMagdaSession' is not null or undefined
|
|
2019
|
+
if (xMagdaSession === null || xMagdaSession === undefined) {
|
|
2020
|
+
throw new Error('Required parameter xMagdaSession was null or undefined when calling putById.');
|
|
2021
|
+
}
|
|
2022
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
2023
|
+
let useFormData = false;
|
|
2024
|
+
let requestOptions = {
|
|
2025
|
+
method: 'PUT',
|
|
2026
|
+
qs: queryParameters,
|
|
2027
|
+
headers: headerParams,
|
|
2028
|
+
uri: localVarPath,
|
|
2029
|
+
useQuerystring: this._useQuerystring,
|
|
2030
|
+
json: true,
|
|
2031
|
+
body: hook,
|
|
2032
|
+
};
|
|
2033
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
2034
|
+
if (Object.keys(formParams).length) {
|
|
2035
|
+
if (useFormData) {
|
|
2036
|
+
requestOptions.formData = formParams;
|
|
2037
|
+
}
|
|
2038
|
+
else {
|
|
2039
|
+
requestOptions.form = formParams;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
return new Promise((resolve, reject) => {
|
|
2043
|
+
request(requestOptions, (error, response, body) => {
|
|
2044
|
+
if (error) {
|
|
2045
|
+
reject(error);
|
|
2046
|
+
}
|
|
2047
|
+
else {
|
|
2048
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
2049
|
+
resolve({ response: response, body: body });
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
reject({ response: response, body: body });
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
exports.WebHooksApi = WebHooksApi;
|
|
2060
|
+
//# sourceMappingURL=api.js.map
|