diff --git a/src/internal/connector/exchange_data_collection.go b/src/internal/connector/exchange_data_collection.go index 8e6fecd10..b27d78bde 100644 --- a/src/internal/connector/exchange_data_collection.go +++ b/src/internal/connector/exchange_data_collection.go @@ -1,12 +1,36 @@ package connector -// A DataStream provides an iterator to consume a -// collection of graph data of the same type (e.g. mail) -type DataStream interface{} +import "io" + +// A DataCollection represents a collection of data of the +// same type (e.g. mail) +type DataCollection interface { + // Returns either the next item in the collection or an error if one occurred. + // If not more items are available in the collection, returns (nil, nil). + NextItem() (DataStream, error) +} + +// DataStream represents a single item within a DataCollection +// that can be consumed as a stream +type DataStream interface { + // ToReader returns a reader for the data stream + ToReader() io.Reader + // Provides a unique identifier for this data + UUID() string +} // ExchangeDataCollection represents exchange mailbox -// data for a single user. It implements the DataStream -// interface which allows reading data in the collection +// data for a single user. +// +// It implements the DataCollection interface type ExchangeDataCollection struct { user string } + +// NextItem returns either the next item in the collection or an error if one occurred. +// If not more items are available in the collection, returns (nil, nil). +func (*ExchangeDataCollection) NextItem() (DataStream, error) { + // TODO: Return the next "to be read" item in the collection as a + // DataStream + return nil, nil +} diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index bff8f3f04..4fddda740 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -120,8 +120,8 @@ func (gc *GraphConnector) GetUsersIds() []string { return values } -// ExchangeDataStream returns a DataStream that the caller can -// use to stream mailbox data out for the specified user -func (gc *GraphConnector) ExchangeDataStream(user string) DataStream { +// ExchangeDataStream returns a DataCollection that the caller can +// use to read mailbox data out for the specified user +func (gc *GraphConnector) ExchangeDataCollection(user string) DataCollection { return &ExchangeDataCollection{user: user} }