server

package
v0.0.0-...-c476a70 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillBestMatch

func FillBestMatch(url url.Values, bestMatchRequest *BestMatchRequest)

func NewHttpError

func NewHttpError(err error, detail string, status int) error

Types

type BestMatchRequest

type BestMatchRequest struct {
	Material  string `json:"material" validate:"required,alpha,lowercase"`
	Latitude  string `json:"latitude" validate:"required,latitude"`
	Longitude string `json:"longitude" validate:"required,longitude"`
	Square    string `json:"square" validate:"omitempty,number"`
	Phone     string `json:"phone" validate:"omitempty,e164"`
}

type ClientError

type ClientError interface {
	Error() string
	ResponseBody() ([]byte, error)
	ResponseHeaders() (int, map[string]string)
}

type HttpError

type HttpError struct {
	Cause  error  `json:"-"`
	Detail string `json:"detail"`
	Status int    `json:"-"`
}

func (HttpError) Error

func (e HttpError) Error() string

func (HttpError) ResponseBody

func (e HttpError) ResponseBody() ([]byte, error)

func (HttpError) ResponseHeaders

func (e HttpError) ResponseHeaders() (status int, headers map[string]string)

type Server

type Server struct {
	PartnerRepo partner.Repository
}

func NewServer

func NewServer() (*Server, error)

func (*Server) FindBestMatch

func (s *Server) FindBestMatch(w http.ResponseWriter, r *http.Request, ps httprouter.Params) error

func (*Server) GetPartner

func (s *Server) GetPartner(w http.ResponseWriter, r *http.Request, ps httprouter.Params) error

func (*Server) Start

func (s *Server) Start()

Jump to

Keyboard shortcuts

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