client

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound is returned when the object is not found or the iterator has reached the end.

Functions

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 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) *Client

New returns a new ActivityPub client.

func (*Client) GetActor

func (c *Client) GetActor(actorIRI *url.URL) (*vocab.ActorType, error)

GetActor retrieves the actor at the given IRI.

func (*Client) GetPublicKey

func (c *Client) GetPublicKey(keyIRI *url.URL) (*vocab.PublicKeyType, error)

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 Config added in v0.1.3

type Config struct {
	CacheSize       int
	CacheExpiration time.Duration
}

Config contains configuration parameters for the client.

type ReferenceIterator

type ReferenceIterator interface {
	Next() (*url.URL, error)
	TotalItems() int
}

ReferenceIterator iterates over all of the references in a result set.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL