Documentation ¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) DeleteInboxMessage(ctx context.Context, id string) error
- func (c *Client) DeleteSentboxMessage(ctx context.Context, id string) error
- func (c *Client) GetThread(ctx context.Context, name string) (*pb.GetThreadResponse, error)
- func (c *Client) GetUsage(ctx context.Context, opts ...UsageOption) (*pb.GetUsageResponse, error)
- func (c *Client) ListInboxMessages(ctx context.Context, opts ...ListOption) ([]Message, error)
- func (c *Client) ListSentboxMessages(ctx context.Context, opts ...ListOption) ([]Message, error)
- func (c *Client) ListThreads(ctx context.Context) (*pb.ListThreadsResponse, error)
- func (c *Client) ReadInboxMessage(ctx context.Context, id string) error
- func (c *Client) SendMessage(ctx context.Context, from thread.Identity, to thread.PubKey, body []byte) (msg Message, err error)
- func (c *Client) SetupMailbox(ctx context.Context) (mailbox thread.ID, err error)
- type ListOption
- type Message
- type Status
- type UsageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides the client api.
func NewClient ¶
func NewClient(target string, opts ...grpc.DialOption) (*Client, error)
NewClient starts the client.
func (*Client) DeleteInboxMessage ¶
DeleteInboxMessage deletes an inbox message by ID.
func (*Client) DeleteSentboxMessage ¶
DeleteSentboxMessage deletes a sent message by ID.
func (*Client) GetUsage ¶
func (c *Client) GetUsage(ctx context.Context, opts ...UsageOption) (*pb.GetUsageResponse, error)
GetUsage returns current billing and usage information.
func (*Client) ListInboxMessages ¶
ListInboxMessages lists messages from the inbox. Use options to paginate with seek and limit and filter by read status.
func (*Client) ListSentboxMessages ¶
ListSentboxMessages lists messages from the sentbox. Use options to paginate with seek and limit.
func (*Client) ListThreads ¶
ListThreads returns a list of threads. Threads can be created using the threads or threads network client.
func (*Client) ReadInboxMessage ¶
ReadInboxMessage marks a message as read by ID.
type ListOption ¶
type ListOption func(*listOptions)
func WithAscending ¶
func WithAscending(asc bool) ListOption
WithAscending lists messages by ascending order.
func WithLimit ¶
func WithLimit(limit int) ListOption
WithLimit limits the number of list messages results.
func WithStatus ¶
func WithStatus(s Status) ListOption
WithStatus filters messages by read status. Note: Only applies to inbox messages.
type Message ¶
type Message struct { ID string `json:"_id"` From thread.PubKey `json:"from"` To thread.PubKey `json:"to"` Body []byte `json:"body"` Signature []byte `json:"signature"` CreatedAt time.Time `json:"created_at"` ReadAt time.Time `json:"read_at,omitempty"` }
Message is the client side representation of a mailbox message. Signature corresponds to the encrypted body. Use message.Open to get the plaintext body.
func (Message) UnmarshalInstance ¶
UnmarshalInstance unmarshals the message from its ThreadDB instance data. This will return an error if the message signature fails verification.
type UsageOption ¶
type UsageOption func(*usageOptions)
func WithPubKey ¶
func WithPubKey(key string) UsageOption
WithPubKey returns usage info for the public key.