Documentation ¶
Index ¶
- type ChildrenResponse
- type DriveItem
- type ErrorResponse
- type GraphToken
- func (t *GraphToken) DownloadFile(file *DriveItem) ([]byte, error)
- func (t *GraphToken) ListFile(path string) (*DriveItem, error)
- func (t *GraphToken) ListFolder(path string) ([]*DriveItem, error)
- func (t *GraphToken) MakeRequest(method string, url string, body io.Reader) (*http.Response, error)
- func (t *GraphToken) SyncFolder(odpath string, destpath string, filetype string) error
- type Hashes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChildrenResponse ¶
type DriveItem ¶
type DriveItem struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` Size int `json:"size"` WebURL string `json:"webUrl"` Ctag string `json:"cTag"` Etag string `json:"eTag"` CreationDate string `json:"createdDateTime"` ModifiedDate string `json:"lastModifiedDateTime"` Root *struct{} `json:"root"` DownloadURL string `json:"@content.downloadUrl"` Audio *struct { Album string `json:"album"` AlbumArtist string `json:"albumArtist"` Artist string `json:"Artist"` Bitrate int `json:"bitrate"` Composers string `json:"composers"` Copyright string `json:"copyright"` Disc int `json:"disc"` DiscCount int `json:"discCount"` Duration int `json:"duration"` Genre string `json:"genre"` HasDRM bool `json:"hasDrm"` IsVariableBitrate bool `json:"isVariableBitrate"` Title string `json:"title"` Track int `json:"track"` TrackCount int `json:"trackCount"` Year int `json:"year"` } `json:"audio"` File *struct { MimeType string `json:"mimeType"` Hashes *Hashes `json:"hashes"` } `json:"file"` Folder *struct { ChildCount int `json:"childCount"` View *struct { SortBy string `json:"sortBy"` SortOrder string `json:"sortOrder"` ViewType string `json:"viewType"` } `json:"view"` } `json:"folder"` }
type ErrorResponse ¶
type ErrorResponse struct { Outer struct { Code string `json:"code"` Message string `json:"message"` Inner struct { Date string `json:"date"` RequestID string `json:"request-id"` ClientRequestId string `json:"client-request-id"` } `json:"innerError"` } `json:"error"` }
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
type GraphToken ¶
type GraphToken struct { TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` Scope string `json:"scope"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` // contains filtered or unexported fields }
func CreateAccess ¶
func CreateAccess(clientID string, redirectURI string, fname string) (*GraphToken, error)
func (*GraphToken) DownloadFile ¶
func (t *GraphToken) DownloadFile(file *DriveItem) ([]byte, error)
Downloads a DriveItem, and returns the file body.
func (*GraphToken) ListFile ¶
func (t *GraphToken) ListFile(path string) (*DriveItem, error)
Get DriveItem information for a single file. Path should be WITHOUT leading/trailing slashes.
func (*GraphToken) ListFolder ¶
func (t *GraphToken) ListFolder(path string) ([]*DriveItem, error)
Lists all files in a given folder. Path should be WITHOUT leading/trailing slashes.
func (*GraphToken) MakeRequest ¶
func (*GraphToken) SyncFolder ¶
func (t *GraphToken) SyncFolder(odpath string, destpath string, filetype string) error
A read-only sync of a given OneDrive folder. Downloads files that don't exist in local directory. Deletes files in local directory not found on OneDrive. Does not redownload existing files. Creates a json file in the target directory to store state of synced files.
Click to show internal directories.
Click to hide internal directories.