import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper } from '../infrastructure'; import type { GitlabAPIResponse, MappedOmit, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; import type { SimpleUserSchema } from './Users'; import type { SimpleProjectSchema } from './Projects'; export type TodoAction = | 'assigned' | 'mentioned' | 'build_failed' | 'marked' | 'approval_required' | 'unmergeable' | 'directly_addressed' | 'merge_train_removed'; export type TodoType = | 'Issue' | 'MergeRequest' | 'Commit' | 'Epic' | 'DesignManagement::Design' | 'AlertManagement::Alert'; export type TodoState = 'pending' | 'done'; export interface TodoSchema extends Record { id: number; author: MappedOmit; project: Pick< SimpleProjectSchema, 'id' | 'name' | 'name_with_namespace' | 'path' | 'path_with_namespace' >; action_name: TodoAction; target_type: TodoType; target: Record; target_url: string; body: string; state: TodoState; created_at: string; updated_at: string; } export class TodoLists extends BaseResource { all( options?: { action?: TodoAction; authorId?: number; projectId?: string | number; groupId?: string | number; state?: TodoState; type?: TodoType; } & Sudo & ShowExpanded & PaginationRequestOptions

, ): Promise> { return RequestHelper.get()(this, 'todos', options); } done( options: { todoId: number } & Sudo & ShowExpanded, ): Promise>; done( options?: Sudo & ShowExpanded, ): Promise>; done({ todoId, ...options }: { todoId?: number } & Sudo & ShowExpanded = {}): Promise< GitlabAPIResponse > { let prefix = 'todos'; if (todoId) prefix += `/${todoId}`; return RequestHelper.post()( this, `${prefix}/mark_as_done`, options as Sudo & ShowExpanded, ); } }