api

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequestErrorHandler = func(w http.ResponseWriter, err error) {
		writeError(w, err.Error(), http.StatusBadRequest)
	}
	InternalErrorHandler = func(w http.ResponseWriter) {
		writeError(w, "An unexpected error occurred.", http.StatusInternalServerError)
	}
	UnauthorizedErrorHandler = func(w http.ResponseWriter, err error) {
		writeError(w, err.Error(), http.StatusUnauthorized)
	}
)

Functions

func GetChainId

func GetChainId(r *http.Request) (*uint64, error)

Types

type Error

type Error struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	SupportId string `json:"support_id"`
}

type Meta

type Meta struct {
	ChainId         *uint64 `json:"chain_id"`
	ContractAddress string  `json:"address"`
	Signature       string  `json:"signature"`
	Page            int     `json:"page"`
	Limit           int     `json:"limit"`
	TotalItems      int     `json:"total_items"`
	TotalPages      int     `json:"total_pages"`
}

type QueryParams

type QueryParams struct {
	FilterParams map[string]string `schema:"-"`
	GroupBy      string            `schema:"group_by"`
	SortBy       string            `schema:"sort_by"`
	SortOrder    string            `schema:"sort_order"`
	Page         int               `schema:"page"`
	Limit        int               `schema:"limit"`
	Aggregates   []string          `schema:"aggregate"`
}

func ParseQueryParams

func ParseQueryParams(r *http.Request) (QueryParams, error)

type QueryResponse

type QueryResponse struct {
	Meta         Meta              `json:"meta"`
	Data         interface{}       `json:"data,omitempty"`
	Aggregations map[string]string `json:"aggregations,omitempty"`
}

Jump to

Keyboard shortcuts

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