Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

156 KB
Raw Blame
// This file is auto-generated by @hey-api/openapi-ts

import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
import { client } from './client.gen';
import type { DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdData, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ChatGroupsByIdData, DeleteApiV1ChatGroupsByIdErrors, DeleteApiV1ChatGroupsByIdMembersData, DeleteApiV1ChatGroupsByIdMembersErrors, DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1EvalBenchmarksByIdData, DeleteApiV1EvalBenchmarksByIdErrors, DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalDatasetsByIdData, DeleteApiV1EvalDatasetsByIdErrors, DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalTestCasesByIdData, DeleteApiV1EvalTestCasesByIdErrors, DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponses, DeleteApiV1GenerationsByIdData, DeleteApiV1GenerationsByIdErrors, DeleteApiV1GenerationsByIdResponses, DeleteApiV1GoalsByIdData, DeleteApiV1GoalsByIdErrors, DeleteApiV1GoalsByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponses, DeleteApiV1MemoriesByCategoryByIdData, DeleteApiV1MemoriesByCategoryByIdErrors, DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesData, DeleteApiV1MemoriesErrors, DeleteApiV1MemoriesResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponses, DeleteApiV1PushTokensByDeviceIdData, DeleteApiV1PushTokensByDeviceIdErrors, DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TasksByIdData, DeleteApiV1TasksByIdErrors, DeleteApiV1TasksByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdAccountsByAccountIdData, GetApiV1AgentsByIdAccountsByAccountIdErrors, GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsData, GetApiV1AgentsByIdAccountsErrors, GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsErrors, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponses, GetApiV1ChatGroupsByIdData, GetApiV1ChatGroupsByIdErrors, GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsData, GetApiV1ChatGroupsErrors, GetApiV1ChatGroupsResponses, GetApiV1DocumentsByIdData, GetApiV1DocumentsByIdErrors, GetApiV1DocumentsByIdResponses, GetApiV1DocumentsData, GetApiV1DocumentsErrors, GetApiV1DocumentsResponses, GetApiV1EvalBenchmarksByIdData, GetApiV1EvalBenchmarksByIdErrors, GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksData, GetApiV1EvalBenchmarksErrors, GetApiV1EvalBenchmarksResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesData, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByIdData, GetApiV1EvalDatasetsByIdErrors, GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsData, GetApiV1EvalDatasetsErrors, GetApiV1EvalDatasetsResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdTopicsData, GetApiV1EvalRunsByIdTopicsErrors, GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsData, GetApiV1EvalRunsErrors, GetApiV1EvalRunsResponses, GetApiV1EvalTestCasesByIdData, GetApiV1EvalTestCasesByIdErrors, GetApiV1EvalTestCasesByIdResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesErrors, GetApiV1FilesResponses, GetApiV1GenerationsByIdData, GetApiV1GenerationsByIdErrors, GetApiV1GenerationsByIdResponses, GetApiV1GenerationsData, GetApiV1GenerationsErrors, GetApiV1GenerationsResponses, GetApiV1GoalsByIdData, GetApiV1GoalsByIdErrors, GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdSupervisionData, GetApiV1GoalsByIdSupervisionErrors, GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsData, GetApiV1GoalsErrors, GetApiV1GoalsResponses, GetApiV1HealthData, GetApiV1HealthResponses, GetApiV1ImTopicsByTopicIdSyncData, GetApiV1ImTopicsByTopicIdSyncErrors, GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersErrors, GetApiV1McpServersResponses, GetApiV1MemoriesByCategoryData, GetApiV1MemoriesByCategoryErrors, GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesPersonaData, GetApiV1MemoriesPersonaErrors, GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaVersionsData, GetApiV1MemoriesPersonaVersionsErrors, GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesErrors, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsErrors, GetApiV1ModelsResponses, GetApiV1NotificationsCountsData, GetApiV1NotificationsCountsErrors, GetApiV1NotificationsCountsResponses, GetApiV1NotificationsData, GetApiV1NotificationsErrors, GetApiV1NotificationsResponses, GetApiV1NotificationsSettingsData, GetApiV1NotificationsSettingsErrors, GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsUnreadCountData, GetApiV1NotificationsUnreadCountErrors, GetApiV1NotificationsUnreadCountResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsErrors, GetApiV1PermissionsResponses, GetApiV1PluginsData, GetApiV1PluginsErrors, GetApiV1PluginsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersErrors, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesErrors, GetApiV1RolesResponses, GetApiV1SignalsReceiptsData, GetApiV1SignalsReceiptsErrors, GetApiV1SignalsReceiptsResponses, GetApiV1TasksByIdData, GetApiV1TasksByIdErrors, GetApiV1TasksByIdResponses, GetApiV1TasksByIdRunsData, GetApiV1TasksByIdRunsErrors, GetApiV1TasksByIdRunsResponses, GetApiV1TasksData, GetApiV1TasksErrors, GetApiV1TasksResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponses, GetApiV1TopicsByTopicIdThreadsData, GetApiV1TopicsByTopicIdThreadsErrors, GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsData, GetApiV1TopicsErrors, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageErrors, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeErrors, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdData, PatchApiV1AgentsByIdAccountsByAccountIdErrors, PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponses, PatchApiV1ChatGroupsByIdData, PatchApiV1ChatGroupsByIdErrors, PatchApiV1ChatGroupsByIdResponses, PatchApiV1DocumentsByIdData, PatchApiV1DocumentsByIdErrors, PatchApiV1DocumentsByIdResponses, PatchApiV1EvalBenchmarksByIdData, PatchApiV1EvalBenchmarksByIdErrors, PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalDatasetsByIdData, PatchApiV1EvalDatasetsByIdErrors, PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalRunsByIdStatusData, PatchApiV1EvalRunsByIdStatusErrors, PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalTestCasesByIdData, PatchApiV1EvalTestCasesByIdErrors, PatchApiV1EvalTestCasesByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponses, PatchApiV1GoalsByIdData, PatchApiV1GoalsByIdErrors, PatchApiV1GoalsByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1NotificationsSettingsData, PatchApiV1NotificationsSettingsErrors, PatchApiV1NotificationsSettingsResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TasksByIdData, PatchApiV1TasksByIdErrors, PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdStatusData, PatchApiV1TasksByIdStatusErrors, PatchApiV1TasksByIdStatusResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponses, PostApiV1AgentsByIdAccountsData, PostApiV1AgentsByIdAccountsErrors, PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdDuplicateData, PostApiV1AgentsByIdDuplicateErrors, PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsData, PostApiV1AgentsErrors, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponses, PostApiV1AudioSpeechData, PostApiV1AudioSpeechErrors, PostApiV1AudioSpeechResponses, PostApiV1AudioTranscriptionsData, PostApiV1AudioTranscriptionsErrors, PostApiV1AudioTranscriptionsResponses, PostApiV1ChatData, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGroupsByIdMembersData, PostApiV1ChatGroupsByIdMembersErrors, PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsData, PostApiV1ChatGroupsErrors, PostApiV1ChatGroupsResponses, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponses, PostApiV1DocumentsData, PostApiV1DocumentsErrors, PostApiV1DocumentsResponses, PostApiV1EvalBenchmarksData, PostApiV1EvalBenchmarksErrors, PostApiV1EvalBenchmarksResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesData, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsData, PostApiV1EvalDatasetsErrors, PostApiV1EvalDatasetsResponses, PostApiV1EvalRunsByIdClaimData, PostApiV1EvalRunsByIdClaimErrors, PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdResultsData, PostApiV1EvalRunsByIdResultsErrors, PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdRetryErrorsData, PostApiV1EvalRunsByIdRetryErrorsErrors, PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1GoalsByIdAdvanceData, PostApiV1GoalsByIdAdvanceErrors, PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdPauseData, PostApiV1GoalsByIdPauseErrors, PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdRestartData, PostApiV1GoalsByIdRestartErrors, PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdResumeData, PostApiV1GoalsByIdResumeErrors, PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsData, PostApiV1GoalsErrors, PostApiV1GoalsResponses, PostApiV1ImagesGenerationsData, PostApiV1ImagesGenerationsErrors, PostApiV1ImagesGenerationsResponses, PostApiV1ImMessagesData, PostApiV1ImMessagesErrors, PostApiV1ImMessagesResponses, PostApiV1ImTopicsByTopicIdReadData, PostApiV1ImTopicsByTopicIdReadErrors, PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersErrors, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsErrors, PostApiV1ModelsResponses, PostApiV1NotificationsArchiveAllData, PostApiV1NotificationsArchiveAllErrors, PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsByIdArchiveData, PostApiV1NotificationsByIdArchiveErrors, PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsReadAllData, PostApiV1NotificationsReadAllErrors, PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadData, PostApiV1NotificationsReadErrors, PostApiV1NotificationsReadResponses, PostApiV1ObjectsGenerationsData, PostApiV1ObjectsGenerationsErrors, PostApiV1ObjectsGenerationsResponses, PostApiV1PermissionsData, PostApiV1PermissionsErrors, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersErrors, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesErrors, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesErrors, PostApiV1RolesResponses, PostApiV1SignalsSourceEventsData, PostApiV1SignalsSourceEventsErrors, PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsTriggerData, PostApiV1SignalsTriggerErrors, PostApiV1SignalsTriggerResponses, PostApiV1TasksByIdRunsData, PostApiV1TasksByIdRunsErrors, PostApiV1TasksByIdRunsResponses, PostApiV1TasksData, PostApiV1TasksErrors, PostApiV1TasksResponses, PostApiV1TextGenerationsData, PostApiV1TextGenerationsErrors, PostApiV1TextGenerationsResponses, PostApiV1TopicsData, PostApiV1TopicsErrors, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersErrors, PostApiV1UsersResponses, PostApiV1VideosGenerationsData, PostApiV1VideosGenerationsErrors, PostApiV1VideosGenerationsResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialData, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1PushTokensByDeviceIdData, PutApiV1PushTokensByDeviceIdErrors, PutApiV1PushTokensByDeviceIdResponses } from './types.gen';

