Documentation ¶
Index ¶
- Variables
- func ReadActivities(it ActivityIterator, maxItems int) ([]*vocab.ActivityType, error)
- func ReadReferences(it ReferenceIterator, maxItems int) ([]*url.URL, error)
- type ActivityIterator
- type Client
- func (c *Client) GetActivities(iri *url.URL, order Order) (ActivityIterator, error)
- func (c *Client) GetActor(actorIRI *url.URL) (*vocab.ActorType, error)
- func (c *Client) GetPublicKey(keyIRI *url.URL) (*vocab.PublicKeyType, error)
- func (c *Client) GetReferences(iri *url.URL) (ReferenceIterator, error)
- type Config
- type Order
- type ReferenceIterator
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = fmt.Errorf("not found")
ErrNotFound is returned when the object is not found or the iterator has reached the end.
Functions ¶
func ReadActivities ¶
func ReadActivities(it ActivityIterator, maxItems int) ([]*vocab.ActivityType, error)
ReadActivities reads the activities from the given iterator up to a maximum number specified by maxItems. If maxItems <= 0 then all activities are read.
func ReadReferences ¶
func ReadReferences(it ReferenceIterator, maxItems int) ([]*url.URL, error)
ReadReferences reads the references from the given iterator up to a maximum number specified by maxItems. If maxItems <= 0 then all references are read.
Types ¶
type ActivityIterator ¶
type ActivityIterator interface { // Next returns the next activity or the ErrNotFound error if no more items are available. Next() (*vocab.ActivityType, error) // NextPage advances to the next page. If there are no more pages then an ErrNotFound error is returned. NextPage() (*url.URL, error) // SetNextIndex sets the index of the next activity within the current page that Next will return. SetNextIndex(int) // TotalItems returns the total number of items available at the moment the iterator was created. // This value remains constant throughout the lifetime of the iterator. TotalItems() int // CurrentPage returns the ID of the current page that the iterator is processing. CurrentPage() *url.URL // NextIndex returns the next index of the current page that will be processed. This function does not // advance the iterator. NextIndex() int }
ActivityIterator iterates over the activities in a result set.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements an ActivityPub client which retrieves ActivityPub objects (such as actors, activities, and collections) from remote sources.
func New ¶
func New(cfg Config, t httpTransport, fetchPublicKey verifiable.PublicKeyFetcher, resolver serviceResolver) *Client
New returns a new ActivityPub client.
func (*Client) GetActivities ¶
GetActivities returns an iterator that reads activities at the given IRI. The IRI may reference a Collection, OrderedCollection, CollectionPage, or OrderedCollectionPage.
func (*Client) GetPublicKey ¶
GetPublicKey retrieves the public key at the given IRI.
func (*Client) GetReferences ¶
func (c *Client) GetReferences(iri *url.URL) (ReferenceIterator, error)
GetReferences returns an iterator that reads all references at the given IRI. The IRI either resolves to an ActivityPub actor, collection or ordered collection.
type Order ¶
type Order string
Order is the order in which activities are returned.
const ( // Forward indicates that activities should be returned in the same order that they were retrieved // from the REST endpoint. Forward Order = "forward" // Reverse indicates that activities should be returned in reverse order that they were retrieved // from the REST endpoint.. Reverse Order = "reverse" )