Skip to content
Sarj Workspace Sync

org-sync/org-slack-client

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

import { z } from "zod";
import type { RetryOptions } from "./http.ts";
import type { SlackMember, SlackProfile } from "./model.ts";
declare const ProfileFieldSchema: z.ZodObject<{
id: z.ZodString;
is_protected: z.ZodOptional<z.ZodBoolean>;
label: z.ZodString;
options: z.ZodOptional<z.ZodObject<{
is_protected: z.ZodOptional<z.ZodBoolean>;
is_scim: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
possible_values: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
type: z.ZodUnion<[z.ZodEnum<{
options_list: "options_list";
text: "text";
user: "user";
}>, z.ZodString]>;
}, z.core.$strip>;
export type SlackProfileField = z.output<typeof ProfileFieldSchema>;
export interface SlackSnapshot {
actorUserId: string;
fields: SlackProfileField[];
members: SlackMember[];
scopes: string[];
teamId: string;
}
export interface IOrgSlackClient {
getProfile(userId: string, correlationId: string, deadlineAt?: number): Promise<SlackProfile>;
listSnapshot(runId: string, deadlineAt?: number): Promise<SlackSnapshot>;
readProfileSchema?(correlationId: string, deadlineAt: number, expectedTeamId: string): Promise<Pick<SlackSnapshot, "fields" | "teamId">>;
setProfile(userId: string, profile: {
"display_name"?: string | undefined;
fields?: Record<string, {
alt: string;
value: string;
}> | undefined;
"real_name"?: string | undefined;
title?: string | undefined;
}, correlationId: string, deadlineAt?: number): Promise<void>;
}
export interface OrgSlackClientOptions extends Pick<RetryOptions, "fetchImpl" | "random" | "sleep"> {
token: string;
}
export declare class OrgSlackClient implements IOrgSlackClient {
#private;
constructor(options: OrgSlackClientOptions);
getProfile(userId: string, correlationId: string, deadlineAt?: number): Promise<SlackProfile>;
readProfileSchema(correlationId: string, deadlineAt: number, expectedTeamId: string): Promise<Pick<SlackSnapshot, "fields" | "teamId">>;
listSnapshot(runId: string, deadlineAt?: number): Promise<SlackSnapshot>;
setProfile(userId: string, profile: {
"display_name"?: string | undefined;
fields?: Record<string, {
alt: string;
value: string;
}> | undefined;
"real_name"?: string | undefined;
title?: string | undefined;
}, correlationId: string, deadlineAt?: number): Promise<void>;
}
export {};