kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/706/head
rodzic
946f23a5c4
commit
e40eaa9888
|
@ -20,7 +20,7 @@ export namespace googleDrive {
|
||||||
parents?: string[]
|
parents?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fileFields: (keyof File)[] = [
|
export const fileFields: readonly (keyof File)[] = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
'mimeType',
|
'mimeType',
|
||||||
|
@ -31,6 +31,7 @@ export namespace googleDrive {
|
||||||
'modifiedTime',
|
'modifiedTime',
|
||||||
'parents'
|
'parents'
|
||||||
]
|
]
|
||||||
|
export const requestFileFields = `files(${fileFields.join(',')}),nextPageToken`
|
||||||
|
|
||||||
export interface ListFilesResponse {
|
export interface ListFilesResponse {
|
||||||
files: File[]
|
files: File[]
|
||||||
|
@ -104,6 +105,7 @@ export class GoogleDriveClient extends AIFunctionsProvider {
|
||||||
const q = conditions.join(' and ')
|
const q = conditions.join(' and ')
|
||||||
|
|
||||||
const { data } = await this.drive.files.list({
|
const { data } = await this.drive.files.list({
|
||||||
|
fields: googleDrive.requestFileFields,
|
||||||
...opts,
|
...opts,
|
||||||
q
|
q
|
||||||
})
|
})
|
||||||
|
@ -128,7 +130,10 @@ export class GoogleDriveClient extends AIFunctionsProvider {
|
||||||
async getFile(
|
async getFile(
|
||||||
opts: google.drive_v3.Params$Resource$Files$Get
|
opts: google.drive_v3.Params$Resource$Files$Get
|
||||||
): Promise<googleDrive.File> {
|
): Promise<googleDrive.File> {
|
||||||
const { data } = await this.drive.files.get(opts)
|
const { data } = await this.drive.files.get({
|
||||||
|
fields: googleDrive.requestFileFields,
|
||||||
|
...opts
|
||||||
|
})
|
||||||
|
|
||||||
return pruneNullOrUndefinedDeep(
|
return pruneNullOrUndefinedDeep(
|
||||||
pick(data, ...googleDrive.fileFields)
|
pick(data, ...googleDrive.fileFields)
|
||||||
|
|
Ładowanie…
Reference in New Issue