import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { UserSchema } from '../resources/Users' ; import { RequestHelper , PaginatedRequestOptions , BaseRequestOptions , Sudo , endpoint , } from '../infrastructure' ; export interface NoteSchema extends Record < string , unknown > { id : number ; body : string ; author : UserSchema ; created_at : string ; updated_at : string ; confidential : boolean ; } export class ResourceNotes < C extends boolean = false > extends BaseResource < C > { protected resource2Type : string ; constructor ( resourceType , resource2Type , options ) { super ( { prefixUrl : resourceType , ... options } ) ; this . resource2Type = resource2Type ; } all ( resourceId , resource2Id , options ? ) { return RequestHelper . get < NoteSchema [ ] > ( ) ( this , endpoint `${ resourceId }/${ this . resource2Type }/${ resource2Id }/notes` , options ) ; } create ( resourceId , resource2Id , body , options ? ) { return RequestHelper . post < NoteSchema > ( ) ( this , endpoint `${ resourceId }/${ this . resource2Type }/${ resource2Id }/notes` , { body , ... options , } ) ; } edit ( resourceId , resource2Id , noteId , body , options ? ) { return RequestHelper . put < NoteSchema > ( ) ( this , endpoint `${ resourceId }/${ this . resource2Type }/${ resource2Id }/notes/${ noteId }` , { body , ... options , } ) ; } remove ( resourceId , resource2Id , noteId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/${ this . resource2Type }/${ resource2Id }/notes/${ noteId }` , options ) ; } show ( resourceId , resource2Id , noteId , options ? ) { return RequestHelper . get < NoteSchema > ( ) ( this , endpoint `${ resourceId }/${ this . resource2Type }/${ resource2Id }/notes/${ noteId }` , options ) ; } }