sdk

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UploadSessionFileSizeLimit int = 4 * 1000 * 1000
	UploadSessionMultiple      int = 320 * 1024
	UploadSessionRangeSize     int = UploadSessionMultiple * 10
)
View Source
var (
	GraphURL = "https://graph.microsoft.com/v1.0/"
)

Functions

func IsHTTPStatusOK added in v0.4.1

func IsHTTPStatusOK(status int) bool

func UnmarshalJSON

func UnmarshalJSON(o interface{}, body []byte) error

Types

type Client

type Client struct {
	Config      *Config
	SecretStore *SecretStore
}

func CreateClient

func CreateClient(conf *Config) *Client

func (*Client) CreateDir

func (client *Client) CreateDir(path string) error

func (*Client) Delete

func (client *Client) Delete(path string) error

func (*Client) Download

func (client *Client) Download(sourceFilePath, targetFolder string) error

func (*Client) GetLoginURL

func (client *Client) GetLoginURL() string

func (*Client) Info added in v0.4.0

func (client *Client) Info(path string) (*DriveItem, error)

func (*Client) List

func (client *Client) List(path string) ([]*DriveItem, error)

func (*Client) Login

func (client *Client) Login() error

func (*Client) ReadSecretStore

func (client *Client) ReadSecretStore() error

func (*Client) RenewAccessToken

func (client *Client) RenewAccessToken() (*LoginRedeemCodeResponse, error)

func (*Client) ShouldRenewAccessToken

func (client *Client) ShouldRenewAccessToken() bool

func (*Client) UpdateSecretStore

func (client *Client) UpdateSecretStore(grant *LoginRedeemCodeResponse) error

func (*Client) Upload

func (client *Client) Upload(localFilePath, targetFolder string) error

type Config

type Config struct {
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	Scopes       []string `json:"scopes"`
	RedirectURL  string   `json:"redirect_uri"`
	SecretStore  string   `json:"secret_store"`
	Root         string   `json:"root"`
}

func ReadConfig

func ReadConfig(filename string) (*Config, error)

func ReadConfigData added in v0.4.3

func ReadConfigData(data []byte) (*Config, error)

type CreateFolderRequest

type CreateFolderRequest struct {
	Name             string           `json:"name"`
	Folder           FolderProperties `json:"folder"`
	ConflictBehavior string           `json:"@microsoft.graph.conflictBehavior"`
}

type DriveItem

type DriveItem struct {
	Name           string         `json:"name"`
	SizeBytes      int64          `json:"size"`
	File           FileItem       `json:"file"`
	Folder         FolderItem     `json:"folder"`
	FileSystemInfo FileSystemInfo `json:"fileSystemInfo"`
}

type EmptyStruct

type EmptyStruct struct{}

type FileHashes added in v0.4.0

type FileHashes struct {
	QuickXOR string `json:"quickXorHash"`
	SHA1     string `json:"sha1Hash"`
	SHA256   string `json:"sha256Hash"`
}

type FileItem

type FileItem struct {
	MimeType string     `json:"mimeType"`
	Hashes   FileHashes `json:"hashes"`
}

type FileSystemInfo added in v0.4.0

type FileSystemInfo struct {
	Created      time.Time `json:"createdDateTime"`
	LastModified time.Time `json:"lastModifiedDateTime"`
}

type FolderItem

type FolderItem struct {
	ChildCount int `json:"childCount"`
}

type FolderProperties

type FolderProperties struct {
}

type HTTPRequestParams

type HTTPRequestParams map[string]string

type ListResponse

type ListResponse struct {
	Items    []DriveItem `json:"value"`
	NextLink string      `json:"@odata.nextLink"`
}

type LoginRedeemCodeResponse

type LoginRedeemCodeResponse struct {
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type SecretStore

type SecretStore struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	Expiry       time.Time `json:"expiry"`
}

type UploadSessionResponse

type UploadSessionResponse struct {
	UploadURL string    `json:"uploadUrl"`
	Expiry    time.Time `json:"expirationDateTime"`
}

Jump to

Keyboard shortcuts

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