Documentation
¶
Index ¶
- Variables
- type AsyncJob
- type AsyncJobStatus
- type AudioFacet
- type DeletedFacet
- type Drive
- type DriveService
- func (ds *DriveService) Get(ctx context.Context, driveID string) (*Drive, *http.Response, error)
- func (ds *DriveService) GetDefault(ctx context.Context) (*Drive, *http.Response, error)
- func (ds *DriveService) ListAll(ctx context.Context) (*Drives, *http.Response, error)
- func (ds *DriveService) ListChildren(ctx context.Context, driveID string, filter string) (*Items, *http.Response, error)
- func (ds *DriveService) Search(ctx context.Context, q string, filter string) (*Items, *http.Response, error)
- type Drives
- type Error
- type FileFacet
- type FolderFacet
- type HashesFacet
- type Identity
- type IdentitySet
- type ImageFacet
- type Item
- type ItemReference
- type ItemService
- func (is ItemService) Copy(ctx context.Context, itemID, name string, parentReference ItemReference) (*Item, *http.Response, error)
- func (is *ItemService) CreateFolder(ctx context.Context, parentID, folderName string) (*Item, *http.Response, error)
- func (is *ItemService) Delete(ctx context.Context, itemID, eTag string) (bool, *http.Response, error)
- func (is *ItemService) Get(ctx context.Context, itemID string) (*Item, *http.Response, error)
- func (is *ItemService) GetDefaultDriveRootFolder(ctx context.Context) (*Item, *http.Response, error)
- func (is *ItemService) ListChildren(ctx context.Context, itemID string) (*Items, *http.Response, error)
- func (is ItemService) Move(ctx context.Context, itemID, parentReference ItemReference) (*Item, *http.Response, error)
- func (is ItemService) SimpleUpload(folderID string, file *os.File) (*Item, *http.Response, error)
- func (is ItemService) Update(ctx context.Context, item *Item, ifMatch bool) (*Item, *http.Response, error)
- func (is *ItemService) UploadFromURL(parentID, name, webURL string) (*Item, *http.Response, error)
- type Items
- type LocationFacet
- type OneDrive
- type PhotoFacet
- type Quota
- type SharingLink
- type SpecialFolder
- type Thumbnail
- type ThumbnailSet
- type VideoFacet
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileTooLarge represents the error returned when the file is too large for upload ErrFileTooLarge = errors.New("file is too large for simple upload") )
Functions ¶
This section is empty.
Types ¶
type AsyncJob ¶
AsyncJob stores the location (URL) which can be pinged with CheckStatus() to check progress of an Async job.
func (AsyncJob) CheckStatus ¶
func (aj AsyncJob) CheckStatus() (*AsyncJobStatus, error)
CheckStatus returns a new AsyncJobStatus
type AsyncJobStatus ¶
type AsyncJobStatus struct { Operation string `json:"operation"` PercentageComplete float64 `json:"percentageComplete"` Status string `json:"status"` }
AsyncJobStatus provides information on the status of a asynchronous job progress.
type AudioFacet ¶
type AudioFacet struct { Album string `json:"album"` AlbumArtist string `json:"albumArtist"` Artist string `json:"artist"` Bitrate int64 `json:"bitrate"` Composers string `json:"composers"` Copyright string `json:"copyright"` Disc int `json:"disc"` DiscCount int `json:"discCount"` Duration int64 `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"` }
The AudioFacet groups audio-related data on OneDrive into a single structure. It is available on the audio property of Item resources that have associated audio. See: http://onedrive.github.io/facets/audio_facet.htm
type DeletedFacet ¶
type DeletedFacet struct{}
The DeletedFacet indicates that the item on OneDrive has been deleted. In this version of the API, the presence (non-null) of the facet value indicates that the file was deleted. A null (or missing) value indicates that the file is not deleted. See: http://onedrive.github.io/facets/deleted_facet.htm
type Drive ¶
type Drive struct { ID string `json:"id"` DriveType string `json:"driveType"` Owner *IdentitySet `json:"owner"` Quota *Quota `json:"quota"` // Relationships Items *Items `json:"items"` Root *Item `json:"root"` Special *Items `json:"special"` }
The Drive resource represents a drive in OneDrive. It provides information about the owner of the drive, total and available storage space, and exposes a collection of all the Items contained within the drive. See: http://onedrive.github.io/resources/drive.htm
type DriveService ¶
type DriveService struct {
*OneDrive
}
DriveService manages the communication with Drive related API endpoints.
func (*DriveService) Get ¶
Get returns a Drive for the authenticated user. If no driveID is provided the users default Drive is returned. A user will always have at least one Drive available -- the default Drive.
func (*DriveService) GetDefault ¶
GetDefault is a convenience function to return the users default Drive
func (*DriveService) ListChildren ¶
func (ds *DriveService) ListChildren(ctx context.Context, driveID string, filter string) (*Items, *http.Response, error)
ListChildren returns a collection of all the Items under the Drive root. If no driveID is specified, the children from the root drive are retrieved.
type Drives ¶
type Drives struct {
Collection []*Drive `json:"value"`
}
Drives represents a collection of Drives
type Error ¶
type Error struct { Code string `json:"code"` Message string `json:"message"` InnerError *Error `json:"innererror"` }
The Error type defines the basic structure of errors that are returned from the OneDrive API. Error messages can be nested recursively, with inner errors containing more specific error codes See: https://docs.microsoft.com/en-gb/onedrive/developer/rest-api/concepts/errors?view=odsp-graph-online
type FileFacet ¶
type FileFacet struct { MimeType *string `json:"mimeType,omitempty"` Hashes *HashesFacet `json:"hashes,omitempty"` }
The FileFacet groups file-related data on OneDrive into a single structure. It is available on the file property of Item resources that represent files. See: http://onedrive.github.io/facets/file_facet.htm
type FolderFacet ¶
type FolderFacet struct {
ChildCount int64 `json:"childCount"`
}
The FolderFacet groups folder-related data on OneDrive into a single structure. It is available on the folder property of Item resources that represent folders. See: http://onedrive.github.io/facets/folder_facet.htm
type HashesFacet ¶
The HashesFacet groups different types of hashes into a single structure, for an item on OneDrive. See: http://onedrive.github.io/facets/hashes_facet.htm
type Identity ¶
The Identity type represents an identity of an actor. For example, and actor can be a user, device, or application. See: http://onedrive.github.io/resources/identity.htm
type IdentitySet ¶
type IdentitySet struct { User *Identity `json:"user"` Application *Identity `json:"application"` Device *Identity `json:"device"` }
The IdentitySet type is a keyed collection of Identity objects. It is used to represent a set of identities associated with various events for an item, such as created by or last modified by. See: http://onedrive.github.io/resources/identitySet.htm
type ImageFacet ¶
The ImageFacet groups image-related data on OneDrive into a single structure. See: http://onedrive.github.io/facets/image_facet.htm
type Item ¶
type Item struct { ID string `json:"id"` Name string `json:"name"` ETag string `json:"eTag"` CTag string `json:"cTag"` CreatedBy *IdentitySet `json:"createdBy"` LastModifiedBy *IdentitySet `json:"lastModifiedBy"` CreatedDateTime time.Time `json:"createdDateTime"` LastModifiedDateTime time.Time `json:"lastModifiedDateTime"` Size int64 `json:"size"` ParentReference *ItemReference `json:"parentReference"` WebURL string `json:"webUrl"` File *FileFacet `json:"file"` Folder *FolderFacet `json:"folder"` Image *ImageFacet `json:"image"` Photo *PhotoFacet `json:"photo"` Audio *AudioFacet `json:"audio"` Video *VideoFacet `json:"video"` Location *LocationFacet `json:"location"` Deleted *DeletedFacet `json:"deleted"` // Instance attributes ConflictBehaviour string `json:"@name.conflictBehavior"` ContentDownloadURL string `json:"@content.downloadUrl"` GraphDownloadURL string `json:"@microsoft.graph.downloadUrl"` SourceURL string `json:"@content.sourceUrl"` // Relationships Content []byte `json:"content"` Children []*Item `json:"children"` Thumbnails *ThumbnailSet `json:"thumbnails"` }
The Item resource type represents metadata for an item in OneDrive. All top-level filesystem objects in OneDrive are Item resources. If an item is a Folder or File facet, the Item resource will contain a value for either the folder or file property, respectively. See: http://onedrive.github.io/resources/item.htm
type ItemReference ¶
type ItemReference struct { DriveID string `json:"driveId"` ID string `json:"id"` Path string `json:"path"` }
The ItemReference type groups data needed to reference a OneDrive item across the service into a single structure. See: http://onedrive.github.io/resources/itemReference.htm
type ItemService ¶
type ItemService struct {
*OneDrive
}
ItemService manages the communication with Item related API endpoints
func (ItemService) Copy ¶
func (is ItemService) Copy(ctx context.Context, itemID, name string, parentReference ItemReference) (*Item, *http.Response, error)
Copy creates a copy of a OneDrive Item resource (including children) under a new parent item. See: http://onedrive.github.io/items/copy.htm
func (*ItemService) CreateFolder ¶
func (is *ItemService) CreateFolder(ctx context.Context, parentID, folderName string) (*Item, *http.Response, error)
CreateFolder creates a new folder within the parent.
func (*ItemService) Delete ¶
func (is *ItemService) Delete(ctx context.Context, itemID, eTag string) (bool, *http.Response, error)
Delete removed a OneDrive item by using its ID. Note that deleting items using this method will move the items to the Recycle Bin, instead of permanently deleting them. See: http://onedrive.github.io/items/delete.htm
func (*ItemService) GetDefaultDriveRootFolder ¶
func (is *ItemService) GetDefaultDriveRootFolder(ctx context.Context) (*Item, *http.Response, error)
GetDefaultDriveRootFolder is a convenience function to return the root folder of the users default Drive
func (*ItemService) ListChildren ¶
func (is *ItemService) ListChildren(ctx context.Context, itemID string) (*Items, *http.Response, error)
ListChildren returns a collection of all the Items under an Item
func (ItemService) Move ¶
func (is ItemService) Move(ctx context.Context, itemID, parentReference ItemReference) (*Item, *http.Response, error)
Move changes the parent folder for a OneDrive Item resource. See: http://onedrive.github.io/items/move.htm
func (ItemService) SimpleUpload ¶
SimpleUpload allows you to provide the contents of a new file or update the contents of an existing file in a single API call. This method only supports files up to 100MB in size. For larger files use ResumableUpload(). See: https://dev.onedrive.com/items/upload_put.htm
func (ItemService) Update ¶
func (is ItemService) Update(ctx context.Context, item *Item, ifMatch bool) (*Item, *http.Response, error)
Update updates the metadata for a OneDrive Item resource. See: http://onedrive.github.io/items/update.htm
func (*ItemService) UploadFromURL ¶
UploadFromURL allows your app to upload an item to OneDrive by providing a URL. OneDrive will download the file directly from a remote server so your app doesn't have to upload the file's bytes. See: http://onedrive.github.io/items/upload_url.htm
type Items ¶
type Items struct {
Collection []*Item `json:"value"`
}
Items represents a collection of Items
type LocationFacet ¶
type LocationFacet struct { Altitude float64 `json:"altitude"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
The LocationFacet groups geographic location-related data on OneDrive into a single structure. See: http://onedrive.github.io/facets/location_facet.htm
type OneDrive ¶
type OneDrive struct { Client *http.Client // When debug is set to true, the JSON response is formatted for better readability Debug bool BaseURL string // Services Drives *DriveService Items *ItemService // contains filtered or unexported fields }
OneDrive is the entry point for the client. It manages the communication with Microsoft OneDrive API
type PhotoFacet ¶
type PhotoFacet struct { TakenDateTime time.Time `json:"takenDateTime"` CameraMake string `json:"cameraMake"` CameraModel string `json:"cameraModel"` FNumber float64 `json:"fNumber"` ExposureDenominator float64 `json:"exposureDenominator"` ExposureNumerator float64 `json:"exposureNumerator"` FocalLength float64 `json:"focalLength"` ISO int `json:"iso"` }
The PhotoFacet groups photo-related data on OneDrive, for example, EXIF metadata, into a single structure. See: http://onedrive.github.io/facets/photo_facet.htm
type Quota ¶
type Quota struct { Total int64 `json:"total"` Used int64 `json:"used"` Remaining int64 `json:"remaining"` Deleted int64 `json:"deleted"` State string `json:"state"` }
The Quota facet groups storage space quota-related information on OneDrive into a single structure. See: http://onedrive.github.io/facets/quotainfo_facet.htm
type SharingLink ¶
type SharingLink struct { Token string `json:"token"` WebURL string `json:"webUrl"` Type string `json:"type"` Application *Identity `json:"application"` }
The SharingLink type groups sharing link-related data on OneDrive into a single structure. See: http://onedrive.github.io/facets/sharinglink_facet.htm
type SpecialFolder ¶
type SpecialFolder struct {
Name string `json:"name"`
}
The SpecialFolder facet provides information about how a folder on OneDrive can be accessed via the special folders collection. See: http://onedrive.github.io/facets/jumpinfo_facet.htm
type Thumbnail ¶
type Thumbnail struct { Width int `json:"width"` Height int `json:"height"` URL string `json:"url"` // Relationships Content []byte `json:"content"` }
The Thumbnail resource type represents a thumbnail for an image, video, document, or any file or folder on OneDrive that has a graphical representation. See: http://onedrive.github.io/resources/thumbnail.htm
type ThumbnailSet ¶
type ThumbnailSet struct { ID string `json:"id"` Small *Thumbnail `json:"small"` Medium *Thumbnail `json:"medium"` Large *Thumbnail `json:"large"` }
The ThumbnailSet type is a keyed collection of Thumbnail objects. It is used to represent a set of thumbnails associated with a single file on OneDrive. See: http://onedrive.github.io/resources/thumbnailSet.htm
type VideoFacet ¶
type VideoFacet struct { Bitrate int64 `json:"bitrate"` Duration int64 `json:"duration"` Height int64 `json:"height"` Width int64 `json:"width"` }
The VideoFacet groups video-related data on OneDrive into a single complex type. See: http://onedrive.github.io/facets/video_facet.htm