import type { JsonObject } from "type-fest"; import * as z from "zod"; /** Scalar value serialized into one Slack query parameter. */ type SlackQueryValue = boolean | number | string | undefined; /** Scalar value serialized into one Slack form field. */ type SlackFormValue = boolean | number | string | undefined; /** Mutually exclusive Slack JSON and form request bodies. */ type SlackApiBodyOptions = { /** JSON request body for a Slack write method. */ body?: JsonObject; form?: never; } | { body?: never; /** URL-encoded request fields for methods that require form encoding. */ form: Record; }; /** Options for one authenticated Slack Web API request. */ export type SlackApiCallOptions = SlackApiBodyOptions & { /** HTTP verb. Defaults to `POST` when a body is present and `GET` otherwise. */ httpMethod?: "GET" | "POST"; /** URL query parameters for Slack read methods. */ query?: Record; /** Schema that validates and types the successful Slack response. */ responseSchema: TSchema; }; /** Internal authenticated Slack Web API client used by packaged actions. */ export interface SlackApi { /** * Calls any Slack Web API method and validates the successful response. * * Slack's `ok: false` responses throw `SlackApiError`, including when Slack * returns HTTP 200. * * @param method - Slack method name such as `chat.postMessage`. * @param options - Request data and successful response schema. */ call(method: string, options: SlackApiCallOptions): Promise>; } /** Structured error returned by an authenticated Slack Web API request. */ export declare class SlackApiError extends Error { /** Slack error code or an HTTP fallback code. */ readonly code: string; /** Structured diagnostics retained in durable automation failures. */ readonly details: JsonObject; /** Slack Web API method that failed. */ readonly method: string; /** Scopes Slack reported as required for the request. */ readonly neededScopes?: string; /** Scopes Slack reported on the supplied token. */ readonly providedScopes?: string; /** Field-level diagnostics Slack returned with the failed request. */ readonly responseMessages?: string[]; /** Retry delay from Slack's `Retry-After` header, in seconds. */ readonly retryAfter?: number; /** HTTP status returned by Slack. */ readonly status: number; /** * Creates a structured Slack API error. * * @param options - Provider and transport error details. * @param options.code - Slack error code or HTTP fallback. * @param options.method - Slack method that failed. * @param options.neededScopes - Scopes required by Slack. * @param options.providedScopes - Scopes granted to the token. * @param options.responseMessages - Provider field-level diagnostics. * @param options.retryAfter - Retry delay in seconds. * @param options.status - HTTP response status. */ constructor(options: { code: string; method: string; neededScopes?: string; providedScopes?: string; responseMessages?: string[]; retryAfter?: number; status: number; }); } /** * Creates the authenticated Slack Web API client used by packaged actions. * * @param secret - Resolved Slack integration secret. */ export declare function getSlackApi(secret: Record): SlackApi; /** * Converts action input values into provider-native Slack message fields. * * @param input - Camel-cased public message fields. * @param input.attachments - Legacy Slack attachments. * @param input.blocks - Block Kit content. * @param input.text - Text content or accessibility fallback. * @param input.unfurlLinks - Whether Slack should unfurl links. * @param input.unfurlMedia - Whether Slack should unfurl media. */ export declare function toSlackMessageBody(input: { attachments?: JsonObject[]; blocks?: JsonObject[]; text?: string; unfurlLinks?: boolean; unfurlMedia?: boolean; }): JsonObject; export {}; //# sourceMappingURL=api.d.ts.map