refactor: split git provider adapters
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import type { PushFile, RemoteFile } from '@/lib/types'
|
||||
|
||||
export type GitProviderName = 'github' | 'gitea'
|
||||
|
||||
export interface GitRemoteConfig {
|
||||
apiBaseUrl: string
|
||||
lfsBatchUrl: string
|
||||
owner: string
|
||||
provider: GitProviderName
|
||||
repo: string
|
||||
token: string
|
||||
username?: string
|
||||
webUrl: string
|
||||
}
|
||||
|
||||
export interface LfsObject {
|
||||
oid: string
|
||||
size: number
|
||||
contentBase64: string
|
||||
}
|
||||
|
||||
export type LfsPushFile = PushFile & {
|
||||
oid: string
|
||||
size: number
|
||||
}
|
||||
|
||||
export interface PushFilesParams {
|
||||
commitMessage: string
|
||||
deletePaths: string[]
|
||||
files: PushFile[]
|
||||
}
|
||||
|
||||
export interface GitProvider {
|
||||
getRemoteFolder(folderPath: string): Promise<{ exists: boolean; files: RemoteFile[] }>
|
||||
pushFiles(params: PushFilesParams): Promise<{ commitUrl: string }>
|
||||
}
|
||||
Reference in New Issue
Block a user