lbryinc

package
v2.4.10 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

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

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