slack-web-api-client
Version:
Streamlined Slack Web API client for TypeScript
703 lines • 32.1 kB
JavaScript
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SlackAPIClient = void 0;
const errors_1 = require("../errors");
const index_1 = require("../logging/index");
const index_2 = require("./retry-handler/index");
const defaultOptions = {
logLevel: "INFO",
throwSlackAPIError: true,
baseUrl: "https://slack.com/api/",
};
class SlackAPIClient {
#token;
#options;
#logLevel;
#throwSlackAPIError;
#baseUrl;
retryHandlers;
constructor(token = undefined, options = defaultOptions) {
this.#token = token;
this.#options = options;
this.#logLevel = this.#options.logLevel ?? defaultOptions.logLevel;
this.#throwSlackAPIError = this.#options.throwSlackAPIError ?? true;
this.#baseUrl = this.#options.baseUrl
? this.#options.baseUrl.endsWith("/")
? this.#options.baseUrl
: this.#options.baseUrl + "/"
: defaultOptions.baseUrl;
this.retryHandlers = this.#options.retryHandlers ?? [new index_2.RatelimitRetryHandler()];
}
// --------------------------------------
// Internal methods
// --------------------------------------
async call(name,
// deno-lint-ignore no-explicit-any
params = {}, retryHandlerState = undefined) {
const url = `${this.#baseUrl}${name}`;
const token = params ? (params.token ?? this.#token) : this.#token;
// deno-lint-ignore no-explicit-any
const _params = {};
Object.assign(_params, params);
if (_params && _params.token) {
delete _params.token;
}
for (const [key, value] of Object.entries(_params)) {
if (typeof value === "object") {
if (Array.isArray(value) && value.length > 0 && typeof value[0] !== "object") {
_params[key] = value.map((v) => v.toString()).join(",");
}
else {
_params[key] = JSON.stringify(value);
}
}
if (value === undefined || value === null) {
delete _params[key];
}
}
const headers = {
"Content-Type": "application/x-www-form-urlencoded",
};
if (token) {
headers["Authorization"] = `Bearer ${token}`;
}
const body = new URLSearchParams(_params);
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Slack API request (${name}): ${body}`);
}
if (retryHandlerState) {
retryHandlerState.currentAttempt += 1;
}
const state = retryHandlerState ?? {
currentAttempt: 0,
logLevel: this.#logLevel,
};
const request = new Request(url, {
method: "POST",
headers,
body,
});
let response;
try {
response = await fetch(request);
for (const rh of this.retryHandlers) {
if (await rh.shouldRetry({ state, request, response })) {
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Retrying ${name} API call (params: ${JSON.stringify(params)})`);
}
return await this.call(name, params, state);
}
}
}
catch (e) {
const error = new errors_1.SlackAPIConnectionError(name, -1, "", undefined, e);
for (const rh of this.retryHandlers) {
if (await rh.shouldRetry({ state, request, error })) {
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Retrying ${name} API call (params: ${JSON.stringify(params)})`);
}
return await this.call(name, params, state);
}
}
throw error;
}
if (response.status != 200) {
const body = await response.text();
throw new errors_1.SlackAPIConnectionError(name, response.status, body, response.headers, undefined);
}
const responseBody = await response.json();
const result = {
...responseBody,
headers: response.headers,
};
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Slack API response (${name}): ${JSON.stringify(result)}}`);
}
if (this.#throwSlackAPIError && result.error) {
throw new errors_1.SlackAPIError(name, result.error, result);
}
return result;
}
async #sendMultipartData(name,
// deno-lint-ignore no-explicit-any
params = {}, retryHandlerState = undefined) {
const url = `${this.#baseUrl}${name}`;
const token = params ? (params.token ?? this.#token) : this.#token;
const body = new FormData();
for (const [key, value] of Object.entries(params)) {
if (value === undefined || value === null || key === "token") {
continue;
}
if (typeof value === "object") {
if (value instanceof Blob) {
body.append(key, value);
}
else {
body.append(key, new Blob([value]));
}
}
else {
body.append(key, value);
}
}
const headers = {};
if (token) {
headers["Authorization"] = `Bearer ${token}`;
}
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
const bodyParamNames = Array.from(body.keys()).join(", ");
console.log(`Slack API request (${name}): Sending ${bodyParamNames}`);
}
if (retryHandlerState) {
retryHandlerState.currentAttempt += 1;
}
const state = retryHandlerState ?? {
currentAttempt: 0,
logLevel: this.#logLevel,
};
const request = new Request(url, {
method: "POST",
headers,
body,
});
let response;
try {
response = await fetch(request);
for (const rh of this.retryHandlers) {
if (await rh.shouldRetry({ state, request, response })) {
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Retrying ${name} API call`);
}
return await this.#sendMultipartData(name, params, state);
}
}
}
catch (e) {
const error = new errors_1.SlackAPIConnectionError(name, -1, "", undefined, e);
for (const rh of this.retryHandlers) {
if (await rh.shouldRetry({ state, request, error })) {
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Retrying ${name} API call`);
}
return await this.#sendMultipartData(name, params, state);
}
}
throw error;
}
if (response.status != 200) {
const body = await response.text();
throw new errors_1.SlackAPIConnectionError(name, response.status, body, response.headers, undefined);
}
const responseBody = await response.json();
const result = {
...responseBody,
headers: response.headers,
};
if ((0, index_1.isDebugLogEnabled)(this.#logLevel)) {
console.log(`Slack API response (${name}): ${JSON.stringify(result)}}`);
}
if (this.#throwSlackAPIError && result.error) {
throw new errors_1.SlackAPIError(name, result.error, result);
}
return result;
}
async #uploadFilesV2(params) {
const files = "files" in params ? params.files : [{ ...params }];
const completes = [];
const uploadErrors = [];
const client = new _a(params.token ?? this.#token, {
logLevel: this.#options.logLevel,
throwSlackAPIError: true, // intentionally set to true for uploadAsync()
});
for (const f of files) {
// deno-lint-ignore no-inner-declarations
async function uploadAsync() {
const body = f.file
? new Uint8Array(f.file instanceof Blob ? await f.file.arrayBuffer() : f.file)
: new TextEncoder().encode(f.content);
const getUrl = await client.files.getUploadURLExternal({
token: params.token,
filename: f.filename,
length: body.length,
snippet_type: f.snippet_type,
});
const { upload_url, file_id } = getUrl;
let response;
try {
response = await fetch(upload_url, { method: "POST", body });
}
catch (e) {
throw new errors_1.SlackAPIConnectionError("files.slack.com", -1, "", undefined, e);
}
const uploadBody = await response.text();
if ((0, index_1.isDebugLogEnabled)(client.#logLevel)) {
console.log(`Slack file upload result: (file ID: ${file_id}, status: ${response.status}, body: ${uploadBody})`);
}
if (response.status !== 200) {
uploadErrors.push(uploadBody);
}
if (uploadErrors.length > 0) {
const errorResponse = {
ok: false,
error: "upload_failure",
uploadErrors,
headers: response.headers,
};
throw new errors_1.SlackAPIError("files.slack.com", "upload_error", errorResponse);
}
return { id: file_id, title: f.title ?? f.filename };
}
completes.push(uploadAsync());
}
try {
const completion = await this.files.completeUploadExternal({
token: params.token,
files: await Promise.all(completes),
channel_id: params.channel_id,
initial_comment: params.initial_comment,
thread_ts: params.thread_ts,
});
return {
ok: true,
files: completion.files,
headers: completion.headers,
};
}
catch (e) {
if (e instanceof errors_1.SlackAPIError && !this.#throwSlackAPIError) {
return e.result;
}
throw e;
}
}
#bindApiCall(self, method) {
return self.call.bind(self, method);
}
#bindNoArgAllowedApiCall(self, method) {
return self.call.bind(self, method);
}
#bindMultipartApiCall(self, method) {
return self.#sendMultipartData.bind(self, method);
}
#bindFilesUploadV2(self) {
return self.#uploadFilesV2.bind(self);
}
// --------------------------------------
// API definition
// --------------------------------------
admin = {
apps: {
approve: this.#bindNoArgAllowedApiCall(this, "admin.apps.approve"),
approved: {
list: this.#bindNoArgAllowedApiCall(this, "admin.apps.approved.list"),
},
clearResolution: this.#bindApiCall(this, "admin.apps.clearResolution"),
requests: {
cancel: this.#bindApiCall(this, "admin.apps.requests.cancel"),
list: this.#bindNoArgAllowedApiCall(this, "admin.apps.requests.list"),
},
restrict: this.#bindNoArgAllowedApiCall(this, "admin.apps.restrict"),
restricted: {
list: this.#bindNoArgAllowedApiCall(this, "admin.apps.restricted.list"),
},
uninstall: this.#bindApiCall(this, "admin.apps.uninstall"),
activities: {
list: this.#bindNoArgAllowedApiCall(this, "admin.apps.activities.list"),
},
},
auth: {
policy: {
assignEntities: this.#bindApiCall(this, "admin.auth.policy.assignEntities"),
getEntities: this.#bindApiCall(this, "admin.auth.policy.getEntities"),
removeEntities: this.#bindApiCall(this, "admin.auth.policy.removeEntities"),
},
},
barriers: {
create: this.#bindApiCall(this, "admin.barriers.create"),
delete: this.#bindApiCall(this, "admin.barriers.delete"),
list: this.#bindNoArgAllowedApiCall(this, "admin.barriers.list"),
update: this.#bindApiCall(this, "admin.barriers.update"),
},
conversations: {
archive: this.#bindApiCall(this, "admin.conversations.archive"),
bulkArchive: this.#bindApiCall(this, "admin.conversations.bulkArchive"),
bulkDelete: this.#bindApiCall(this, "admin.conversations.bulkDelete"),
bulkMove: this.#bindApiCall(this, "admin.conversations.bulkMove"),
convertToPrivate: this.#bindApiCall(this, "admin.conversations.convertToPrivate"),
convertToPublic: this.#bindApiCall(this, "admin.conversations.convertToPublic"),
create: this.#bindApiCall(this, "admin.conversations.create"),
delete: this.#bindApiCall(this, "admin.conversations.delete"),
disconnectShared: this.#bindApiCall(this, "admin.conversations.disconnectShared"),
ekm: {
listOriginalConnectedChannelInfo: this.#bindNoArgAllowedApiCall(this, "admin.conversations.ekm.listOriginalConnectedChannelInfo"),
},
getConversationPrefs: this.#bindApiCall(this, "admin.conversations.getConversationPrefs"),
getTeams: this.#bindApiCall(this, "admin.conversations.getTeams"),
invite: this.#bindApiCall(this, "admin.conversations.invite"),
rename: this.#bindApiCall(this, "admin.conversations.rename"),
restrictAccess: {
addGroup: this.#bindApiCall(this, "admin.conversations.restrictAccess.addGroup"),
listGroups: this.#bindApiCall(this, "admin.conversations.restrictAccess.listGroups"),
removeGroup: this.#bindApiCall(this, "admin.conversations.restrictAccess.removeGroup"),
},
requestSharedInvite: {
approve: this.#bindApiCall(this, "conversations.requestSharedInvite.approve"),
deny: this.#bindApiCall(this, "conversations.requestSharedInvite.deny"),
list: this.#bindApiCall(this, "conversations.requestSharedInvite.list"),
},
getCustomRetention: this.#bindApiCall(this, "admin.conversations.getCustomRetention"),
setCustomRetention: this.#bindApiCall(this, "admin.conversations.setCustomRetention"),
removeCustomRetention: this.#bindApiCall(this, "admin.conversations.removeCustomRetention"),
lookup: this.#bindApiCall(this, "admin.conversations.lookup"),
search: this.#bindNoArgAllowedApiCall(this, "admin.conversations.search"),
setConversationPrefs: this.#bindApiCall(this, "admin.conversations.setConversationPrefs"),
setTeams: this.#bindApiCall(this, "admin.conversations.setTeams"),
unarchive: this.#bindApiCall(this, "admin.conversations.unarchive"),
},
emoji: {
add: this.#bindApiCall(this, "admin.emoji.add"),
addAlias: this.#bindApiCall(this, "admin.emoji.addAlias"),
list: this.#bindApiCall(this, "admin.emoji.list"),
remove: this.#bindApiCall(this, "admin.emoji.remove"),
rename: this.#bindApiCall(this, "admin.emoji.rename"),
},
functions: {
list: this.#bindApiCall(this, "admin.functions.list"),
permissions: {
lookup: this.#bindApiCall(this, "admin.functions.permissions.lookup"),
set: this.#bindApiCall(this, "admin.functions.permissions.set"),
},
},
inviteRequests: {
approve: this.#bindApiCall(this, "admin.inviteRequests.approve"),
approved: {
list: this.#bindApiCall(this, "admin.inviteRequests.approved.list"),
},
denied: {
list: this.#bindApiCall(this, "admin.inviteRequests.denied.list"),
},
deny: this.#bindApiCall(this, "admin.inviteRequests.deny"),
list: this.#bindApiCall(this, "admin.inviteRequests.list"),
},
roles: {
addAssignments: this.#bindApiCall(this, "admin.roles.addAssignments"),
listAssignments: this.#bindNoArgAllowedApiCall(this, "admin.roles.listAssignments"),
removeAssignments: this.#bindApiCall(this, "admin.roles.removeAssignments"),
},
teams: {
admins: {
list: this.#bindApiCall(this, "admin.teams.admins.list"),
},
create: this.#bindApiCall(this, "admin.teams.create"),
list: this.#bindNoArgAllowedApiCall(this, "admin.teams.list"),
owners: {
list: this.#bindApiCall(this, "admin.teams.owners.list"),
},
settings: {
info: this.#bindApiCall(this, "admin.teams.settings.info"),
setDefaultChannels: this.#bindApiCall(this, "admin.teams.settings.setDefaultChannels"),
setDescription: this.#bindApiCall(this, "admin.teams.settings.setDescription"),
setDiscoverability: this.#bindApiCall(this, "admin.teams.settings.setDiscoverability"),
setIcon: this.#bindApiCall(this, "admin.teams.settings.setIcon"),
setName: this.#bindApiCall(this, "admin.teams.settings.setName"),
},
},
usergroups: {
addChannels: this.#bindApiCall(this, "admin.usergroups.addChannels"),
addTeams: this.#bindApiCall(this, "admin.usergroups.addTeams"),
listChannels: this.#bindApiCall(this, "admin.usergroups.listChannels"),
removeChannels: this.#bindApiCall(this, "admin.usergroups.removeChannels"),
},
users: {
assign: this.#bindApiCall(this, "admin.users.assign"),
invite: this.#bindApiCall(this, "admin.users.invite"),
list: this.#bindApiCall(this, "admin.users.list"),
remove: this.#bindApiCall(this, "admin.users.remove"),
session: {
list: this.#bindNoArgAllowedApiCall(this, "admin.users.session.list"),
reset: this.#bindApiCall(this, "admin.users.session.reset"),
resetBulk: this.#bindApiCall(this, "admin.users.session.resetBulk"),
invalidate: this.#bindApiCall(this, "admin.users.session.invalidate"),
getSettings: this.#bindApiCall(this, "admin.users.session.getSettings"),
setSettings: this.#bindApiCall(this, "admin.users.session.setSettings"),
clearSettings: this.#bindApiCall(this, "admin.users.session.clearSettings"),
},
unsupportedVersions: {
export: this.#bindNoArgAllowedApiCall(this, "admin.users.unsupportedVersions.export"),
},
setAdmin: this.#bindApiCall(this, "admin.users.setAdmin"),
setExpiration: this.#bindApiCall(this, "admin.users.setExpiration"),
setOwner: this.#bindApiCall(this, "admin.users.setOwner"),
setRegular: this.#bindApiCall(this, "admin.users.setRegular"),
},
workflows: {
search: this.#bindNoArgAllowedApiCall(this, "admin.workflows.search"),
unpublish: this.#bindApiCall(this, "admin.workflows.unpublish"),
collaborators: {
add: this.#bindApiCall(this, "admin.workflows.collaborators.add"),
remove: this.#bindApiCall(this, "admin.workflows.collaborators.remove"),
},
permissions: {
lookup: this.#bindApiCall(this, "admin.workflows.permissions.lookup"),
},
},
};
api = {
test: this.#bindNoArgAllowedApiCall(this, "api.test"),
};
apps = {
connections: {
open: this.#bindNoArgAllowedApiCall(this, "apps.connections.open"),
},
datastore: {
put: this.#bindApiCall(this, "apps.datastore.put"),
update: this.#bindApiCall(this, "apps.datastore.update"),
get: this.#bindApiCall(this, "apps.datastore.get"),
query: this.#bindApiCall(this, "apps.datastore.query"),
delete: this.#bindApiCall(this, "apps.datastore.delete"),
},
event: {
authorizations: {
list: this.#bindApiCall(this, "apps.event.authorizations.list"),
},
},
manifest: {
create: this.#bindApiCall(this, "apps.manifest.create"),
delete: this.#bindApiCall(this, "apps.manifest.delete"),
update: this.#bindApiCall(this, "apps.manifest.update"),
export: this.#bindApiCall(this, "apps.manifest.export"),
validate: this.#bindApiCall(this, "apps.manifest.validate"),
},
uninstall: this.#bindApiCall(this, "apps.uninstall"),
};
assistant = {
threads: {
setStatus: this.#bindApiCall(this, "assistant.threads.setStatus"),
setSuggestedPrompts: this.#bindApiCall(this, "assistant.threads.setSuggestedPrompts"),
setTitle: this.#bindApiCall(this, "assistant.threads.setTitle"),
},
};
auth = {
revoke: this.#bindNoArgAllowedApiCall(this, "auth.revoke"),
teams: {
list: this.#bindNoArgAllowedApiCall(this, "auth.teams.list"),
},
test: this.#bindNoArgAllowedApiCall(this, "auth.test"),
};
bots = {
info: this.#bindApiCall(this, "bots.info"),
};
bookmarks = {
add: this.#bindApiCall(this, "bookmarks.add"),
edit: this.#bindApiCall(this, "bookmarks.edit"),
list: this.#bindApiCall(this, "bookmarks.list"),
remove: this.#bindApiCall(this, "bookmarks.remove"),
};
canvases = {
access: {
delete: this.#bindApiCall(this, "canvases.access.delete"),
set: this.#bindApiCall(this, "canvases.access.set"),
},
create: this.#bindApiCall(this, "canvases.create"),
edit: this.#bindApiCall(this, "canvases.edit"),
delete: this.#bindApiCall(this, "canvases.delete"),
sections: {
lookup: this.#bindApiCall(this, "canvases.sections.lookup"),
},
};
chat = {
delete: this.#bindApiCall(this, "chat.delete"),
deleteScheduledMessage: this.#bindApiCall(this, "chat.deleteScheduledMessage"),
getPermalink: this.#bindApiCall(this, "chat.getPermalink"),
meMessage: this.#bindApiCall(this, "chat.meMessage"),
postEphemeral: this.#bindApiCall(this, "chat.postEphemeral"),
postMessage: this.#bindApiCall(this, "chat.postMessage"),
scheduleMessage: this.#bindApiCall(this, "chat.scheduleMessage"),
scheduledMessages: {
list: this.#bindApiCall(this, "chat.scheduledMessages.list"),
},
unfurl: this.#bindApiCall(this, "chat.unfurl"),
update: this.#bindApiCall(this, "chat.update"),
};
conversations = {
acceptSharedInvite: this.#bindApiCall(this, "conversations.acceptSharedInvite"),
approveSharedInvite: this.#bindApiCall(this, "conversations.approveSharedInvite"),
archive: this.#bindApiCall(this, "conversations.archive"),
close: this.#bindApiCall(this, "conversations.close"),
create: this.#bindApiCall(this, "conversations.create"),
declineSharedInvite: this.#bindApiCall(this, "conversations.declineSharedInvite"),
history: this.#bindApiCall(this, "conversations.history"),
info: this.#bindApiCall(this, "conversations.info"),
invite: this.#bindApiCall(this, "conversations.invite"),
inviteShared: this.#bindApiCall(this, "conversations.inviteShared"),
join: this.#bindApiCall(this, "conversations.join"),
kick: this.#bindApiCall(this, "conversations.kick"),
leave: this.#bindApiCall(this, "conversations.leave"),
list: this.#bindNoArgAllowedApiCall(this, "conversations.list"),
listConnectInvites: this.#bindNoArgAllowedApiCall(this, "conversations.listConnectInvites"),
mark: this.#bindApiCall(this, "conversations.mark"),
members: this.#bindApiCall(this, "conversations.members"),
open: this.#bindNoArgAllowedApiCall(this, "conversations.open"),
rename: this.#bindApiCall(this, "conversations.rename"),
replies: this.#bindApiCall(this, "conversations.replies"),
setPurpose: this.#bindApiCall(this, "conversations.setPurpose"),
setTopic: this.#bindApiCall(this, "conversations.setTopic"),
unarchive: this.#bindApiCall(this, "conversations.unarchive"),
canvases: {
create: this.#bindApiCall(this, "conversations.canvases.create"),
},
externalInvitePermissions: {
set: this.#bindApiCall(this, "conversations.externalInvitePermissions.set"),
},
};
dnd = {
endDnd: this.#bindNoArgAllowedApiCall(this, "dnd.endDnd"),
endSnooze: this.#bindNoArgAllowedApiCall(this, "dnd.endSnooze"),
info: this.#bindApiCall(this, "dnd.info"),
setSnooze: this.#bindApiCall(this, "dnd.setSnooze"),
teamInfo: this.#bindNoArgAllowedApiCall(this, "dnd.teamInfo"),
};
emoji = {
list: this.#bindNoArgAllowedApiCall(this, "emoji.list"),
};
files = {
delete: this.#bindApiCall(this, "files.delete"),
info: this.#bindApiCall(this, "files.info"),
list: this.#bindNoArgAllowedApiCall(this, "files.list"),
revokePublicURL: this.#bindApiCall(this, "files.revokePublicURL"),
sharedPublicURL: this.#bindApiCall(this, "files.sharedPublicURL"),
/**
* @deprecated use files.uploadV2 instead
*/
upload: this.#bindMultipartApiCall(this, "files.upload"),
uploadV2: this.#bindFilesUploadV2(this),
getUploadURLExternal: this.#bindApiCall(this, "files.getUploadURLExternal"),
completeUploadExternal: this.#bindApiCall(this, "files.completeUploadExternal"),
remote: {
info: this.#bindNoArgAllowedApiCall(this, "files.remote.info"),
list: this.#bindNoArgAllowedApiCall(this, "files.remote.list"),
add: this.#bindApiCall(this, "files.remote.add"),
update: this.#bindNoArgAllowedApiCall(this, "files.remote.update"),
remove: this.#bindNoArgAllowedApiCall(this, "files.remote.remove"),
share: this.#bindApiCall(this, "files.remote.share"),
},
};
functions = {
completeSuccess: this.#bindApiCall(this, "functions.completeSuccess"),
completeError: this.#bindApiCall(this, "functions.completeError"),
};
migration = {
exchange: this.#bindApiCall(this, "migration.exchange"),
};
oauth = {
v2: {
access: this.#bindApiCall(this, "oauth.v2.access"),
exchange: this.#bindApiCall(this, "oauth.v2.exchange"),
},
};
openid = {
connect: {
token: this.#bindApiCall(this, "openid.connect.token"),
userInfo: this.#bindNoArgAllowedApiCall(this, "openid.connect.userInfo"),
},
};
pins = {
add: this.#bindApiCall(this, "pins.add"),
list: this.#bindApiCall(this, "pins.list"),
remove: this.#bindApiCall(this, "pins.remove"),
};
reactions = {
add: this.#bindNoArgAllowedApiCall(this, "reactions.add"),
get: this.#bindNoArgAllowedApiCall(this, "reactions.get"),
list: this.#bindNoArgAllowedApiCall(this, "reactions.list"),
remove: this.#bindApiCall(this, "reactions.remove"),
};
reminders = {
add: this.#bindApiCall(this, "reminders.add"),
complete: this.#bindApiCall(this, "reminders.complete"),
delete: this.#bindApiCall(this, "reminders.delete"),
info: this.#bindApiCall(this, "reminders.info"),
list: this.#bindApiCall(this, "reminders.list"),
};
search = {
all: this.#bindApiCall(this, "search.all"),
files: this.#bindApiCall(this, "search.files"),
messages: this.#bindApiCall(this, "search.messages"),
};
stars = {
add: this.#bindNoArgAllowedApiCall(this, "stars.add"),
list: this.#bindNoArgAllowedApiCall(this, "stars.list"),
remove: this.#bindNoArgAllowedApiCall(this, "stars.remove"),
};
team = {
accessLogs: this.#bindNoArgAllowedApiCall(this, "team.accessLogs"),
billableInfo: this.#bindNoArgAllowedApiCall(this, "team.billableInfo"),
billing: {
info: this.#bindNoArgAllowedApiCall(this, "team.billing.info"),
},
info: this.#bindNoArgAllowedApiCall(this, "team.info"),
integrationLogs: this.#bindNoArgAllowedApiCall(this, "team.integrationLogs"),
preferences: {
list: this.#bindNoArgAllowedApiCall(this, "team.preferences.list"),
},
profile: {
get: this.#bindNoArgAllowedApiCall(this, "team.profile.get"),
},
externalTeams: {
list: this.#bindApiCall(this, "team.externalTeams.list"),
disconnect: this.#bindApiCall(this, "team.externalTeams.disconnect"),
},
};
tooling = {
tokens: {
rotate: this.#bindApiCall(this, "tooling.tokens.rotate"),
},
};
usergroups = {
create: this.#bindApiCall(this, "usergroups.create"),
disable: this.#bindApiCall(this, "usergroups.disable"),
enable: this.#bindApiCall(this, "usergroups.enable"),
list: this.#bindNoArgAllowedApiCall(this, "usergroups.list"),
update: this.#bindApiCall(this, "usergroups.update"),
users: {
list: this.#bindApiCall(this, "usergroups.users.list"),
update: this.#bindApiCall(this, "usergroups.users.update"),
},
};
users = {
conversations: this.#bindNoArgAllowedApiCall(this, "users.conversations"),
deletePhoto: this.#bindNoArgAllowedApiCall(this, "users.deletePhoto"),
getPresence: this.#bindNoArgAllowedApiCall(this, "users.getPresence"),
identity: this.#bindNoArgAllowedApiCall(this, "users.identity"),
info: this.#bindApiCall(this, "users.info"),
list: this.#bindNoArgAllowedApiCall(this, "users.list"),
lookupByEmail: this.#bindApiCall(this, "users.lookupByEmail"),
setPhoto: this.#bindApiCall(this, "users.setPhoto"),
setPresence: this.#bindApiCall(this, "users.setPresence"),
profile: {
get: this.#bindNoArgAllowedApiCall(this, "users.profile.get"),
set: this.#bindNoArgAllowedApiCall(this, "users.profile.set"),
},
discoverableContacts: {
lookup: this.#bindApiCall(this, "users.discoverableContacts.lookup"),
},
};
views = {
open: this.#bindApiCall(this, "views.open"),
publish: this.#bindApiCall(this, "views.publish"),
push: this.#bindApiCall(this, "views.push"),
update: this.#bindApiCall(this, "views.update"),
};
workflows = {
triggers: {
create: this.#bindApiCall(this, "workflows.triggers.create"),
update: this.#bindApiCall(this, "workflows.triggers.update"),
delete: this.#bindApiCall(this, "workflows.triggers.delete"),
list: this.#bindNoArgAllowedApiCall(this, "workflows.triggers.list"),
},
};
}
exports.SlackAPIClient = SlackAPIClient;
_a = SlackAPIClient;
//# sourceMappingURL=api-client.js.map