import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, MappedOmit, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; import type { CommitSchema } from './Commits'; export interface BranchSchema extends Record { name: string; merged: boolean; protected: boolean; default: boolean; developers_can_push: boolean; developers_can_merge: boolean; can_push: boolean; web_url: string; commit: MappedOmit; } export class Branches extends BaseResource { all( projectId: string | number, options?: { search?: string; regex?: string } & PaginationRequestOptions

& Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/repository/branches`, options, ); } create( projectId: string | number, branchName: string, ref: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()( this, endpoint`projects/${projectId}/repository/branches`, { branch: branchName, ref, ...options, }, ); } remove( projectId: string | number, branchName: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()( this, endpoint`projects/${projectId}/repository/branches/${branchName}`, options, ); } removeMerged( projectId: string | number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()( this, endpoint`projects/${projectId}/repository/merged_branches`, options, ); } show( projectId: string | number, branchName: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/repository/branches/${branchName}`, options, ); } }