Documentation ¶
Index ¶
- Constants
- func BadRequest(ctx context.Context, w http.ResponseWriter, msg string)
- func CreateRouter(params *RouterParams) *chi.Mux
- func CreatedResponse(ctx context.Context, w http.ResponseWriter, data any)
- func Forbidden(ctx context.Context, w http.ResponseWriter, msg string)
- func InternalServerError(ctx context.Context, w http.ResponseWriter, msg string)
- func NewCompanyID() uuid.UUID
- func NewCreatedAt() time.Time
- func NotFound(ctx context.Context, w http.ResponseWriter, msg string)
- func OKResponse(ctx context.Context, w http.ResponseWriter, data any)
- func Unauthorized(ctx context.Context, w http.ResponseWriter, msg string)
- func WithAuthN(tokenService authn.TokenValidator) func(next http.Handler) http.Handler
- func WithCountryRestriction(geoIPService geoip.CountryDetector, allowedCountryName string) func(next http.Handler) http.Handler
- func WithLogRequestBoundaries() func(next http.Handler) http.Handler
- func WithXRequestID(next http.Handler) http.Handler
- type CompaniesSearchRequest
- type CompaniesSearchResponse
- type CompanyResponse
- type GetCompanyResponse
- type HandlerEnv
- func (h *HandlerEnv) DeleteCompany(w http.ResponseWriter, r *http.Request)
- func (h *HandlerEnv) GetCompany(w http.ResponseWriter, r *http.Request)
- func (h *HandlerEnv) PostCompanies(w http.ResponseWriter, r *http.Request)
- func (h *HandlerEnv) PostCompaniesSearch(w http.ResponseWriter, r *http.Request)
- type InputCompany
- type PostCompanyResponse
- type Response
- type ResponseBody
- type RouterParams
Constants ¶
View Source
const AuthHeaderParts = 2
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(ctx context.Context, w http.ResponseWriter, msg string)
func CreateRouter ¶
func CreateRouter(params *RouterParams) *chi.Mux
func CreatedResponse ¶
func CreatedResponse(ctx context.Context, w http.ResponseWriter, data any)
func InternalServerError ¶
func InternalServerError(ctx context.Context, w http.ResponseWriter, msg string)
func NewCompanyID ¶
func NewCreatedAt ¶
func OKResponse ¶
func OKResponse(ctx context.Context, w http.ResponseWriter, data any)
func Unauthorized ¶
func Unauthorized(ctx context.Context, w http.ResponseWriter, msg string)
func WithCountryRestriction ¶
Types ¶
type CompaniesSearchRequest ¶
type CompaniesSearchRequest struct {
CompaniesIDs []string `json:"companies_ids"` //nolint:tagliatelle // false positive
}
type CompaniesSearchResponse ¶
type CompaniesSearchResponse []CompanyResponse
type CompanyResponse ¶
type CompanyResponse struct { CreatedAt time.Time `json:"created_at"` InputCompany ID uuid.UUID `json:"id"` }
type GetCompanyResponse ¶
type GetCompanyResponse struct {
CompanyResponse
}
type HandlerEnv ¶
func (*HandlerEnv) DeleteCompany ¶
func (h *HandlerEnv) DeleteCompany(w http.ResponseWriter, r *http.Request)
func (*HandlerEnv) GetCompany ¶
func (h *HandlerEnv) GetCompany(w http.ResponseWriter, r *http.Request)
func (*HandlerEnv) PostCompanies ¶
func (h *HandlerEnv) PostCompanies(w http.ResponseWriter, r *http.Request)
func (*HandlerEnv) PostCompaniesSearch ¶
func (h *HandlerEnv) PostCompaniesSearch(w http.ResponseWriter, r *http.Request)
PostCompaniesSearch is used to fetch list of companies POST was chosen instead GET we can pass parameters only in URL, but URL max length is 2048, so we will pass parameters in body in POST request.
type InputCompany ¶
type PostCompanyResponse ¶
type PostCompanyResponse struct {
CompanyResponse
}
type Response ¶
type Response struct { HTTPBody *ResponseBody HTTPStatus int }
type ResponseBody ¶
type RouterParams ¶
type RouterParams struct { Logger logging.Logger Handler *HandlerEnv CountryDetector geoip.CountryDetector GeoIPConf *config.GeoIP TokenService authn.TokenValidator }
Click to show internal directories.
Click to hide internal directories.