feat: expand readwise example

This commit is contained in:
Alexander Navarro 2024-12-02 10:33:53 -03:00
parent 8f424d45f7
commit 5d00b7c336
3 changed files with 192 additions and 45 deletions

View file

@ -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() {