import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { UserSchema } from '../resources/Users' ; import { PaginatedRequestOptions , RequestHelper , Sudo } from '../infrastructure' ; export interface AwardEmojiSchema extends Record < string , unknown > { id : number ; name : string ; user : UserSchema ; created_at : string ; updated_at : string ; awardable_id : number ; awardable_type : string ; } export function url ( projectId , resourceType , resourceId , awardId ? , noteId ? ) { const [ pId , rId ] = [ projectId , resourceId ] . map ( encodeURIComponent ) ; const output = [ pId , resourceType , rId ] ; if ( noteId ) output . push ( 'notes' , encodeURIComponent ( noteId ) ) ; output . push ( 'award_emoji' ) ; if ( awardId ) output . push ( encodeURIComponent ( awardId ) ) ; return output . join ( '/' ) ; } export class ResourceAwardEmojis < C extends boolean = false > extends BaseResource < C > { protected resourceType : string ; constructor ( resourceType , options ) { super ( { prefixUrl : 'projects' , ... options } ) ; this . resourceType = resourceType ; } all ( projectId , resourceIId , options ? ) { return RequestHelper . get < AwardEmojiSchema [ ] > ( ) ( this , url ( projectId , this . resourceType , resourceIId ) , options ) ; } award ( projectId , resourceIId , name , options ? ) { return RequestHelper . post < AwardEmojiSchema > ( ) ( this , url ( projectId , this . resourceType , resourceIId ) , { name , ... options , } ) ; } remove ( projectId , resourceIId , awardId , options ? ) { return RequestHelper . del ( ) ( this , url ( projectId , this . resourceType , resourceIId , awardId ) , options ) ; } show ( projectId , resourceIId , awardId , options ? ) { return RequestHelper . get < AwardEmojiSchema > ( ) ( this , url ( projectId , this . resourceType , resourceIId , awardId ) , options ) ; } }