import { PreviewState } from '@staticcms/core/constants/enums'; import { Cursor } from '@staticcms/core/lib/util'; import type { DataFile, PersistOptions, UnpublishedEntry } from '@staticcms/core'; import type { WorkflowStatus } from '@staticcms/core/constants/publishModes'; import type { ApiRequest } from '@staticcms/core/lib/util'; import type AssetProxy from '@staticcms/core/valueObjects/AssetProxy'; export declare const API_NAME = "GitLab"; export interface Config { apiRoot?: string; token?: string; branch?: string; repo?: string; squashMerges: boolean; initialWorkflowStatus: WorkflowStatus; cmsLabelPrefix: string; } export interface CommitAuthor { name: string; email: string; } declare enum CommitAction { CREATE = "create", DELETE = "delete", MOVE = "move", UPDATE = "update" } type CommitItem = { base64Content?: string; path: string; oldPath?: string; action: CommitAction; }; type FileEntry = { id: string; type: string; path: string; name: string; }; declare enum GitLabCommitStatuses { Pending = "pending", Running = "running", Success = "success", Failed = "failed", Canceled = "canceled" } type GitLabCommitStatus = { status: GitLabCommitStatuses; name: string; author: { username: string; name: string; }; description: null; sha: string; ref: string; target_url: string; }; type GitLabMergeRequest = { id: number; iid: number; title: string; description: string; state: string; merged_by: { name: string; username: string; }; merged_at: string; created_at: string; updated_at: string; target_branch: string; source_branch: string; author: { name: string; username: string; }; labels: string[]; sha: string; }; type GitLabBranch = { name: string; developers_can_push: boolean; developers_can_merge: boolean; commit: { id: string; }; }; export declare function getMaxAccess(groups: { group_access_level: number; }[]): { group_access_level: number; }; export default class API { apiRoot: string; token: string | boolean; branch: string; repo: string; repoURL: string; commitAuthor?: CommitAuthor; squashMerges: boolean; initialWorkflowStatus: WorkflowStatus; cmsLabelPrefix: string; constructor(config: Config); withAuthorizationHeaders: (req: ApiRequest) => Promise; buildRequest: (req: ApiRequest) => Promise; request: (req: ApiRequest) => Promise; responseToJSON: (res: Response) => Promise; responseToBlob: (res: Response) => Promise; responseToText: (res: Response) => Promise; requestJSON: (req: ApiRequest) => Promise; requestText: (req: ApiRequest) => Promise; user: () => Promise; WRITE_ACCESS: number; MAINTAINER_ACCESS: number; hasWriteAccess: () => Promise; readFile: (path: string, sha?: string | null, { parseText, branch }?: { parseText?: boolean | undefined; branch?: string | undefined; }) => Promise; readFileMetadata(path: string, sha: string | null | undefined): Promise; getCursorFromHeaders: (headers: Headers) => Cursor; getCursor: ({ headers }: { headers: Headers; }) => Cursor; fetchCursor: (req: ApiRequest) => Promise; fetchCursorAndEntries: (req: ApiRequest) => Promise<{ entries: FileEntry[]; cursor: Cursor; }>; listFiles: (path: string, recursive?: boolean) => Promise<{ files: FileEntry[]; cursor: Cursor; }>; traverseCursor: (cursor: Cursor, action: string) => Promise<{ entries: FileEntry[]; cursor: Cursor; }>; listAllFiles: (path: string, folderSupport?: boolean, recursive?: boolean, branch?: string) => Promise; toBase64: (str: string) => Promise; fromBase64: (str: string) => string; getBranch(branchName: string): Promise; uploadAndCommit(items: CommitItem[], { commitMessage, branch, newBranch }: { commitMessage?: string | undefined; branch?: string | undefined; newBranch?: boolean | undefined; }): Promise; getCommitItems(files: { path: string; newPath?: string; }[], branch: string): Promise; persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions): Promise; deleteFiles: (paths: string[], commitMessage: string) => Promise; getFileId(path: string, branch: string): Promise; isFileExists(path: string, branch: string): Promise; getDifferences(to: string, from?: string): Promise<{ status: string; oldPath: string; newPath: string; newFile: boolean; path: string; binary: boolean; }[]>; getDefaultBranch(): Promise; isShaExistsInBranch(branch: string, sha: string): Promise; /** * Editorial Workflow */ listUnpublishedBranches(): Promise; getMergeRequests(sourceBranch?: string): Promise; getBranchMergeRequest(branch: string): Promise; retrieveUnpublishedEntryData(contentKey: string): Promise; updateMergeRequestLabels(mergeRequest: GitLabMergeRequest, labels: string[]): Promise; updateUnpublishedEntryStatus(collection: string, slug: string, newStatus: WorkflowStatus): Promise; deleteBranch(branch: string): Promise; closeMergeRequest(mergeRequest: GitLabMergeRequest): Promise; deleteUnpublishedEntry(collectionName: string, slug: string): Promise; getMergeRequestStatues(mergeRequest: GitLabMergeRequest, branch: string): Promise; mergeMergeRequest(mergeRequest: GitLabMergeRequest): Promise; publishUnpublishedEntry(collectionName: string, slug: string): Promise; getStatuses(collectionName: string, slug: string): Promise<{ context: string; state: PreviewState; target_url: string; }[]>; createMergeRequest(branch: string, commitMessage: string, status: WorkflowStatus): Promise; rebaseMergeRequest(mergeRequest: GitLabMergeRequest): Promise; editorialWorkflowGit(files: (DataFile | AssetProxy)[], slug: string, options: PersistOptions): Promise; getUnpublishedEntrySha(collection: string, slug: string): Promise; } export {};