onedrive

package
v0.0.0-...-16924cb Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AuthUrl string = "https://login.microsoftonline.com/%s/oauth2/v2.0/authorize"
View Source
const RootUrl string = "https://graph.microsoft.com/v1.0"
View Source
const TokenUrl string = "https://login.microsoftonline.com/%s/oauth2/v2.0/token"

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchReq

type BatchReq struct {
	Id     string `json:"id"`
	Method string `json:"method"`
	Url    string `json:"url"`
	Dep    string `json:"dependsOn,omitempty"`
}

type BatchResp

type BatchResp struct {
	Id      string            `json:"id"`
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
	Body    string            `json:"body"`
}

type GraphClient

type GraphClient struct {
	Config *OneDrive
	*http.Client
	// contains filtered or unexported fields
}

func NewExistedGraphClient

func NewExistedGraphClient(onedrive *OneDrive, ctx context.Context) *GraphClient

func NewGraphClient

func NewGraphClient(clientId string, clientSecret string, tenant string, ctx context.Context) (*GraphClient, error)

func (*GraphClient) BatchDo

func (client *GraphClient) BatchDo(reqs []BatchReq) ([]BatchResp, error)

func (*GraphClient) CreateFolder

func (client *GraphClient) CreateFolder(parentId, name string) (*DriveItem, error)

func (*GraphClient) CreateFolderRecursive

func (client *GraphClient) CreateFolderRecursive(path string) (*DriveItem, error)

func (*GraphClient) DeleteItem

func (client *GraphClient) DeleteItem(itemId string) error

func (*GraphClient) Do

func (client *GraphClient) Do(req *http.Request) (*http.Response, error)

func (*GraphClient) DownloadFile

func (client *GraphClient) DownloadFile(itemId string) ([]byte, error)

func (*GraphClient) GetDrive

func (client *GraphClient) GetDrive() (*[]Drive, error)

func (*GraphClient) GetItem

func (client *GraphClient) GetItem(path, filename string) (*DriveItem, error)

func (*GraphClient) ListAllFiles

func (client *GraphClient) ListAllFiles(root string, length int) ([]DriveItem, error)

func (*GraphClient) ListFiles

func (client *GraphClient) ListFiles(path string, length int, nextUrl string) (*[]DriveItem, error)
func (client *GraphClient) MakeShareLink(item string) (string, error)

func (*GraphClient) MoveItem

func (client *GraphClient) MoveItem(itemId, targetId string) error

func (*GraphClient) NewRequest

func (client *GraphClient) NewRequest(method, url string, data []byte) (*http.Request, error)

func (*GraphClient) NewRequestJson

func (client *GraphClient) NewRequestJson(method, url string, data interface{}) (*http.Request, error)

func (*GraphClient) NewRequestWithBuffer

func (client *GraphClient) NewRequestWithBuffer(method, url string, data io.Reader) (*http.Request, error)

func (*GraphClient) ReadData

func (client *GraphClient) ReadData(resp *http.Response) ([]byte, error)

func (*GraphClient) UploadFile

func (client *GraphClient) UploadFile(path string, filename string, data []byte) error

UploadFile limit: 4MB

func (*GraphClient) UploadLargeFile

func (client *GraphClient) UploadLargeFile(path, filename string, data []byte) error

Directories

Path Synopsis
Package quickxorhash provides the quickXorHash algorithm which is a quick, simple non-cryptographic hash algorithm that works by XORing the bytes in a circular-shifting fashion.
Package quickxorhash provides the quickXorHash algorithm which is a quick, simple non-cryptographic hash algorithm that works by XORing the bytes in a circular-shifting fashion.

Jump to

Keyboard shortcuts

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