const mergeMethodHeaders = (
    defaults: Record<string, unknown>,
    headers: Options['headers'],
): Record<string, unknown> => {
    const merged = { ...defaults };
    if (!headers) {
        return merged;
    }
    const entries = headers instanceof Headers ? [...headers.entries()] : Array.isArray(headers) ? headers : Object.entries(headers);
    for (const [key, value] of entries) {
        merged[key] = value;
    }
    return merged;
};

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
    /**
     * You can provide a client instance returned by `createClient()` instead of
     * individual options. This might be also useful if you want to implement a
     * custom client.
     */
    client?: Client;
    /**
     * You can pass arbitrary values through the `meta` object. This can be
     * used to access values that aren't defined as part of the SDK function.
     */
    meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
};

class HeyApiClient {
    protected client: Client;
    
    constructor(args?: {
        client?: Client;
    }) {
        this.client = args?.client ?? client;
    }
}

class HeyApiRegistry<T> {
    private readonly defaultKey = 'default';
    
    private readonly instances: Map<string, T> = new Map();
    
    get(key?: string): T {
        const instance = this.instances.get(key ?? this.defaultKey);
        if (!instance) {
            throw new Error(`No SDK client found. Create one with "new LobeHub()" to fix this error.`);
        }
        return instance;
    }
    
    set(value: T, key?: string): void {
        this.instances.set(key ?? this.defaultKey, value);
    }
}

export class Health extends HeyApiClient {
    /**
     * Health check
     */
    public check<ThrowOnError extends boolean = false>(options?: Options<GetApiV1HealthData, ThrowOnError>): RequestResult<GetApiV1HealthResponses, unknown, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1HealthResponses, unknown, ThrowOnError>({ url: '/api/v1/health', ...options });
    }
}

export class AgentGroups extends HeyApiClient {
    /**
     * List agent groups
     *
     * Paginated with `limit` + `cursor`; answers `{ items, total, hasMore, nextCursor }`. Clients that still expect the former bare array can pass the deprecated `format=array`, which returns every item as a plain array.
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentGroupsData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agent-groups',
            ...options
        });
    }
    
    /**
     * Create an agent group
     *
     * **API key scopes:** `agent:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentGroupsData, ThrowOnError>): RequestResult<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agent-groups',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete an agent group
     *
     * **API key scopes:** `agent:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agent-groups/{id}',
            ...options
        });
    }
    
    /**
     * Get an agent group
     *
     * **API key scopes:** `agent:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agent-groups/{id}',
            ...options
        });
    }
    
    /**
     * Update an agent group
     *
     * **API key scopes:** `agent:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agent-groups/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Agents extends HeyApiClient {
    /**
     * List agents
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentsData, ThrowOnError>): RequestResult<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents',
            ...options
        });
    }
    
    /**
     * Create an agent
     *
     * **API key scopes:** `agent:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsData, ThrowOnError>): RequestResult<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete an agent
     *
     * **API key scopes:** `agent:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}',
            ...options
        });
    }
    
    /**
     * Get an agent with its mounted files and knowledge bases
     *
     * **API key scopes:** `agent:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}',
            ...options
        });
    }
    
    /**
     * Update an agent
     *
     * **API key scopes:** `agent:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Duplicate an agent
     *
     * **API key scopes:** `agent:write`.
     */
    public createDuplicate<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsByIdDuplicateData, ThrowOnError>): RequestResult<PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsByIdDuplicateErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsByIdDuplicateErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/duplicate',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List an agent's accounts
     *
     * **API key scopes:** `agent:read`.
     */
    public listAccounts<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdAccountsData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdAccountsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdAccountsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts',
            ...options
        });
    }
    
    /**
     * Mount or provision an agent account
     *
     * **API key scopes:** `agent:write`.
     */
    public createAccount<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsByIdAccountsData, ThrowOnError>): RequestResult<PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdAccountsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdAccountsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Revoke an agent account
     *
     * Releases the account and marks it revoked. The row is kept for audit, so the response is the revoked account.
     *
     * **API key scopes:** `agent:write`.
     */
    public deleteAccount<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts/{accountId}',
            ...options
        });
    }
    
    /**
     * Get an agent account
     *
     * **API key scopes:** `agent:read`.
     */
    public getAccount<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts/{accountId}',
            ...options
        });
    }
    
    /**
     * Update an agent account
     *
     * **API key scopes:** `agent:write`.
     */
    public updateAccount<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts/{accountId}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Write an agent account credential
     *
     * Write-only: the response carries the non-secret hint and `hasCredential`, never the secret.
     *
     * **API key scopes:** `agent:credential:write` + `agent:write`.
     */
    public updateAccountCredential<ThrowOnError extends boolean = false>(options: Options<PutApiV1AgentsByIdAccountsByAccountIdCredentialData, ThrowOnError>): RequestResult<PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, ThrowOnError> {
        return (options.client ?? this.client).put<PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/agents/{id}/accounts/{accountId}/credential',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class ApiKeys extends HeyApiClient {
    /**
     * List API keys
     *
     * Paginated with `limit` + `cursor`; answers `{ items, total, hasMore, nextCursor }`. Clients that still expect the former bare array can pass the deprecated `format=array`, which returns every item as a plain array.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ApiKeysData, ThrowOnError>): RequestResult<GetApiV1ApiKeysResponses, GetApiV1ApiKeysErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1ApiKeysResponses, GetApiV1ApiKeysErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/api-keys',
            ...options
        });
    }
    
    /**
     * Create an API key
     *
     * The plaintext key is returned only in this response.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ApiKeysData, ThrowOnError>): RequestResult<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/api-keys',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete an API key
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/api-keys/{id}',
            ...options
        });
    }
    
    /**
     * Get an API key
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/api-keys/{id}',
            ...options
        });
    }
    
    /**
     * Update an API key
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/api-keys/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Audio extends HeyApiClient {
    /**
     * Create speech
     *
     * OpenAI-compatible text-to-speech. Point an OpenAI SDK at `/api/v1` and call `audio.speech.create`. `model` takes `provider/model` (for example `lobehub/speech-2.8-hd`) or a bare model id; the optional `provider` and `params` (emotion, pitch, volume, sampleRate) are LobeHub extensions. Returns the audio bytes; usage is reported in `X-LobeHub-*` headers. API keys need the `generation:write` scope (keys issued with `model:invoke` are also accepted). Synthesis errors use OpenAI's `{ error: { message, type, code, param } }` body; authentication and permission errors use the platform `ApiError` envelope.
     *
     * **API key scopes:** `generation:write`.
     */
    public createSpeech<ThrowOnError extends boolean = false>(options: Options<PostApiV1AudioSpeechData, ThrowOnError>): RequestResult<PostApiV1AudioSpeechResponses, PostApiV1AudioSpeechErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AudioSpeechResponses, PostApiV1AudioSpeechErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/audio/speech',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Create a transcription
     *
     * OpenAI-compatible speech-to-text: upload the audio as multipart/form-data and get `{ text }` back, so an OpenAI SDK pointed at `/api/v1` can call `audio.transcriptions.create`. Send the clip as `file` (up to 3 MB), or the id of an uploaded file as `fileId` (the key then also needs `file:read`). `provider` (default `openai`) is a LobeHub extension. Billing follows the provider configuration, like the in-app voice input. The transcript is always returned as JSON `{ text }`, whatever `response_format` asks of the provider.
     *
     * **API key scopes:** `generation:write`.
     */
    public createTranscription<ThrowOnError extends boolean = false>(options: Options<PostApiV1AudioTranscriptionsData, ThrowOnError>): RequestResult<PostApiV1AudioTranscriptionsResponses, PostApiV1AudioTranscriptionsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1AudioTranscriptionsResponses, PostApiV1AudioTranscriptionsErrors, ThrowOnError>({
            ...formDataBodySerializer,
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/audio/transcriptions',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': null }, options.headers)
        });
    }
}

