// This file is auto-generated by @hey-api/openapi-ts

import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape } from './client';
import { client } from './client.gen';
import type { AcceptInviteData, AcceptInviteErrors, AcceptInviteResponses, ConnectMailboxData, ConnectMailboxErrors, ConnectMailboxResponses, CreateBoardGroupData, CreateBoardGroupResponses, CreateCalendarEventData, CreateCalendarEventResponses, CreateFocusSessionData, CreateFocusSessionResponses, CreateInviteData, CreateInviteErrors, CreateInviteResponses, CreateLabelData, CreateLabelResponses, CreateNoteData, CreateNoteResponses, CreateOutgoingMailData, CreateOutgoingMailErrors, CreateOutgoingMailResponses, CreateTaskData, CreateTaskFromMailData, CreateTaskFromMailErrors, CreateTaskFromMailResponses, CreateTaskResponses, DeleteTaskAttachmentData, DeleteTaskAttachmentErrors, DeleteTaskAttachmentResponses, DownloadTaskAttachmentData, DownloadTaskAttachmentErrors, DownloadTaskAttachmentResponses, GetHealthData, GetHealthErrors, GetHealthResponses, GetInviteByTokenData, GetInviteByTokenErrors, GetInviteByTokenResponses, GetMetricsData, GetMetricsErrors, GetMetricsPrometheusData, GetMetricsPrometheusErrors, GetMetricsPrometheusResponses, GetMetricsResponses, ListActivityData, ListActivityErrors, ListActivityResponses, ListBoardGroupsData, ListBoardGroupsResponses, ListCalendarEventsData, ListCalendarEventsResponses, ListFocusSessionsData, ListFocusSessionsResponses, ListInvitesData, ListInvitesResponses, ListLabelsData, ListLabelsResponses, ListMailboxesData, ListMailboxesResponses, ListMailMessagesData, ListMailMessagesResponses, ListMembersData, ListMembersResponses, ListNotesData, ListNotesResponses, ListOutgoingMailsData, ListOutgoingMailsResponses, ListTasksData, ListTasksResponses, ListWorkspacesData, ListWorkspacesResponses, RevokeInviteData, RevokeInviteErrors, RevokeInviteResponses, SyncMailboxData, SyncMailboxErrors, SyncMailboxResponses, UpdateBoardGroupData, UpdateBoardGroupResponses, UpdateCalendarEventData, UpdateCalendarEventResponses, UpdateFocusSessionData, UpdateFocusSessionResponses, UpdateMemberData, UpdateMemberErrors, UpdateMemberResponses, UpdateNoteData, UpdateNoteResponses, UpdateTaskData, UpdateTaskResponses, UploadTaskAttachmentData, UploadTaskAttachmentErrors, UploadTaskAttachmentResponses } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
    /**
     * 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?: Record<string, unknown>;
};

export const getHealth = <ThrowOnError extends boolean = false>(options?: Options<GetHealthData, ThrowOnError>) => (options?.client ?? client).get<GetHealthResponses, GetHealthErrors, ThrowOnError>({ url: '/v1/health', ...options });

export const getMetrics = <ThrowOnError extends boolean = false>(options?: Options<GetMetricsData, ThrowOnError>) => (options?.client ?? client).get<GetMetricsResponses, GetMetricsErrors, ThrowOnError>({ url: '/v1/metrics', ...options });

export const getMetricsPrometheus = <ThrowOnError extends boolean = false>(options?: Options<GetMetricsPrometheusData, ThrowOnError>) => (options?.client ?? client).get<GetMetricsPrometheusResponses, GetMetricsPrometheusErrors, ThrowOnError>({ url: '/v1/metrics/prometheus', ...options });

export const listWorkspaces = <ThrowOnError extends boolean = false>(options?: Options<ListWorkspacesData, ThrowOnError>) => (options?.client ?? client).get<ListWorkspacesResponses, unknown, ThrowOnError>({ url: '/v1/workspaces', ...options });

export const listMembers = <ThrowOnError extends boolean = false>(options: Options<ListMembersData, ThrowOnError>) => (options.client ?? client).get<ListMembersResponses, unknown, ThrowOnError>({ url: '/v1/members', ...options });

export const updateMember = <ThrowOnError extends boolean = false>(options: Options<UpdateMemberData, ThrowOnError>) => (options.client ?? client).patch<UpdateMemberResponses, UpdateMemberErrors, ThrowOnError>({
    url: '/v1/members/{memberId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listInvites = <ThrowOnError extends boolean = false>(options: Options<ListInvitesData, ThrowOnError>) => (options.client ?? client).get<ListInvitesResponses, unknown, ThrowOnError>({ url: '/v1/invites', ...options });

export const createInvite = <ThrowOnError extends boolean = false>(options: Options<CreateInviteData, ThrowOnError>) => (options.client ?? client).post<CreateInviteResponses, CreateInviteErrors, ThrowOnError>({
    url: '/v1/invites',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const getInviteByToken = <ThrowOnError extends boolean = false>(options: Options<GetInviteByTokenData, ThrowOnError>) => (options.client ?? client).get<GetInviteByTokenResponses, GetInviteByTokenErrors, ThrowOnError>({ url: '/v1/invites/{token}', ...options });

export const acceptInvite = <ThrowOnError extends boolean = false>(options: Options<AcceptInviteData, ThrowOnError>) => (options.client ?? client).post<AcceptInviteResponses, AcceptInviteErrors, ThrowOnError>({
    url: '/v1/invites/{token}/accept',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const revokeInvite = <ThrowOnError extends boolean = false>(options: Options<RevokeInviteData, ThrowOnError>) => (options.client ?? client).post<RevokeInviteResponses, RevokeInviteErrors, ThrowOnError>({ url: '/v1/invites/{inviteId}/revoke', ...options });

export const listActivity = <ThrowOnError extends boolean = false>(options: Options<ListActivityData, ThrowOnError>) => (options.client ?? client).get<ListActivityResponses, ListActivityErrors, ThrowOnError>({ url: '/v1/activity', ...options });

export const listBoardGroups = <ThrowOnError extends boolean = false>(options: Options<ListBoardGroupsData, ThrowOnError>) => (options.client ?? client).get<ListBoardGroupsResponses, unknown, ThrowOnError>({ url: '/v1/board-groups', ...options });

export const createBoardGroup = <ThrowOnError extends boolean = false>(options: Options<CreateBoardGroupData, ThrowOnError>) => (options.client ?? client).post<CreateBoardGroupResponses, unknown, ThrowOnError>({
    url: '/v1/board-groups',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const updateBoardGroup = <ThrowOnError extends boolean = false>(options: Options<UpdateBoardGroupData, ThrowOnError>) => (options.client ?? client).patch<UpdateBoardGroupResponses, unknown, ThrowOnError>({
    url: '/v1/board-groups/{groupId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listLabels = <ThrowOnError extends boolean = false>(options: Options<ListLabelsData, ThrowOnError>) => (options.client ?? client).get<ListLabelsResponses, unknown, ThrowOnError>({ url: '/v1/labels', ...options });

export const createLabel = <ThrowOnError extends boolean = false>(options: Options<CreateLabelData, ThrowOnError>) => (options.client ?? client).post<CreateLabelResponses, unknown, ThrowOnError>({
    url: '/v1/labels',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listTasks = <ThrowOnError extends boolean = false>(options: Options<ListTasksData, ThrowOnError>) => (options.client ?? client).get<ListTasksResponses, unknown, ThrowOnError>({ url: '/v1/tasks', ...options });

export const createTask = <ThrowOnError extends boolean = false>(options: Options<CreateTaskData, ThrowOnError>) => (options.client ?? client).post<CreateTaskResponses, unknown, ThrowOnError>({
    url: '/v1/tasks',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listCalendarEvents = <ThrowOnError extends boolean = false>(options: Options<ListCalendarEventsData, ThrowOnError>) => (options.client ?? client).get<ListCalendarEventsResponses, unknown, ThrowOnError>({ url: '/v1/calendar/events', ...options });

export const createCalendarEvent = <ThrowOnError extends boolean = false>(options: Options<CreateCalendarEventData, ThrowOnError>) => (options.client ?? client).post<CreateCalendarEventResponses, unknown, ThrowOnError>({
    url: '/v1/calendar/events',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const updateTask = <ThrowOnError extends boolean = false>(options: Options<UpdateTaskData, ThrowOnError>) => (options.client ?? client).patch<UpdateTaskResponses, unknown, ThrowOnError>({
    url: '/v1/tasks/{taskId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const uploadTaskAttachment = <ThrowOnError extends boolean = false>(options: Options<UploadTaskAttachmentData, ThrowOnError>) => (options.client ?? client).post<UploadTaskAttachmentResponses, UploadTaskAttachmentErrors, ThrowOnError>({
    ...formDataBodySerializer,
    url: '/v1/tasks/{taskId}/attachments',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

export const deleteTaskAttachment = <ThrowOnError extends boolean = false>(options: Options<DeleteTaskAttachmentData, ThrowOnError>) => (options.client ?? client).delete<DeleteTaskAttachmentResponses, DeleteTaskAttachmentErrors, ThrowOnError>({ url: '/v1/tasks/{taskId}/attachments/{attachmentId}', ...options });

export const downloadTaskAttachment = <ThrowOnError extends boolean = false>(options: Options<DownloadTaskAttachmentData, ThrowOnError>) => (options.client ?? client).get<DownloadTaskAttachmentResponses, DownloadTaskAttachmentErrors, ThrowOnError>({ url: '/v1/tasks/{taskId}/attachments/{attachmentId}/download', ...options });

export const updateCalendarEvent = <ThrowOnError extends boolean = false>(options: Options<UpdateCalendarEventData, ThrowOnError>) => (options.client ?? client).patch<UpdateCalendarEventResponses, unknown, ThrowOnError>({
    url: '/v1/calendar/events/{eventId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listNotes = <ThrowOnError extends boolean = false>(options: Options<ListNotesData, ThrowOnError>) => (options.client ?? client).get<ListNotesResponses, unknown, ThrowOnError>({ url: '/v1/notes', ...options });

export const createNote = <ThrowOnError extends boolean = false>(options: Options<CreateNoteData, ThrowOnError>) => (options.client ?? client).post<CreateNoteResponses, unknown, ThrowOnError>({
    url: '/v1/notes',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const updateNote = <ThrowOnError extends boolean = false>(options: Options<UpdateNoteData, ThrowOnError>) => (options.client ?? client).patch<UpdateNoteResponses, unknown, ThrowOnError>({
    url: '/v1/notes/{noteId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listFocusSessions = <ThrowOnError extends boolean = false>(options: Options<ListFocusSessionsData, ThrowOnError>) => (options.client ?? client).get<ListFocusSessionsResponses, unknown, ThrowOnError>({ url: '/v1/focus/sessions', ...options });

export const createFocusSession = <ThrowOnError extends boolean = false>(options: Options<CreateFocusSessionData, ThrowOnError>) => (options.client ?? client).post<CreateFocusSessionResponses, unknown, ThrowOnError>({
    url: '/v1/focus/sessions',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const updateFocusSession = <ThrowOnError extends boolean = false>(options: Options<UpdateFocusSessionData, ThrowOnError>) => (options.client ?? client).patch<UpdateFocusSessionResponses, unknown, ThrowOnError>({
    url: '/v1/focus/sessions/{sessionId}',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listMailboxes = <ThrowOnError extends boolean = false>(options: Options<ListMailboxesData, ThrowOnError>) => (options.client ?? client).get<ListMailboxesResponses, unknown, ThrowOnError>({ url: '/v1/mailboxes', ...options });

export const connectMailbox = <ThrowOnError extends boolean = false>(options: Options<ConnectMailboxData, ThrowOnError>) => (options.client ?? client).post<ConnectMailboxResponses, ConnectMailboxErrors, ThrowOnError>({
    url: '/v1/mailboxes',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const syncMailbox = <ThrowOnError extends boolean = false>(options: Options<SyncMailboxData, ThrowOnError>) => (options.client ?? client).post<SyncMailboxResponses, SyncMailboxErrors, ThrowOnError>({ url: '/v1/mailboxes/{mailboxId}/sync', ...options });

export const listMailMessages = <ThrowOnError extends boolean = false>(options: Options<ListMailMessagesData, ThrowOnError>) => (options.client ?? client).get<ListMailMessagesResponses, unknown, ThrowOnError>({ url: '/v1/mail/messages', ...options });

export const createTaskFromMail = <ThrowOnError extends boolean = false>(options: Options<CreateTaskFromMailData, ThrowOnError>) => (options.client ?? client).post<CreateTaskFromMailResponses, CreateTaskFromMailErrors, ThrowOnError>({
    url: '/v1/mail/messages/{messageId}/create-task',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

export const listOutgoingMails = <ThrowOnError extends boolean = false>(options: Options<ListOutgoingMailsData, ThrowOnError>) => (options.client ?? client).get<ListOutgoingMailsResponses, unknown, ThrowOnError>({ url: '/v1/mail/outgoing', ...options });

export const createOutgoingMail = <ThrowOnError extends boolean = false>(options: Options<CreateOutgoingMailData, ThrowOnError>) => (options.client ?? client).post<CreateOutgoingMailResponses, CreateOutgoingMailErrors, ThrowOnError>({
    url: '/v1/mail/outgoing',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});
