api

package
v0.0.0-...-0dee372 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryBrewery string = "brewery"
	CategoryBar     string = "bar"
)
View Source
const VERSION string = "0.0.1"

Variables

This section is empty.

Functions

func CategoryCode

func CategoryCode(name string) string

Types

type Api

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

func New

func New(conf *config.Config) *Api

func (*Api) Do

func (self *Api) Do(request *Request) (*Response, error)

func (*Api) DoJSON

func (self *Api) DoJSON(jdata string) (*Response, error)

func (*Api) GetDatabase

func (self *Api) GetDatabase() *database.Database

func (*Api) IsPublicMethod

func (self *Api) IsPublicMethod(method string) bool

type BatchRequest

type BatchRequest []Request

type Request

type Request struct {
	Method  string         `json:"method"`
	Version string         `json:"version"`
	Params  *RequestParams `json:"params"`
	Id      string         `json:"id,ompitempty"`
}

func (*Request) Unmarshal

func (self *Request) Unmarshal(data string) error

type RequestParams

type RequestParams struct {
	Email     string  `json:"email,omitempty"`
	Username  string  `json:"username,omitempty"`
	Password  string  `json:"password,omitempty"`
	Apikey    string  `json:"apikey,omitempty"`
	Latitude  float64 `json:"latitude,omitempty"`
	Longitude float64 `json:"longitude,omitempty"`
	Name      string  `json:"name,omitempty"`
	CrawlId   string  `json:"crawl_id,omitempty"`
	VenueId   string  `json:"venue_id,omitempty"`
}

type Response

type Response struct {
	Status  string       `json:"status"`
	Version string       `json:"version,omitempty"`
	Message string       `json:"message,omitempty"`
	Error   string       `json:"error,omitempty"`
	Data    ResponseData `json:"data,omitempty"`
	Id      string       `json:"id,omitempty"`
}

func (*Response) Marshal

func (self *Response) Marshal() (string, error)

func (*Response) SetError

func (self *Response) SetError(err error)

func (*Response) Write

func (self *Response) Write(w io.Writer) error

type ResponseData

type ResponseData struct {
	Users  []*database.User      `json:"users,omitempty"`
	User   *database.User        `json:"user,omitempty"`
	Crawl  *database.Crawl       `json:"crawl,omitempty"`
	Crawls []*database.Crawl     `json:"crawls,omitempty"`
	Venues *database.CrawlVenues `json:"venues,omitempty"`
}

Jump to

Keyboard shortcuts

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