3054 lines
89 KiB
JavaScript
3054 lines
89 KiB
JavaScript
'use strict';
|
|
|
|
var client = require('../client');
|
|
|
|
class Messaging {
|
|
constructor(client) {
|
|
this.client = client;
|
|
}
|
|
listMessages(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 = "/messaging/messages";
|
|
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
|
|
);
|
|
}
|
|
createEmail(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
subject: rest[0],
|
|
content: rest[1],
|
|
topics: rest[2],
|
|
users: rest[3],
|
|
targets: rest[4],
|
|
cc: rest[5],
|
|
bcc: rest[6],
|
|
attachments: rest[7],
|
|
draft: rest[8],
|
|
html: rest[9],
|
|
scheduledAt: rest[10]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const subject = params.subject;
|
|
const content = params.content;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const cc = params.cc;
|
|
const bcc = params.bcc;
|
|
const attachments = params.attachments;
|
|
const draft = params.draft;
|
|
const html = params.html;
|
|
const scheduledAt = params.scheduledAt;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
if (typeof subject === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "subject"');
|
|
}
|
|
if (typeof content === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "content"');
|
|
}
|
|
const apiPath = "/messaging/messages/email";
|
|
const payload = {};
|
|
if (typeof messageId !== "undefined") {
|
|
payload["messageId"] = messageId;
|
|
}
|
|
if (typeof subject !== "undefined") {
|
|
payload["subject"] = subject;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof cc !== "undefined") {
|
|
payload["cc"] = cc;
|
|
}
|
|
if (typeof bcc !== "undefined") {
|
|
payload["bcc"] = bcc;
|
|
}
|
|
if (typeof attachments !== "undefined") {
|
|
payload["attachments"] = attachments;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof html !== "undefined") {
|
|
payload["html"] = html;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateEmail(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
topics: rest[0],
|
|
users: rest[1],
|
|
targets: rest[2],
|
|
subject: rest[3],
|
|
content: rest[4],
|
|
draft: rest[5],
|
|
html: rest[6],
|
|
cc: rest[7],
|
|
bcc: rest[8],
|
|
scheduledAt: rest[9],
|
|
attachments: rest[10]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const subject = params.subject;
|
|
const content = params.content;
|
|
const draft = params.draft;
|
|
const html = params.html;
|
|
const cc = params.cc;
|
|
const bcc = params.bcc;
|
|
const scheduledAt = params.scheduledAt;
|
|
const attachments = params.attachments;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/email/{messageId}".replace("{messageId}", messageId);
|
|
const payload = {};
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof subject !== "undefined") {
|
|
payload["subject"] = subject;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof html !== "undefined") {
|
|
payload["html"] = html;
|
|
}
|
|
if (typeof cc !== "undefined") {
|
|
payload["cc"] = cc;
|
|
}
|
|
if (typeof bcc !== "undefined") {
|
|
payload["bcc"] = bcc;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
if (typeof attachments !== "undefined") {
|
|
payload["attachments"] = attachments;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createPush(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
title: rest[0],
|
|
body: rest[1],
|
|
topics: rest[2],
|
|
users: rest[3],
|
|
targets: rest[4],
|
|
data: rest[5],
|
|
action: rest[6],
|
|
image: rest[7],
|
|
icon: rest[8],
|
|
sound: rest[9],
|
|
color: rest[10],
|
|
tag: rest[11],
|
|
badge: rest[12],
|
|
draft: rest[13],
|
|
scheduledAt: rest[14],
|
|
contentAvailable: rest[15],
|
|
critical: rest[16],
|
|
priority: rest[17]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const title = params.title;
|
|
const body = params.body;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const data = params.data;
|
|
const action = params.action;
|
|
const image = params.image;
|
|
const icon = params.icon;
|
|
const sound = params.sound;
|
|
const color = params.color;
|
|
const tag = params.tag;
|
|
const badge = params.badge;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
const contentAvailable = params.contentAvailable;
|
|
const critical = params.critical;
|
|
const priority = params.priority;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/push";
|
|
const payload = {};
|
|
if (typeof messageId !== "undefined") {
|
|
payload["messageId"] = messageId;
|
|
}
|
|
if (typeof title !== "undefined") {
|
|
payload["title"] = title;
|
|
}
|
|
if (typeof body !== "undefined") {
|
|
payload["body"] = body;
|
|
}
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof action !== "undefined") {
|
|
payload["action"] = action;
|
|
}
|
|
if (typeof image !== "undefined") {
|
|
payload["image"] = image;
|
|
}
|
|
if (typeof icon !== "undefined") {
|
|
payload["icon"] = icon;
|
|
}
|
|
if (typeof sound !== "undefined") {
|
|
payload["sound"] = sound;
|
|
}
|
|
if (typeof color !== "undefined") {
|
|
payload["color"] = color;
|
|
}
|
|
if (typeof tag !== "undefined") {
|
|
payload["tag"] = tag;
|
|
}
|
|
if (typeof badge !== "undefined") {
|
|
payload["badge"] = badge;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
if (typeof contentAvailable !== "undefined") {
|
|
payload["contentAvailable"] = contentAvailable;
|
|
}
|
|
if (typeof critical !== "undefined") {
|
|
payload["critical"] = critical;
|
|
}
|
|
if (typeof priority !== "undefined") {
|
|
payload["priority"] = priority;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updatePush(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
topics: rest[0],
|
|
users: rest[1],
|
|
targets: rest[2],
|
|
title: rest[3],
|
|
body: rest[4],
|
|
data: rest[5],
|
|
action: rest[6],
|
|
image: rest[7],
|
|
icon: rest[8],
|
|
sound: rest[9],
|
|
color: rest[10],
|
|
tag: rest[11],
|
|
badge: rest[12],
|
|
draft: rest[13],
|
|
scheduledAt: rest[14],
|
|
contentAvailable: rest[15],
|
|
critical: rest[16],
|
|
priority: rest[17]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const title = params.title;
|
|
const body = params.body;
|
|
const data = params.data;
|
|
const action = params.action;
|
|
const image = params.image;
|
|
const icon = params.icon;
|
|
const sound = params.sound;
|
|
const color = params.color;
|
|
const tag = params.tag;
|
|
const badge = params.badge;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
const contentAvailable = params.contentAvailable;
|
|
const critical = params.critical;
|
|
const priority = params.priority;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/push/{messageId}".replace("{messageId}", messageId);
|
|
const payload = {};
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof title !== "undefined") {
|
|
payload["title"] = title;
|
|
}
|
|
if (typeof body !== "undefined") {
|
|
payload["body"] = body;
|
|
}
|
|
if (typeof data !== "undefined") {
|
|
payload["data"] = data;
|
|
}
|
|
if (typeof action !== "undefined") {
|
|
payload["action"] = action;
|
|
}
|
|
if (typeof image !== "undefined") {
|
|
payload["image"] = image;
|
|
}
|
|
if (typeof icon !== "undefined") {
|
|
payload["icon"] = icon;
|
|
}
|
|
if (typeof sound !== "undefined") {
|
|
payload["sound"] = sound;
|
|
}
|
|
if (typeof color !== "undefined") {
|
|
payload["color"] = color;
|
|
}
|
|
if (typeof tag !== "undefined") {
|
|
payload["tag"] = tag;
|
|
}
|
|
if (typeof badge !== "undefined") {
|
|
payload["badge"] = badge;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
if (typeof contentAvailable !== "undefined") {
|
|
payload["contentAvailable"] = contentAvailable;
|
|
}
|
|
if (typeof critical !== "undefined") {
|
|
payload["critical"] = critical;
|
|
}
|
|
if (typeof priority !== "undefined") {
|
|
payload["priority"] = priority;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createSms(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
content: rest[0],
|
|
topics: rest[1],
|
|
users: rest[2],
|
|
targets: rest[3],
|
|
draft: rest[4],
|
|
scheduledAt: rest[5]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const content = params.content;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
if (typeof content === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "content"');
|
|
}
|
|
const apiPath = "/messaging/messages/sms";
|
|
const payload = {};
|
|
if (typeof messageId !== "undefined") {
|
|
payload["messageId"] = messageId;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createSMS(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
content: rest[0],
|
|
topics: rest[1],
|
|
users: rest[2],
|
|
targets: rest[3],
|
|
draft: rest[4],
|
|
scheduledAt: rest[5]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const content = params.content;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
if (typeof content === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "content"');
|
|
}
|
|
const apiPath = "/messaging/messages/sms";
|
|
const payload = {};
|
|
if (typeof messageId !== "undefined") {
|
|
payload["messageId"] = messageId;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateSms(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
topics: rest[0],
|
|
users: rest[1],
|
|
targets: rest[2],
|
|
content: rest[3],
|
|
draft: rest[4],
|
|
scheduledAt: rest[5]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const content = params.content;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/sms/{messageId}".replace("{messageId}", messageId);
|
|
const payload = {};
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateSMS(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
topics: rest[0],
|
|
users: rest[1],
|
|
targets: rest[2],
|
|
content: rest[3],
|
|
draft: rest[4],
|
|
scheduledAt: rest[5]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const topics = params.topics;
|
|
const users = params.users;
|
|
const targets = params.targets;
|
|
const content = params.content;
|
|
const draft = params.draft;
|
|
const scheduledAt = params.scheduledAt;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/sms/{messageId}".replace("{messageId}", messageId);
|
|
const payload = {};
|
|
if (typeof topics !== "undefined") {
|
|
payload["topics"] = topics;
|
|
}
|
|
if (typeof users !== "undefined") {
|
|
payload["users"] = users;
|
|
}
|
|
if (typeof targets !== "undefined") {
|
|
payload["targets"] = targets;
|
|
}
|
|
if (typeof content !== "undefined") {
|
|
payload["content"] = content;
|
|
}
|
|
if (typeof draft !== "undefined") {
|
|
payload["draft"] = draft;
|
|
}
|
|
if (typeof scheduledAt !== "undefined") {
|
|
payload["scheduledAt"] = scheduledAt;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getMessage(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/{messageId}".replace("{messageId}", messageId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
delete(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/{messageId}".replace("{messageId}", messageId);
|
|
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
|
|
);
|
|
}
|
|
listMessageLogs(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/{messageId}/logs".replace("{messageId}", messageId);
|
|
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
|
|
);
|
|
}
|
|
listTargets(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
messageId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const messageId = params.messageId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof messageId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "messageId"');
|
|
}
|
|
const apiPath = "/messaging/messages/{messageId}/targets".replace("{messageId}", messageId);
|
|
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
|
|
);
|
|
}
|
|
listProviders(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 = "/messaging/providers";
|
|
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
|
|
);
|
|
}
|
|
createApnsProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
authKey: rest[1],
|
|
authKeyId: rest[2],
|
|
teamId: rest[3],
|
|
bundleId: rest[4],
|
|
sandbox: rest[5],
|
|
enabled: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const authKey = params.authKey;
|
|
const authKeyId = params.authKeyId;
|
|
const teamId = params.teamId;
|
|
const bundleId = params.bundleId;
|
|
const sandbox = params.sandbox;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/apns";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
if (typeof authKeyId !== "undefined") {
|
|
payload["authKeyId"] = authKeyId;
|
|
}
|
|
if (typeof teamId !== "undefined") {
|
|
payload["teamId"] = teamId;
|
|
}
|
|
if (typeof bundleId !== "undefined") {
|
|
payload["bundleId"] = bundleId;
|
|
}
|
|
if (typeof sandbox !== "undefined") {
|
|
payload["sandbox"] = sandbox;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
createAPNSProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
authKey: rest[1],
|
|
authKeyId: rest[2],
|
|
teamId: rest[3],
|
|
bundleId: rest[4],
|
|
sandbox: rest[5],
|
|
enabled: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const authKey = params.authKey;
|
|
const authKeyId = params.authKeyId;
|
|
const teamId = params.teamId;
|
|
const bundleId = params.bundleId;
|
|
const sandbox = params.sandbox;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/apns";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
if (typeof authKeyId !== "undefined") {
|
|
payload["authKeyId"] = authKeyId;
|
|
}
|
|
if (typeof teamId !== "undefined") {
|
|
payload["teamId"] = teamId;
|
|
}
|
|
if (typeof bundleId !== "undefined") {
|
|
payload["bundleId"] = bundleId;
|
|
}
|
|
if (typeof sandbox !== "undefined") {
|
|
payload["sandbox"] = sandbox;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateApnsProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
authKey: rest[2],
|
|
authKeyId: rest[3],
|
|
teamId: rest[4],
|
|
bundleId: rest[5],
|
|
sandbox: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const authKey = params.authKey;
|
|
const authKeyId = params.authKeyId;
|
|
const teamId = params.teamId;
|
|
const bundleId = params.bundleId;
|
|
const sandbox = params.sandbox;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/apns/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
if (typeof authKeyId !== "undefined") {
|
|
payload["authKeyId"] = authKeyId;
|
|
}
|
|
if (typeof teamId !== "undefined") {
|
|
payload["teamId"] = teamId;
|
|
}
|
|
if (typeof bundleId !== "undefined") {
|
|
payload["bundleId"] = bundleId;
|
|
}
|
|
if (typeof sandbox !== "undefined") {
|
|
payload["sandbox"] = sandbox;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateAPNSProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
authKey: rest[2],
|
|
authKeyId: rest[3],
|
|
teamId: rest[4],
|
|
bundleId: rest[5],
|
|
sandbox: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const authKey = params.authKey;
|
|
const authKeyId = params.authKeyId;
|
|
const teamId = params.teamId;
|
|
const bundleId = params.bundleId;
|
|
const sandbox = params.sandbox;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/apns/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
if (typeof authKeyId !== "undefined") {
|
|
payload["authKeyId"] = authKeyId;
|
|
}
|
|
if (typeof teamId !== "undefined") {
|
|
payload["teamId"] = teamId;
|
|
}
|
|
if (typeof bundleId !== "undefined") {
|
|
payload["bundleId"] = bundleId;
|
|
}
|
|
if (typeof sandbox !== "undefined") {
|
|
payload["sandbox"] = sandbox;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createFcmProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
serviceAccountJSON: rest[1],
|
|
enabled: rest[2]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const serviceAccountJSON = params.serviceAccountJSON;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/fcm";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof serviceAccountJSON !== "undefined") {
|
|
payload["serviceAccountJSON"] = serviceAccountJSON;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
createFCMProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
serviceAccountJSON: rest[1],
|
|
enabled: rest[2]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const serviceAccountJSON = params.serviceAccountJSON;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/fcm";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof serviceAccountJSON !== "undefined") {
|
|
payload["serviceAccountJSON"] = serviceAccountJSON;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateFcmProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
serviceAccountJSON: rest[2]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const serviceAccountJSON = params.serviceAccountJSON;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/fcm/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof serviceAccountJSON !== "undefined") {
|
|
payload["serviceAccountJSON"] = serviceAccountJSON;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateFCMProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
serviceAccountJSON: rest[2]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const serviceAccountJSON = params.serviceAccountJSON;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/fcm/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof serviceAccountJSON !== "undefined") {
|
|
payload["serviceAccountJSON"] = serviceAccountJSON;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createMailgunProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
apiKey: rest[1],
|
|
domain: rest[2],
|
|
isEuRegion: rest[3],
|
|
fromName: rest[4],
|
|
fromEmail: rest[5],
|
|
replyToName: rest[6],
|
|
replyToEmail: rest[7],
|
|
enabled: rest[8]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const apiKey = params.apiKey;
|
|
const domain = params.domain;
|
|
const isEuRegion = params.isEuRegion;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/mailgun";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof domain !== "undefined") {
|
|
payload["domain"] = domain;
|
|
}
|
|
if (typeof isEuRegion !== "undefined") {
|
|
payload["isEuRegion"] = isEuRegion;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateMailgunProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
apiKey: rest[1],
|
|
domain: rest[2],
|
|
isEuRegion: rest[3],
|
|
enabled: rest[4],
|
|
fromName: rest[5],
|
|
fromEmail: rest[6],
|
|
replyToName: rest[7],
|
|
replyToEmail: rest[8]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const apiKey = params.apiKey;
|
|
const domain = params.domain;
|
|
const isEuRegion = params.isEuRegion;
|
|
const enabled = params.enabled;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/mailgun/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof domain !== "undefined") {
|
|
payload["domain"] = domain;
|
|
}
|
|
if (typeof isEuRegion !== "undefined") {
|
|
payload["isEuRegion"] = isEuRegion;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createMsg91Provider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
templateId: rest[1],
|
|
senderId: rest[2],
|
|
authKey: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const templateId = params.templateId;
|
|
const senderId = params.senderId;
|
|
const authKey = params.authKey;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/msg91";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof templateId !== "undefined") {
|
|
payload["templateId"] = templateId;
|
|
}
|
|
if (typeof senderId !== "undefined") {
|
|
payload["senderId"] = senderId;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateMsg91Provider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
templateId: rest[2],
|
|
senderId: rest[3],
|
|
authKey: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const templateId = params.templateId;
|
|
const senderId = params.senderId;
|
|
const authKey = params.authKey;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/msg91/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof templateId !== "undefined") {
|
|
payload["templateId"] = templateId;
|
|
}
|
|
if (typeof senderId !== "undefined") {
|
|
payload["senderId"] = senderId;
|
|
}
|
|
if (typeof authKey !== "undefined") {
|
|
payload["authKey"] = authKey;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createResendProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
apiKey: rest[1],
|
|
fromName: rest[2],
|
|
fromEmail: rest[3],
|
|
replyToName: rest[4],
|
|
replyToEmail: rest[5],
|
|
enabled: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const apiKey = params.apiKey;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/resend";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateResendProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
apiKey: rest[2],
|
|
fromName: rest[3],
|
|
fromEmail: rest[4],
|
|
replyToName: rest[5],
|
|
replyToEmail: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const apiKey = params.apiKey;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/resend/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createSendgridProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
apiKey: rest[1],
|
|
fromName: rest[2],
|
|
fromEmail: rest[3],
|
|
replyToName: rest[4],
|
|
replyToEmail: rest[5],
|
|
enabled: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const apiKey = params.apiKey;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/sendgrid";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateSendgridProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
apiKey: rest[2],
|
|
fromName: rest[3],
|
|
fromEmail: rest[4],
|
|
replyToName: rest[5],
|
|
replyToEmail: rest[6]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const apiKey = params.apiKey;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/sendgrid/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createSmtpProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
host: rest[1],
|
|
port: rest[2],
|
|
username: rest[3],
|
|
password: rest[4],
|
|
encryption: rest[5],
|
|
autoTLS: rest[6],
|
|
mailer: rest[7],
|
|
fromName: rest[8],
|
|
fromEmail: rest[9],
|
|
replyToName: rest[10],
|
|
replyToEmail: rest[11],
|
|
enabled: rest[12]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const host = params.host;
|
|
const port = params.port;
|
|
const username = params.username;
|
|
const password = params.password;
|
|
const encryption = params.encryption;
|
|
const autoTLS = params.autoTLS;
|
|
const mailer = params.mailer;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
if (typeof host === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "host"');
|
|
}
|
|
const apiPath = "/messaging/providers/smtp";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof host !== "undefined") {
|
|
payload["host"] = host;
|
|
}
|
|
if (typeof port !== "undefined") {
|
|
payload["port"] = port;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof password !== "undefined") {
|
|
payload["password"] = password;
|
|
}
|
|
if (typeof encryption !== "undefined") {
|
|
payload["encryption"] = encryption;
|
|
}
|
|
if (typeof autoTLS !== "undefined") {
|
|
payload["autoTLS"] = autoTLS;
|
|
}
|
|
if (typeof mailer !== "undefined") {
|
|
payload["mailer"] = mailer;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
createSMTPProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
host: rest[1],
|
|
port: rest[2],
|
|
username: rest[3],
|
|
password: rest[4],
|
|
encryption: rest[5],
|
|
autoTLS: rest[6],
|
|
mailer: rest[7],
|
|
fromName: rest[8],
|
|
fromEmail: rest[9],
|
|
replyToName: rest[10],
|
|
replyToEmail: rest[11],
|
|
enabled: rest[12]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const host = params.host;
|
|
const port = params.port;
|
|
const username = params.username;
|
|
const password = params.password;
|
|
const encryption = params.encryption;
|
|
const autoTLS = params.autoTLS;
|
|
const mailer = params.mailer;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
if (typeof host === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "host"');
|
|
}
|
|
const apiPath = "/messaging/providers/smtp";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof host !== "undefined") {
|
|
payload["host"] = host;
|
|
}
|
|
if (typeof port !== "undefined") {
|
|
payload["port"] = port;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof password !== "undefined") {
|
|
payload["password"] = password;
|
|
}
|
|
if (typeof encryption !== "undefined") {
|
|
payload["encryption"] = encryption;
|
|
}
|
|
if (typeof autoTLS !== "undefined") {
|
|
payload["autoTLS"] = autoTLS;
|
|
}
|
|
if (typeof mailer !== "undefined") {
|
|
payload["mailer"] = mailer;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateSmtpProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
host: rest[1],
|
|
port: rest[2],
|
|
username: rest[3],
|
|
password: rest[4],
|
|
encryption: rest[5],
|
|
autoTLS: rest[6],
|
|
mailer: rest[7],
|
|
fromName: rest[8],
|
|
fromEmail: rest[9],
|
|
replyToName: rest[10],
|
|
replyToEmail: rest[11],
|
|
enabled: rest[12]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const host = params.host;
|
|
const port = params.port;
|
|
const username = params.username;
|
|
const password = params.password;
|
|
const encryption = params.encryption;
|
|
const autoTLS = params.autoTLS;
|
|
const mailer = params.mailer;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/smtp/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof host !== "undefined") {
|
|
payload["host"] = host;
|
|
}
|
|
if (typeof port !== "undefined") {
|
|
payload["port"] = port;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof password !== "undefined") {
|
|
payload["password"] = password;
|
|
}
|
|
if (typeof encryption !== "undefined") {
|
|
payload["encryption"] = encryption;
|
|
}
|
|
if (typeof autoTLS !== "undefined") {
|
|
payload["autoTLS"] = autoTLS;
|
|
}
|
|
if (typeof mailer !== "undefined") {
|
|
payload["mailer"] = mailer;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateSMTPProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
host: rest[1],
|
|
port: rest[2],
|
|
username: rest[3],
|
|
password: rest[4],
|
|
encryption: rest[5],
|
|
autoTLS: rest[6],
|
|
mailer: rest[7],
|
|
fromName: rest[8],
|
|
fromEmail: rest[9],
|
|
replyToName: rest[10],
|
|
replyToEmail: rest[11],
|
|
enabled: rest[12]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const host = params.host;
|
|
const port = params.port;
|
|
const username = params.username;
|
|
const password = params.password;
|
|
const encryption = params.encryption;
|
|
const autoTLS = params.autoTLS;
|
|
const mailer = params.mailer;
|
|
const fromName = params.fromName;
|
|
const fromEmail = params.fromEmail;
|
|
const replyToName = params.replyToName;
|
|
const replyToEmail = params.replyToEmail;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/smtp/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof host !== "undefined") {
|
|
payload["host"] = host;
|
|
}
|
|
if (typeof port !== "undefined") {
|
|
payload["port"] = port;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof password !== "undefined") {
|
|
payload["password"] = password;
|
|
}
|
|
if (typeof encryption !== "undefined") {
|
|
payload["encryption"] = encryption;
|
|
}
|
|
if (typeof autoTLS !== "undefined") {
|
|
payload["autoTLS"] = autoTLS;
|
|
}
|
|
if (typeof mailer !== "undefined") {
|
|
payload["mailer"] = mailer;
|
|
}
|
|
if (typeof fromName !== "undefined") {
|
|
payload["fromName"] = fromName;
|
|
}
|
|
if (typeof fromEmail !== "undefined") {
|
|
payload["fromEmail"] = fromEmail;
|
|
}
|
|
if (typeof replyToName !== "undefined") {
|
|
payload["replyToName"] = replyToName;
|
|
}
|
|
if (typeof replyToEmail !== "undefined") {
|
|
payload["replyToEmail"] = replyToEmail;
|
|
}
|
|
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(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createTelesignProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
from: rest[1],
|
|
customerId: rest[2],
|
|
apiKey: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const from = params.from;
|
|
const customerId = params.customerId;
|
|
const apiKey = params.apiKey;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/telesign";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
if (typeof customerId !== "undefined") {
|
|
payload["customerId"] = customerId;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateTelesignProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
customerId: rest[2],
|
|
apiKey: rest[3],
|
|
from: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const customerId = params.customerId;
|
|
const apiKey = params.apiKey;
|
|
const from = params.from;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/telesign/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof customerId !== "undefined") {
|
|
payload["customerId"] = customerId;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createTextmagicProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
from: rest[1],
|
|
username: rest[2],
|
|
apiKey: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const from = params.from;
|
|
const username = params.username;
|
|
const apiKey = params.apiKey;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/textmagic";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateTextmagicProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
username: rest[2],
|
|
apiKey: rest[3],
|
|
from: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const username = params.username;
|
|
const apiKey = params.apiKey;
|
|
const from = params.from;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/textmagic/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof username !== "undefined") {
|
|
payload["username"] = username;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createTwilioProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
from: rest[1],
|
|
accountSid: rest[2],
|
|
authToken: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const from = params.from;
|
|
const accountSid = params.accountSid;
|
|
const authToken = params.authToken;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/twilio";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
if (typeof accountSid !== "undefined") {
|
|
payload["accountSid"] = accountSid;
|
|
}
|
|
if (typeof authToken !== "undefined") {
|
|
payload["authToken"] = authToken;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateTwilioProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
accountSid: rest[2],
|
|
authToken: rest[3],
|
|
from: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const accountSid = params.accountSid;
|
|
const authToken = params.authToken;
|
|
const from = params.from;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/twilio/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof accountSid !== "undefined") {
|
|
payload["accountSid"] = accountSid;
|
|
}
|
|
if (typeof authToken !== "undefined") {
|
|
payload["authToken"] = authToken;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
createVonageProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
from: rest[1],
|
|
apiKey: rest[2],
|
|
apiSecret: rest[3],
|
|
enabled: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const from = params.from;
|
|
const apiKey = params.apiKey;
|
|
const apiSecret = params.apiSecret;
|
|
const enabled = params.enabled;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/providers/vonage";
|
|
const payload = {};
|
|
if (typeof providerId !== "undefined") {
|
|
payload["providerId"] = providerId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof apiSecret !== "undefined") {
|
|
payload["apiSecret"] = apiSecret;
|
|
}
|
|
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
|
|
);
|
|
}
|
|
updateVonageProvider(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
name: rest[0],
|
|
enabled: rest[1],
|
|
apiKey: rest[2],
|
|
apiSecret: rest[3],
|
|
from: rest[4]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const name = params.name;
|
|
const enabled = params.enabled;
|
|
const apiKey = params.apiKey;
|
|
const apiSecret = params.apiSecret;
|
|
const from = params.from;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/vonage/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof enabled !== "undefined") {
|
|
payload["enabled"] = enabled;
|
|
}
|
|
if (typeof apiKey !== "undefined") {
|
|
payload["apiKey"] = apiKey;
|
|
}
|
|
if (typeof apiSecret !== "undefined") {
|
|
payload["apiSecret"] = apiSecret;
|
|
}
|
|
if (typeof from !== "undefined") {
|
|
payload["from"] = from;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getProvider(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/{providerId}".replace("{providerId}", providerId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteProvider(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/{providerId}".replace("{providerId}", providerId);
|
|
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
|
|
);
|
|
}
|
|
listProviderLogs(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
providerId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const providerId = params.providerId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof providerId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "providerId"');
|
|
}
|
|
const apiPath = "/messaging/providers/{providerId}/logs".replace("{providerId}", providerId);
|
|
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
|
|
);
|
|
}
|
|
listSubscriberLogs(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
subscriberId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const subscriberId = params.subscriberId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof subscriberId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "subscriberId"');
|
|
}
|
|
const apiPath = "/messaging/subscribers/{subscriberId}/logs".replace("{subscriberId}", subscriberId);
|
|
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
|
|
);
|
|
}
|
|
listTopics(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 = "/messaging/topics";
|
|
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
|
|
);
|
|
}
|
|
createTopic(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
name: rest[0],
|
|
subscribe: rest[1]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const name = params.name;
|
|
const subscribe = params.subscribe;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
if (typeof name === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
}
|
|
const apiPath = "/messaging/topics";
|
|
const payload = {};
|
|
if (typeof topicId !== "undefined") {
|
|
payload["topicId"] = topicId;
|
|
}
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof subscribe !== "undefined") {
|
|
payload["subscribe"] = subscribe;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getTopic(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
updateTopic(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
name: rest[0],
|
|
subscribe: rest[1]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const name = params.name;
|
|
const subscribe = params.subscribe;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
|
|
const payload = {};
|
|
if (typeof name !== "undefined") {
|
|
payload["name"] = name;
|
|
}
|
|
if (typeof subscribe !== "undefined") {
|
|
payload["subscribe"] = subscribe;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"patch",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteTopic(paramsOrFirst) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
|
|
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
|
|
);
|
|
}
|
|
listTopicLogs(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
queries: rest[0],
|
|
total: rest[1]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const queries = params.queries;
|
|
const total = params.total;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}/logs".replace("{topicId}", topicId);
|
|
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
|
|
);
|
|
}
|
|
listSubscribers(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
queries: rest[0],
|
|
search: rest[1],
|
|
total: rest[2]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const queries = params.queries;
|
|
const search = params.search;
|
|
const total = params.total;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}/subscribers".replace("{topicId}", topicId);
|
|
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
|
|
);
|
|
}
|
|
createSubscriber(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
subscriberId: rest[0],
|
|
targetId: rest[1]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const subscriberId = params.subscriberId;
|
|
const targetId = params.targetId;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
if (typeof subscriberId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "subscriberId"');
|
|
}
|
|
if (typeof targetId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "targetId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}/subscribers".replace("{topicId}", topicId);
|
|
const payload = {};
|
|
if (typeof subscriberId !== "undefined") {
|
|
payload["subscriberId"] = subscriberId;
|
|
}
|
|
if (typeof targetId !== "undefined") {
|
|
payload["targetId"] = targetId;
|
|
}
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {
|
|
"content-type": "application/json"
|
|
};
|
|
return this.client.call(
|
|
"post",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
getSubscriber(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
subscriberId: rest[0]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const subscriberId = params.subscriberId;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
if (typeof subscriberId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "subscriberId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}", topicId).replace("{subscriberId}", subscriberId);
|
|
const payload = {};
|
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
const apiHeaders = {};
|
|
return this.client.call(
|
|
"get",
|
|
uri,
|
|
apiHeaders,
|
|
payload
|
|
);
|
|
}
|
|
deleteSubscriber(paramsOrFirst, ...rest) {
|
|
let params;
|
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
params = paramsOrFirst || {};
|
|
} else {
|
|
params = {
|
|
topicId: paramsOrFirst,
|
|
subscriberId: rest[0]
|
|
};
|
|
}
|
|
const topicId = params.topicId;
|
|
const subscriberId = params.subscriberId;
|
|
if (typeof topicId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "topicId"');
|
|
}
|
|
if (typeof subscriberId === "undefined") {
|
|
throw new client.AppwriteException('Missing required parameter: "subscriberId"');
|
|
}
|
|
const apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}", topicId).replace("{subscriberId}", subscriberId);
|
|
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.Messaging = Messaging;
|
|
//# sourceMappingURL=out.js.map
|
|
//# sourceMappingURL=messaging.js.map
|