generated from alecodes/base-template
feat: expand readwise example
This commit is contained in:
parent
8f424d45f7
commit
5d00b7c336
3 changed files with 192 additions and 45 deletions
|
|
@ -107,6 +107,7 @@ func (collection *Collection) FetchNodes(
|
|||
startPagination Pagination,
|
||||
poolConfig *WorkConfig,
|
||||
) error {
|
||||
fmt.Printf("Fetching nodes for Collection: %d - %v\n", collection.Id, collection.name)
|
||||
values, err := fetchWithPagination(ctx, poolConfig, fetcher, startPagination)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -13,6 +13,20 @@ type Platform struct {
|
|||
Collections []*Collection // Child nodes
|
||||
}
|
||||
|
||||
func (platform *Platform) AddCollection(
|
||||
name string,
|
||||
metadata, originalData []byte,
|
||||
) (*Collection, error) {
|
||||
collection, err := platform._conn.NewCollection(name, metadata, originalData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
platform.Collections = append(platform.Collections, collection)
|
||||
|
||||
return collection, nil
|
||||
}
|
||||
|
||||
func (platform *Platform) GetDefaultCollection() (*Collection, error) {
|
||||
for _, collection := range platform.Collections {
|
||||
if collection.IsDefault() {
|
||||
|
|
|
|||
Reference in a new issue