export class Chat extends HeyApiClient {
    /**
     * Run a non-streaming chat completion
     *
     * **API key scopes:** `model:invoke`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatData, ThrowOnError>): RequestResult<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Translate text
     *
     * **API key scopes:** `model:invoke`.
     */
    public createTranslate<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatTranslateData, ThrowOnError>): RequestResult<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat/translate',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Generate a reply to a message
     *
     * **API key scopes:** `model:invoke`.
     */
    public createGenerateReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGenerateReplyData, ThrowOnError>): RequestResult<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat/generate-reply',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class ChatGroups extends HeyApiClient {
    /**
     * List chat groups
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ChatGroupsData, ThrowOnError>): RequestResult<GetApiV1ChatGroupsResponses, GetApiV1ChatGroupsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1ChatGroupsResponses, GetApiV1ChatGroupsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups',
            ...options
        });
    }
    
    /**
     * Create a chat group with its supervisor and members
     *
     * **API key scopes:** `agent:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGroupsData, ThrowOnError>): RequestResult<PostApiV1ChatGroupsResponses, PostApiV1ChatGroupsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ChatGroupsResponses, PostApiV1ChatGroupsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a chat group
     *
     * **API key scopes:** `agent:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1ChatGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1ChatGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups/{id}',
            ...options
        });
    }
    
    /**
     * Get a chat group
     *
     * **API key scopes:** `agent:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups/{id}',
            ...options
        });
    }
    
    /**
     * Update a chat group
     *
     * **API key scopes:** `agent:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1ChatGroupsByIdResponses, PatchApiV1ChatGroupsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1ChatGroupsByIdResponses, PatchApiV1ChatGroupsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Remove members from a chat group
     *
     * Detaches the agents and answers with the updated group.
     *
     * **API key scopes:** `agent:write`.
     */
    public removeMembers<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ChatGroupsByIdMembersData, ThrowOnError>): RequestResult<DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdMembersErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdMembersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups/{id}/members',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Add members to a chat group
     *
     * **API key scopes:** `agent:write`.
     */
    public addMembers<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGroupsByIdMembersData, ThrowOnError>): RequestResult<PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsByIdMembersErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsByIdMembersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/chat-groups/{id}/members',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Documents extends HeyApiClient {
    /**
     * List documents
     *
     * **API key scopes:** `knowledge:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1DocumentsData, ThrowOnError>): RequestResult<GetApiV1DocumentsResponses, GetApiV1DocumentsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1DocumentsResponses, GetApiV1DocumentsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/documents',
            ...options
        });
    }
    
    /**
     * Create a document
     *
     * Creates a page from Markdown or Lexical `editorData`, or a folder with `fileType: "custom/folder"`.
     *
     * **API key scopes:** `knowledge:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1DocumentsData, ThrowOnError>): RequestResult<PostApiV1DocumentsResponses, PostApiV1DocumentsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1DocumentsResponses, PostApiV1DocumentsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/documents',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Get a document
     *
     * Returns the Markdown `content` and the Lexical `editorData` of the body.
     *
     * **API key scopes:** `knowledge:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1DocumentsByIdData, ThrowOnError>): RequestResult<GetApiV1DocumentsByIdResponses, GetApiV1DocumentsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1DocumentsByIdResponses, GetApiV1DocumentsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/documents/{id}',
            ...options
        });
    }
    
    /**
     * Update a document
     *
     * Replaces the title and/or the whole body, sent as Markdown `content` or Lexical `editorData`. A page open in the editor receives the write through its live room. Send `ifUpdatedAt` to get 409 instead of overwriting an edit made since the client last read the page; a page someone else is editing also answers 409.
     *
     * **API key scopes:** `knowledge:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1DocumentsByIdData, ThrowOnError>): RequestResult<PatchApiV1DocumentsByIdResponses, PatchApiV1DocumentsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1DocumentsByIdResponses, PatchApiV1DocumentsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/documents/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Eval extends HeyApiClient {
    /**
     * List eval runs
     *
     * **API key scopes:** `eval:read`.
     */
    public listRuns<ThrowOnError extends boolean = false>(options?: Options<GetApiV1EvalRunsData, ThrowOnError>): RequestResult<GetApiV1EvalRunsResponses, GetApiV1EvalRunsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1EvalRunsResponses, GetApiV1EvalRunsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs',
            ...options
        });
    }
    
    /**
     * Create an eval run
     *
     * Queues an asynchronous QStash-backed evaluation run and returns immediately.
     *
     * **API key scopes:** `eval:write`.
     */
    public createRuns<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalRunsData, ThrowOnError>): RequestResult<PostApiV1EvalRunsResponses, PostApiV1EvalRunsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalRunsResponses, PostApiV1EvalRunsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List topic results of an eval run
     *
     * **API key scopes:** `eval:read`.
     */
    public listRunsTopics<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdTopicsData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsByIdTopicsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsByIdTopicsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/topics',
            ...options
        });
    }
    
    /**
     * Get an eval run
     *
     * **API key scopes:** `eval:read`.
     */
    public getRuns<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}',
            ...options
        });
    }
    
    /**
     * List case results of an eval run
     *
     * **API key scopes:** `eval:read`.
     */
    public listRunsResults<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdResultsData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/results',
            ...options
        });
    }
    
    /**
     * Report results for a batch of run topics
     *
     * Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
     *
     * **API key scopes:** `eval:write`.
     */
    public createRunsResults<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalRunsByIdResultsData, ThrowOnError>): RequestResult<PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdResultsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdResultsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/results',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List benchmarks
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public listBenchmarks<ThrowOnError extends boolean = false>(options?: Options<GetApiV1EvalBenchmarksData, ThrowOnError>): RequestResult<GetApiV1EvalBenchmarksResponses, GetApiV1EvalBenchmarksErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1EvalBenchmarksResponses, GetApiV1EvalBenchmarksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/benchmarks',
            ...options
        });
    }
    
    /**
     * Create a benchmark
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public createBenchmarks<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalBenchmarksData, ThrowOnError>): RequestResult<PostApiV1EvalBenchmarksResponses, PostApiV1EvalBenchmarksErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalBenchmarksResponses, PostApiV1EvalBenchmarksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/benchmarks',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a benchmark
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public deleteBenchmarks<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1EvalBenchmarksByIdData, ThrowOnError>): RequestResult<DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalBenchmarksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalBenchmarksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/benchmarks/{id}',
            ...options
        });
    }
    
    /**
     * Get a benchmark
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public getBenchmarks<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalBenchmarksByIdData, ThrowOnError>): RequestResult<GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/benchmarks/{id}',
            ...options
        });
    }
    
    /**
     * Update a benchmark
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public updateBenchmarks<ThrowOnError extends boolean = false>(options: Options<PatchApiV1EvalBenchmarksByIdData, ThrowOnError>): RequestResult<PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalBenchmarksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalBenchmarksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/benchmarks/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List datasets
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public listDatasets<ThrowOnError extends boolean = false>(options?: Options<GetApiV1EvalDatasetsData, ThrowOnError>): RequestResult<GetApiV1EvalDatasetsResponses, GetApiV1EvalDatasetsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1EvalDatasetsResponses, GetApiV1EvalDatasetsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets',
            ...options
        });
    }
    
    /**
     * Create a dataset
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public createDatasets<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalDatasetsData, ThrowOnError>): RequestResult<PostApiV1EvalDatasetsResponses, PostApiV1EvalDatasetsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalDatasetsResponses, PostApiV1EvalDatasetsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a dataset
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public deleteDatasets<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1EvalDatasetsByIdData, ThrowOnError>): RequestResult<DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalDatasetsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalDatasetsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets/{id}',
            ...options
        });
    }
    
    /**
     * Get a dataset
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public getDatasets<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalDatasetsByIdData, ThrowOnError>): RequestResult<GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets/{id}',
            ...options
        });
    }
    
    /**
     * Update a dataset
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public updateDatasets<ThrowOnError extends boolean = false>(options: Options<PatchApiV1EvalDatasetsByIdData, ThrowOnError>): RequestResult<PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalDatasetsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalDatasetsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List test cases of a dataset
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public listDatasetsTestCases<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalDatasetsByDatasetIdTestCasesData, ThrowOnError>): RequestResult<GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets/{datasetId}/test-cases',
            ...options
        });
    }
    
    /**
     * Create a test case
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public createDatasetsTestCases<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalDatasetsByDatasetIdTestCasesData, ThrowOnError>): RequestResult<PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/datasets/{datasetId}/test-cases',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a test case
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public deleteTestCases<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1EvalTestCasesByIdData, ThrowOnError>): RequestResult<DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1EvalTestCasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1EvalTestCasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/test-cases/{id}',
            ...options
        });
    }
    
    /**
     * Get a test case
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:read`.
     */
    public getTestCases<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalTestCasesByIdData, ThrowOnError>): RequestResult<GetApiV1EvalTestCasesByIdResponses, GetApiV1EvalTestCasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1EvalTestCasesByIdResponses, GetApiV1EvalTestCasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/test-cases/{id}',
            ...options
        });
    }
    
    /**
     * Update a test case
     *
     * Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
     *
     * **API key scopes:** `eval:write`.
     */
    public updateTestCases<ThrowOnError extends boolean = false>(options: Options<PatchApiV1EvalTestCasesByIdData, ThrowOnError>): RequestResult<PatchApiV1EvalTestCasesByIdResponses, PatchApiV1EvalTestCasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1EvalTestCasesByIdResponses, PatchApiV1EvalTestCasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/test-cases/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Claim a pending external eval run
     *
     * Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
     *
     * **API key scopes:** `eval:write`.
     */
    public createRunsClaim<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalRunsByIdClaimData, ThrowOnError>): RequestResult<PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdClaimErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdClaimErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/claim',
            ...options
        });
    }
    
    /**
     * Set the status of an external eval run
     *
     * Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
     *
     * **API key scopes:** `eval:write`.
     */
    public updateRunsStatus<ThrowOnError extends boolean = false>(options: Options<PatchApiV1EvalRunsByIdStatusData, ThrowOnError>): RequestResult<PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalRunsByIdStatusErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalRunsByIdStatusErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/status',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Retry the errored cases of an eval run
     *
     * Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
     *
     * **API key scopes:** `eval:write`.
     */
    public createRunsRetryErrors<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalRunsByIdRetryErrorsData, ThrowOnError>): RequestResult<PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsByIdRetryErrorsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsByIdRetryErrorsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{id}/retry-errors',
            ...options
        });
    }
    
    /**
     * Report the result of one run topic
     *
     * Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
     *
     * **API key scopes:** `eval:write`.
     */
    public updateRunsTopicsResult<ThrowOnError extends boolean = false>(options: Options<PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, ThrowOnError>): RequestResult<PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, ThrowOnError> {
        return (options.client ?? this.client).put<PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/eval/runs/{runId}/topics/{topicId}/result',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Plugins extends HeyApiClient {
    /**
     * List installed plugins in the current workspace or personal scope
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PluginsData, ThrowOnError>): RequestResult<GetApiV1PluginsResponses, GetApiV1PluginsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1PluginsResponses, GetApiV1PluginsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/plugins',
            ...options
        });
    }
}

export class Files extends HeyApiClient {
    /**
     * List files
     *
     * **API key scopes:** `file:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1FilesData, ThrowOnError>): RequestResult<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files',
            ...options
        });
    }
    
    /**
     * Upload a file and return the corresponding file record
     *
     * **API key scopes:** `file:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesData, ThrowOnError>): RequestResult<PostApiV1FilesResponses, PostApiV1FilesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1FilesResponses, PostApiV1FilesErrors, ThrowOnError>({
            ...formDataBodySerializer,
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': null }, options.headers)
        });
    }
    
    /**
     * Delete a file
     *
     * **API key scopes:** `file:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1FilesByIdData, ThrowOnError>): RequestResult<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}',
            ...options
        });
    }
    
    /**
     * Get a file
     *
     * Non-image files include their parse result. A file that does not exist answers 400.
     *
     * **API key scopes:** `file:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdData, ThrowOnError>): RequestResult<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}',
            ...options
        });
    }
    
    /**
     * Update a file
     *
     * **API key scopes:** `file:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1FilesByIdData, ThrowOnError>): RequestResult<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Get a pre-signed file URL
     *
     * **API key scopes:** `file:read`.
     */
    public getUrl<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdUrlData, ThrowOnError>): RequestResult<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}/url',
            ...options
        });
    }
    
    /**
     * Parse file content
     *
     * **API key scopes:** `file:write`.
     */
    public parse<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdParsesData, ThrowOnError>): RequestResult<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}/parses',
            ...options
        });
    }
    
    /**
     * Get file chunking status
     *
     * **API key scopes:** `file:read`.
     */
    public listChunks<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}/chunks',
            ...options
        });
    }
    
    /**
     * Start a file chunking task
     *
     * **API key scopes:** `file:write`.
     */
    public createChunks<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/{id}/chunks',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Batch file upload
     *
     * **API key scopes:** `file:write`.
     */
    public uploadBatch<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesBatchesData, ThrowOnError>): RequestResult<PostApiV1FilesBatchesResponses, PostApiV1FilesBatchesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1FilesBatchesResponses, PostApiV1FilesBatchesErrors, ThrowOnError>({
            ...formDataBodySerializer,
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/batches',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': null }, options.headers)
        });
    }
    
    /**
     * Get several files
     *
     * **API key scopes:** `file:read`.
     */
    public query<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesQueriesData, ThrowOnError>): RequestResult<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/files/queries',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Goals extends HeyApiClient {
    /**
     * List goals
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1GoalsData, ThrowOnError>): RequestResult<GetApiV1GoalsResponses, GetApiV1GoalsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1GoalsResponses, GetApiV1GoalsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals',
            ...options
        });
    }
    
    /**
     * Create a goal
     *
     * Creates the goal graph and hands it to the coordinator.
     *
     * **API key scopes:** `agent:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsData, ThrowOnError>): RequestResult<PostApiV1GoalsResponses, PostApiV1GoalsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1GoalsResponses, PostApiV1GoalsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a goal
     *
     * **API key scopes:** `agent:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1GoalsByIdData, ThrowOnError>): RequestResult<DeleteApiV1GoalsByIdResponses, DeleteApiV1GoalsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1GoalsByIdResponses, DeleteApiV1GoalsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}',
            ...options
        });
    }
    
    /**
     * Get a goal and its graph
     *
     * **API key scopes:** `agent:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1GoalsByIdData, ThrowOnError>): RequestResult<GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}',
            ...options
        });
    }
    
    /**
     * Update a goal requirement or budget
     *
     * **API key scopes:** `agent:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1GoalsByIdData, ThrowOnError>): RequestResult<PatchApiV1GoalsByIdResponses, PatchApiV1GoalsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1GoalsByIdResponses, PatchApiV1GoalsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Get goal supervision state
     *
     * **API key scopes:** `agent:read`.
     */
    public getSupervision<ThrowOnError extends boolean = false>(options: Options<GetApiV1GoalsByIdSupervisionData, ThrowOnError>): RequestResult<GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsByIdSupervisionErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsByIdSupervisionErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}/supervision',
            ...options
        });
    }
    
    /**
     * Run the goal coordinator now
     *
     * **API key scopes:** `agent:write`.
     */
    public advance<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdAdvanceData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdAdvanceErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdAdvanceErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}/advance',
            ...options
        });
    }
    
    /**
     * Pause a goal
     *
     * **API key scopes:** `agent:write`.
     */
    public pause<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdPauseData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdPauseErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdPauseErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}/pause',
            ...options
        });
    }
    
    /**
     * Resume a paused goal
     *
     * **API key scopes:** `agent:write`.
     */
    public resume<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdResumeData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsByIdResumeErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsByIdResumeErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}/resume',
            ...options
        });
    }
    
    /**
     * Restart every unfinished task of a goal
     *
     * **API key scopes:** `agent:write`.
     */
    public restart<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdRestartData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdRestartErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdRestartErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/goals/{id}/restart',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Im extends HeyApiClient {
    /**
     * Send a message to an agent; the reply arrives asynchronously via sync
     *
     * **API key scopes:** `agent:write` + `chat:write` + `model:invoke`.
     */
    public send<ThrowOnError extends boolean = false>(options: Options<PostApiV1ImMessagesData, ThrowOnError>): RequestResult<PostApiV1ImMessagesResponses, PostApiV1ImMessagesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ImMessagesResponses, PostApiV1ImMessagesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/im/messages',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Long-poll a conversation for whole new messages, typing and read receipts
     *
     * **API key scopes:** `chat:read`.
     */
    public sync<ThrowOnError extends boolean = false>(options: Options<GetApiV1ImTopicsByTopicIdSyncData, ThrowOnError>): RequestResult<GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1ImTopicsByTopicIdSyncErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1ImTopicsByTopicIdSyncErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/im/topics/{topicId}/sync',
            ...options
        });
    }
    
    /**
     * Mark the agent's messages read up to a message
     *
     * **API key scopes:** `chat:write`.
     */
    public markRead<ThrowOnError extends boolean = false>(options: Options<PostApiV1ImTopicsByTopicIdReadData, ThrowOnError>): RequestResult<PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1ImTopicsByTopicIdReadErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1ImTopicsByTopicIdReadErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/im/topics/{topicId}/read',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class KnowledgeBases extends HeyApiClient {
    /**
     * List knowledge bases
     *
     * **API key scopes:** `knowledge:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases',
            ...options
        });
    }
    
    /**
     * Create a knowledge base
     *
     * **API key scopes:** `knowledge:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a knowledge base
     *
     * Also deletes the files that belong to no other knowledge base.
     *
     * **API key scopes:** `knowledge:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}',
            ...options
        });
    }
    
    /**
     * Get a knowledge base
     *
     * **API key scopes:** `knowledge:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}',
            ...options
        });
    }
    
    /**
     * Update a knowledge base
     *
     * **API key scopes:** `knowledge:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List the files of a knowledge base
     *
     * **API key scopes:** `knowledge:read`.
     */
    public listFiles<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdFilesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}/files',
            ...options
        });
    }
    
    /**
     * Remove files from a knowledge base
     *
     * Detaches the files from the knowledge base without deleting them, and reports per file which ones were detached.
     *
     * **API key scopes:** `knowledge:write`.
     */
    public removeFiles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}/files/batch',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Add files to a knowledge base
     *
     * **API key scopes:** `knowledge:write`.
     */
    public addFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}/files/batch',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Move files to another knowledge base
     *
     * **API key scopes:** `knowledge:write`.
     */
    public moveFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesMoveData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/knowledge-bases/{id}/files/move',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class McpServers extends HeyApiClient {
    /**
     * List remote MCP servers
     *
     * Paginated with `limit` + `cursor`; answers `{ items, total, hasMore, nextCursor }`. Clients that still expect the former bare array can pass the deprecated `format=array`, which returns every item as a plain array.
     *
     * **API key scopes:** `mcp:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1McpServersData, ThrowOnError>): RequestResult<GetApiV1McpServersResponses, GetApiV1McpServersErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1McpServersResponses, GetApiV1McpServersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers',
            ...options
        });
    }
    
    /**
     * Add a remote MCP server
     *
     * **API key scopes:** `mcp:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1McpServersData, ThrowOnError>): RequestResult<PostApiV1McpServersResponses, PostApiV1McpServersErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1McpServersResponses, PostApiV1McpServersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a remote MCP server
     *
     * **API key scopes:** `mcp:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1McpServersByIdData, ThrowOnError>): RequestResult<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers/{id}',
            ...options
        });
    }
    
    /**
     * Get a remote MCP server
     *
     * **API key scopes:** `mcp:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1McpServersByIdData, ThrowOnError>): RequestResult<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers/{id}',
            ...options
        });
    }
    
    /**
     * Update a remote MCP server
     *
     * Changing `serverUrl` or `credentials` resets the status to `disconnected`.
     *
     * **API key scopes:** `mcp:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1McpServersByIdData, ThrowOnError>): RequestResult<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Discover and sync MCP tools
     *
     * **API key scopes:** `mcp:write`.
     */
    public createSync<ThrowOnError extends boolean = false>(options: Options<PostApiV1McpServersByIdSyncData, ThrowOnError>): RequestResult<PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersByIdSyncErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersByIdSyncErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/mcp-servers/{id}/sync',
            ...options
        });
    }
}

