mock

package
v0.0.0-...-880cb89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriveItemFileName = "fnords.txt"
	DriveFileMetaData = `{"fileName": "` + DriveItemFileName + `"}`
)
View Source
const DriveFilePayloadData = `` /* 2937-byte string literal not displayed */

Variables

This section is empty.

Functions

func FileRespReadCloser

func FileRespReadCloser(pl string) io.ReadCloser

func FileRespWithExtensions

func FileRespWithExtensions(pl string, extData *details.ExtensionData) io.ReadCloser

Types

type BackupHandler

type BackupHandler[T any] struct {
	ItemInfo details.ItemInfo
	// FIXME: this is a hacky solution.  Better to use an interface
	// and plug in the selector scope there.
	Sel selectors.Selector

	DriveItemEnumeration EnumerateDriveItemsDelta

	GI  GetsItem
	GIP GetsItemPermission

	PathPrefixFn  pathPrefixer
	PathPrefixErr error

	MetadataPathPrefixFn  metadataPathPrefixer
	MetadataPathPrefixErr error

	CanonPathFn  canonPather
	CanonPathErr error

	ProtectedResource idname.Provider
	Service           path.ServiceType
	Category          path.CategoryType

	// driveID -> itemPager
	ItemPagerV map[string]pagers.DeltaHandler[models.DriveItemable]

	LocationIDFn locationIDer

	GetResps []*http.Response
	GetErrs  []error

	RootFolder models.DriveItemable
	// contains filtered or unexported fields
}

func DefaultDriveBHWith

func DefaultDriveBHWith(
	resource string,
	enumerator EnumerateDriveItemsDelta,
) *BackupHandler[models.DriveItemable]

func DefaultOneDriveBH

func DefaultOneDriveBH(resourceOwner string) *BackupHandler[models.DriveItemable]

func DefaultSharePointBH

func DefaultSharePointBH(resourceOwner string) *BackupHandler[models.DriveItemable]

func (BackupHandler[T]) AugmentItemInfo

func (BackupHandler[T]) CanonicalPath

func (h BackupHandler[T]) CanonicalPath(pb *path.Builder, tID string) (path.Path, error)

func (BackupHandler[T]) EnumerateDriveItemsDelta

func (h BackupHandler[T]) EnumerateDriveItemsDelta(
	ctx context.Context,
	driveID, prevDeltaLink string,
	cc api.CallConfig,
) pagers.NextPageResulter[models.DriveItemable]

func (BackupHandler[T]) FormatDisplayPath

func (h BackupHandler[T]) FormatDisplayPath(_ string, pb *path.Builder) string

func (*BackupHandler[T]) Get

func (BackupHandler[T]) GetItem

func (h BackupHandler[T]) GetItem(ctx context.Context, _, _ string) (models.DriveItemable, error)

func (BackupHandler[T]) GetItemPermission

func (h BackupHandler[T]) GetItemPermission(
	ctx context.Context,
	_, _ string,
) (models.PermissionCollectionResponseable, error)

func (BackupHandler[T]) GetRootFolder

func (h BackupHandler[T]) GetRootFolder(context.Context, string) (models.DriveItemable, error)

func (BackupHandler[T]) IncludesDir

func (h BackupHandler[T]) IncludesDir(dir string) bool

func (BackupHandler[T]) IsAllPass

func (h BackupHandler[T]) IsAllPass() bool

func (BackupHandler[T]) MetadataPathPrefix

func (h BackupHandler[T]) MetadataPathPrefix(tID string) (path.Path, error)

func (BackupHandler[T]) NewDrivePager

func (BackupHandler[T]) NewLocationIDer

func (h BackupHandler[T]) NewLocationIDer(driveID string, elems ...string) details.LocationIDer

func (BackupHandler[T]) PathPrefix

func (h BackupHandler[T]) PathPrefix(tID, driveID string) (path.Path, error)

func (BackupHandler[T]) ServiceCat

func (h BackupHandler[T]) ServiceCat() (path.ServiceType, path.CategoryType)

type DeltaDrive

type DeltaDrive struct {
	ID   string
	Able models.Driveable
}

func Drive

func Drive(driveSuffix ...any) *DeltaDrive

func (*DeltaDrive) NewEnumer

func (dd *DeltaDrive) NewEnumer() *DeltaDriveEnumerator

type DeltaDriveEnumerator

type DeltaDriveEnumerator struct {
	Drive *DeltaDrive

	DeltaQueries []*DeltaQuery
	Err          error
	// contains filtered or unexported fields
}

func (*DeltaDriveEnumerator) With

func (*DeltaDriveEnumerator) WithErr

