// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; export class Slack extends APIResource { /** * Begin Slack identity verification. Idempotent — repeated calls reuse the active * challenge. */ register(params: SlackRegisterParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/auth/slack/register', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Unbind a Slack identity from a user. Only affects the specified Slack channel. */ unregister(params: SlackUnregisterParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/auth/slack/unregister', { body, ...options, headers: buildHeaders([ { Accept: '*/*', ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Response body for POST /slack/register. */ export interface SlackRegisterResponse { challenge_id: string; expires_at: string; resend_available_in: number; channel?: string; } export interface SlackRegisterParams { /** * Body param: User's email address. */ email: string; /** * Body param: Provider code identifying the specific Slack workspace/integration * instance. */ provider_code: string; /** * Body param: Slack user ID (external_subject in the identity system). */ slack_user_id: string; /** * Body param: Optional display name for user provisioning. */ display_name?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export interface SlackUnregisterParams { /** * Body param: User's email address. */ email: string; /** * Body param: Provider code identifying the specific Slack workspace/integration * instance. */ provider_code: string; /** * Body param: Slack user ID (external_subject in the identity system). */ slack_user_id: string; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace Slack { export { type SlackRegisterResponse as SlackRegisterResponse, type SlackRegisterParams as SlackRegisterParams, type SlackUnregisterParams as SlackUnregisterParams, }; }