import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, UserAgentDetailSchema, } from '../infrastructure'; import type { CreateSnippetOptions, EditSnippetOptions, ExpandedSnippetSchema, SnippetSchema, } from './Snippets'; export class ProjectSnippets extends BaseResource { all( projectId: string | number, options?: Sudo & ShowExpanded & PaginationRequestOptions

, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/snippets`, options, ); } create( projectId: string | number, title: string, options?: CreateSnippetOptions & Sudo & ShowExpanded, ) { return RequestHelper.post()( this, endpoint`projects/${projectId}/snippets`, { title, ...options, }, ); } edit( projectId: string | number, snippetId: number, options?: EditSnippetOptions & Sudo & ShowExpanded, ) { return RequestHelper.put()( this, endpoint`projects/${projectId}/snippets/${snippetId}`, options, ); } remove( projectId: string | number, snippetId: number, options?: Sudo & ShowExpanded, ) { return RequestHelper.del()( this, endpoint`projects/${projectId}/snippets/${snippetId}`, options, ); } show( projectId: string | number, snippetId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/snippets/${snippetId}`, options, ); } showContent( projectId: string | number, snippetId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/snippets/${snippetId}/raw`, options, ); } showRepositoryFileContent( projectId: string | number, snippetId: number, ref: string, filePath: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/snippets/${snippetId}/files/${ref}/${filePath}/raw`, options, ); } showUserAgentDetails( projectId: string | number, snippetId: number, options?: Sudo & ShowExpanded, ) { return RequestHelper.get()( this, endpoint`projects/${projectId}/snippets/${snippetId}/user_agent_detail`, options, ); } }