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.GetThreadReply, 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.ListThreadsReply, 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
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 ¶ added in v1.0.14
DeleteInboxMessage deletes an inbox message by ID.
func (*Client) DeleteSentboxMessage ¶ added in v1.0.14
DeleteSentboxMessage deletes a sent message by ID.
func (*Client) ListInboxMessages ¶ added in v1.0.14
ListInboxMessages lists messages from the inbox. Use options to paginate with seek and limit and filter by read status.
func (*Client) ListSentboxMessages ¶ added in v1.0.14
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 ¶ added in v1.0.14
ReadInboxMessage marks a message as read by ID.
type ListOption ¶ added in v1.0.14
type ListOption func(*listOptions)
func WithAscending ¶ added in v1.0.14
func WithAscending(asc bool) ListOption
WithAscending lists messages by ascending order.
func WithLimit ¶ added in v1.0.14
func WithLimit(limit int) ListOption
WithLimit limits the number of list messages results.
func WithSeek ¶ added in v1.0.14
func WithSeek(id string) ListOption
WithSeek starts listing from the given ID.
func WithStatus ¶ added in v1.0.14
func WithStatus(s Status) ListOption
WithStatus filters messages by read status. Note: Only applies to inbox messages.
type Message ¶ added in v1.0.14
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 ¶ added in v1.0.14
UnmarshalInstance unmarshals the message from its ThreadDB instance data. This will return an error if the message signature fails verification.