import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { MilestoneSchema } from './ResourceMilestones' ; import { LabelSchema } from './ResourceLabels' ; import { BaseRequestOptions , endpoint , PaginatedRequestOptions , RequestHelper , Sudo , } from '../infrastructure' ; export interface IssueBoardListSchema extends Record < string , unknown > { id : number ; label : Pick < LabelSchema , 'name' | 'color' | 'description' > ; position : number ; max_issue_count : number ; max_issue_weight : number ; limit_metric ? : string ; } export interface IssueBoardSchema extends Record < string , unknown > { id : number ; name : string ; milestone : Pick < MilestoneSchema , 'id' | 'title' > ; lists ? : IssueBoardListSchema [ ] ; } export class ResourceIssueBoards < C extends boolean = false > extends BaseResource < C > { constructor ( resourceType , options ) { super ( { prefixUrl : resourceType , ... options } ) ; } all ( resourceId , options ? ) { return RequestHelper . get < IssueBoardSchema [ ] > ( ) ( this , endpoint `${ resourceId }/boards` , options ) ; } create ( resourceId , name , options ? ) { return RequestHelper . post < IssueBoardSchema > ( ) ( this , endpoint `${ resourceId }/boards` , { name , ... options , } ) ; } createList ( resourceId , boardId , labelId , options ? ) { return RequestHelper . post < IssueBoardListSchema > ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }/lists` , { labelId , ... options , } ) ; } edit ( resourceId , boardId , options ? ) { return RequestHelper . put ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }` , options ) ; } editList ( resourceId , boardId , listId , position , options ? ) { return RequestHelper . put < IssueBoardListSchema > ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }/lists/${ listId }` , { position , ... options , } ) ; } lists ( resourceId , boardId , options ? ) { return RequestHelper . get < IssueBoardListSchema [ ] > ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }/lists` , options ) ; } remove ( resourceId , boardId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }` , options ) ; } removeList ( resourceId , boardId , listId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }/lists/${ listId }` , options ) ; } show ( resourceId , boardId , options ? ) { return RequestHelper . get < IssueBoardSchema > ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }` , options ) ; } showList ( resourceId , boardId , listId , options ? ) { return RequestHelper . get < IssueBoardListSchema > ( ) ( this , endpoint `${ resourceId }/boards/${ boardId }/lists/${ listId }` , options ) ; } }