export class Memories extends HeyApiClient {
    /**
     * Get the current persona document
     *
     * `data` is null until a persona has been written.
     *
     * **API key scopes:** `user:read`.
     */
    public getPersona<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MemoriesPersonaData, ThrowOnError>): RequestResult<GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/memories/persona',
            ...options
        });
    }
    
    /**
     * List persona document versions
     *
     * **API key scopes:** `user:read`.
     */
    public listPersonaVersions<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MemoriesPersonaVersionsData, ThrowOnError>): RequestResult<GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MemoriesPersonaVersionsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MemoriesPersonaVersionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/memories/persona/versions',
            ...options
        });
    }
    
    /**
     * Delete all memory entries
     *
     * Removes every memory, the persona and the per-topic extraction status; `count` is the number of memories removed.
     *
     * **API key scopes:** `user:write`.
     */
    public deleteAll<ThrowOnError extends boolean = false>(options?: Options<DeleteApiV1MemoriesData, ThrowOnError>): RequestResult<DeleteApiV1MemoriesResponses, DeleteApiV1MemoriesErrors, ThrowOnError> {
        return (options?.client ?? this.client).delete<DeleteApiV1MemoriesResponses, DeleteApiV1MemoriesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/memories',
            ...options
        });
    }
    
    /**
     * Delete a memory entry
     *
     * **API key scopes:** `user:write`.
     */
    public deleteEntry<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MemoriesByCategoryByIdData, ThrowOnError>): RequestResult<DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesByCategoryByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesByCategoryByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/memories/{category}/{id}',
            ...options
        });
    }
    
    /**
     * List the entries of a memory category
     *
     * Every identity, or the newest entries of the other categories; the array shape follows `category`.
     *
     * **API key scopes:** `user:read`.
     */
    public listCategory<ThrowOnError extends boolean = false>(options: Options<GetApiV1MemoriesByCategoryData, ThrowOnError>): RequestResult<GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesByCategoryErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesByCategoryErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/memories/{category}',
            ...options
        });
    }
}

