fix: types in GitHubHelper

This commit is contained in:
EnixCoda 2019-02-18 22:15:00 +08:00
parent 7b929a0d77
commit 706b0c530c
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -74,15 +74,21 @@ async function getTreeData({ userName, repoName, branchName, accessToken }: Meta
export type ItemData = {
userName: string
repoName: string
branchName: string
accessToken: string
}
export type BlobData = {
encoding: 'base64' | string
fileSHA: string
} & ItemData
content?: string
}
async function getBlobData({ userName, repoName, accessToken, fileSHA }: BlobData) {
async function getBlobData({
userName,
repoName,
accessToken,
fileSHA,
}: Pick<ItemData & BlobData, 'userName' | 'repoName' | 'accessToken' | 'fileSHA'>) {
const url = `https://api.github.com/repos/${userName}/${repoName}/git/blobs/${fileSHA}`
return await request(url, { accessToken })
}