github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/registry/regclient/follow.go (about) 1 package regclient 2 3 import ( 4 "context" 5 6 "github.com/qri-io/dataset" 7 qhttp "github.com/qri-io/qri/lib/http" 8 "github.com/qri-io/qri/registry" 9 ) 10 11 // GetFollowing returns a list of datasets a user follows from the registry 12 func (c Client) GetFollowing(ctx context.Context, p *registry.FollowGetParams) ([]*dataset.Dataset, error) { 13 if c.httpClient == nil { 14 return nil, ErrNoRegistry 15 } 16 17 results := []*dataset.Dataset{} 18 err := c.httpClient.Call(ctx, qhttp.AERegistryGetFollowing, "", p, results) 19 if err != nil { 20 return nil, err 21 } 22 return results, nil 23 } 24 25 // Follow updates the users follow status for a datasets on the registry 26 func (c Client) Follow(ctx context.Context, p *registry.FollowParams) error { 27 if c.httpClient == nil { 28 return ErrNoRegistry 29 } 30 return c.httpClient.Call(ctx, qhttp.AERegistryFollow, "", p, nil) 31 }