export class MessageTranslations extends HeyApiClient {
    /**
     * Delete a message's translation
     *
     * `id` is the id of the message whose translation was removed.
     *
     * **API key scopes:** `chat:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/message-translations/{messageId}',
            ...options
        });
    }
    
    /**
     * Get a message's translation
     *
     * `null` when the message has no stored translation.
     *
     * **API key scopes:** `chat:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/message-translations/{messageId}',
            ...options
        });
    }
    
    /**
     * Set a message's translation
     *
     * **API key scopes:** `chat:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/message-translations/{messageId}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Translate a message
     *
     * **API key scopes:** `chat:write` + `model:invoke`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/message-translations/{messageId}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Messages extends HeyApiClient {
    /**
     * Count messages
     *
     * **API key scopes:** `chat:read`.
     */
    public getCount<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesCountData, ThrowOnError>): RequestResult<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages/count',
            ...options
        });
    }
    
    /**
     * Delete messages in batch
     *
     * Best effort: ids the caller may not delete or that no longer exist are skipped. `count` is the number of messages actually removed.
     *
     * **API key scopes:** `chat:write`.
     */
    public deleteMany<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesData, ThrowOnError>): RequestResult<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List messages
     *
     * **API key scopes:** `chat:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesData, ThrowOnError>): RequestResult<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages',
            ...options
        });
    }
    
    /**
     * Create a message
     *
     * **API key scopes:** `chat:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesData, ThrowOnError>): RequestResult<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a message
     *
     * **API key scopes:** `chat:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesByIdData, ThrowOnError>): RequestResult<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages/{id}',
            ...options
        });
    }
    
    /**
     * Get a message
     *
     * **API key scopes:** `chat:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessagesByIdData, ThrowOnError>): RequestResult<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages/{id}',
            ...options
        });
    }
    
    /**
     * Create a user message and generate an AI reply
     *
     * Stores the user message, then generates and stores the assistant reply. Answers with the reply; `null` only if it could not be read back.
     *
     * **API key scopes:** `chat:write` + `model:invoke`.
     */
    public createReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesRepliesData, ThrowOnError>): RequestResult<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/messages/replies',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Models extends HeyApiClient {
    /**
     * List models
     *
     * **API key scopes:** `model:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ModelsData, ThrowOnError>): RequestResult<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/models',
            ...options
        });
    }
    
    /**
     * Create a model
     *
     * **API key scopes:** `model:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ModelsData, ThrowOnError>): RequestResult<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/models',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Get a model
     *
     * **API key scopes:** `model:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/models/{providerId}/{modelId}',
            ...options
        });
    }
    
    /**
     * Update a model
     *
     * **API key scopes:** `model:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/models/{providerId}/{modelId}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Notifications extends HeyApiClient {
    /**
     * List notifications
     *
     * Unarchived notifications, newest first; pass the last `id` as `cursor` for the next page.
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1NotificationsData, ThrowOnError>): RequestResult<GetApiV1NotificationsResponses, GetApiV1NotificationsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1NotificationsResponses, GetApiV1NotificationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications',
            ...options
        });
    }
    
    /**
     * Get notification delivery settings
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public listSettings<ThrowOnError extends boolean = false>(options?: Options<GetApiV1NotificationsSettingsData, ThrowOnError>): RequestResult<GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsSettingsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsSettingsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/settings',
            ...options
        });
    }
    
    /**
     * Update notification delivery settings
     *
     * Answers with the merged settings now stored for the scope.
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public updateSettings<ThrowOnError extends boolean = false>(options: Options<PatchApiV1NotificationsSettingsData, ThrowOnError>): RequestResult<PatchApiV1NotificationsSettingsResponses, PatchApiV1NotificationsSettingsErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1NotificationsSettingsResponses, PatchApiV1NotificationsSettingsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/settings',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Get the unread notification count
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public getUnreadCount<ThrowOnError extends boolean = false>(options?: Options<GetApiV1NotificationsUnreadCountData, ThrowOnError>): RequestResult<GetApiV1NotificationsUnreadCountResponses, GetApiV1NotificationsUnreadCountErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1NotificationsUnreadCountResponses, GetApiV1NotificationsUnreadCountErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/unread-count',
            ...options
        });
    }
    
    /**
     * Get per-category notification counts
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public getCounts<ThrowOnError extends boolean = false>(options?: Options<GetApiV1NotificationsCountsData, ThrowOnError>): RequestResult<GetApiV1NotificationsCountsResponses, GetApiV1NotificationsCountsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1NotificationsCountsResponses, GetApiV1NotificationsCountsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/counts',
            ...options
        });
    }
    
    /**
     * Mark notifications as read
     *
     * **API key scopes:** `chat:write`.
     */
    public markRead<ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsReadData, ThrowOnError>): RequestResult<PostApiV1NotificationsReadResponses, PostApiV1NotificationsReadErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1NotificationsReadResponses, PostApiV1NotificationsReadErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/read',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Mark every notification as read
     *
     * **API key scopes:** `chat:write`.
     */
    public markAllRead<ThrowOnError extends boolean = false>(options?: Options<PostApiV1NotificationsReadAllData, ThrowOnError>): RequestResult<PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadAllErrors, ThrowOnError> {
        return (options?.client ?? this.client).post<PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadAllErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/read-all',
            ...options
        });
    }
    
    /**
     * Archive every notification
     *
     * **API key scopes:** `chat:write`.
     */
    public archiveAll<ThrowOnError extends boolean = false>(options?: Options<PostApiV1NotificationsArchiveAllData, ThrowOnError>): RequestResult<PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsArchiveAllErrors, ThrowOnError> {
        return (options?.client ?? this.client).post<PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsArchiveAllErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/archive-all',
            ...options
        });
    }
    
    /**
     * Archive a notification
     *
     * **API key scopes:** `chat:write`.
     */
    public archive<ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsByIdArchiveData, ThrowOnError>): RequestResult<PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsByIdArchiveErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsByIdArchiveErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/notifications/{id}/archive',
            ...options
        });
    }
}

