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:
parent
66b58fff03
commit
c4632cb152
54
src/internal/connector/sharepoint/collection.go
Normal file
54
src/internal/connector/sharepoint/collection.go
Normal 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
|
||||
}
|
||||
25
src/internal/connector/sharepoint/datacategory_string.go
Normal file
25
src/internal/connector/sharepoint/datacategory_string.go
Normal 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]]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user