rclone: github.com/ncw/rclone/backend/onedrive/api Index | Files

package api

import "github.com/ncw/rclone/backend/onedrive/api"

Index

Package Files

types.go

Constants

const (

    // PackageTypeOneNote is the package type value for OneNote files
    PackageTypeOneNote = "oneNote"
)

type AsyncOperationStatus Uses

type AsyncOperationStatus struct {
    PercentageComplete float64 `json:"percentageComplete"` // An 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"
}

AsyncOperationStatus provides information on the status of a asynchronous job progress.

The following API calls return AsyncOperationStatus resources:

Copy Item Upload From URL

type CopyItemRequest Uses

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 Uses

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 Uses

type CreateShareLinkRequest struct {
    Type  string `json:"type"`            //Link type in View, Edit or Embed
    Scope string `json:"scope,omitempty"` //Optional. Scope in anonymousi, organization
}

CreateShareLinkRequest is the request to create a sharing link Always Type:view and Scope:anonymous for public sharing

type CreateShareLinkResponse Uses

type CreateShareLinkResponse struct {
    ID    string   `json:"id"`
    Roles []string `json:"roles"`
    Link  struct {
        Type        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"`
}

CreateShareLinkResponse is the response from CreateShareLinkRequest

type CreateUploadRequest Uses

type CreateUploadRequest struct {
    Item SetFileSystemInfo `json:"item"`
}

CreateUploadRequest is used by CreateUploadSession to set the dates correctly

type CreateUploadResponse Uses

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 DeletedFacet Uses

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 Drive Uses

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 Uses

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

func (*Error) Error Uses

func (e *Error) Error() string

Error returns a string for the error and satisfies the error interface

type FileFacet Uses

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 Uses

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 Uses

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 Uses

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 Uses

type Identity struct {
    DisplayName string `json:"displayName"`
    ID          string `json:"id"`
}

Identity represents an identity of an actor. For example, and actor can be a user, device, or application.

type IdentitySet Uses

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 Uses

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.
    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 Uses

func (i *Item) GetCreatedBy() IdentitySet

GetCreatedBy returns a normalized CreatedBy of the item

func (*Item) GetCreatedDateTime Uses

func (i *Item) GetCreatedDateTime() Timestamp

GetCreatedDateTime returns a normalized CreatedDateTime of the item

func (*Item) GetDriveID Uses

func (i *Item) GetDriveID() string

GetDriveID returns a normalized ParentReference of the item

func (*Item) GetFile Uses

func (i *Item) GetFile() *FileFacet

GetFile returns a normalized File of the item

func (*Item) GetFileSystemInfo Uses

func (i *Item) GetFileSystemInfo() *FileSystemInfoFacet

GetFileSystemInfo returns a normalized FileSystemInfo of the item

func (*Item) GetFolder Uses

func (i *Item) GetFolder() *FolderFacet

GetFolder returns a normalized Folder of the item

func (*Item) GetID Uses

func (i *Item) GetID() string

GetID returns a normalized ID of the item If DriveID is known it will be prefixed to the ID with # seperator Can be parsed using onedrive.parseNormalizedID(normalizedID)

func (*Item) GetLastModifiedBy Uses

func (i *Item) GetLastModifiedBy() IdentitySet

GetLastModifiedBy returns a normalized LastModifiedBy of the item

func (*Item) GetLastModifiedDateTime Uses

func (i *Item) GetLastModifiedDateTime() Timestamp

GetLastModifiedDateTime returns a normalized LastModifiedDateTime of the item

func (*Item) GetName Uses

func (i *Item) GetName() string

GetName returns a normalized Name of the item

func (*Item) GetPackage Uses

func (i *Item) GetPackage() *PackageFacet

GetPackage returns a normalized Package of the item

func (*Item) GetPackageType Uses

func (i *Item) GetPackageType() string

GetPackageType returns the package type of the item if available, otherwise ""

func (*Item) GetParentReference Uses

func (i *Item) GetParentReference() *ItemReference

GetParentReference returns a normalized ParentReference of the item

func (*Item) GetSize Uses

func (i *Item) GetSize() int64

GetSize returns a normalized Size of the item

func (*Item) GetWebURL Uses

func (i *Item) GetWebURL() string

GetWebURL returns a normalized WebURL of the item

func (*Item) IsRemote Uses

func (i *Item) IsRemote() bool

IsRemote checks if item is a remote item

type ItemReference Uses

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 ListChildrenResponse Uses

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 MoveItemRequest Uses

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 PackageFacet Uses

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 Uses

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 Uses

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 Uses

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 Uses

type Timestamp time.Time

Timestamp represents represents date and time information for the OneDrive API, by using ISO 8601 and is always in UTC time.

func (*Timestamp) MarshalJSON Uses

func (t *Timestamp) MarshalJSON() (out []byte, err error)

MarshalJSON turns a Timestamp into JSON (in UTC)

func (*Timestamp) UnmarshalJSON Uses

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON turns JSON into a Timestamp

type UploadFragmentResponse Uses

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 ViewDeltaResponse Uses

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

Package api imports 2 packages (graph) and is imported by 1 packages. Updated 2019-03-29. Refresh now. Tools for package owners.