onedrive/types/index.d.ts

53 lines
2 KiB
TypeScript
Raw Normal View History

// API response object for /api?path=<path_to_file_or_folder>, this may return either a file or a folder.
// Pagination is also declared here with the 'next' parameter.
export declare type OdAPIResponse = { file?: OdFileObject; folder?: OdFolderObject; next?: string }
// A folder object returned from the OneDrive API. This contains the parameter 'value', which is an array of items
// inside the folder. The items may also be either files or folders.
export declare type OdFolderObject = {
2022-01-21 13:42:21 +00:00
'@odata.count': number
'@odata.context': string
'@odata.nextLink'?: string
2022-01-21 13:42:21 +00:00
value: Array<{
'@microsoft.graph.downloadUrl': string
2022-01-21 13:42:21 +00:00
id: string
name: string
size: number
lastModifiedDateTime: string
file?: { mimeType: string; hashes: { quickXorHash: string; sha1Hash?: string; sha256Hash?: string } }
folder?: { childCount: number; view: { sortBy: string; sortOrder: 'ascending'; viewType: 'thumbnails' } }
video?: OdVideoFile
2022-01-21 13:42:21 +00:00
}>
}
// A file object returned from the OneDrive API. This object may contain 'video' if the file is a video.
export declare type OdFileObject = {
'@microsoft.graph.downloadUrl': string
'@odata.context': string
name: string
size: number
id: string
lastModifiedDateTime: string
file: { mimeType: string; hashes: { quickXorHash: string; sha1Hash?: string; sha256Hash?: string } }
video?: OdVideoFile
}
// A representation of a OneDrive video file. All fields are declared here, but we mainly use 'width' and 'height'.
export declare type OdVideoFile = {
width: number
height: number
duration: number
bitrate: number
frameRate: number
audioBitsPerSample: number
audioChannels: number
audioFormat: string
audioSamplesPerSecond: number
}
// API response object for /api/search?q=<query>. Likewise, this array of items may also contain either files or folders.
export declare type OdSearchResult = Array<{
2022-01-21 13:42:21 +00:00
id: string
name: string
file?: OdFileObject
folder?: OdFolderObject
path: string
parentReference: { id: string; name: string; path?: string }
2022-01-21 13:42:21 +00:00
}>