export class Permissions extends HeyApiClient {
    /**
     * List permissions
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PermissionsData, ThrowOnError>): RequestResult<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/permissions',
            ...options
        });
    }
    
    /**
     * Create a permission
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1PermissionsData, ThrowOnError>): RequestResult<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/permissions',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a permission
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PermissionsByIdData, ThrowOnError>): RequestResult<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/permissions/{id}',
            ...options
        });
    }
    
    /**
     * Get a permission
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1PermissionsByIdData, ThrowOnError>): RequestResult<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/permissions/{id}',
            ...options
        });
    }
    
    /**
     * Update a permission
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1PermissionsByIdData, ThrowOnError>): RequestResult<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/permissions/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Providers extends HeyApiClient {
    /**
     * List providers
     *
     * **API key scopes:** `model:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ProvidersData, ThrowOnError>): RequestResult<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/providers',
            ...options
        });
    }
    
    /**
     * Create a provider
     *
     * **API key scopes:** `model:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ProvidersData, ThrowOnError>): RequestResult<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/providers',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a provider
     *
     * Also removes the models configured under the provider.
     *
     * **API key scopes:** `model:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ProvidersByIdData, ThrowOnError>): RequestResult<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/providers/{id}',
            ...options
        });
    }
    
    /**
     * Get a provider
     *
     * **API key scopes:** `model:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ProvidersByIdData, ThrowOnError>): RequestResult<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/providers/{id}',
            ...options
        });
    }
    
    /**
     * Update a provider
     *
     * **API key scopes:** `model:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ProvidersByIdData, ThrowOnError>): RequestResult<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/providers/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class PushTokens extends HeyApiClient {
    /**
     * Stop pushing to this device (sign-out)
     *
     * `id` is the device id. Idempotent: a stale `expoToken` removes nothing and leaves the rotated registration in place.
     *
     * **API key scopes:** `chat:read`.
     */
    public unregister<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PushTokensByDeviceIdData, ThrowOnError>): RequestResult<DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1PushTokensByDeviceIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1PushTokensByDeviceIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/push-tokens/{deviceId}',
            ...options
        });
    }
    
    /**
     * Register or rotate this device's push token
     *
     * **API key scopes:** `chat:read`.
     */
    public register<ThrowOnError extends boolean = false>(options: Options<PutApiV1PushTokensByDeviceIdData, ThrowOnError>): RequestResult<PutApiV1PushTokensByDeviceIdResponses, PutApiV1PushTokensByDeviceIdErrors, ThrowOnError> {
        return (options.client ?? this.client).put<PutApiV1PushTokensByDeviceIdResponses, PutApiV1PushTokensByDeviceIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/push-tokens/{deviceId}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Responses extends HeyApiClient {
    /**
     * Create a model response
     *
     * OpenResponses-compatible: `model` takes an agent id. Without `stream` the response object is the whole JSON body (no success envelope); a run that fails still answers 200 with `status: "failed"` and `error`. With `stream: true` the body is `text/event-stream`: each message is `event: <type>` plus `data: <ResponseStreamEvent JSON>`, and the final `response.completed` / `response.failed` / `response.incomplete` event carries the same response object.
     *
     * **API key scopes:** `agent:write` + `chat:write` + `model:invoke`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ResponsesData, ThrowOnError>): RequestResult<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/responses',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Roles extends HeyApiClient {
    /**
     * List roles
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1RolesData, ThrowOnError>): RequestResult<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles',
            ...options
        });
    }
    
    /**
     * Create a role
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1RolesData, ThrowOnError>): RequestResult<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a role
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}',
            ...options
        });
    }
    
    /**
     * Get a role
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdData, ThrowOnError>): RequestResult<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}',
            ...options
        });
    }
    
    /**
     * Update a role
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Clear a role's permissions
     *
     * `count` is the number of permission mappings removed.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public deletePermissions<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}/permissions',
            ...options
        });
    }
    
    /**
     * List a role's permissions
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public listPermissions<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}/permissions',
            ...options
        });
    }
    
    /**
     * Update a role's permissions
     *
     * Grants and revokes permissions by id; returns how many mappings changed.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public updatePermissions<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/roles/{id}/permissions',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Signals extends HeyApiClient {
    /**
     * Emit an agent signal source event
     *
     * **API key scopes:** `agent:write` + `model:invoke`.
     */
    public emit<ThrowOnError extends boolean = false>(options: Options<PostApiV1SignalsSourceEventsData, ThrowOnError>): RequestResult<PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsSourceEventsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsSourceEventsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/signals/source-events',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Trigger a synthesized agent signal source event
     *
     * **API key scopes:** `agent:write` + `model:invoke`.
     */
    public trigger<ThrowOnError extends boolean = false>(options: Options<PostApiV1SignalsTriggerData, ThrowOnError>): RequestResult<PostApiV1SignalsTriggerResponses, PostApiV1SignalsTriggerErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1SignalsTriggerResponses, PostApiV1SignalsTriggerErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/signals/trigger',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List agent signal receipts for a topic
     *
     * **API key scopes:** `agent:read`.
     */
    public listReceipts<ThrowOnError extends boolean = false>(options: Options<GetApiV1SignalsReceiptsData, ThrowOnError>): RequestResult<GetApiV1SignalsReceiptsResponses, GetApiV1SignalsReceiptsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1SignalsReceiptsResponses, GetApiV1SignalsReceiptsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/signals/receipts',
            ...options
        });
    }
}

