lbryinc

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError added in v2.7.0

type APIError struct {
	Err error
}

APIError wraps errors returned by LBRY API server to discern them from other kinds (like http errors).

func (APIError) Error added in v2.7.0

func (e APIError) Error() string

type APIResponse

type APIResponse struct {
	Success bool          `json:"success"`
	Error   *string       `json:"error"`
	Data    *ResponseData `json:"data"`
}

APIResponse reflects internal-apis JSON response format.

type Client

type Client struct {
	AuthToken string
	Logger    *log.Logger
	// contains filtered or unexported fields
}

Client stores data about internal-apis call it is about to make.

func NewClient

func NewClient(authToken string, opts *ClientOpts) Client

NewClient returns a client instance for internal-apis. It requires authToken to be provided for authentication.

func (Client) Call

func (c Client) Call(object, method string, params map[string]interface{}) (ResponseData, error)

Call calls a remote internal-apis server, returning a response, wrapped into standardized API Response struct.

func (Client) UserHasVerifiedEmail added in v2.4.4

func (c Client) UserHasVerifiedEmail() (ResponseData, error)

UserHasVerifiedEmail calls has_verified_email method.

func (Client) UserMe

func (c Client) UserMe() (ResponseData, error)

UserMe returns user details for the user associated with the current auth_token.

type ClientOpts

type ClientOpts struct {
	ServerAddress string
	RemoteIP      string
}

ClientOpts allow to provide extra parameters to NewClient: - ServerAddress - RemoteIP — to forward the IP of a frontend client making the request

type ResponseData

type ResponseData map[string]interface{}

ResponseData is a map containing parsed json response.

Jump to

Keyboard shortcuts

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