1058 lines
32 KiB
JavaScript
1058 lines
32 KiB
JavaScript
import { AppwriteException } from '../client.mjs';
|
|
|
|
// src/services/sites.ts
|
|
var Sites = class {
|
|
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 = "/sites";
|
|
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 = {
|
|
siteId: paramsOrFirst,
|
|
name: rest[0],
|
|
framework: rest[1],
|
|
buildRuntime: rest[2],
|
|
enabled: rest[3],
|
|
logging: rest[4],
|
|
timeout: rest[5],
|
|
installCommand: rest[6],
|
|
buildCommand: rest[7],
|
|
outputDirectory: rest[8],
|
|
adapter: rest[9],
|
|
installationId: rest[10],
|
|
fallbackFile: rest[11],
|
|
providerRepositoryId: rest[12],
|
|
providerBranch: rest[13],
|
|
providerSilentMode: rest[14],
|
|
providerRootDirectory: rest[15],
|
|
specification: rest[16]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const name = params.name;
|
|
const framework = params.framework;
|
|
const buildRuntime = params.buildRuntime;
|
|
const enabled = params.enabled;
|
|
const logging = params.logging;
|
|
const timeout = params.timeout;
|
|
const installCommand = params.installCommand;
|
|
const buildCommand = params.buildCommand;
|
|
const outputDirectory = params.outputDirectory;
|
|
const adapter = params.adapter;
|
|
const installationId = params.installationId;
|
|
const fallbackFile = params.fallbackFile;
|
|
const providerRepositoryId = params.providerRepositoryId;
|
|
const providerBranch = params.providerBranch;
|
|
const providerSilentMode = params.providerSilentMode;
|
|
const providerRootDirectory = params.providerRootDirectory;
|
|
const specification = params.specification;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
if (typeof framework === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "framework"');
|
|
}
|
|
if (typeof buildRuntime === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "buildRuntime"');
|
|
}
|
|
const apiPath = "/sites";
|
|
const payload = {};
|
|
if (typeof siteId !== "undefined") {
|
|
payload["siteId"] = siteId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof framework !== "undefined") {
|
|
payload["framework"] = framework;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof logging !== "undefined") {
|
|
payload["logging"] = logging;
|
|
}
|
|
if (typeof timeout !== "undefined") {
|
|
payload["timeout"] = timeout;
|
|
}
|
|
if (typeof installCommand !== "undefined") {
|
|
payload["installCommand"] = installCommand;
|
|
}
|
|
if (typeof buildCommand !== "undefined") {
|
|
payload["buildCommand"] = buildCommand;
|
|
}
|
|
if (typeof outputDirectory !== "undefined") {
|
|
payload["outputDirectory"] = outputDirectory;
|
|
}
|
|
if (typeof buildRuntime !== "undefined") {
|
|
payload["buildRuntime"] = buildRuntime;
|
|
}
|
|
if (typeof adapter !== "undefined") {
|
|
payload["adapter"] = adapter;
|
|
}
|
|
if (typeof installationId !== "undefined") {
|
|
payload["installationId"] = installationId;
|
|
}
|
|
if (typeof fallbackFile !== "undefined") {
|
|
payload["fallbackFile"] = fallbackFile;
|
|
}
|
|
if (typeof providerRepositoryId !== "undefined") {
|
|
payload["providerRepositoryId"] = providerRepositoryId;
|
|
}
|
|
if (typeof providerBranch !== "undefined") {
|
|
payload["providerBranch"] = providerBranch;
|
|
}
|
|
if (typeof providerSilentMode !== "undefined") {
|
|
payload["providerSilentMode"] = providerSilentMode;
|
|
}
|
|
if (typeof providerRootDirectory !== "undefined") {
|
|
payload["providerRootDirectory"] = providerRootDirectory;
|
|
}
|
|
if (typeof specification !== "undefined") {
|
|
payload["specification"] = specification;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
/**
|
|
* Get a list of all frameworks that are currently available on the server instance.
|
|
*
|
|
* @throws {AppwriteException}
|
|
* @returns {Promise<Models.FrameworkList>}
|
|
*/
|
|
listFrameworks() {
|
|
const apiPath = "/sites/frameworks";
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
/**
|
|
* List allowed site specifications for this instance.
|
|
*
|
|
* @throws {AppwriteException}
|
|
* @returns {Promise<Models.SpecificationList>}
|
|
*/
|
|
listSpecifications() {
|
|
const apiPath = "/sites/specifications";
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
get(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
|
|
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 = {
|
|
siteId: paramsOrFirst,
|
|
name: rest[0],
|
|
framework: rest[1],
|
|
enabled: rest[2],
|
|
logging: rest[3],
|
|
timeout: rest[4],
|
|
installCommand: rest[5],
|
|
buildCommand: rest[6],
|
|
outputDirectory: rest[7],
|
|
buildRuntime: rest[8],
|
|
adapter: rest[9],
|
|
fallbackFile: rest[10],
|
|
installationId: rest[11],
|
|
providerRepositoryId: rest[12],
|
|
providerBranch: rest[13],
|
|
providerSilentMode: rest[14],
|
|
providerRootDirectory: rest[15],
|
|
specification: rest[16]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const name = params.name;
|
|
const framework = params.framework;
|
|
const enabled = params.enabled;
|
|
const logging = params.logging;
|
|
const timeout = params.timeout;
|
|
const installCommand = params.installCommand;
|
|
const buildCommand = params.buildCommand;
|
|
const outputDirectory = params.outputDirectory;
|
|
const buildRuntime = params.buildRuntime;
|
|
const adapter = params.adapter;
|
|
const fallbackFile = params.fallbackFile;
|
|
const installationId = params.installationId;
|
|
const providerRepositoryId = params.providerRepositoryId;
|
|
const providerBranch = params.providerBranch;
|
|
const providerSilentMode = params.providerSilentMode;
|
|
const providerRootDirectory = params.providerRootDirectory;
|
|
const specification = params.specification;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
if (typeof framework === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "framework"');
|
|
}
|
|
const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof framework !== "undefined") {
|
|
payload["framework"] = framework;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof logging !== "undefined") {
|
|
payload["logging"] = logging;
|
|
}
|
|
if (typeof timeout !== "undefined") {
|
|
payload["timeout"] = timeout;
|
|
}
|
|
if (typeof installCommand !== "undefined") {
|
|
payload["installCommand"] = installCommand;
|
|
}
|
|
if (typeof buildCommand !== "undefined") {
|
|
payload["buildCommand"] = buildCommand;
|
|
}
|
|
if (typeof outputDirectory !== "undefined") {
|
|
payload["outputDirectory"] = outputDirectory;
|
|
}
|
|
if (typeof buildRuntime !== "undefined") {
|
|
payload["buildRuntime"] = buildRuntime;
|
|
}
|
|
if (typeof adapter !== "undefined") {
|
|
payload["adapter"] = adapter;
|
|
}
|
|
if (typeof fallbackFile !== "undefined") {
|
|
payload["fallbackFile"] = fallbackFile;
|
|
}
|
|
if (typeof installationId !== "undefined") {
|
|
payload["installationId"] = installationId;
|
|
}
|
|
if (typeof providerRepositoryId !== "undefined") {
|
|
payload["providerRepositoryId"] = providerRepositoryId;
|
|
}
|
|
if (typeof providerBranch !== "undefined") {
|
|
payload["providerBranch"] = providerBranch;
|
|
}
|
|
if (typeof providerSilentMode !== "undefined") {
|
|
payload["providerSilentMode"] = providerSilentMode;
|
|
}
|
|
if (typeof providerRootDirectory !== "undefined") {
|
|
payload["providerRootDirectory"] = providerRootDirectory;
|
|
}
|
|
if (typeof specification !== "undefined") {
|
|
payload["specification"] = specification;
|
|
}
|
|
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 = {
|
|
siteId: paramsOrFirst
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
|
|
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
|
|
);
|
|
}
|
|
updateSiteDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployment".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof deploymentId !== "undefined") {
|
|
payload["deploymentId"] = deploymentId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listDeployments(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
queries: rest[0],
|
|
search: rest[1],
|
|
total: rest[2]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const queries = params.queries;
|
|
const search = params.search;
|
|
const total = params.total;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments".replace("{siteId}", siteId);
|
|
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
|
|
);
|
|
}
|
|
createDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
let onProgress;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
onProgress = paramsOrFirst == null ? void 0 : paramsOrFirst.onProgress;
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
code: rest[0],
|
|
activate: rest[1],
|
|
installCommand: rest[2],
|
|
buildCommand: rest[3],
|
|
outputDirectory: rest[4]
|
|
};
|
|
onProgress = rest[5];
|
|
}
|
|
const siteId = params.siteId;
|
|
const code = params.code;
|
|
const activate = params.activate;
|
|
const installCommand = params.installCommand;
|
|
const buildCommand = params.buildCommand;
|
|
const outputDirectory = params.outputDirectory;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof code === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
}
|
|
if (typeof activate === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "activate"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof installCommand !== "undefined") {
|
|
payload["installCommand"] = installCommand;
|
|
}
|
|
if (typeof buildCommand !== "undefined") {
|
|
payload["buildCommand"] = buildCommand;
|
|
}
|
|
if (typeof outputDirectory !== "undefined") {
|
|
payload["outputDirectory"] = outputDirectory;
|
|
}
|
|
if (typeof code !== "undefined") {
|
|
payload["code"] = code;
|
|
}
|
|
if (typeof activate !== "undefined") {
|
|
payload["activate"] = activate;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "multipart/form-data"
|
|
};
|
|
return this.client.chunkedUpload(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload,
|
|
onProgress
|
|
);
|
|
}
|
|
createDuplicateDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/duplicate".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof deploymentId !== "undefined") {
|
|
payload["deploymentId"] = deploymentId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createTemplateDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
repository: rest[0],
|
|
owner: rest[1],
|
|
rootDirectory: rest[2],
|
|
type: rest[3],
|
|
reference: rest[4],
|
|
activate: rest[5]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const repository = params.repository;
|
|
const owner = params.owner;
|
|
const rootDirectory = params.rootDirectory;
|
|
const type = params.type;
|
|
const reference = params.reference;
|
|
const activate = params.activate;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof repository === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "repository"');
|
|
}
|
|
if (typeof owner === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "owner"');
|
|
}
|
|
if (typeof rootDirectory === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "rootDirectory"');
|
|
}
|
|
if (typeof type === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
}
|
|
if (typeof reference === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "reference"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/template".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof repository !== "undefined") {
|
|
payload["repository"] = repository;
|
|
}
|
|
if (typeof owner !== "undefined") {
|
|
payload["owner"] = owner;
|
|
}
|
|
if (typeof rootDirectory !== "undefined") {
|
|
payload["rootDirectory"] = rootDirectory;
|
|
}
|
|
if (typeof type !== "undefined") {
|
|
payload["type"] = type;
|
|
}
|
|
if (typeof reference !== "undefined") {
|
|
payload["reference"] = reference;
|
|
}
|
|
if (typeof activate !== "undefined") {
|
|
payload["activate"] = activate;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createVcsDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
type: rest[0],
|
|
reference: rest[1],
|
|
activate: rest[2]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const type = params.type;
|
|
const reference = params.reference;
|
|
const activate = params.activate;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof type === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
}
|
|
if (typeof reference === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "reference"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/vcs".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof type !== "undefined") {
|
|
payload["type"] = type;
|
|
}
|
|
if (typeof reference !== "undefined") {
|
|
payload["reference"] = reference;
|
|
}
|
|
if (typeof activate !== "undefined") {
|
|
payload["activate"] = activate;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/{deploymentId}".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteDeployment(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/{deploymentId}".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
|
|
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
|
|
);
|
|
}
|
|
getDeploymentDownload(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0],
|
|
type: rest[1]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
const type = params.type;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/{deploymentId}/download".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
|
|
const payload = {};
|
|
if (typeof type !== "undefined") {
|
|
payload["type"] = type;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload,
|
|
"arrayBuffer"
|
|
);
|
|
}
|
|
updateDeploymentStatus(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
deploymentId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const deploymentId = params.deploymentId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof deploymentId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/deployments/{deploymentId}/status".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
listLogs(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/logs".replace("{siteId}", siteId);
|
|
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
|
|
);
|
|
}
|
|
getLog(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
logId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const logId = params.logId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof logId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "logId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/logs/{logId}".replace("{siteId}", siteId).replace("{logId}", logId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteLog(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
logId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const logId = params.logId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof logId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "logId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/logs/{logId}".replace("{siteId}", siteId).replace("{logId}", logId);
|
|
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
|
|
);
|
|
}
|
|
listVariables(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/variables".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createVariable(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
key: rest[0],
|
|
value: rest[1],
|
|
secret: rest[2]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const key = params.key;
|
|
const value = params.value;
|
|
const secret = params.secret;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
if (typeof value === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "value"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/variables".replace("{siteId}", siteId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof value !== "undefined") {
|
|
payload["value"] = value;
|
|
}
|
|
if (typeof secret !== "undefined") {
|
|
payload["secret"] = secret;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getVariable(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
variableId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const variableId = params.variableId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof variableId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateVariable(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
variableId: rest[0],
|
|
key: rest[1],
|
|
value: rest[2],
|
|
secret: rest[3]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const variableId = params.variableId;
|
|
const key = params.key;
|
|
const value = params.value;
|
|
const secret = params.secret;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof variableId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
}
|
|
if (typeof key === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "key"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
|
|
const payload = {};
|
|
if (typeof key !== "undefined") {
|
|
payload["key"] = key;
|
|
}
|
|
if (typeof value !== "undefined") {
|
|
payload["value"] = value;
|
|
}
|
|
if (typeof secret !== "undefined") {
|
|
payload["secret"] = secret;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"put",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteVariable(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
siteId: paramsOrFirst,
|
|
variableId: rest[0]
|
|
};
|
|
}
|
|
const siteId = params.siteId;
|
|
const variableId = params.variableId;
|
|
if (typeof siteId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "siteId"');
|
|
}
|
|
if (typeof variableId === "undefined") {
|
|
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
}
|
|
const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
|
|
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
|
|
);
|
|
}
|
|
};
|
|
|
|
export { Sites };
|
|
//# sourceMappingURL=out.js.map
|
|
//# sourceMappingURL=sites.mjs.map
|