Skip to content
Sarj Workspace Sync

org-sync/org-channel-slack-client

@sarj-ai/workspace-sync/org-sync/slack-channel-client ยท Source

import type { SlackChannelIdentity, SlackChannelRemovalSafety, SlackChannelSyncSnapshot, SlackUserGroupSnapshot } from "./channel-model.ts";
import type { RetryOptions } from "./http.ts";
import type { SlackMember } from "./model.ts";
export interface SlackMembershipFinalSourceAuthority {
assertFinalSourceAuthority(): Promise<void>;
assertFreshPlan(): void;
}
export interface IOrgChannelSlackClient {
addUserGroupMembers?(userGroupId: string, handle: string, name: string, channelIds: readonly string[], expectedCurrentUserIds: readonly string[], reviewedAdditionUserIds: readonly string[], correlationId: string, deadlineAt?: number, onMutationStart?: () => void, beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>): Promise<{
readonly userIds: readonly string[];
readonly wrote: boolean;
}>;
createUserGroup?(name: string, handle: string, channelIds: readonly string[], runId: string, deadlineAt?: number): Promise<string>;
getChannelIdentity(channelId: string, correlationId: string, deadlineAt?: number): Promise<SlackChannelIdentity>;
getChannelRemovalSafety?(channelId: string, correlationId: string, deadlineAt?: number): Promise<SlackChannelRemovalSafety>;
getUserGroup?(handle: string, runId: string, deadlineAt?: number): Promise<null | SlackUserGroupSnapshot>;
getUserGroupById?(id: string, runId: string, deadlineAt?: number): Promise<null | SlackUserGroupSnapshot>;
invite?(channelId: string, userId: string, correlationId: string, deadlineAt?: number): Promise<void>;
kick?(channelId: string, userId: string, correlationId: string, deadlineAt?: number): Promise<void>;
listChannelMembers(channelId: string, correlationId: string, deadlineAt?: number): Promise<string[]>;
listMembershipUsers?(runId: string, deadlineAt?: number): Promise<SlackMember[]>;
listSnapshot(channelNames: readonly string[], runId: string, deadlineAt?: number, includeUserGroups?: boolean, managedUserGroupHandles?: readonly string[], publicChannelPrefixes?: readonly string[]): Promise<SlackChannelSyncSnapshot>;
removeUserGroupMembers?(userGroupId: string, handle: string, name: string, channelIds: readonly string[], desiredUserIds: readonly string[], expectedCurrentUserIds: readonly string[], reviewedRemovalUserIds: readonly string[], correlationId: string, deadlineAt?: number, onMutationStart?: () => void, beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>, finalAuthority?: SlackMembershipFinalSourceAuthority): Promise<{
readonly userIds: readonly string[];
readonly wrote: boolean;
}>;
renameChannel?(channelId: string, name: string, correlationId: string, deadlineAt?: number): Promise<void>;
updateUserGroup?(userGroupId: string, name: string, handle: string, channelIds: readonly string[], userIds: readonly string[], membershipMode: "additive" | "authoritative", correlationId: string, deadlineAt?: number, expectedCurrentUserIds?: readonly string[], reviewedRemovalUserIds?: readonly string[], beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>, onMutationStart?: () => void, expectedCurrentChannelIds?: readonly string[], reviewedRemovalChannelIds?: readonly string[]): Promise<void>;
}
export interface OrgChannelSlackClientOptions extends Pick<RetryOptions, "fetchImpl" | "random" | "sleep"> {
token: string;
}
export declare class OrgChannelSlackClient implements IOrgChannelSlackClient {
#private;
constructor(options: OrgChannelSlackClientOptions);
listMembershipUsers(runId: string, deadlineAt?: number): Promise<SlackMember[]>;
createUserGroup(name: string, handle: string, channelIds: readonly string[], runId: string, deadlineAt?: number): Promise<string>;
getChannelIdentity(channelId: string, correlationId: string, deadlineAt?: number): Promise<SlackChannelIdentity>;
getChannelRemovalSafety(channelId: string, correlationId: string, deadlineAt?: number): Promise<{
id: string;
isArchived: boolean;
isExternallyShared: boolean;
isPrivate: boolean;
name: string;
}>;
getUserGroup(handle: string, runId: string, deadlineAt?: number): Promise<null | SlackUserGroupSnapshot>;
getUserGroupById(id: string, runId: string, deadlineAt?: number): Promise<null | SlackUserGroupSnapshot>;
invite(channelId: string, userId: string, correlationId: string, deadlineAt?: number): Promise<void>;
kick(channelId: string, userId: string, correlationId: string, deadlineAt?: number): Promise<void>;
listChannelMembers(channelId: string, correlationId: string, deadlineAt?: number): Promise<string[]>;
listSnapshot(channelNames: readonly string[], runId: string, deadlineAt?: number, includeUserGroups?: boolean, managedUserGroupHandles?: readonly string[], publicChannelPrefixes?: readonly string[]): Promise<SlackChannelSyncSnapshot>;
renameChannel(channelId: string, name: string, correlationId: string, deadlineAt?: number): Promise<void>;
updateUserGroup(userGroupId: string, name: string, handle: string, channelIds: readonly string[], userIds: readonly string[], membershipMode: "additive" | "authoritative", correlationId: string, deadlineAt?: number, expectedCurrentUserIds?: readonly string[], reviewedRemovalUserIds?: readonly string[], beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>, onMutationStart?: () => void, expectedCurrentChannelIds?: readonly string[], reviewedRemovalChannelIds?: readonly string[]): Promise<void>;
removeUserGroupMembers(userGroupId: string, handle: string, name: string, channelIds: readonly string[], desiredUserIds: readonly string[], expectedCurrentUserIds: readonly string[], reviewedRemovalUserIds: readonly string[], correlationId: string, deadlineAt?: number, onMutationStart?: () => void, beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>, finalAuthority?: SlackMembershipFinalSourceAuthority): Promise<{
readonly userIds: readonly string[];
readonly wrote: boolean;
}>;
addUserGroupMembers(userGroupId: string, handle: string, name: string, channelIds: readonly string[], expectedCurrentUserIds: readonly string[], reviewedAdditionUserIds: readonly string[], correlationId: string, deadlineAt?: number, onMutationStart?: () => void, beforeMembershipMutation?: (slackUserIds: readonly string[]) => Promise<void>): Promise<{
readonly userIds: readonly string[];
readonly wrote: boolean;
}>;
}