export class Tasks extends HeyApiClient {
    /**
     * List tasks
     *
     * **API key scopes:** `agent:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TasksData, ThrowOnError>): RequestResult<GetApiV1TasksResponses, GetApiV1TasksErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1TasksResponses, GetApiV1TasksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks',
            ...options
        });
    }
    
    /**
     * Create a task
     *
     * **API key scopes:** `agent:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksData, ThrowOnError>): RequestResult<PostApiV1TasksResponses, PostApiV1TasksErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1TasksResponses, PostApiV1TasksErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a task
     *
     * **API key scopes:** `agent:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TasksByIdData, ThrowOnError>): RequestResult<DeleteApiV1TasksByIdResponses, DeleteApiV1TasksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1TasksByIdResponses, DeleteApiV1TasksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}',
            ...options
        });
    }
    
    /**
     * Get a task
     *
     * **API key scopes:** `agent:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdData, ThrowOnError>): RequestResult<GetApiV1TasksByIdResponses, GetApiV1TasksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1TasksByIdResponses, GetApiV1TasksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}',
            ...options
        });
    }
    
    /**
     * Update a task
     *
     * **API key scopes:** `agent:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TasksByIdData, ThrowOnError>): RequestResult<PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Change a task status
     *
     * **API key scopes:** `agent:write`.
     */
    public updateStatus<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TasksByIdStatusData, ThrowOnError>): RequestResult<PatchApiV1TasksByIdStatusResponses, PatchApiV1TasksByIdStatusErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1TasksByIdStatusResponses, PatchApiV1TasksByIdStatusErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}/status',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List past runs of a task
     *
     * **API key scopes:** `agent:read`.
     */
    public listRuns<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdRunsData, ThrowOnError>): RequestResult<GetApiV1TasksByIdRunsResponses, GetApiV1TasksByIdRunsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1TasksByIdRunsResponses, GetApiV1TasksByIdRunsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}/runs',
            ...options
        });
    }
    
    /**
     * Run a task now
     *
     * Starts the run and answers once the agent operation is accepted; follow it with `operationId`.
     *
     * **API key scopes:** `agent:write`.
     */
    public run<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksByIdRunsData, ThrowOnError>): RequestResult<PostApiV1TasksByIdRunsResponses, PostApiV1TasksByIdRunsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1TasksByIdRunsResponses, PostApiV1TasksByIdRunsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/tasks/{id}/runs',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Topics extends HeyApiClient {
    /**
     * List topics
     *
     * **API key scopes:** `chat:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TopicsData, ThrowOnError>): RequestResult<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics',
            ...options
        });
    }
    
    /**
     * Create a topic
     *
     * **API key scopes:** `chat:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TopicsData, ThrowOnError>): RequestResult<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a topic
     *
     * **API key scopes:** `chat:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TopicsByIdData, ThrowOnError>): RequestResult<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics/{id}',
            ...options
        });
    }
    
    /**
     * Get a topic
     *
     * **API key scopes:** `chat:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TopicsByIdData, ThrowOnError>): RequestResult<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics/{id}',
            ...options
        });
    }
    
    /**
     * Update a topic
     *
     * **API key scopes:** `chat:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TopicsByIdData, ThrowOnError>): RequestResult<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * List topic threads
     *
     * **API key scopes:** `chat:read`.
     */
    public listThreads<ThrowOnError extends boolean = false>(options: Options<GetApiV1TopicsByTopicIdThreadsData, ThrowOnError>): RequestResult<GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsByTopicIdThreadsErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsByTopicIdThreadsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/topics/{topicId}/threads',
            ...options
        });
    }
}

export class Users extends HeyApiClient {
    /**
     * Get current authenticated user
     *
     * Reachable by every authenticated caller. An API key without `user:read` receives only `{ id }`; `messageCount` is included only with `?includeCount=1` and `chat:read`.
     *
     * **API key scopes:** any API key (no scope needed).
     */
    public me<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersMeData, ThrowOnError>): RequestResult<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/me',
            ...options
        });
    }
    
    /**
     * List users
     *
     * **API key scopes:** `user:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersData, ThrowOnError>): RequestResult<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users',
            ...options
        });
    }
    
    /**
     * Create a user
     *
     * **API key scopes:** `user:write`.
     */
    public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1UsersData, ThrowOnError>): RequestResult<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Delete a user
     *
     * **API key scopes:** `user:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}',
            ...options
        });
    }
    
    /**
     * Get a user
     *
     * **API key scopes:** `user:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdData, ThrowOnError>): RequestResult<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}',
            ...options
        });
    }
    
    /**
     * Update a user
     *
     * **API key scopes:** `user:write`.
     */
    public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
    
    /**
     * Clear a user's roles
     *
     * `count` is the number of role assignments removed.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public deleteRoles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}/roles',
            ...options
        });
    }
    
    /**
     * List a user's roles
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public listRoles<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}/roles',
            ...options
        });
    }
    
    /**
     * Update a user's roles
     *
     * Adds and removes role assignments, then returns all of the user's roles.
     *
     * **API key scopes:** a full-access API key (`*`).
     */
    public updateRoles<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError> {
        return (options.client ?? this.client).patch<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/users/{id}/roles',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Usage extends HeyApiClient {
    /**
     * Get usage and quota summary
     *
     * **API key scopes:** `usage:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsageData, ThrowOnError>): RequestResult<GetApiV1UsageResponses, GetApiV1UsageErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1UsageResponses, GetApiV1UsageErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/usage',
            ...options
        });
    }
}

export class Generations extends HeyApiClient {
    /**
     * List generations
     *
     * Lists the image, video and music generations the caller can see, newest first. Filter by `type`; page with `cursor` / `limit`.
     *
     * **API key scopes:** `generation:read`.
     */
    public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1GenerationsData, ThrowOnError>): RequestResult<GetApiV1GenerationsResponses, GetApiV1GenerationsErrors, ThrowOnError> {
        return (options?.client ?? this.client).get<GetApiV1GenerationsResponses, GetApiV1GenerationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/generations',
            ...options
        });
    }
    
    /**
     * Delete a generation
     *
     * Deletes a generation record and its thumbnail. The library file it was saved as is kept. In a workspace only the creator or a workspace owner may delete it.
     *
     * **API key scopes:** `generation:write`.
     */
    public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1GenerationsByIdData, ThrowOnError>): RequestResult<DeleteApiV1GenerationsByIdResponses, DeleteApiV1GenerationsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).delete<DeleteApiV1GenerationsByIdResponses, DeleteApiV1GenerationsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/generations/{id}',
            ...options
        });
    }
    
    /**
     * Get a generation
     *
     * Reports one generation: its `status` (`pending`, `processing`, `success` or `error`), the asset URLs once it succeeded, or the failure reason. Poll until the status is `success` or `error` — the SDK does this in `generations.wait(id)`.
     *
     * **API key scopes:** `generation:read`.
     */
    public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1GenerationsByIdData, ThrowOnError>): RequestResult<GetApiV1GenerationsByIdResponses, GetApiV1GenerationsByIdErrors, ThrowOnError> {
        return (options.client ?? this.client).get<GetApiV1GenerationsByIdResponses, GetApiV1GenerationsByIdErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/generations/{id}',
            ...options
        });
    }
}

