api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2023 Adevinta

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrDateMalformed indicates that the date format does not comply with YYYY-MM-DD.
	ErrDateMalformed = errors.New("malformed Date")

	// ErrPageMalformed indicates that the page requested is not an integer larger than 0.
	ErrPageMalformed = errors.New("malformed Page Number")

	// ErrPageNotFound indicates that the page requested does not exist.
	ErrPageNotFound = errors.New("page Not Found")

	// ErrSizeMalformed indicates that the size requested is not an integer larger than 0.
	ErrSizeMalformed = errors.New("malformed Size Number")

	// ErrSizeTooLarge indicates that the size requested is larger than the maximum allowed.
	ErrSizeTooLarge = errors.New("size Number Too Large")

	// ErrInvalidFilter indicates that there is a conflict between specified params for the filter.
	ErrInvalidFilter = errors.New("filter parameters combination is invalid")
)

Functions

This section is empty.

Types

type API

type API struct {
	Options Options
	// contains filtered or unexported fields
}

API represents an API services and all the stuff needed to work.

func New

func New(ticketServer tracking.TicketServer, ticketTrackerBuilder tracking.TicketTrackerBuilder,
	storage storage.Storage, options Options) *API

New instantiates a new API.

func (*API) CreateTicket

func (api *API) CreateTicket(c echo.Context) error

CreateTicket creates a ticket and returns a JSON containing the new ticket.

func (*API) GetFindingTicket

func (api *API) GetFindingTicket(c echo.Context) error

GetFindingTicket checks if a ticket was created and retrieves it if it is found.

func (*API) GetTicket

func (api *API) GetTicket(c echo.Context) error

GetTicket returns a JSON containing a specific ticket.

func (*API) Healthcheck

func (api *API) Healthcheck(c echo.Context) error

Healthcheck performs a simple query and returns an OK response.

type Options

type Options struct {
	MaxSize     int
	DefaultSize int
}

Options represents size options for the API requests.

type Pagination

type Pagination struct {
	Limit  int  `json:"limit"`
	Offset int  `json:"offset"`
	Total  int  `json:"total"`
	More   bool `json:"more"`
}

Pagination represents the pagination options for the API requests.

Jump to

Keyboard shortcuts

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