Documentation ¶
Overview ¶
Package regclient defines a client for interacting with a registry server
Index ¶
- Variables
- type Client
- func (c *Client) CreateProfile(p *registry.Profile, pk crypto.PrivKey) (*registry.Profile, error)
- func (c *Client) DeleteProfile(p *registry.Profile, privKey crypto.PrivKey) error
- func (c Client) GetProfile(p *registry.Profile) error
- func (c Client) GetReputation(id string) (*registry.ReputationResponse, error)
- func (c *Client) ProveProfileKey(p *registry.Profile, pk crypto.PrivKey) (*registry.Profile, error)
- func (c *Client) PutProfile(p *registry.Profile, privKey crypto.PrivKey) (*registry.Profile, error)
- func (c Client) Search(p *SearchParams) ([]*registry.Result, error)
- type Config
- type SearchFilter
- type SearchParams
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoRegistry indicates that no registry has been specified // all client methods MUST return ErrNoRegistry for all method calls // when config.Registry.Location is an empty string ErrNoRegistry = errors.New("registry: no registry specified") // ErrNoConnection indicates no path to the registry can be found ErrNoConnection = errors.New("registry: no connection") // ErrNotRegistered indicates this client is not registered ErrNotRegistered = errors.New("registry: not registered") // HTTPClient is hoisted here in case you'd like to use a different client instance // by default we just use http.DefaultClient HTTPClient = http.DefaultClient )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a registry configuration with methods for interacting with the configured registry
func (*Client) CreateProfile ¶
CreateProfile creates a user profile, associating a public key in the process
func (*Client) DeleteProfile ¶
DeleteProfile removes a profile from the registry
func (Client) GetProfile ¶
GetProfile fills in missing fields in p with registry data
func (Client) GetReputation ¶
func (c Client) GetReputation(id string) (*registry.ReputationResponse, error)
GetReputation gets the reputation of a profile using the ProfileID
func (*Client) ProveProfileKey ¶
ProveProfileKey associates a public key with a profile by proving this user can sign messages with the private key
func (*Client) PutProfile ¶
PutProfile adds a profile to the registry
type Config ¶
type Config struct { // Location is the URL base to call to Location string }
Config encapsulates options for working with a registry
type SearchFilter ¶
type SearchFilter struct { // Type denotes the ype of search filter Type string // Relation indicates the relation between the key and value // supported options include ["eq"|"neq"|"gt"|"gte"|"lt"|"lte"] Relation string // Key corresponds to the name of the index mapping that we wish to // apply the filter to Key string // Value is the predicate of the subject-relation-predicate triple // eg. [key=timestamp] [gte] [value=[today]] Value interface{} }
SearchFilter stores various types of filters that may be applied to a search
type SearchParams ¶
type SearchParams struct { QueryString string Filters []SearchFilter Limit int Offset int }
SearchParams contains the parameters that are passed to a Client.Search method