feat: add governed public self-enrollment links
This commit is contained in:
@@ -264,6 +264,82 @@ export type SchedulingPublicParticipationSubmitPayload = SchedulingPublicPartici
|
||||
idempotency_key?: string;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLink = {
|
||||
id: string;
|
||||
request_id: string;
|
||||
status: "active" | "expired" | "revoked" | "exhausted";
|
||||
expires_at: string;
|
||||
max_enrollments: number;
|
||||
enrollment_count: number;
|
||||
allow_anonymous: boolean;
|
||||
allow_authenticated: boolean;
|
||||
created_at: string;
|
||||
revoked_at?: string | null;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLinkListResponse = { links: SchedulingEnrollmentLink[] };
|
||||
|
||||
export type SchedulingEnrollmentLinkActionResponse = {
|
||||
link: SchedulingEnrollmentLink;
|
||||
action_url?: string | null;
|
||||
replayed: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLinkCreatePayload = {
|
||||
expires_at: string;
|
||||
max_enrollments: number;
|
||||
allow_anonymous: boolean;
|
||||
allow_authenticated: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingPublicEnrollmentResponse = {
|
||||
request_id: string;
|
||||
link_id: string;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
location?: string | null;
|
||||
timezone: string;
|
||||
status: SchedulingStatus;
|
||||
deadline_at?: string | null;
|
||||
enrollment_expires_at: string;
|
||||
enrollment_remaining: number;
|
||||
display_name_required: boolean;
|
||||
participant_email_required: boolean;
|
||||
anonymous_allowed: boolean;
|
||||
authenticated_allowed: boolean;
|
||||
anonymous_password_required: boolean;
|
||||
single_choice: boolean;
|
||||
max_participants_per_option: number | null;
|
||||
allow_maybe: boolean;
|
||||
allow_comments: boolean;
|
||||
allow_participant_updates: boolean;
|
||||
enrolled: boolean;
|
||||
account_bound: boolean;
|
||||
has_response: boolean;
|
||||
submitted_at?: string | null;
|
||||
answers: Array<{ slot_id: string; value: SchedulingAvailabilityValue }>;
|
||||
comment?: string | null;
|
||||
replayed: boolean;
|
||||
slots: SchedulingPublicCandidateSlot[];
|
||||
};
|
||||
|
||||
export type SchedulingPublicEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||
display_name: string;
|
||||
email?: string | null;
|
||||
password?: string | null;
|
||||
participant_proof: string;
|
||||
idempotency_key: string;
|
||||
};
|
||||
|
||||
export type SchedulingAuthenticatedEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||
display_name: string;
|
||||
email?: string | null;
|
||||
password?: string | null;
|
||||
bind_account_confirmed: boolean;
|
||||
participant_proof?: string | null;
|
||||
idempotency_key: string;
|
||||
};
|
||||
|
||||
export type SchedulingCalendarActionResponse = {
|
||||
request: SchedulingRequest;
|
||||
created_event_ids: string[];
|
||||
@@ -423,6 +499,79 @@ export function submitPublicSchedulingParticipation(
|
||||
);
|
||||
}
|
||||
|
||||
export function listSchedulingEnrollmentLinks(
|
||||
settings: ApiSettings,
|
||||
requestId: string
|
||||
): Promise<SchedulingEnrollmentLinkListResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkListResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links`
|
||||
);
|
||||
}
|
||||
|
||||
export function createSchedulingEnrollmentLink(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
payload: SchedulingEnrollmentLinkCreatePayload
|
||||
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function revokeSchedulingEnrollmentLink(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
linkId: string
|
||||
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links/${linkId}`,
|
||||
{ method: "DELETE" }
|
||||
);
|
||||
}
|
||||
|
||||
export function getPublicSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
password?: string
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}`,
|
||||
json({ password: password || null })
|
||||
);
|
||||
}
|
||||
|
||||
export function submitPublicSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingPublicEnrollmentSubmitPayload
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function submitAuthenticatedSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingAuthenticatedEnrollmentSubmitPayload
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/authenticated-responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function openSchedulingRequest(settings: ApiSettings, requestId: string): Promise<SchedulingStatusResponse> {
|
||||
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/open`, json({}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user