Skip to content
Sarj Workspace Sync

workspace-directory/posthog-membership-client

@sarj-ai/workspace-sync/workspace-directory/posthog-membership-client ยท Source

import { z } from "zod";
type FetchImpl = typeof globalThis.fetch;
export declare const PosthogIdSchema: z.ZodString;
export declare const PosthogOriginSchema: z.ZodEnum<{
"https://eu.posthog.com": "https://eu.posthog.com";
"https://us.posthog.com": "https://us.posthog.com";
}>;
export declare const PosthogMemberSchema: z.ZodObject<{
id: z.ZodString;
level: z.ZodNumber;
user: z.ZodObject<{
uuid: z.ZodString;
email: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const PosthogInviteSchema: z.ZodObject<{
id: z.ZodString;
target_email: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
level: z.ZodNumber;
is_expired: z.ZodBoolean;
created_by: z.ZodObject<{
uuid: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
export type PosthogMember = z.output<typeof PosthogMemberSchema>;
export type PosthogInvite = z.output<typeof PosthogInviteSchema>;
export interface PosthogMembershipSnapshot {
organizationId: string;
actorUuid: string;
members: PosthogMember[];
invites: PosthogInvite[];
}
export interface IPosthogMembershipClient {
read(): Promise<PosthogMembershipSnapshot>;
invite(email: string): Promise<PosthogInvite>;
cancelInvite(inviteId: string): Promise<void>;
removeMember(userUuid: string): Promise<void>;
}
/** A dedicated organization-scoped key needs user:read, organization:read and organization_member:write. */
export declare class PosthogMembershipClient implements IPosthogMembershipClient {
#private;
constructor(options: {
origin: string;
organizationId: string;
actorUuid: string;
token: string;
fetchImpl?: FetchImpl;
});
read(): Promise<PosthogMembershipSnapshot>;
invite(email: string): Promise<PosthogInvite>;
cancelInvite(inviteId: string): Promise<void>;
removeMember(userUuid: string): Promise<void>;
}
export {};