import type { ActivityStore } from "./activity-log.js"; import { type DiscordClient } from "./discord-client.js"; import { type OperationStore } from "./operation-store.js"; import type { ScopePolicy } from "./policy.js"; import type { RequestOptions } from "./types.js"; import type { WebhookCredentialStore } from "./webhook-credential-store.js"; export declare const WEBHOOK_TYPES: Readonly<{ application: 3; channelFollower: 2; incoming: 1; }>; export declare const WEBHOOK_OMITTED_FIELDS: readonly ["avatar", "sourceChannel", "sourceGuild", "token", "unknownRawFields", "url", "userProfile"]; export type WebhookType = "application" | "channel-follower" | "incoming"; export interface WebhookDeletionRequest { auditReason: string; channelId: string; operationKey: string; webhookId: string; } export interface WebhookCreationRequest { auditReason: string; channelId: string; name: string; operationKey: string; } export interface NormalizedWebhookCreationRequest extends WebhookCreationRequest { operationKeyHash: string; } export interface WebhookChangeRequest { auditReason: string; channelId: string; destinationChannelId?: string; name?: string; operationKey: string; webhookId: string; } export interface NormalizedWebhookChangeRequest extends WebhookChangeRequest { operationKeyHash: string; requestedFields: WebhookChangeField[]; } export declare const WEBHOOK_CHANGE_FIELDS: readonly ["channelId", "name"]; export type WebhookChangeField = typeof WEBHOOK_CHANGE_FIELDS[number]; export interface NormalizedWebhookDeletionRequest extends WebhookDeletionRequest { operationKeyHash: string; } export interface ProjectedWebhook { applicationId: string | null; channelId: string; createdAt: string; creatorUserId: string | null; guildId: string; name: string | null; type: WebhookType; webhookId: string; } export interface WebhookPrivacyProjection { credentialsProjectedOut: true; omittedFields: typeof WEBHOOK_OMITTED_FIELDS; } export interface WebhookPermissionEvidence { administrator: boolean; confidence: "complete"; effectivePermissions: string; manageWebhooks: true; permissionSourceChannelId: string; viewChannel: true; } export interface WebhookChannelProjection { guildId: string; id: string; name: string; parentId: string | null; type: number; typeName: string; } export interface WebhookInventoryResult { channel: WebhookChannelProjection; guild: { id: string; name: string; }; page: { returned: number; safetyLimit: number; }; permission: WebhookPermissionEvidence; privacy: WebhookPrivacyProjection; schemaVersion: number; status: "ok"; webhooks: ProjectedWebhook[]; } export interface WebhookLookupResult extends Omit { webhook: ProjectedWebhook; } export interface WebhookDeletionPlan { action: "delete"; applicationId: string; auditReason: string; botId: string; channel: WebhookChannelProjection; createdAt: string; digest: string; guild: { id: string; name: string; }; operationKeyHash: string; permission: WebhookPermissionEvidence; privacy: WebhookPrivacyProjection; schemaVersion: number; status: "planned"; target: ProjectedWebhook; warnings: string[]; } export interface WebhookDeletionResult { activityId: string; channelId: string; credentialCleanup: "failed" | "not-attempted" | "not-configured" | "not-present" | "removed"; guildId: string; operationKeyHash: string; planDigest: string; schemaVersion: number; status: "completed" | "completed-with-drift"; verifiedAbsent: boolean; webhookId: string; } export interface WebhookAdministrationEndpoint { channel: WebhookChannelProjection; inventory: { returned: number; safetyLimit: number; }; permission: WebhookPermissionEvidence; webhooks: ProjectedWebhook[]; } export interface WebhookCreationPlan { action: "create"; applicationId: string; auditReason: string; botId: string; createdAt: string; desired: { channelId: string; name: string; type: "incoming"; }; digest: string; guild: { id: string; name: string; }; operationKeyHash: string; privacy: WebhookPrivacyProjection; risks: string[]; schemaVersion: number; source: WebhookAdministrationEndpoint; status: "planned"; warnings: string[]; } export interface WebhookCreationResult { activityId: string; channelId: string; credentialStored: true; created: ProjectedWebhook; guildId: string; inventoryMatched: boolean; observed: ProjectedWebhook | null; operationKeyHash: string; planDigest: string; readbackMatched: boolean; responseMatched: true; schemaVersion: number; status: "completed" | "completed-with-drift"; } export interface WebhookChangePlan { action: "update"; applicationId: string; auditReason: string; botId: string; changedFields: WebhookChangeField[]; createdAt: string; current: ProjectedWebhook; desired: ProjectedWebhook; destination: WebhookAdministrationEndpoint | null; digest: string; guild: { id: string; name: string; }; operationKeyHash: string; privacy: WebhookPrivacyProjection; requestedFields: WebhookChangeField[]; risks: string[]; schemaVersion: number; source: WebhookAdministrationEndpoint; status: "already-current" | "planned"; warnings: string[]; writeRequired: boolean; } export interface WebhookChangeResult { activityId: string | null; channelId: string; destinationChannelId: string; guildId: string; inventoryMatched: boolean; observed: ProjectedWebhook | null; operationKeyHash: string; planDigest: string; readbackMatched: boolean; responseMatched: boolean; schemaVersion: number; sourceTargetAbsent: boolean; status: "already-current" | "completed" | "completed-with-drift"; webhookId: string; } export interface WebhookServiceClient extends Pick { } export interface WebhookServiceOptions { activityStore: ActivityStore; client: WebhookServiceClient; clock?: () => Date; operationStore: OperationStore; planKey?: Uint8Array; policy: ScopePolicy; randomId?: () => string; credentialStore?: Pick; } export declare function normalizeWebhookDeletionRequest(request: WebhookDeletionRequest): NormalizedWebhookDeletionRequest; export declare function normalizeWebhookName(value: unknown): string; export declare function normalizeWebhookCreationRequest(request: WebhookCreationRequest): NormalizedWebhookCreationRequest; export declare function normalizeWebhookChangeRequest(request: WebhookChangeRequest): NormalizedWebhookChangeRequest; export declare class WebhookService { #private; constructor(options: WebhookServiceOptions); list(botId: string, channelId: string, options?: RequestOptions): Promise; get(botId: string, channelId: string, webhookId: string, options?: RequestOptions): Promise; planCreation(applicationId: string, botId: string, request: WebhookCreationRequest, options?: RequestOptions): Promise; planChange(applicationId: string, botId: string, request: WebhookChangeRequest, options?: RequestOptions): Promise; plan(applicationId: string, botId: string, request: WebhookDeletionRequest, options?: RequestOptions): Promise; executeCreation(applicationId: string, botId: string, request: WebhookCreationRequest, expectedDigest: string, options?: RequestOptions): Promise; executeChange(applicationId: string, botId: string, request: WebhookChangeRequest, expectedDigest: string, options?: RequestOptions): Promise; execute(applicationId: string, botId: string, request: WebhookDeletionRequest, expectedDigest: string, options?: RequestOptions): Promise; } //# sourceMappingURL=webhook-service.d.ts.map