export class Images extends HeyApiClient {
    /**
     * Generate images
     *
     * Generates `n` images from a prompt with an image model (the account's default when `model` is omitted). Billing and quota follow the Image page. By default the request waits up to `waitTimeoutSeconds` and returns the finished images with their URLs; any still running come back with their current status — poll `GET /generations/{id}` or call `generations.wait(id)` in the SDK. With `wait: false` it answers as soon as the work is queued. Each request is added to `topicId`, or to a new generation topic. A request the plan or budget refuses (insufficient credits, plan limit) is recorded as generations that already failed: they come back with `status: 'error'` and the reason in `error`, as on the Image page.
     *
     * **API key scopes:** `generation:write`.
     */
    public generate<ThrowOnError extends boolean = false>(options: Options<PostApiV1ImagesGenerationsData, ThrowOnError>): RequestResult<PostApiV1ImagesGenerationsResponses, PostApiV1ImagesGenerationsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ImagesGenerationsResponses, PostApiV1ImagesGenerationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/images/generations',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Videos extends HeyApiClient {
    /**
     * Generate a video
     *
     * Starts a video generation and answers 202 with the generation id while it runs; videos take minutes. Poll `GET /generations/{id}` until the status is `success` or `error`, or call `generations.wait(id)` in the SDK. Billing and quota follow the Video page. Each request is added to `topicId`, or to a new generation topic. A request the plan or budget refuses (insufficient credits, plan limit) is recorded as a generation that already failed: it comes back with the status `error` and the reason in the `error` field.
     *
     * **API key scopes:** `generation:write`.
     */
    public generate<ThrowOnError extends boolean = false>(options: Options<PostApiV1VideosGenerationsData, ThrowOnError>): RequestResult<PostApiV1VideosGenerationsResponses, PostApiV1VideosGenerationsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1VideosGenerationsResponses, PostApiV1VideosGenerationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/videos/generations',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Text extends HeyApiClient {
    /**
     * Generate text
     *
     * Generates text with an LLM in a single completion — no tools, nothing stored as a conversation. Pass `prompt` (and optionally `system`), or a `messages` list. `model` + `provider` pick the model; omit both for the platform's default chat model. The answer is in `text`; a reasoning model's reasoning comes back separately in `reasoning`, never spliced into `text`. Provider failures answer 502 `upstream_error` with the provider's reason; budget and quota refusals keep their own status (402 / 429).
     *
     * **API key scopes:** `generation:write`.
     */
    public generate<ThrowOnError extends boolean = false>(options: Options<PostApiV1TextGenerationsData, ThrowOnError>): RequestResult<PostApiV1TextGenerationsResponses, PostApiV1TextGenerationsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1TextGenerationsResponses, PostApiV1TextGenerationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/text/generations',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class Objects extends HeyApiClient {
    /**
     * Generate a JSON object
     *
     * Generates a JSON object that matches `schema` (structured output, single completion) — the same path `lh generate json` uses. The root of `schema` must be `type: "object"`; `strict: true` asks providers that support it to enforce the schema exactly (every property required, `additionalProperties: false`). `model` + `provider` pick the model; omit both for the platform's default. A reply that is not a JSON object for the schema answers 422 `unprocessable_entity`; provider failures answer 502 `upstream_error`.
     *
     * **API key scopes:** `generation:write`.
     */
    public generate<ThrowOnError extends boolean = false>(options: Options<PostApiV1ObjectsGenerationsData, ThrowOnError>): RequestResult<PostApiV1ObjectsGenerationsResponses, PostApiV1ObjectsGenerationsErrors, ThrowOnError> {
        return (options.client ?? this.client).post<PostApiV1ObjectsGenerationsResponses, PostApiV1ObjectsGenerationsErrors, ThrowOnError>({
            security: [{ scheme: 'bearer', type: 'http' }],
            url: '/api/v1/objects/generations',
            ...options,
            headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
        });
    }
}

export class LobeHub extends HeyApiClient {
    public static readonly __registry: HeyApiRegistry<LobeHub> = new HeyApiRegistry<LobeHub>();
    
    constructor(args?: {
        client?: Client;
        key?: string;
    }) {
        super(args);
        LobeHub.__registry.set(this, args?.key);
    }
    
    private _health?: Health;
    get health(): Health {
        return this._health ??= new Health({ client: this.client });
    }
    
    private _agentGroups?: AgentGroups;
    get agentGroups(): AgentGroups {
        return this._agentGroups ??= new AgentGroups({ client: this.client });
    }
    
    private _agents?: Agents;
    get agents(): Agents {
        return this._agents ??= new Agents({ client: this.client });
    }
    
    private _apiKeys?: ApiKeys;
    get apiKeys(): ApiKeys {
        return this._apiKeys ??= new ApiKeys({ client: this.client });
    }
    
    private _audio?: Audio;
    get audio(): Audio {
        return this._audio ??= new Audio({ client: this.client });
    }
    
    private _chat?: Chat;
    get chat(): Chat {
        return this._chat ??= new Chat({ client: this.client });
    }
    
    private _chatGroups?: ChatGroups;
    get chatGroups(): ChatGroups {
        return this._chatGroups ??= new ChatGroups({ client: this.client });
    }
    
    private _documents?: Documents;
    get documents(): Documents {
        return this._documents ??= new Documents({ client: this.client });
    }
    
    private _eval?: Eval;
    get eval(): Eval {
        return this._eval ??= new Eval({ client: this.client });
    }
    
    private _plugins?: Plugins;
    get plugins(): Plugins {
        return this._plugins ??= new Plugins({ client: this.client });
    }
    
    private _files?: Files;
    get files(): Files {
        return this._files ??= new Files({ client: this.client });
    }
    
    private _goals?: Goals;
    get goals(): Goals {
        return this._goals ??= new Goals({ client: this.client });
    }
    
    private _im?: Im;
    get im(): Im {
        return this._im ??= new Im({ client: this.client });
    }
    
    private _knowledgeBases?: KnowledgeBases;
    get knowledgeBases(): KnowledgeBases {
        return this._knowledgeBases ??= new KnowledgeBases({ client: this.client });
    }
    
    private _mcpServers?: McpServers;
    get mcpServers(): McpServers {
        return this._mcpServers ??= new McpServers({ client: this.client });
    }
    
    private _memories?: Memories;
    get memories(): Memories {
        return this._memories ??= new Memories({ client: this.client });
    }
    
    private _messageTranslations?: MessageTranslations;
    get messageTranslations(): MessageTranslations {
        return this._messageTranslations ??= new MessageTranslations({ client: this.client });
    }
    
    private _messages?: Messages;
    get messages(): Messages {
        return this._messages ??= new Messages({ client: this.client });
    }
    
    private _models?: Models;
    get models(): Models {
        return this._models ??= new Models({ client: this.client });
    }
    
    private _notifications?: Notifications;
    get notifications(): Notifications {
        return this._notifications ??= new Notifications({ client: this.client });
    }
    
    private _permissions?: Permissions;
    get permissions(): Permissions {
        return this._permissions ??= new Permissions({ client: this.client });
    }
    
    private _providers?: Providers;
    get providers(): Providers {
        return this._providers ??= new Providers({ client: this.client });
    }
    
    private _pushTokens?: PushTokens;
    get pushTokens(): PushTokens {
        return this._pushTokens ??= new PushTokens({ client: this.client });
    }
    
    private _responses?: Responses;
    get responses(): Responses {
        return this._responses ??= new Responses({ client: this.client });
    }
    
    private _roles?: Roles;
    get roles(): Roles {
        return this._roles ??= new Roles({ client: this.client });
    }
    
    private _signals?: Signals;
    get signals(): Signals {
        return this._signals ??= new Signals({ client: this.client });
    }
    
    private _tasks?: Tasks;
    get tasks(): Tasks {
        return this._tasks ??= new Tasks({ client: this.client });
    }
    
    private _topics?: Topics;
    get topics(): Topics {
        return this._topics ??= new Topics({ client: this.client });
    }
    
    private _users?: Users;
    get users(): Users {
        return this._users ??= new Users({ client: this.client });
    }
    
    private _usage?: Usage;
    get usage(): Usage {
        return this._usage ??= new Usage({ client: this.client });
    }
    
    private _generations?: Generations;
    get generations(): Generations {
        return this._generations ??= new Generations({ client: this.client });
    }
    
    private _images?: Images;
    get images(): Images {
        return this._images ??= new Images({ client: this.client });
    }
    
    private _videos?: Videos;
    get videos(): Videos {
        return this._videos ??= new Videos({ client: this.client });
    }
    
    private _text?: Text;
    get text(): Text {
        return this._text ??= new Text({ client: this.client });
    }
    
    private _objects?: Objects;
    get objects(): Objects {
        return this._objects ??= new Objects({ client: this.client });
    }
}