onedrive

package module
v0.0.0-...-7789b51 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 8 Imported by: 0

README

onedrive-sdk-go

OneDrive SDK for Golang

Still alpha

See examples/ folder for examples

TODO

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReauthRequired   = errors.New("re-authentication required")
	ErrAccessDenied     = errors.New("access denied")
	ErrRetryLater       = errors.New("retry later")
	ErrInvalidRequest   = errors.New("invalid request")
	ErrResourceNotFound = errors.New("resource not found")
	ErrConflict         = errors.New("conflict")
	ErrQuotaExceeded    = errors.New("quota exceeded")
)

Sentinel errors

Functions

func GetMyDrives

func GetMyDrives(client *http.Client) error

GetMyDrives retrieves the drives information.

func NewClient

func NewClient(ctx context.Context, oauthConfig *OAuthConfig, token OAuthToken, tokenRefreshCallback func(OAuthToken)) *http.Client

NewClient creates a new HTTP client with the given OAuth token.

func SetLogger

func SetLogger(l Logger)

SetLogger allows users of the SDK to set their own logger

func StartAuthentication

func StartAuthentication(
	ctx context.Context,
	oauthConfig *OAuthConfig,
) (authURL string, codeVerifier string, err error)

StartAuthentication initiates the OAuth authentication process.

Types

type DefaultLogger

type DefaultLogger struct{}

func (DefaultLogger) Debug

func (l DefaultLogger) Debug(v ...interface{})

The Debug method by default is empty

type Logger

type Logger interface {
	Debug(v ...interface{})
}

type OAuthConfig

type OAuthConfig oauth2.Config

OAuthConfig represents an OAuth2 Config.

func GetOauth2Config

func GetOauth2Config(clientID string) (context.Context, *OAuthConfig)

GetOauth2Config returns the OAuth2 configuration.

type OAuthToken

type OAuthToken oauth2.Token

OAuthToken represents an OAuth2 Token.

func CompleteAuthentication

func CompleteAuthentication(
	ctx context.Context,
	oauthConfig *OAuthConfig,
	code string,
	verifier string,
) (*OAuthToken, error)

CompleteAuthentication completes the OAuth authentication process.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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