2957 lines
98 KiB
JavaScript
2957 lines
98 KiB
JavaScript
'use strict';
|
|
|
|
var client = require('../client');
|
|
|
|
class Databases {
|
|
constructor(client) {
|
|
this.client = client;
|
|
}
|
|
list(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
queries: paramsOrFirst,
|
|
search: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const queries = params.queries;
|
|
const search = params.search;
|
|
const total = params.total;
|
|
const apiPath = "/databases";
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof search !== "undefined") {
|
|
payload["search"] = search;
|
|
}
|
|
if (typeof total !== "undefined") {
|
|
payload["total"] = total;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
create(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/databases";
|
|
const payload = {};
|
|
if (typeof databaseId !== "undefined") {
|
|
payload["databaseId"] = databaseId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listTransactions(paramsOrFirst) {
|
|
let params;
|
|
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
queries: paramsOrFirst
|
|
};
|
|
}
|
|
const queries = params.queries;
|
|
const apiPath = "/databases/transactions";
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createTransaction(paramsOrFirst) {
|
|
let params;
|
|
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
ttl: paramsOrFirst
|
|
};
|
|
}
|
|
const ttl = params.ttl;
|
|
const apiPath = "/databases/transactions";
|
|
const payload = {};
|
|
if (typeof ttl !== "undefined") {
|
|
payload["ttl"] = ttl;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getTransaction(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
transactionId: paramsOrFirst
|
|
};
|
|
}
|
|
const transactionId = params.transactionId;
|
|
if (typeof transactionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "transactionId"');
|
|
}
|
|
const apiPath = "/databases/transactions/{transactionId}".replace("{transactionId}", transactionId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateTransaction(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
transactionId: paramsOrFirst,
|
|
commit: rest[0],
|
|
rollback: rest[1]
|
|
};
|
|
}
|
|
const transactionId = params.transactionId;
|
|
const commit = params.commit;
|
|
const rollback = params.rollback;
|
|
if (typeof transactionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "transactionId"');
|
|
}
|
|
const apiPath = "/databases/transactions/{transactionId}".replace("{transactionId}", transactionId);
|
|
const payload = {};
|
|
if (typeof commit !== "undefined") {
|
|
payload["commit"] = commit;
|
|
}
|
|
if (typeof rollback !== "undefined") {
|
|
payload["rollback"] = rollback;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteTransaction(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
transactionId: paramsOrFirst
|
|
};
|
|
}
|
|
const transactionId = params.transactionId;
|
|
if (typeof transactionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "transactionId"');
|
|
}
|
|
const apiPath = "/databases/transactions/{transactionId}".replace("{transactionId}", transactionId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createOperations(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
transactionId: paramsOrFirst,
|
|
operations: rest[0]
|
|
};
|
|
}
|
|
const transactionId = params.transactionId;
|
|
const operations = params.operations;
|
|
if (typeof transactionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "transactionId"');
|
|
}
|
|
const apiPath = "/databases/transactions/{transactionId}/operations".replace("{transactionId}", transactionId);
|
|
const payload = {};
|
|
if (typeof operations !== "undefined") {
|
|
payload["operations"] = operations;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
get(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}".replace("{databaseId}", databaseId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
update(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}".replace("{databaseId}", databaseId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"put",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
delete(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}".replace("{databaseId}", databaseId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listCollections(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
queries: rest[0],
|
|
search: rest[1],
|
|
total: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const queries = params.queries;
|
|
const search = params.search;
|
|
const total = params.total;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections".replace("{databaseId}", databaseId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof search !== "undefined") {
|
|
payload["search"] = search;
|
|
}
|
|
if (typeof total !== "undefined") {
|
|
payload["total"] = total;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createCollection(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
name: rest[1],
|
|
permissions: rest[2],
|
|
documentSecurity: rest[3],
|
|
enabled: rest[4],
|
|
attributes: rest[5],
|
|
indexes: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const name = params.name;
|
|
const permissions = params.permissions;
|
|
const documentSecurity = params.documentSecurity;
|
|
const enabled = params.enabled;
|
|
const attributes = params.attributes;
|
|
const indexes = params.indexes;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections".replace("{databaseId}", databaseId);
|
|
const payload = {};
|
|
if (typeof collectionId !== "undefined") {
|
|
payload["collectionId"] = collectionId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof permissions !== "undefined") {
|
|
payload["permissions"] = permissions;
|
|
}
|
|
if (typeof documentSecurity !== "undefined") {
|
|
payload["documentSecurity"] = documentSecurity;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof attributes !== "undefined") {
|
|
payload["attributes"] = attributes;
|
|
}
|
|
if (typeof indexes !== "undefined") {
|
|
payload["indexes"] = indexes;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getCollection(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateCollection(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
name: rest[1],
|
|
permissions: rest[2],
|
|
documentSecurity: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const name = params.name;
|
|
const permissions = params.permissions;
|
|
const documentSecurity = params.documentSecurity;
|
|
const enabled = params.enabled;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof permissions !== "undefined") {
|
|
payload["permissions"] = permissions;
|
|
}
|
|
if (typeof documentSecurity !== "undefined") {
|
|
payload["documentSecurity"] = documentSecurity;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"put",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteCollection(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listAttributes(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
queries: rest[1],
|
|
total: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof total !== "undefined") {
|
|
payload["total"] = total;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createBooleanAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
array: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateBooleanAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createDatetimeAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
array: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateDatetimeAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createEmailAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
array: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateEmailAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createEnumAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
elements: rest[2],
|
|
required: rest[3],
|
|
xdefault: rest[4],
|
|
array: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const elements = params.elements;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof elements === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "elements"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof elements !== "undefined") {
|
|
payload["elements"] = elements;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateEnumAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
elements: rest[2],
|
|
required: rest[3],
|
|
xdefault: rest[4],
|
|
newKey: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const elements = params.elements;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof elements === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "elements"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof elements !== "undefined") {
|
|
payload["elements"] = elements;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createFloatAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
min: rest[3],
|
|
max: rest[4],
|
|
xdefault: rest[5],
|
|
array: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const min = params.min;
|
|
const max = params.max;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof min !== "undefined") {
|
|
payload["min"] = min;
|
|
}
|
|
if (typeof max !== "undefined") {
|
|
payload["max"] = max;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateFloatAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
min: rest[4],
|
|
max: rest[5],
|
|
newKey: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const min = params.min;
|
|
const max = params.max;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof min !== "undefined") {
|
|
payload["min"] = min;
|
|
}
|
|
if (typeof max !== "undefined") {
|
|
payload["max"] = max;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createIntegerAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
min: rest[3],
|
|
max: rest[4],
|
|
xdefault: rest[5],
|
|
array: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const min = params.min;
|
|
const max = params.max;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof min !== "undefined") {
|
|
payload["min"] = min;
|
|
}
|
|
if (typeof max !== "undefined") {
|
|
payload["max"] = max;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateIntegerAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
min: rest[4],
|
|
max: rest[5],
|
|
newKey: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const min = params.min;
|
|
const max = params.max;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof min !== "undefined") {
|
|
payload["min"] = min;
|
|
}
|
|
if (typeof max !== "undefined") {
|
|
payload["max"] = max;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createIpAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
array: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateIpAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createLineAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateLineAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createPointAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updatePointAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createPolygonAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updatePolygonAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createRelationshipAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
relatedCollectionId: rest[1],
|
|
type: rest[2],
|
|
twoWay: rest[3],
|
|
key: rest[4],
|
|
twoWayKey: rest[5],
|
|
onDelete: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const relatedCollectionId = params.relatedCollectionId;
|
|
const type = params.type;
|
|
const twoWay = params.twoWay;
|
|
const key = params.key;
|
|
const twoWayKey = params.twoWayKey;
|
|
const onDelete = params.onDelete;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof relatedCollectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "relatedCollectionId"');
|
|
}
|
|
if (typeof type === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "type"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof relatedCollectionId !== "undefined") {
|
|
payload["relatedCollectionId"] = relatedCollectionId;
|
|
}
|
|
if (typeof type !== "undefined") {
|
|
payload["type"] = type;
|
|
}
|
|
if (typeof twoWay !== "undefined") {
|
|
payload["twoWay"] = twoWay;
|
|
}
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof twoWayKey !== "undefined") {
|
|
payload["twoWayKey"] = twoWayKey;
|
|
}
|
|
if (typeof onDelete !== "undefined") {
|
|
payload["onDelete"] = onDelete;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createStringAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
size: rest[2],
|
|
required: rest[3],
|
|
xdefault: rest[4],
|
|
array: rest[5],
|
|
encrypt: rest[6]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const size = params.size;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
const encrypt = params.encrypt;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof size === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "size"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof size !== "undefined") {
|
|
payload["size"] = size;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
if (typeof encrypt !== "undefined") {
|
|
payload["encrypt"] = encrypt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateStringAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
size: rest[4],
|
|
newKey: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const size = params.size;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof size !== "undefined") {
|
|
payload["size"] = size;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createUrlAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
array: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const array = params.array;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof array !== "undefined") {
|
|
payload["array"] = array;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateUrlAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
required: rest[2],
|
|
xdefault: rest[3],
|
|
newKey: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const required = params.required;
|
|
const xdefault = params.xdefault;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof required === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "required"');
|
|
}
|
|
if (typeof xdefault === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "xdefault"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof required !== "undefined") {
|
|
payload["required"] = required;
|
|
}
|
|
if (typeof xdefault !== "undefined") {
|
|
payload["default"] = xdefault;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateRelationshipAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
onDelete: rest[2],
|
|
newKey: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const onDelete = params.onDelete;
|
|
const newKey = params.newKey;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
if (typeof onDelete !== "undefined") {
|
|
payload["onDelete"] = onDelete;
|
|
}
|
|
if (typeof newKey !== "undefined") {
|
|
payload["newKey"] = newKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listDocuments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
queries: rest[1],
|
|
transactionId: rest[2],
|
|
total: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const queries = params.queries;
|
|
const transactionId = params.transactionId;
|
|
const total = params.total;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
if (typeof total !== "undefined") {
|
|
payload["total"] = total;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createDocument(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
data: rest[2],
|
|
permissions: rest[3],
|
|
transactionId: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const data = params.data;
|
|
const permissions = params.permissions;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
if (typeof data === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "data"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof documentId !== "undefined") {
|
|
payload["documentId"] = documentId;
|
|
}
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof permissions !== "undefined") {
|
|
payload["permissions"] = permissions;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createDocuments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documents: rest[1],
|
|
transactionId: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documents = params.documents;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documents === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documents"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof documents !== "undefined") {
|
|
payload["documents"] = documents;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
upsertDocuments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documents: rest[1],
|
|
transactionId: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documents = params.documents;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documents === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documents"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof documents !== "undefined") {
|
|
payload["documents"] = documents;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"put",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateDocuments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
data: rest[1],
|
|
queries: rest[2],
|
|
transactionId: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const data = params.data;
|
|
const queries = params.queries;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteDocuments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
queries: rest[1],
|
|
transactionId: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const queries = params.queries;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getDocument(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
queries: rest[2],
|
|
transactionId: rest[3]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const queries = params.queries;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
upsertDocument(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
data: rest[2],
|
|
permissions: rest[3],
|
|
transactionId: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const data = params.data;
|
|
const permissions = params.permissions;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
if (typeof data === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "data"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
|
|
const payload = {};
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof permissions !== "undefined") {
|
|
payload["permissions"] = permissions;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"put",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateDocument(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
data: rest[2],
|
|
permissions: rest[3],
|
|
transactionId: rest[4]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const data = params.data;
|
|
const permissions = params.permissions;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
|
|
const payload = {};
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof permissions !== "undefined") {
|
|
payload["permissions"] = permissions;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteDocument(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
transactionId: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
|
|
const payload = {};
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
decrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
attribute: rest[2],
|
|
value: rest[3],
|
|
min: rest[4],
|
|
transactionId: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const attribute = params.attribute;
|
|
const value = params.value;
|
|
const min = params.min;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
if (typeof attribute === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "attribute"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId).replace("{attribute}", attribute);
|
|
const payload = {};
|
|
if (typeof value !== "undefined") {
|
|
payload["value"] = value;
|
|
}
|
|
if (typeof min !== "undefined") {
|
|
payload["min"] = min;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
incrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
documentId: rest[1],
|
|
attribute: rest[2],
|
|
value: rest[3],
|
|
max: rest[4],
|
|
transactionId: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const documentId = params.documentId;
|
|
const attribute = params.attribute;
|
|
const value = params.value;
|
|
const max = params.max;
|
|
const transactionId = params.transactionId;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof documentId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "documentId"');
|
|
}
|
|
if (typeof attribute === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "attribute"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId).replace("{attribute}", attribute);
|
|
const payload = {};
|
|
if (typeof value !== "undefined") {
|
|
payload["value"] = value;
|
|
}
|
|
if (typeof max !== "undefined") {
|
|
payload["max"] = max;
|
|
}
|
|
if (typeof transactionId !== "undefined") {
|
|
payload["transactionId"] = transactionId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listIndexes(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
queries: rest[1],
|
|
total: rest[2]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof queries !== "undefined") {
|
|
payload["queries"] = queries;
|
|
}
|
|
if (typeof total !== "undefined") {
|
|
payload["total"] = total;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createIndex(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1],
|
|
type: rest[2],
|
|
attributes: rest[3],
|
|
orders: rest[4],
|
|
lengths: rest[5]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
const type = params.type;
|
|
const attributes = params.attributes;
|
|
const orders = params.orders;
|
|
const lengths = params.lengths;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof type === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "type"');
|
|
}
|
|
if (typeof attributes === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "attributes"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof type !== "undefined") {
|
|
payload["type"] = type;
|
|
}
|
|
if (typeof attributes !== "undefined") {
|
|
payload["attributes"] = attributes;
|
|
}
|
|
if (typeof orders !== "undefined") {
|
|
payload["orders"] = orders;
|
|
}
|
|
if (typeof lengths !== "undefined") {
|
|
payload["lengths"] = lengths;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getIndex(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteIndex(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
databaseId: paramsOrFirst,
|
|
collectionId: rest[0],
|
|
key: rest[1]
|
|
};
|
|
}
|
|
const databaseId = params.databaseId;
|
|
const collectionId = params.collectionId;
|
|
const key = params.key;
|
|
if (typeof databaseId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "databaseId"');
|
|
}
|
|
if (typeof collectionId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "collectionId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"delete",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
}
|
|
|
|
exports.Databases = Databases;
|
|
//# sourceMappingURL=out.js.map
|
|
//# sourceMappingURL=databases.js.map
|