handlers

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package handlers provides HTTP handlers for different services across the application.

Index

Constants

View Source
const SyncQueryParameter = "sync"

Variables

View Source
var EmptyBodyError = &errors.RequestError{StatusCode: http.StatusBadRequest, Err: fmt.Errorf("empty body")}
View Source
var InvalidBodyError = &errors.RequestError{StatusCode: http.StatusBadRequest, Err: fmt.Errorf("invalid body")}

Functions

func UseCompress

func UseCompress(h http.Handler) http.Handler

func UseCors

func UseCors(h http.Handler) http.Handler

func UseJson

func UseJson(h http.Handler) http.Handler

func UseLogging

func UseLogging(out io.Writer, h http.Handler) http.Handler

Types

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

Accounts is a HTTP server for account management. It provides list, create and details APIs. It uses an account service to interface with data.

func NewAccounts

func NewAccounts(l *log.Logger, service *accounts.Service) *Accounts

NewAccounts initiates a new accounts server.

func (*Accounts) Create

func (s *Accounts) Create() http.Handler

func (*Accounts) CreateFunc

func (s *Accounts) CreateFunc(rw http.ResponseWriter, r *http.Request)

Create creates a new account asynchronously. It returns a Job JSON representation.

func (*Accounts) Details

func (s *Accounts) Details() http.Handler

func (*Accounts) DetailsFunc

func (s *Accounts) DetailsFunc(rw http.ResponseWriter, r *http.Request)

Details returns details regarding an account. It reads the address for the wanted account from URL. Account service is responsible for validating the address.

func (*Accounts) List

func (s *Accounts) List() http.Handler

func (*Accounts) ListFunc

func (s *Accounts) ListFunc(rw http.ResponseWriter, r *http.Request)

List returns all accounts.

type Jobs

type Jobs struct {
	// contains filtered or unexported fields
}

Jobs is a HTTP server for jobs. It provides details API. It uses jobs service to interface with data.

func NewJobs

func NewJobs(l *log.Logger, service *jobs.Service) *Jobs

NewJobs initiates a new jobs server.

func (*Jobs) Details

func (s *Jobs) Details() http.Handler

func (*Jobs) DetailsFunc

func (s *Jobs) DetailsFunc(rw http.ResponseWriter, r *http.Request)

Details returns details regarding a job. It reads the job id for the wanted job from URL. Job service is responsible for validating the job id.

func (*Jobs) List

func (s *Jobs) List() http.Handler

func (*Jobs) ListFunc

func (s *Jobs) ListFunc(rw http.ResponseWriter, r *http.Request)

List returns all jobs.

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

Templates is a HTTP server for template management.

func NewTemplates

func NewTemplates(l *log.Logger, service *templates.Service) *Templates

func (*Templates) AddToken

func (s *Templates) AddToken() http.Handler

func (*Templates) AddTokenFunc

func (s *Templates) AddTokenFunc(rw http.ResponseWriter, r *http.Request)

func (*Templates) GetToken

func (s *Templates) GetToken() http.Handler

func (*Templates) GetTokenFunc

func (s *Templates) GetTokenFunc(rw http.ResponseWriter, r *http.Request)

func (*Templates) ListTokens

func (s *Templates) ListTokens(tType templates.TokenType) http.Handler

func (*Templates) MakeListTokensFunc

func (s *Templates) MakeListTokensFunc(tType templates.TokenType) http.HandlerFunc

func (*Templates) RemoveToken

func (s *Templates) RemoveToken() http.Handler

func (*Templates) RemoveTokenFunc

func (s *Templates) RemoveTokenFunc(rw http.ResponseWriter, r *http.Request)

type Tokens

type Tokens struct {
	// contains filtered or unexported fields
}

func NewTokens

func NewTokens(l *log.Logger, service *tokens.Service) *Tokens

func (*Tokens) AccountTokens

func (s *Tokens) AccountTokens(tType templates.TokenType) http.Handler

func (*Tokens) CreateWithdrawal

func (s *Tokens) CreateWithdrawal() http.Handler

func (*Tokens) CreateWithdrawalFunc

func (s *Tokens) CreateWithdrawalFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) Details

func (s *Tokens) Details() http.Handler

func (*Tokens) DetailsFunc

func (s *Tokens) DetailsFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) GetDeposit

func (s *Tokens) GetDeposit() http.Handler

func (*Tokens) GetDepositFunc

func (s *Tokens) GetDepositFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) GetWithdrawal

func (s *Tokens) GetWithdrawal() http.Handler

func (*Tokens) GetWithdrawalFunc

func (s *Tokens) GetWithdrawalFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) ListDeposits

func (s *Tokens) ListDeposits() http.Handler

func (*Tokens) ListDepositsFunc

func (s *Tokens) ListDepositsFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) ListWithdrawals

func (s *Tokens) ListWithdrawals() http.Handler

func (*Tokens) ListWithdrawalsFunc

func (s *Tokens) ListWithdrawalsFunc(rw http.ResponseWriter, r *http.Request)

func (*Tokens) MakeAccountTokensFunc

func (s *Tokens) MakeAccountTokensFunc(tType templates.TokenType) http.HandlerFunc

func (*Tokens) Setup

func (s *Tokens) Setup() http.Handler

func (*Tokens) SetupFunc

func (s *Tokens) SetupFunc(rw http.ResponseWriter, r *http.Request)

type Transactions

type Transactions struct {
	// contains filtered or unexported fields
}

func NewTransactions

func NewTransactions(l *log.Logger, service *transactions.Service) *Transactions

NewTransactions initiates a new transactions server.

func (*Transactions) Create

func (s *Transactions) Create() http.Handler

func (*Transactions) CreateFunc

func (s *Transactions) CreateFunc(rw http.ResponseWriter, r *http.Request)

func (*Transactions) Details

func (s *Transactions) Details() http.Handler

func (*Transactions) DetailsFunc

func (s *Transactions) DetailsFunc(rw http.ResponseWriter, r *http.Request)

func (*Transactions) ExecuteScript

func (s *Transactions) ExecuteScript() http.Handler

func (*Transactions) ExecuteScriptFunc

func (s *Transactions) ExecuteScriptFunc(rw http.ResponseWriter, r *http.Request)

func (*Transactions) List

func (s *Transactions) List() http.Handler

func (*Transactions) ListFunc

func (s *Transactions) ListFunc(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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