GC SharePoint Collection Framework (#1444)

## Description
Boilerplate for SharePoint collection 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
This commit is contained in:
Danny 2022-11-04 10:11:10 -04:00 committed by GitHub
parent 66b58fff03
commit c4632cb152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,54 @@
package sharepoint
import (
"io"
"github.com/alcionai/corso/src/internal/connector/graph"
"github.com/alcionai/corso/src/internal/connector/support"
"github.com/alcionai/corso/src/internal/data"
"github.com/alcionai/corso/src/pkg/path"
)
type DataCategory int
//go:generate stringer -type=DataCategory
const (
Unknown DataCategory = iota
List
Drive
)
var (
_ data.Collection = &Collection{}
_ data.Stream = &Item{}
)
type Collection struct {
data chan data.Stream
// folderPath indicates the hierarchy within the collection
folderPath path.Path
// M365 IDs of the items of this collection
service graph.Service
statusUpdater support.StatusUpdater
}
func (sc *Collection) FullPath() path.Path {
return sc.FullPath()
}
func (sc *Collection) Items() <-chan data.Stream {
return sc.data
}
type Item struct {
id string
data io.ReadCloser
}
func (sd *Item) UUID() string {
return sd.id
}
func (sd *Item) ToReader() io.ReadCloser {
return sd.data
}

View File

@ -0,0 +1,25 @@
// Code generated by "stringer -type=DataCategory"; DO NOT EDIT.
package sharepoint
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[Unknown-0]
_ = x[List-1]
_ = x[Drive-2]
}
const _DataCategory_name = "UnknownListDrive"
var _DataCategory_index = [...]uint8{0, 7, 11, 16}
func (i DataCategory) String() string {
if i < 0 || i >= DataCategory(len(_DataCategory_index)-1) {
return "DataCategory(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _DataCategory_name[_DataCategory_index[i]:_DataCategory_index[i+1]]
}