import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { BaseRequestOptions , endpoint , PaginatedRequestOptions , RequestHelper , Sudo , } from '../infrastructure' ; export interface BadgeSchema extends Record < string , unknown > { name : string ; id : number ; link_url : string ; image_url : string ; rendered_link_url : string ; rendered_image_url : string ; kind : 'project' | 'group' ; } export class ResourceBadges < C extends boolean = false > extends BaseResource < C > { constructor ( resourceType , options ) { super ( { prefixUrl : resourceType , ... options } ) ; } add ( resourceId , options ? ) { return RequestHelper . post < BadgeSchema > ( ) ( this , endpoint `${ resourceId }/badges` , options ) ; } all ( resourceId , options ? ) { return RequestHelper . get < BadgeSchema [ ] > ( ) ( this , endpoint `${ resourceId }/badges` , options ) ; } edit ( resourceId , badgeId , options ? ) { return RequestHelper . put < BadgeSchema > ( ) ( this , endpoint `${ resourceId }/badges/${ badgeId }` , options ) ; } preview ( resourceId , linkUrl , imageUrl , options ? ) { return RequestHelper . get < Omit < BadgeSchema , 'id' | 'name' | 'kind' > > ( ) ( this , endpoint `${ resourceId }/badges/render` , { linkUrl , imageUrl , ... options } ) ; } remove ( resourceId , badgeId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/badges/${ badgeId }` , options ) ; } show ( resourceId , badgeId , options ? ) { return RequestHelper . get < BadgeSchema > ( ) ( this , endpoint `${ resourceId }/badges/${ badgeId }` , options ) ; } }