Documentation ¶
Index ¶
- Constants
- Variables
- func HandleError(err error) error
- func NormalizePath(pth string) string
- type Address
- type AsyncOperationStatus
- type ChunkedUploadSessionDescriptor
- type CreateSessionBody
- type Deleted
- type DeltaCollectionPage
- type Drive
- type File
- type FileSystemInfo
- type Folder
- type Hashes
- type Identity
- type IdentitySet
- type Item
- type ItemCollectionPage
- type ItemCopyBody
- type ItemCreateBody
- type ItemReference
- type ItemUpdateBody
- type OneDrive
- func (c *OneDrive) Drive() (drive *Drive, err error)
- func (c *OneDrive) HandleError(err error) error
- func (c *OneDrive) ItemsChildren(address Address, link string) (res *ItemCollectionPage, err error)
- func (c *OneDrive) ItemsContent(address Address, span *ioutils.FileSpan) (reader io.ReadCloser, size int64, err error)
- func (c *OneDrive) ItemsCopy(address Address, body *ItemCopyBody) (monitorUrl string, err error)
- func (c *OneDrive) ItemsCopyAwait(monitorUrl string) (item *Item, err error)
- func (c *OneDrive) ItemsCopyStatus(monitorUrl string) (status *AsyncOperationStatus, item *Item, err error)
- func (c *OneDrive) ItemsCreate(address Address, body *ItemCreateBody) (item *Item, err error)
- func (c *OneDrive) ItemsDelete(address Address) (err error)
- func (c *OneDrive) ItemsDelta(address Address, link string, token string) (res *DeltaCollectionPage, err error)
- func (c *OneDrive) ItemsGet(address Address) (item *Item, err error)
- func (c *OneDrive) ItemsUpdate(address Address, itemUpdate *ItemUpdateBody) (item *Item, err error)
- func (c *OneDrive) ItemsUpload(address Address, name string, nameConflictBehavior string, content io.Reader, ...) (item *Item, err error)
- func (c *OneDrive) ItemsUploadCreateSession(address Address, body *CreateSessionBody) (uploadSession *UploadSession, err error)
- func (c *OneDrive) ItemsUploadSessionAppend(uploadSession *UploadSession, content io.Reader, start int64, end int64, ...) (err error)
- func (c *OneDrive) ItemsUploadSessionFinish(uploadSession *UploadSession, content io.Reader, start int64, end int64, ...) (item *Item, err error)
- func (c *OneDrive) Request(request *httpclient.RequestData) (res *http.Response, err error)
- type OneDriveAuth
- type OneDriveError
- type OneDriveErrorDetails
- type Quota
- type RefreshResp
- type RefreshRespError
- type UploadSession
Constants ¶
View Source
const ( AddressTypeId = 0 AddressTypePath = 1 )
View Source
const ( ErrorCodeItemNotFound = "itemNotFound" ErrorCodeNameAlreadyExists = "nameAlreadyExists" )
View Source
const ( NameConflictBehaviorRename = "rename" NameConflictBehaviorReplace = "replace" NameConflictBehaviorFail = "fail" )
View Source
const ( AsyncOperationStatusNotStarted = "notStarted" AsyncOperationStatusInProgress = "inProgress" AsyncOperationStatusCompleted = "completed" AsyncOperationStatusUpdating = "updating" AsyncOperationStatusFailed = "failed" AsyncOperationStatusDeletePending = "deletePending" AsyncOperationStatusDeleteFailed = "deleteFailed" AsyncOperationStatusWaiting = "waiting" )
View Source
const (
DefaultMaxFragmentSize = 60 * 1024 * 1024
)
View Source
const (
InvalidGrantError = "invalid_grant"
)
Variables ¶
View Source
var AddressRoot = Address{ Address: "/drive/items/root", Type: AddressTypeId, }
Functions ¶
func HandleError ¶
func NormalizePath ¶
Types ¶
type Address ¶
func AddressPath ¶
type AsyncOperationStatus ¶
type CreateSessionBody ¶
type CreateSessionBody struct {
Item ChunkedUploadSessionDescriptor `json:"item"`
}
type DeltaCollectionPage ¶
type Drive ¶
type Drive struct { Id string `json:"id"` DriveType string `json:"driveType"` Owner IdentitySet `json:"owner"` Quota Quota `json:"quota"` }
type FileSystemInfo ¶
type IdentitySet ¶
type Item ¶
type Item struct { CreatedBy *IdentitySet `json:"createdBy,omitempty"` CreatedDateTime time.Time `json:"createdDateTime,omitempty"` CTag string `json:"cTag,omitempty"` Description string `json:"description,omitempty"` ETag string `json:"eTag,omitempty"` Id string `json:"id,omitempty"` LastModifiedBy *IdentitySet `json:"lastModifiedBy,omitempty"` LastModifiedDateTime time.Time `json:"lastModifiedDateTime,omitempty"` Name string `json:"name,omitempty"` ParentReference *ItemReference `json:"parentReference,omitempty"` Size int64 `json:"size,omitempty"` WebURL string `json:"webUrl,omitempty"` Deleted *Deleted `json:"deleted,omitempty"` File *File `json:"file,omitempty"` FileSystemInfo *FileSystemInfo `json:"fileSystemInfo,omitempty"` Folder *Folder `json:"folder,omitempty"` }
type ItemCollectionPage ¶
type ItemCopyBody ¶
type ItemCopyBody struct { Name string `json:"name,omitempty"` ParentReference *ItemReference `json:"parentReference,omitempty"` }
type ItemCreateBody ¶
type ItemReference ¶
type ItemUpdateBody ¶
type ItemUpdateBody struct { Name string `json:"name,omitempty"` ParentReference *ItemReference `json:"parentReference,omitempty"` }
type OneDrive ¶
type OneDrive struct { ApiClient *httpclient.HTTPClient Auth *OneDriveAuth MaxFragmentSize int64 }
func NewOneDrive ¶
func NewOneDrive(auth *OneDriveAuth) (c *OneDrive)
func (*OneDrive) HandleError ¶
func (*OneDrive) ItemsChildren ¶
func (c *OneDrive) ItemsChildren(address Address, link string) (res *ItemCollectionPage, err error)
func (*OneDrive) ItemsContent ¶
func (*OneDrive) ItemsCopy ¶
func (c *OneDrive) ItemsCopy(address Address, body *ItemCopyBody) (monitorUrl string, err error)
func (*OneDrive) ItemsCopyAwait ¶
func (*OneDrive) ItemsCopyStatus ¶
func (c *OneDrive) ItemsCopyStatus(monitorUrl string) (status *AsyncOperationStatus, item *Item, err error)
func (*OneDrive) ItemsCreate ¶
func (c *OneDrive) ItemsCreate(address Address, body *ItemCreateBody) (item *Item, err error)
func (*OneDrive) ItemsDelete ¶
func (*OneDrive) ItemsDelta ¶
func (*OneDrive) ItemsUpdate ¶
func (c *OneDrive) ItemsUpdate(address Address, itemUpdate *ItemUpdateBody) (item *Item, err error)
func (*OneDrive) ItemsUpload ¶
func (*OneDrive) ItemsUploadCreateSession ¶
func (c *OneDrive) ItemsUploadCreateSession(address Address, body *CreateSessionBody) (uploadSession *UploadSession, err error)
func (*OneDrive) ItemsUploadSessionAppend ¶
func (*OneDrive) ItemsUploadSessionFinish ¶
type OneDriveAuth ¶
type OneDriveAuth struct { ClientId string ClientSecret string RedirectUri string AccessToken string RefreshToken string ExpiresAt time.Time }
func (*OneDriveAuth) ValidToken ¶
func (a *OneDriveAuth) ValidToken() (token string, err error)
type OneDriveError ¶
type OneDriveError struct { Err OneDriveErrorDetails `json:"error"` HttpClientError *httpclient.InvalidStatusError }
func IsOneDriveError ¶
func IsOneDriveError(err error) (oneDriveErr *OneDriveError, ok bool)
func (*OneDriveError) Error ¶
func (e *OneDriveError) Error() string
type OneDriveErrorDetails ¶
type RefreshResp ¶
type RefreshRespError ¶
Click to show internal directories.
Click to hide internal directories.