func (dde *DeltaDriveEnumerator) WithErr(err error) *DeltaDriveEnumerator

WithErr adds an error that is always returned in the last delta index.

type DeltaQuery

type DeltaQuery struct {
	Pages       []NextPage
	DeltaUpdate pagers.DeltaUpdate
	Err         error
	// contains filtered or unexported fields
}

func Delta

func Delta(
	resultDeltaID string,
	err error,
) *DeltaQuery

func DeltaWReset

func DeltaWReset(
	resultDeltaID string,
	err error,
) *DeltaQuery

func (*DeltaQuery) Cancel

func (dq *DeltaQuery) Cancel()

func (*DeltaQuery) NextPage

func (dq *DeltaQuery) NextPage() ([]models.DriveItemable, bool, bool)

func (*DeltaQuery) Results

func (dq *DeltaQuery) Results() (pagers.DeltaUpdate, error)

func (*DeltaQuery) With

func (dq *DeltaQuery) With(
	pages ...NextPage,
) *DeltaQuery

type EnumerateDriveItemsDelta

type EnumerateDriveItemsDelta struct {
	DrivePagers map[string]*DeltaDriveEnumerator
}

func DriveEnumerator

func DriveEnumerator(
	ds ...*DeltaDriveEnumerator,
) EnumerateDriveItemsDelta

func (EnumerateDriveItemsDelta) DrivePager

func (EnumerateDriveItemsDelta) Drives

func (en EnumerateDriveItemsDelta) Drives() []*DeltaDrive

func (EnumerateDriveItemsDelta) EnumerateDriveItemsDelta

func (en EnumerateDriveItemsDelta) EnumerateDriveItemsDelta(
	_ context.Context,
	driveID, _ string,
	_ api.CallConfig,
) pagers.NextPageResulter[models.DriveItemable]

type FetchItemByName

type FetchItemByName struct {
	Item data.Item
	Err  error
}

func (FetchItemByName) FetchItemByName

func (f FetchItemByName) FetchItemByName(context.Context, string) (data.Item, error)

type GetsItem

type GetsItem struct {
	Item models.DriveItemable
	Err  error
}

func (GetsItem) GetItem

func (m GetsItem) GetItem(
	_ context.Context,
	_, _ string,
) (models.DriveItemable, error)

type GetsItemPermission

type GetsItemPermission struct {
	Perm models.PermissionCollectionResponseable
	Err  error
}

func (GetsItemPermission) GetItemPermission

type NextPage

type NextPage struct {
	Items []models.DriveItemable
	Reset bool
}

type RestoreHandler

type RestoreHandler struct {
	ItemInfo details.ItemInfo

	CollisionKeyMap map[string]api.DriveItemIDType

	CalledDeleteItem   bool
	CalledDeleteItemOn string
	DeleteItemErr      error

	CalledPostItem bool
	PostItemResp   models.DriveItemable
	PostItemErr    error

	DrivePagerV pagers.NonDeltaHandler[models.Driveable]

	PostDriveResp models.Driveable
	PostDriveErr  error

	UploadSessionErr error
}

func (*RestoreHandler) AugmentItemInfo

func (*RestoreHandler) DeleteItem

func (h *RestoreHandler) DeleteItem(
	_ context.Context,
	_, itemID string,
) error

func (*RestoreHandler) DeleteItemPermission

func (h *RestoreHandler) DeleteItemPermission(
	context.Context,
	string, string, string,
) error

func (*RestoreHandler) GetFolderByName

func (*RestoreHandler) GetItemsInContainerByCollisionKey

func (h *RestoreHandler) GetItemsInContainerByCollisionKey(
	context.Context,
	string, string,
) (map[string]api.DriveItemIDType, error)

func (*RestoreHandler) GetRootFolder

func (h *RestoreHandler) GetRootFolder(
	context.Context,
	string,
) (models.DriveItemable, error)

func (RestoreHandler) NewDrivePager

func (*RestoreHandler) NewItemContentUpload

func (h *RestoreHandler) NewItemContentUpload(
	context.Context,
	string, string,
) (models.UploadSessionable, error)

func (RestoreHandler) PostDrive

func (h RestoreHandler) PostDrive(
	ctx context.Context,
	protectedResourceID, driveName string,
) (models.Driveable, error)

func (*RestoreHandler) PostItemLinkShareUpdate

func (h *RestoreHandler) PostItemLinkShareUpdate(
	ctx context.Context,
	driveID, itemID string,
	body *drives.ItemItemsItemCreateLinkPostRequestBody,
) (models.Permissionable, error)

Jump to

Keyboard shortcuts

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