Documentation ¶
Index ¶
- Constants
- Variables
- func AcceleratedURL(hurl string) string
- func EncodePath(path string, all ...bool) string
- func EscapeJSONString(input string) string
- func GetConfigDir() string
- func GetDownloadFileName(u *url.URL, fileName string, disposition string) string
- func GetOnedrivePath(dirPath string) string
- func HandleResponForParseAPI(resp *http.Response, err error, objs interface{}) error
- func InitOneShowConfig()
- func PathExists(path string) bool
- func SaveToken2Config(token *AuthToken, configFile string) error
- func SaveToken2DefaultPath(token *AuthToken) error
- func URLPathEscape(in string) string
- func ViewHumanShow(isize int64) string
- func ViewPercent(sub, total int64) string
- type AsyncOperationStatus
- type AuthError
- type AuthService
- type AuthToken
- type CopyItemRequest
- type CreateItemRequest
- type CreateShareLinkRequest
- type CreateShareLinkResponse
- type CreateUploadRequest
- type CreateUploadResponse
- type CurTask
- type DWorker
- type DeletedFacet
- type DownloadInfo
- type Drive
- type Error
- type FileFacet
- type FileSystemInfoFacet
- type FolderFacet
- type HashesType
- type Identity
- type IdentitySet
- type Item
- func (i *Item) GetCreatedBy() IdentitySet
- func (i *Item) GetCreatedDateTime() Timestamp
- func (i *Item) GetDriveID() string
- func (i *Item) GetFile() *FileFacet
- func (i *Item) GetFileSystemInfo() *FileSystemInfoFacet
- func (i *Item) GetFolder() *FolderFacet
- func (i *Item) GetID() string
- func (i *Item) GetLastModifiedBy() IdentitySet
- func (i *Item) GetLastModifiedDateTime() Timestamp
- func (i *Item) GetName() string
- func (i *Item) GetPackage() *PackageFacet
- func (i *Item) GetPackageType() string
- func (i *Item) GetParentReference() *ItemReference
- func (i *Item) GetSize() int64
- func (i *Item) GetWebURL() string
- func (i *Item) IsRemote() bool
- type ItemReference
- type LastModifiedBy
- type ListChildrenResponse
- type LocalFileUploadTask
- func (task *LocalFileUploadTask) Close() error
- func (task *LocalFileUploadTask) Init() error
- func (task *LocalFileUploadTask) Name() string
- func (task *LocalFileUploadTask) Open() error
- func (task *LocalFileUploadTask) Parent() string
- func (task *LocalFileUploadTask) Read(buff *bytes.Buffer, start int64, end int64, len int64) error
- func (task *LocalFileUploadTask) SeekPosition(position int64) error
- func (task *LocalFileUploadTask) Size() int64
- type MoveItemRequest
- type OneClient
- func (cli *OneClient) APICreateUploadSession(driveID string, path string) (*UploadURLResult, error)
- func (cli *OneClient) APIDelFile(driveID string, filePath string) (bool, error)
- func (cli *OneClient) APIDelFileByItemID(driveID string, itemID string) (bool, error)
- func (cli *OneClient) APIGetFile(driveID string, path string) (*Item, error)
- func (cli *OneClient) APIGetFileByID(driveID string, ID string) (*Item, error)
- func (cli *OneClient) APIGetMeDrive() (*Drive, error)
- func (cli *OneClient) APIGetUploadFileInfo(URL string) (*UploadURLResult, error)
- func (cli *OneClient) APIGetUserInfo()
- func (cli *OneClient) APIListFilesByPath(driveID string, path string) (*ListChildrenResponse, error)
- func (cli *OneClient) APIListFilesByPath0(driveID string, path string) (*ListChildrenResponse, error)
- func (cli *OneClient) APISearchByKey(driveID string, key string) (*ListChildrenResponse, error)
- func (cli *OneClient) APIUpdateFileByItemID(driveID string, itemID string, newName string, newPathID string) (bool, error)
- func (cli *OneClient) APIUploadFilePart(task *CurTask, URL string, file *os.File, position int64, fileSize int64) error
- func (cli *OneClient) APIUploadSourcePart(task UploadTask, URL string, position int64, fileSize int64) error
- func (cli *OneClient) APIUploadText(driveID string, path string, content string) (*Item, error)
- func (cli *OneClient) APImkdir(driveID string, path string, dirName string) (*Item, error)
- func (cli *OneClient) DoAutoForNewUser()
- func (cli *OneClient) Download(file string, downloadDir string, a bool)
- func (cli *OneClient) GetAuthCodeURL() string
- func (cli *OneClient) GetFirstToken(code string) error
- func (cli *OneClient) GetOneDriveAppInfo() map[string]string
- func (cli *OneClient) GetOneDriveAppInfoWithSecret() map[string]string
- func (cli *OneClient) GetTokenHeader() map[string]string
- func (u *OneClient) SaveToken2Home(token *AuthToken) error
- func (cli *OneClient) SaveToken2HomeDefault(token *AuthToken)
- func (cli *OneClient) SaveToken2UserConfig(token *AuthToken) error
- func (cli *OneClient) SetOneDriveAPIToken() map[string]string
- func (cli *OneClient) UpdateToken() (*AuthToken, error)
- func (cli *OneClient) UploadBigFile(srcFile string, driveID string, path string) error
- func (cli *OneClient) UploadSource(source string, driveID string, oneDriveParentPath string) error
- func (cli *OneClient) UploadSourceTryAgain(source string, driveID string, oneDriveParentPath string, tryLimit int) error
- type OneFile
- func (of *OneFile) Close() error
- func (of *OneFile) IsDir() bool
- func (of *OneFile) ModTime() time.Time
- func (of *OneFile) Mode() os.FileMode
- func (of *OneFile) Name() string
- func (of *OneFile) Read(p []byte) (n int, err error)
- func (of *OneFile) Readdir(count int) ([]os.FileInfo, error)
- func (of *OneFile) Seek(offset int64, whence int) (int64, error)
- func (of *OneFile) Size() int64
- func (of *OneFile) Stat() (os.FileInfo, error)
- func (of *OneFile) Sys() interface{}
- func (of *OneFile) Write(p []byte) (n int, err error)
- type OneFileSystem
- func (fs *OneFileSystem) CacheItem(name string, item *Item) *OneFile
- func (fs *OneFileSystem) Copy(cache *OneFile) *OneFile
- func (fs *OneFileSystem) Mkdir(ctx context.Context, name string, perm os.FileMode) error
- func (fs *OneFileSystem) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
- func (fs *OneFileSystem) RemoveAll(ctx context.Context, name string) error
- func (fs *OneFileSystem) Rename(ctx context.Context, oldName, newName string) error
- func (fs *OneFileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error)
- type OneShowConfig
- type PackageFacet
- type Quota
- type RemoteItemFacet
- type SetFileSystemInfo
- type Timestamp
- type URLUploadTask
- func (task *URLUploadTask) Close() error
- func (task *URLUploadTask) Init() error
- func (task *URLUploadTask) Name() string
- func (task *URLUploadTask) Open() error
- func (task *URLUploadTask) Parent() string
- func (task *URLUploadTask) Read(buff *bytes.Buffer, start int64, end int64, len int64) error
- func (task *URLUploadTask) SeekPosition(position int64) error
- func (task *URLUploadTask) Size() int64
- type UploadFragmentResponse
- type UploadTask
- type UploadURLResult
- type User
- type Version
- type VersionsResponse
- type ViewDeltaResponse
Constants ¶
const AppConfigDir = ".config/oneshow"
AppConfigDir config dir
const BLOCK int64 = 10 * k320
const ConfigFileDefault string = ".od.json"
ConfigFileDefault default user when login
const CurUser string = ".od_cur_user.id"
CurUser who is the current user
const DefaultBuffSize int = 100 * KB
DefaultBuffSize default buffer size
const KB int = 1024
KB byte unit
const MB int = 1048576
MB byte unit
const OneshowConfigFile string = ".oneshow.json"
OneshowConfigFile config file name
const (
// PackageTypeOneNote is the package type value for OneNote files
PackageTypeOneNote = "oneNote"
)
const TMP_FILE_FIX = ".one.tmp"
Variables ¶
var CALLBACK_URL = "http://localhost:4444/result"
var CLIENT_ID string = "51d4977e-8740-41c9-956b-bc5fa4f58806"
var CLIENT_SECRET string = "jvv9q-o9Yt2bxg.6kRmOLi~5xhQDrN.5._"
var SCOPE string = "Files.Read Files.ReadWrite Files.Read.All Files.ReadWrite.All offline_access Sites.Read.All User.Read"
Functions ¶
func AcceleratedURL ¶
func EscapeJSONString ¶ added in v1.0.1
func GetDownloadFileName ¶
GetDownloadFileName get name of download source
func GetOnedrivePath ¶ added in v1.0.1
func HandleResponForParseAPI ¶
HandleResponForParseAPI parse api
func PathExists ¶
func SaveToken2Config ¶
SaveToken2Config save to configure file
func SaveToken2DefaultPath ¶
SaveToken2DefaultPath save config when first login
func ViewHumanShow ¶
func ViewPercent ¶
Types ¶
type AsyncOperationStatus ¶
type AsyncOperationStatus struct { PercentageComplete float64 `json:"percentageComplete"` // A float value between 0 and 100 that indicates the percentage complete. Status string `json:"status"` // A string value that maps to an enumeration of possible values about the status of the job. "notStarted | inProgress | completed | updating | failed | deletePending | deleteFailed | waiting" ErrorCode string `json:"errorCode"` // Not officially documented :( }
AsyncOperationStatus provides information on the status of an asynchronous job progress.
The following API calls return AsyncOperationStatus resources:
Copy Item Upload From URL
type AuthError ¶
type AuthError struct { Error string `json:"error"` ErrorDescription string `json:"error_description"` }
AuthError is error type
type AuthService ¶
AuthService add auth for download service
type AuthToken ¶
type AuthToken struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` Scope string `json:"scope"` RefreshToken string `json:"refresh_token"` IDToken string `json:"id_token"` ExpiresTime Timestamp `json:"expires_time"` DriveID string `json:"drive_id"` }
AuthToken is from token of API
type CopyItemRequest ¶
type CopyItemRequest struct { ParentReference ItemReference `json:"parentReference"` // Reference to the parent item the copy will be created in. Name *string `json:"name"` // Optional The new name for the copy. If this isn't provided, the same name will be used as the original. }
CopyItemRequest is the request to copy an item object
Note: The parentReference should include either an id or path but not both. If both are included, they need to reference the same item or an error will occur.
type CreateItemRequest ¶
type CreateItemRequest struct { Name string `json:"name"` // Name of the folder to be created. Folder FolderFacet `json:"folder"` // Empty Folder facet to indicate that folder is the type of resource to be created. ConflictBehavior string `json:"@name.conflictBehavior"` // Determines what to do if an item with a matching name already exists in this folder. Accepted values are: rename, replace, and fail (the default). }
CreateItemRequest is the request to create an item object
type CreateShareLinkRequest ¶
type CreateShareLinkRequest struct {}
CreateShareLinkRequest is the request to create a sharing link Always Type:view and Scope:anonymous for public sharing
type CreateShareLinkResponse ¶
type CreateShareLinkResponse struct { string `json:"type"` Scope string `json:"scope"` WebURL string `json:"webUrl"` Application struct { ID string `json:"id"` DisplayName string `json:"displayName"` } `json:"application"` } `json:"link"` }Type
CreateShareLinkResponse is the response from CreateShareLinkRequest
type CreateUploadRequest ¶
type CreateUploadRequest struct {
Item SetFileSystemInfo `json:"item"`
}
CreateUploadRequest is used by CreateUploadSession to set the dates correctly
type CreateUploadResponse ¶
type CreateUploadResponse struct { UploadURL string `json:"uploadUrl"` // "https://sn3302.up.1drv.com/up/fe6987415ace7X4e1eF866337", ExpirationDateTime Timestamp `json:"expirationDateTime"` // "2015-01-29T09:21:55.523Z", NextExpectedRanges []string `json:"nextExpectedRanges"` // ["0-"] }
CreateUploadResponse is the response from creating an upload session
type DWorker ¶
type DWorker struct { HTTPCli *chttp.HttpClient CurDownload *DownloadInfo WorkStatus string WorkerID int AuthSve AuthService DownloadDir string Proxy bool // contains filtered or unexported fields }
DWorker download class
type DeletedFacet ¶
type DeletedFacet struct { }
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.
type DownloadInfo ¶
type DownloadInfo struct { URL string FileName string CurPosition int64 Size int64 Desc string Del int }
DownloadInfo show download info
type Drive ¶
type Drive struct { ID string `json:"id"` DriveType string `json:"driveType"` Owner IdentitySet `json:"owner"` Quota Quota `json:"quota"` }
Drive is a representation of a drive resource
type Error ¶
type Error struct { ErrorInfo struct { Code string `json:"code"` Message string `json:"message"` InnerError struct { Code string `json:"code"` } `json:"innererror"` } `json:"error"` }
Error is returned from one drive when things go wrong
type FileFacet ¶
type FileFacet struct { MimeType string `json:"mimeType"` // The MIME type for the file. This is determined by logic on the server and might not be the value provided when the file was uploaded. Hashes HashesType `json:"hashes"` // Hashes of the file's binary content, if available. }
FileFacet groups file-related data on OneDrive into a single structure.
type FileSystemInfoFacet ¶
type FileSystemInfoFacet struct { CreatedDateTime Timestamp `json:"createdDateTime"` // The UTC date and time the file was created on a client. LastModifiedDateTime Timestamp `json:"lastModifiedDateTime"` // The UTC date and time the file was last modified on a client. }
FileSystemInfoFacet contains properties that are reported by the device's local file system for the local version of an item. This facet can be used to specify the last modified date or created date of the item as it was on the local device.
type FolderFacet ¶
type FolderFacet struct {
ChildCount int64 `json:"childCount"` // Number of children contained immediately within this container.
}
FolderFacet groups folder-related data on OneDrive into a single structure
type HashesType ¶
type HashesType struct { Sha1Hash string `json:"sha1Hash"` // hex encoded SHA1 hash for the contents of the file (if available) Crc32Hash string `json:"crc32Hash"` // hex encoded CRC32 value of the file (if available) QuickXorHash string `json:"quickXorHash"` // base64 encoded QuickXorHash value of the file (if available) }
HashesType groups different types of hashes into a single structure, for an item on OneDrive.
type Identity ¶
Identity represents an identity of an actor. For example, and actor can be a user, device, or application.
type IdentitySet ¶
type IdentitySet struct { User Identity `json:"user"` Application Identity `json:"application"` Device Identity `json:"device"` }
IdentitySet 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.
type Item ¶
type Item struct { ID string `json:"id"` // The unique identifier of the item within the Drive. Read-only. Name string `json:"name"` // The name of the item (filename and extension). Read-write. ETag string `json:"eTag"` // eTag for the entire item (metadata + content). Read-only. CTag string `json:"cTag"` // An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Read-only. CreatedBy IdentitySet `json:"createdBy"` // Identity of the user, device, and application which created the item. Read-only. LastModifiedBy IdentitySet `json:"lastModifiedBy"` // Identity of the user, device, and application which last modified the item. Read-only. CreatedDateTime Timestamp `json:"createdDateTime"` // Date and time of item creation. Read-only. LastModifiedDateTime Timestamp `json:"lastModifiedDateTime"` // Date and time the item was last modified. Read-only. Size int64 `json:"size"` // Size of the item in bytes. Read-only. ParentReference *ItemReference `json:"parentReference"` // Parent information, if the item has a parent. Read-write. WebURL string `json:"webUrl"` // URL that displays the resource in the browser. Read-only. Description string `json:"description"` // Provide a user-visible description of the item. Read-write. DownloadURL string `json:"@microsoft.graph.downloadUrl"` // Provide a download url Folder *FolderFacet `json:"folder"` // Folder metadata, if the item is a folder. Read-only. File *FileFacet `json:"file"` // File metadata, if the item is a file. Read-only. RemoteItem *RemoteItemFacet `json:"remoteItem"` // Remote Item metadata, if the item is a remote shared item. Read-only. FileSystemInfo *FileSystemInfoFacet `json:"fileSystemInfo"` // File system information on client. Read-write. // Image *ImageFacet `json:"image"` // Image metadata, if the item is an image. Read-only. // Photo *PhotoFacet `json:"photo"` // Photo metadata, if the item is a photo. Read-only. // Audio *AudioFacet `json:"audio"` // Audio metadata, if the item is an audio file. Read-only. // Video *VideoFacet `json:"video"` // Video metadata, if the item is a video. Read-only. // Location *LocationFacet `json:"location"` // Location metadata, if the item has location data. Read-only. Package *PackageFacet `json:"package"` // If present, indicates that this item is a package instead of a folder or file. Packages are treated like files in some contexts and folders in others. Read-only. Deleted *DeletedFacet `json:"deleted"` // Information about the deleted state of the item. Read-only. }
Item represents metadata for an item in OneDrive
func (*Item) GetCreatedBy ¶
func (i *Item) GetCreatedBy() IdentitySet
GetCreatedBy returns a normalized CreatedBy of the item
func (*Item) GetCreatedDateTime ¶
GetCreatedDateTime returns a normalized CreatedDateTime of the item
func (*Item) GetDriveID ¶
GetDriveID returns a normalized ParentReference of the item
func (*Item) GetFileSystemInfo ¶
func (i *Item) GetFileSystemInfo() *FileSystemInfoFacet
GetFileSystemInfo returns a normalized FileSystemInfo of the item
func (*Item) GetFolder ¶
func (i *Item) GetFolder() *FolderFacet
GetFolder returns a normalized Folder of the item
func (*Item) GetID ¶
GetID returns a normalized ID of the item If DriveID is known it will be prefixed to the ID with # separator Can be parsed using onedrive.parseNormalizedID(normalizedID)
func (*Item) GetLastModifiedBy ¶
func (i *Item) GetLastModifiedBy() IdentitySet
GetLastModifiedBy returns a normalized LastModifiedBy of the item
func (*Item) GetLastModifiedDateTime ¶
GetLastModifiedDateTime returns a normalized LastModifiedDateTime of the item
func (*Item) GetPackage ¶
func (i *Item) GetPackage() *PackageFacet
GetPackage returns a normalized Package of the item
func (*Item) GetPackageType ¶
GetPackageType returns the package type of the item if available, otherwise ""
func (*Item) GetParentReference ¶
func (i *Item) GetParentReference() *ItemReference
GetParentReference returns a normalized ParentReference of the item
type ItemReference ¶
type ItemReference struct { DriveID string `json:"driveId"` // Unique identifier for the Drive that contains the item. Read-only. ID string `json:"id"` // Unique identifier for the item. Read/Write. Path string `json:"path"` // Path that used to navigate to the item. Read/Write. DriveType string `json:"driveType"` // Type of the drive, Read-Only }
ItemReference groups data needed to reference a OneDrive item across the service into a single structure.
type LastModifiedBy ¶
type LastModifiedBy struct {
User User `json:"user"`
}
LastModifiedBy for each version
type ListChildrenResponse ¶
type ListChildrenResponse struct { Value []Item `json:"value"` // An array of Item objects NextLink string `json:"@odata.nextLink"` // A URL to retrieve the next available page of items. }
ListChildrenResponse is the response to the list children method
type LocalFileUploadTask ¶
type LocalFileUploadTask struct {
// contains filtered or unexported fields
}
func (*LocalFileUploadTask) Close ¶
func (task *LocalFileUploadTask) Close() error
func (*LocalFileUploadTask) Init ¶
func (task *LocalFileUploadTask) Init() error
func (*LocalFileUploadTask) Name ¶
func (task *LocalFileUploadTask) Name() string
func (*LocalFileUploadTask) Open ¶
func (task *LocalFileUploadTask) Open() error
func (*LocalFileUploadTask) Parent ¶
func (task *LocalFileUploadTask) Parent() string
func (*LocalFileUploadTask) SeekPosition ¶
func (task *LocalFileUploadTask) SeekPosition(position int64) error
func (*LocalFileUploadTask) Size ¶
func (task *LocalFileUploadTask) Size() int64
type MoveItemRequest ¶
type MoveItemRequest struct { ParentReference *ItemReference `json:"parentReference,omitempty"` // Reference to the destination parent directory Name string `json:"name,omitempty"` // Optional The new name for the file. If this isn't provided, the same name will be used as the original. FileSystemInfo *FileSystemInfoFacet `json:"fileSystemInfo,omitempty"` // File system information on client. Read-write. }
MoveItemRequest is the request to copy an item object
Note: The parentReference should include either an id or path but not both. If both are included, they need to reference the same item or an error will occur.
type OneClient ¶
type OneClient struct { HTTPClient *chttp.HttpClient SSOHost string APIHost string UserName string ConfigFile string Token *AuthToken CurDriveID string }
OneClient is context object
func NewDefaultCli ¶
NewDefaultCli new a default oneshow client
func NewOneClientUser ¶ added in v0.2.0
func (*OneClient) APICreateUploadSession ¶
func (cli *OneClient) APICreateUploadSession(driveID string, path string) (*UploadURLResult, error)
func (*OneClient) APIDelFile ¶
APIDelFile delete file by file path
func (*OneClient) APIDelFileByItemID ¶
APIDelFileByItemID delete file by item ID
func (*OneClient) APIGetFile ¶
APIGetFile get a file by file path
func (*OneClient) APIGetFileByID ¶
func (*OneClient) APIGetMeDrive ¶
APIGetMeDrive get onedrive infomation
func (*OneClient) APIGetUploadFileInfo ¶
func (cli *OneClient) APIGetUploadFileInfo(URL string) (*UploadURLResult, error)
func (*OneClient) APIGetUserInfo ¶
func (cli *OneClient) APIGetUserInfo()
APIGetUserInfo get user info from api
func (*OneClient) APIListFilesByPath ¶
func (cli *OneClient) APIListFilesByPath(driveID string, path string) (*ListChildrenResponse, error)
func (*OneClient) APIListFilesByPath0 ¶ added in v1.0.1
func (cli *OneClient) APIListFilesByPath0(driveID string, path string) (*ListChildrenResponse, error)
APIListFilesByPath get files by path
func (*OneClient) APISearchByKey ¶
func (cli *OneClient) APISearchByKey(driveID string, key string) (*ListChildrenResponse, error)
APISearchByKey search files by Key
func (*OneClient) APIUpdateFileByItemID ¶
func (cli *OneClient) APIUpdateFileByItemID(driveID string, itemID string, newName string, newPathID string) (bool, error)
APIDelFileByItemID delete file by item ID
func (*OneClient) APIUploadFilePart ¶
func (*OneClient) APIUploadSourcePart ¶
func (*OneClient) APIUploadText ¶
APIUploadText upload a text
func (*OneClient) DoAutoForNewUser ¶
func (cli *OneClient) DoAutoForNewUser()
DoAutoForNewUser config a new user
func (*OneClient) GetAuthCodeURL ¶
GetAuthCodeURL gen an URL for get auto code from API
func (*OneClient) GetFirstToken ¶
GetFirstToken get token and reflesh token by code
func (*OneClient) GetOneDriveAppInfo ¶
GetOneDriveAppInfo setup application information
func (*OneClient) GetOneDriveAppInfoWithSecret ¶
GetOneDriveAppInfoWithSecret with secret info
func (*OneClient) GetTokenHeader ¶
GetTokenHeader for other client
func (*OneClient) SaveToken2Home ¶ added in v0.2.0
SaveToken2Home home
func (*OneClient) SaveToken2HomeDefault ¶
SaveToken2Home save token to local
func (*OneClient) SaveToken2UserConfig ¶
SaveToken2Home save token to local
func (*OneClient) SetOneDriveAPIToken ¶
SetOneDriveAPIToken for http request setup a token
func (*OneClient) UpdateToken ¶
UpdateToken update expried token
func (*OneClient) UploadBigFile ¶
func (*OneClient) UploadSource ¶
type OneFile ¶
type OneFile struct { Client *OneClient Fs *OneFileSystem FullPath string Position int64 //Buff *bytes.Buffer RemoteIn io.ReadCloser // contains filtered or unexported fields }
OneFile onedrive file for webdav
type OneFileSystem ¶
OneFileSystem onedrive file system for webdav
func (*OneFileSystem) CacheItem ¶
func (fs *OneFileSystem) CacheItem(name string, item *Item) *OneFile
CacheItem cache item Object
func (*OneFileSystem) OpenFile ¶
func (fs *OneFileSystem) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
OpenFile create or write or read file
func (*OneFileSystem) RemoveAll ¶
func (fs *OneFileSystem) RemoveAll(ctx context.Context, name string) error
RemoveAll Move files and directories to the recycle bin
type OneShowConfig ¶
type OneShowConfig struct { AcceleratedAPI string `json:"accelerated_api"` Acceleration bool `json:"acceleration"` Client_ID string `json:"client_id"` ClientSecret string `json:"client_secret"` Scope string `json:"scope"` RedirectURL string `json:"redirect_uri"` }
oneshow application config
var OneshowConfig *OneShowConfig
OneshowConfig load .oneshow.json config file
type PackageFacet ¶
type PackageFacet struct {
Type string `json:"type"`
}
PackageFacet indicates that a DriveItem is the top level item in a "package" or a collection of items that should be treated as a collection instead of individual items. `oneNote` is the only currently defined value.
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"` // normal | nearing | critical | exceeded }
Quota groups storage space quota-related information on OneDrive into a single structure.
type RemoteItemFacet ¶
type RemoteItemFacet struct { ID string `json:"id"` // The unique identifier of the item within the remote Drive. Read-only. Name string `json:"name"` // The name of the item (filename and extension). Read-write. CreatedBy IdentitySet `json:"createdBy"` // Identity of the user, device, and application which created the item. Read-only. LastModifiedBy IdentitySet `json:"lastModifiedBy"` // Identity of the user, device, and application which last modified the item. Read-only. CreatedDateTime Timestamp `json:"createdDateTime"` // Date and time of item creation. Read-only. LastModifiedDateTime Timestamp `json:"lastModifiedDateTime"` // Date and time the item was last modified. Read-only. Folder *FolderFacet `json:"folder"` // Folder metadata, if the item is a folder. Read-only. File *FileFacet `json:"file"` // File metadata, if the item is a file. Read-only. Package *PackageFacet `json:"package"` // If present, indicates that this item is a package instead of a folder or file. Packages are treated like files in some contexts and folders in others. Read-only. FileSystemInfo *FileSystemInfoFacet `json:"fileSystemInfo"` // File system information on client. Read-write. ParentReference *ItemReference `json:"parentReference"` // Parent information, if the item has a parent. Read-write. Size int64 `json:"size"` // Size of the item in bytes. Read-only. WebURL string `json:"webUrl"` // URL that displays the resource in the browser. Read-only. }
RemoteItemFacet groups data needed to reference a OneDrive remote item
type SetFileSystemInfo ¶
type SetFileSystemInfo struct {
FileSystemInfo FileSystemInfoFacet `json:"fileSystemInfo"` // File system information on client. Read-write.
}
SetFileSystemInfo is used to Update an object's FileSystemInfo.
type Timestamp ¶
Timestamp represents represents date and time information for the OneDrive API, by using ISO 8601 and is always in UTC time.
func (*Timestamp) MarshalJSON ¶
MarshalJSON turns a Timestamp into JSON (in UTC)
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON turns JSON into a Timestamp
type URLUploadTask ¶
type URLUploadTask struct { FileName string URL string FileSize int64 CurPosition int64 HTTPClient *chttp.HttpClient }
func (*URLUploadTask) Close ¶
func (task *URLUploadTask) Close() error
func (*URLUploadTask) Init ¶
func (task *URLUploadTask) Init() error
func (*URLUploadTask) Name ¶
func (task *URLUploadTask) Name() string
func (*URLUploadTask) Open ¶
func (task *URLUploadTask) Open() error
func (*URLUploadTask) Parent ¶
func (task *URLUploadTask) Parent() string
func (*URLUploadTask) SeekPosition ¶
func (task *URLUploadTask) SeekPosition(position int64) error
func (*URLUploadTask) Size ¶
func (task *URLUploadTask) Size() int64
type UploadFragmentResponse ¶
type UploadFragmentResponse struct { ExpirationDateTime Timestamp `json:"expirationDateTime"` // "2015-01-29T09:21:55.523Z", NextExpectedRanges []string `json:"nextExpectedRanges"` // ["0-"] }
UploadFragmentResponse is the response from uploading a fragment
type UploadTask ¶
type UploadURLResult ¶
type UploadURLResult struct { UploadURL string `json:"uploadUrl"` ExpirationDateTime Timestamp `json:"expirationDateTime"` NextExpectedRanges []string `json:"nextExpectedRanges"` }
AuthError is error type
type User ¶
type User struct { Email string `json:"email"` ID string `json:"id"` DisplayName string `json:"displayName"` }
User details for each version
type Version ¶
type Version struct { ID string `json:"id"` LastModifiedDateTime time.Time `json:"lastModifiedDateTime"` Size int `json:"size"` LastModifiedBy LastModifiedBy `json:"lastModifiedBy"` }
Version info
type VersionsResponse ¶
type VersionsResponse struct {
Versions []Version `json:"value"`
}
VersionsResponse is returned from /versions
type ViewDeltaResponse ¶
type ViewDeltaResponse struct { Value []Item `json:"value"` // An array of Item objects which have been created, modified, or deleted. NextLink string `json:"@odata.nextLink"` // A URL to retrieve the next available page of changes. DeltaLink string `json:"@odata.deltaLink"` // A URL returned instead of @odata.nextLink after all current changes have been returned. Used to read the next set of changes in the future. DeltaToken string `json:"@delta.token"` // A token value that can be used in the query string on manually-crafted calls to view.delta. Not needed if you're using nextLink and deltaLink. }
ViewDeltaResponse is the response to the view delta method