onedrive_app

package
v4.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: AGPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeSiteID added in v4.2.10

func NormalizeSiteID(siteID string) string

NormalizeSiteID converts any accepted SharePoint site identifier into the form expected by the /sites/{site-id} segment.

Accepted inputs:

contoso.sharepoint.com,<siteGuid>,<webGuid>
contoso.sharepoint.com:/sites/<name> [/sites/<name>:]
https://contoso.sharepoint.com/sites/<name>
https://contoso.sharepoint.com            (site collection root)

Graph has two addressing forms: /sites/{hostname} for the root site of a host, and /sites/{hostname}:/{path}: for a site below it. Only the path form carries a colon, so an empty path must not produce one. A path-form identifier still has to be resolved to the comma form before it can be followed by /drive; see resolveSiteID.

Types

type Addition

type Addition struct {
	driver.RootPath
	Region             string `json:"region" type:"select" required:"true" options:"global,cn,us,de" default:"global"`
	ClientID           string `json:"client_id" required:"true"`
	ClientSecret       string `json:"client_secret" required:"true"`
	TenantID           string `json:"tenant_id"`
	Email              string `json:"email"`
	IsSharepoint       bool   `json:"is_sharepoint" default:"false" help:"Mount a SharePoint site's default document library instead of a user's OneDrive"`
	SiteID             string `` /* 199-byte string literal not displayed */
	ChunkSize          int64  `json:"chunk_size" type:"number" default:"5"`
	CustomHost         string `json:"custom_host" help:"Custom host for onedrive download link"`
	DisableDiskUsage   bool   `json:"disable_disk_usage" default:"false"`
	EnableDirectUpload bool   `json:"enable_direct_upload" default:"false" help:"Enable direct upload from client to OneDrive"`
}

type DriveResp added in v4.1.4

type DriveResp struct {
	ID        string `json:"id"`
	DriveType string `json:"driveType"`
	Quota     struct {
		Deleted   uint64 `json:"deleted"`
		Remaining int64  `json:"remaining"`
		State     string `json:"state"`
		Total     int64  `json:"total"`
		Used      int64  `json:"used"`
	} `json:"quota"`
}

type File

type File struct {
	Id                   string    `json:"id"`
	Name                 string    `json:"name"`
	Size                 int64     `json:"size"`
	LastModifiedDateTime time.Time `json:"lastModifiedDateTime"`
	Url                  string    `json:"@microsoft.graph.downloadUrl"`
	File                 *struct {
		MimeType string `json:"mimeType"`
	} `json:"file"`
	Thumbnails []struct {
		Medium struct {
			Url string `json:"url"`
		} `json:"medium"`
	} `json:"thumbnails"`
	ParentReference struct {
		DriveId string `json:"driveId"`
	} `json:"parentReference"`
}

type Files

type Files struct {
	Value    []File `json:"value"`
	NextLink string `json:"@odata.nextLink"`
}

type Host

type Host struct {
	Oauth string
	Api   string
}

type Object

type Object struct {
	model.ObjThumb
	ParentID string
}

type OnedriveAPP

type OnedriveAPP struct {
	model.Storage
	Addition
	AccessToken string
	// contains filtered or unexported fields
}

func (*OnedriveAPP) Config

func (d *OnedriveAPP) Config() driver.Config

func (*OnedriveAPP) Copy

func (d *OnedriveAPP) Copy(ctx context.Context, srcObj, dstDir model.Obj) error

func (*OnedriveAPP) Drop

func (d *OnedriveAPP) Drop(ctx context.Context) error

func (*OnedriveAPP) GetAddition

func (d *OnedriveAPP) GetAddition() driver.Additional

func (*OnedriveAPP) GetDetails added in v4.1.4

func (d *OnedriveAPP) GetDetails(ctx context.Context) (*model.StorageDetails, error)

func (*OnedriveAPP) GetDirectUploadInfo added in v4.1.7

func (d *OnedriveAPP) GetDirectUploadInfo(ctx context.Context, _ string, dstDir model.Obj, fileName string, _ int64) (any, error)

func (*OnedriveAPP) GetDirectUploadTools added in v4.1.7

func (d *OnedriveAPP) GetDirectUploadTools() []string

func (*OnedriveAPP) GetFile

func (d *OnedriveAPP) GetFile(path string) (*File, error)

func (*OnedriveAPP) GetMetaUrl

func (d *OnedriveAPP) GetMetaUrl(auth bool, path string) string

func (*OnedriveAPP) GetRoot

func (d *OnedriveAPP) GetRoot(ctx context.Context) (model.Obj, error)

func (*OnedriveAPP) Init

func (d *OnedriveAPP) Init(ctx context.Context) error
func (d *OnedriveAPP) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*OnedriveAPP) List

func (d *OnedriveAPP) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

func (*OnedriveAPP) MakeDir

func (d *OnedriveAPP) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error

func (*OnedriveAPP) Move

func (d *OnedriveAPP) Move(ctx context.Context, srcObj, dstDir model.Obj) error

func (*OnedriveAPP) Put

func (d *OnedriveAPP) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error

func (*OnedriveAPP) Remove

func (d *OnedriveAPP) Remove(ctx context.Context, obj model.Obj) error

func (*OnedriveAPP) Rename

func (d *OnedriveAPP) Rename(ctx context.Context, srcObj model.Obj, newName string) error

func (*OnedriveAPP) Request

func (d *OnedriveAPP) Request(url string, method string, callback base.ReqCallback, resp interface{}, noRetry ...bool) ([]byte, error)

type RespErr

type RespErr struct {
	Error struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type TokenErr

type TokenErr struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL