sdk

package
v0.0.0-...-26386a0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoRedirect

func NoRedirect(req *http.Request, via []*http.Request) error

Types

type Client

type Client struct {
	*http.Client

	GetCredentials GetCredentialsHandler
	CookieFilename string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseUrl *url.URL) (*Client, error)

func NewClientWithCookies

func NewClientWithCookies(baseUrl *url.URL, cookieFilename string) (*Client, error)

func (*Client) Cookies

func (c *Client) Cookies() []*http.Cookie

func (*Client) GetAsset

func (c *Client) GetAsset(path ...string) Result

func (*Client) Login

func (c *Client) Login(creds UserLogin) (result Result)

func (*Client) LoginGuard

func (c *Client) LoginGuard(req SendRequestHandler) Result

func (*Client) PostAsset

func (c *Client) PostAsset(payload Payload, path ...string) (result Result)

func (*Client) ReadCookies

func (c *Client) ReadCookies(filename string) error

func (*Client) WriteCookies

func (c *Client) WriteCookies(filename string) error

type GeneralResponse

type GeneralResponse struct {
	Message string
	Error   string
}

func NewGeneralResponse

func NewGeneralResponse(r io.Reader) (GeneralResponse, error)

func (*GeneralResponse) FromReader

func (g *GeneralResponse) FromReader(r io.Reader) error

type GetCredentialsHandler

type GetCredentialsHandler func() (UserLogin, error)

type NoRedirectError

type NoRedirectError struct{}

func (NoRedirectError) Error

func (NoRedirectError) Error() string

type Payload

type Payload struct {
	Hash         string  `json:"hash"`
	PeerIdentity peer.ID `json:"identity"`
}

func NewPayload

func NewPayload(r io.Reader) (*Payload, error)

func (*Payload) FromReader

func (p *Payload) FromReader(r io.Reader) error

func (Payload) Reader

func (p Payload) Reader() (io.Reader, error)

type Result

type Result struct {
	RequiredLogin bool
	Payload       *Payload
	Code          int
	Error         error
}

type SendRequestHandler

type SendRequestHandler func() Result

type UserLogin

type UserLogin struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func DefaultGetCredentials

func DefaultGetCredentials() (UserLogin, error)

func (UserLogin) Reader

func (u UserLogin) Reader() (io.Reader, error)

type WriteCookiesHandler

type WriteCookiesHandler func() error

Jump to

Keyboard shortcuts

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