client

package module
v0.0.0-...-050e4c4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: MIT Imports: 15 Imported by: 1

README

HTTP Client for keys.pub

This documentation is in progress.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l Logger) func()

SetLogger sets logger for the package.

Types

type Client

type Client struct {
	*hclient.Client
}

Client ...

func New

func New(urs string) (*Client, error)

New creates a Client for the a Web API.

func (*Client) Account

func (c *Client) Account(ctx context.Context, account *keys.EdX25519Key) (*api.AccountResponse, error)

func (*Client) AccountAuthSave

func (c *Client) AccountAuthSave(ctx context.Context, auth *auth.Auth, account *keys.EdX25519Key) error

func (*Client) AccountAuths

func (c *Client) AccountAuths(ctx context.Context, account *keys.EdX25519Key) ([]*auth.Auth, error)

func (*Client) AccountCreate

func (c *Client) AccountCreate(ctx context.Context, account *keys.EdX25519Key, email string, verifyEmailCode string) error

func (*Client) AccountInvite

func (c *Client) AccountInvite(ctx context.Context, email string, account *keys.EdX25519Key) error

func (*Client) AccountRegister

func (c *Client) AccountRegister(ctx context.Context, email string, registerCode string) error

Register account. registerCode is optional if email address was invited explicitly.

func (*Client) AccountSetUsername

func (c *Client) AccountSetUsername(ctx context.Context, username string, account *keys.EdX25519Key) error

func (*Client) Channel

func (c *Client) Channel(ctx context.Context, channel *keys.EdX25519Key, account *keys.EdX25519Key) (*api.Channel, error)

func (*Client) ChannelCreateWithTeam

func (c *Client) ChannelCreateWithTeam(ctx context.Context, channel *keys.EdX25519Key, info *api.ChannelInfo, team keys.ID, account *keys.EdX25519Key) (string, error)

func (*Client) ChannelCreateWithUsers

func (c *Client) ChannelCreateWithUsers(ctx context.Context, channel *keys.EdX25519Key, info *api.ChannelInfo, users []keys.ID, account *keys.EdX25519Key) (string, error)

func (*Client) ChannelDelete

func (c *Client) ChannelDelete(ctx context.Context, key *keys.EdX25519Key) error

func (*Client) ChannelUsers

func (c *Client) ChannelUsers(ctx context.Context, channel *keys.EdX25519Key) ([]keys.ID, error)

func (*Client) ChannelUsersAdd

func (c *Client) ChannelUsersAdd(ctx context.Context, channel *keys.EdX25519Key, users []keys.ID) error

func (*Client) ChannelUsersRemove

func (c *Client) ChannelUsersRemove(ctx context.Context, channel *keys.EdX25519Key, users []keys.ID) error

func (*Client) Channels

func (c *Client) Channels(ctx context.Context, team keys.ID, account *keys.EdX25519Key) ([]*api.Channel, error)

func (*Client) Config

func (c *Client) Config(ctx context.Context, account *keys.EdX25519Key) (*api.Config, error)

func (*Client) Messages

func (c *Client) Messages(ctx context.Context, channel *keys.EdX25519Key, index int64) (*Messages, error)

Messages. If truncated, there are more results if you call again with the new index.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, message *api.Message, channel *keys.EdX25519Key, sender *keys.EdX25519Key) error

SendMessage sends message data to the channel. Data is encrypted with the channel key before saving.

func (*Client) ShareOpen

func (c *Client) ShareOpen(ctx context.Context, key *keys.EdX25519Key, account *keys.EdX25519Key) ([]byte, error)

ShareOpen opens a secret.

func (*Client) ShareSeal

func (c *Client) ShareSeal(ctx context.Context, key *keys.EdX25519Key, account *keys.EdX25519Key, data []byte, expire time.Duration) error

ShareSeal shares a secret with expiry.

func (*Client) Team

func (c *Client) Team(ctx context.Context, team *keys.EdX25519Key) (*api.Team, error)

func (*Client) TeamCreate

func (c *Client) TeamCreate(ctx context.Context, team *keys.EdX25519Key, account *keys.EdX25519Key) error

func (*Client) TeamCreateDomain

func (c *Client) TeamCreateDomain(ctx context.Context, team *keys.EdX25519Key, account *keys.EdX25519Key, domain string) error

func (*Client) TeamInvite

func (c *Client) TeamInvite(ctx context.Context, team *keys.EdX25519Key, email string, account *keys.EdX25519Key) (string, error)

TeamInvite invites using a phrase. If email if empty, you can use the code from TeamInviteOpen when doing AccountRegister.

func (*Client) TeamInviteOpen

func (c *Client) TeamInviteOpen(ctx context.Context, phrase string, account *keys.EdX25519Key) (*TeamInvite, error)

func (*Client) TeamSign

func (c *Client) TeamSign(team *keys.EdX25519Key, domain string, ts time.Time) (string, error)

func (*Client) UserLookup

func (c *Client) UserLookup(ctx context.Context, field string, value string, account *keys.EdX25519Key) (*api.User, error)

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
	// NoLevel
	NoLevel LogLevel = -1
)

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...

type Messages

type Messages struct {
	Messages  []*api.Message
	Index     int64
	Truncated bool
}

type TeamInvite

type TeamInvite struct {
	TeamKey      *keys.EdX25519Key
	RegisterCode string
}

Directories

Path Synopsis
examples
01-account command
02-team command
03-invite command

Jump to

Keyboard shortcuts

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