onedrive

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSource

type ChangeSource struct {
	Source
}

ChangeSource is an IncrementalSource backed by the Microsoft Graph delta API. It embeds Source to reuse authentication, full Walk, GetFileStream, and metadata conversion.

func NewChangeSource

func NewChangeSource(ctx context.Context, opts ...Option) (*ChangeSource, error)

func (*ChangeSource) GetStartPageToken

func (s *ChangeSource) GetStartPageToken() (string, error)

GetStartPageToken returns the current head of the OneDrive delta stream by requesting a "latest" delta token. The returned string is a full deltaLink URL.

func (*ChangeSource) Info

func (s *ChangeSource) Info() source.SourceInfo

func (*ChangeSource) WalkChanges

func (s *ChangeSource) WalkChanges(ctx context.Context, token string, callback func(source.FileChange) error) (string, error)

WalkChanges iterates over all changes since the given delta token. Folder changes are emitted before file changes so that the engine can resolve parent references incrementally. Returns the new delta token for the next run.

type Option

type Option func(*oneDriveOptions)

Option configures a OneDrive source.

func WithClientID

func WithClientID(id string) Option

WithClientID sets the OAuth client ID. If empty, uses the built-in default.

func WithDriveName

func WithDriveName(name string) Option

WithDriveName sets the shared drive name.

func WithExcludePatterns

func WithExcludePatterns(patterns []string) Option

WithExcludePatterns sets the patterns used to exclude files and folders.

func WithLogger

func WithLogger(w io.Writer) Option

WithLogger sends this source's debug output to w.

Sources are constructed independently of a client, so a client's sink cannot reach them; this is how a caller supplies one (RFC 0022 §8).

func WithResolver

func WithResolver(r *secretref.Resolver) Option

WithResolver sets the secret resolver for ref-based auth.

func WithRootPath

func WithRootPath(path string) Option

WithRootPath sets the path to the root folder.

func WithTokenPath

func WithTokenPath(path string) Option

WithTokenPath sets the path where the OAuth token is cached.

func WithTokenRef

func WithTokenRef(ref string) Option

WithTokenRef sets the secret reference where the OAuth token is cached.

type Source

type Source struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, opts ...Option) (*Source, error)

New creates a new Source from the given config.

func (*Source) GetFileStream

func (s *Source) GetFileStream(fileID string) (io.ReadCloser, error)

func (*Source) Info

func (s *Source) Info() source.SourceInfo

func (*Source) Size

func (s *Source) Size(ctx context.Context) (*source.SourceSize, error)

Size returns the total storage usage for the OneDrive account by calling the /me/drive endpoint which includes quota information.

func (*Source) Walk

func (s *Source) Walk(ctx context.Context, callback func(source.FileMeta) error) error

Jump to

Keyboard shortcuts

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