http

package
v0.26.7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package http provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(verifier jwtVerifier, ctx context.Context, input *openapi3filter.AuthenticationInput) error

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func NewAuthenticator

func NewAuthenticator(verifier jwtVerifier) openapi3filter.AuthenticationFunc

func NewUnableToRetrieveUserFromCtx

func NewUnableToRetrieveUserFromCtx(err error) error

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type BulkInviteMembersByEmail

type BulkInviteMembersByEmail struct {
	Emails []string `json:"emails"`
}

BulkInviteMembersByEmail defines model for BulkInviteMembersByEmail.

type BulkInviteMembersByEmailJSONRequestBody

type BulkInviteMembersByEmailJSONRequestBody = BulkInviteMembersByEmail

BulkInviteMembersByEmailJSONRequestBody defines body for BulkInviteMembersByEmail for application/json ContentType.

type Config

type Config struct {
	Port              int
	Application       *app.App
	AllowedCorsOrigin []string
	Logger            *logs.Logger
	JwtVerifier       jwtVerifier
	Ctx               context.Context
}

type ConfirmInvitationJSONRequestBody

type ConfirmInvitationJSONRequestBody = ConfirmInvitationRequest

ConfirmInvitationJSONRequestBody defines body for ConfirmInvitation for application/json ContentType.

type ConfirmInvitationRequest

type ConfirmInvitationRequest struct {
	Email           string `json:"email"`
	InvitationToken string `json:"invitation_token"`
	Password        string `json:"password"`
}

ConfirmInvitationRequest defines model for ConfirmInvitationRequest.

type CreateAccountJSONRequestBody

type CreateAccountJSONRequestBody = CreateAccountRequest

CreateAccountJSONRequestBody defines body for CreateAccount for application/json ContentType.

type CreateAccountRequest

type CreateAccountRequest struct {
	AccountName string `json:"account_name"`
	Email       string `json:"email"`
	Password    string `json:"password"`
}

CreateAccountRequest defines model for CreateAccountRequest.

type CreateMonitorJSONRequestBody

type CreateMonitorJSONRequestBody = CreateMonitorRequest

CreateMonitorJSONRequestBody defines body for CreateMonitor for application/json ContentType.

type CreateMonitorRequest

type CreateMonitorRequest struct {
	CheckIntervalInSeconds int    `json:"check_interval_in_seconds"`
	EndpointUrl            string `json:"endpoint_url"`
}

CreateMonitorRequest defines model for CreateMonitorRequest.

type DefaultError

type DefaultError = ErrorResponse

DefaultError defines model for DefaultError.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type EditMonitorJSONRequestBody

type EditMonitorJSONRequestBody = EditMonitorRequest

EditMonitorJSONRequestBody defines body for EditMonitor for application/json ContentType.

type EditMonitorRequest

type EditMonitorRequest struct {
	CheckIntervalInSeconds int    `json:"check_interval_in_seconds"`
	EndpointUrl            string `json:"endpoint_url"`
}

EditMonitorRequest defines model for EditMonitorRequest.

type ErrorResponse

type ErrorResponse struct {
	// Error Error custom error code such as 'email_in_use'
	Error string `json:"error"`

	// Message A description about the error
	Message string `json:"message"`
}

ErrorResponse defines model for ErrorResponse.

type FullIncident

type FullIncident struct {
	Cause          string     `json:"cause"`
	CheckedUrl     string     `json:"checked_url"`
	CreatedAt      time.Time  `json:"created_at"`
	Id             string     `json:"id"`
	MonitorId      string     `json:"monitor_id"`
	ResolvedAt     *time.Time `json:"resolved_at,omitempty"`
	ResponseStatus *int       `json:"response_status,omitempty"`
}

FullIncident defines model for FullIncident.

type GetAllIncidentsParams

type GetAllIncidentsParams struct {
	Page  *int `form:"page,omitempty" json:"page,omitempty"`
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

GetAllIncidentsParams defines parameters for GetAllIncidents.

type GetAllIncidentsPayload

type GetAllIncidentsPayload struct {
	Data       []Incident `json:"data"`
	Page       int        `json:"page"`
	PageCount  int        `json:"page_count"`
	PerPage    int        `json:"per_page"`
	TotalCount int64      `json:"total_count"`
}

GetAllIncidentsPayload defines model for GetAllIncidentsPayload.

type GetAllMonitorByIdPayload

type GetAllMonitorByIdPayload struct {
	Data Monitor `json:"data"`
}

GetAllMonitorByIdPayload defines model for GetAllMonitorByIdPayload.

type GetAllMonitorsParams

type GetAllMonitorsParams struct {
	Page  *int `form:"page,omitempty" json:"page,omitempty"`
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

GetAllMonitorsParams defines parameters for GetAllMonitors.

type GetAllMonitorsPayload

type GetAllMonitorsPayload struct {
	Data       []Monitor `json:"data"`
	Page       int       `json:"page"`
	PageCount  int       `json:"page_count"`
	PerPage    int       `json:"per_page"`
	TotalCount int64     `json:"total_count"`
}

GetAllMonitorsPayload defines model for GetAllMonitorsPayload.

type GetIncidentByByIdPayload

type GetIncidentByByIdPayload struct {
	Data FullIncident `json:"data"`
}

GetIncidentByByIdPayload defines model for GetIncidentByByIdPayload.

type GetMonitorResponseTimeStatsParams

type GetMonitorResponseTimeStatsParams struct {
	RangeInDays *int `form:"range_in_days,omitempty" json:"range_in_days,omitempty"`
}

GetMonitorResponseTimeStatsParams defines parameters for GetMonitorResponseTimeStats.

type GetMonitorResponseTimeStatsPayload

type GetMonitorResponseTimeStatsPayload struct {
	Data []ResponseTimeStat `json:"data"`
}

GetMonitorResponseTimeStatsPayload defines model for GetMonitorResponseTimeStatsPayload.

type GetProfileDetailsPayload

type GetProfileDetailsPayload struct {
	Data User `json:"data"`
}

GetProfileDetailsPayload defines model for GetProfileDetailsPayload.

type HandlerError

type HandlerError struct {
	*echo.HTTPError
	// contains filtered or unexported fields
}

func NewHandlerError

func NewHandlerError(err error, slug string) *HandlerError

func NewHandlerErrorWithStatus

func NewHandlerErrorWithStatus(err error, slug string, code int) *HandlerError

func (HandlerError) Error

func (e HandlerError) Error() string

func (HandlerError) Slug

func (e HandlerError) Slug() string

type Incident

type Incident struct {
	Cause      string     `json:"cause"`
	CheckedUrl string     `json:"checked_url"`
	CreatedAt  time.Time  `json:"created_at"`
	Id         string     `json:"id"`
	ResolvedAt *time.Time `json:"resolved_at,omitempty"`
}

Incident defines model for Incident.

type LogInPayload

type LogInPayload struct {
	Token string `json:"token"`
}

LogInPayload defines model for LogInPayload.

type LogInRequest

type LogInRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LogInRequest defines model for LogInRequest.

type LoginJSONRequestBody

type LoginJSONRequestBody = LogInRequest

LoginJSONRequestBody defines body for Login for application/json ContentType.

type Monitor

type Monitor struct {
	CheckIntervalInSeconds int        `json:"check_interval_in_seconds"`
	CreatedAt              time.Time  `json:"created_at"`
	DownSince              *time.Time `json:"down_since,omitempty"`
	EndpointUrl            string     `json:"endpoint_url"`
	Id                     string     `json:"id"`
	Incidents              []Incident `json:"incidents"`
	IsEndpointUp           bool       `json:"is_endpoint_up"`
	IsPaused               bool       `json:"is_paused"`
	LastCheckedAt          *time.Time `json:"last_checked_at,omitempty"`
	UpSince                *time.Time `json:"up_since,omitempty"`
}

Monitor defines model for Monitor.

type Port

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

func NewPort

func NewPort(config Config) (*Port, error)

func (*Port) Start

func (p *Port) Start() error

func (*Port) Stop

func (p *Port) Stop(ctx context.Context) error

type ResponseTimeStat

type ResponseTimeStat struct {
	Date   time.Time `json:"date"`
	Region string    `json:"region"`
	Value  int       `json:"value"`
}

ResponseTimeStat defines model for ResponseTimeStat.

type ServerInterface

type ServerInterface interface {
	// Bulk invite members by email
	// (POST /accounts/members/invite)
	BulkInviteMembersByEmail(ctx echo.Context) error
	// Get details about the user currently logged in
	// (GET /accounts/profile)
	GetProfileDetails(ctx echo.Context) error
	// Creates a new account
	// (POST /auth/accounts)
	CreateAccount(ctx echo.Context) error
	// Creates a user in a team
	// (POST /auth/accounts/confirm-invitation)
	ConfirmInvitation(ctx echo.Context) error
	// Log in
	// (POST /auth/login)
	Login(ctx echo.Context) error
	// Get all incidents
	// (GET /incidents)
	GetAllIncidents(ctx echo.Context, params GetAllIncidentsParams) error
	// Get an incident by id
	// (GET /incidents/{incidentID})
	GetIncidentByID(ctx echo.Context, incidentID string) error
	// Get all monitors in a with pagination
	// (GET /monitors)
	GetAllMonitors(ctx echo.Context, params GetAllMonitorsParams) error
	// Create a new monitor
	// (POST /monitors)
	CreateMonitor(ctx echo.Context) error
	// Delete monitor
	// (DELETE /monitors/{monitorID})
	DeleteMonitor(ctx echo.Context, monitorID string) error
	// Get all monitors in a with pagination
	// (GET /monitors/{monitorID})
	GetMonitorByID(ctx echo.Context, monitorID string) error
	// Pause or unpause the monitor
	// (POST /monitors/{monitorID})
	ToggleMonitorPause(ctx echo.Context, monitorID string) error
	// Edit a monitor by id
	// (PUT /monitors/{monitorID})
	EditMonitor(ctx echo.Context, monitorID string) error
	// Get the stats about the response time
	// (GET /monitors/{monitorID}/stats/response-times)
	GetMonitorResponseTimeStats(ctx echo.Context, monitorID string, params GetMonitorResponseTimeStatsParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) BulkInviteMembersByEmail

func (w *ServerInterfaceWrapper) BulkInviteMembersByEmail(ctx echo.Context) error

BulkInviteMembersByEmail converts echo context to params.

func (*ServerInterfaceWrapper) ConfirmInvitation

func (w *ServerInterfaceWrapper) ConfirmInvitation(ctx echo.Context) error

ConfirmInvitation converts echo context to params.

func (*ServerInterfaceWrapper) CreateAccount

func (w *ServerInterfaceWrapper) CreateAccount(ctx echo.Context) error

CreateAccount converts echo context to params.

func (*ServerInterfaceWrapper) CreateMonitor

func (w *ServerInterfaceWrapper) CreateMonitor(ctx echo.Context) error

CreateMonitor converts echo context to params.

func (*ServerInterfaceWrapper) DeleteMonitor

func (w *ServerInterfaceWrapper) DeleteMonitor(ctx echo.Context) error

DeleteMonitor converts echo context to params.

func (*ServerInterfaceWrapper) EditMonitor

func (w *ServerInterfaceWrapper) EditMonitor(ctx echo.Context) error

EditMonitor converts echo context to params.

func (*ServerInterfaceWrapper) GetAllIncidents

func (w *ServerInterfaceWrapper) GetAllIncidents(ctx echo.Context) error

GetAllIncidents converts echo context to params.

func (*ServerInterfaceWrapper) GetAllMonitors

func (w *ServerInterfaceWrapper) GetAllMonitors(ctx echo.Context) error

GetAllMonitors converts echo context to params.

func (*ServerInterfaceWrapper) GetIncidentByID

func (w *ServerInterfaceWrapper) GetIncidentByID(ctx echo.Context) error

GetIncidentByID converts echo context to params.

func (*ServerInterfaceWrapper) GetMonitorByID

func (w *ServerInterfaceWrapper) GetMonitorByID(ctx echo.Context) error

GetMonitorByID converts echo context to params.

func (*ServerInterfaceWrapper) GetMonitorResponseTimeStats

func (w *ServerInterfaceWrapper) GetMonitorResponseTimeStats(ctx echo.Context) error

GetMonitorResponseTimeStats converts echo context to params.

func (*ServerInterfaceWrapper) GetProfileDetails

func (w *ServerInterfaceWrapper) GetProfileDetails(ctx echo.Context) error

GetProfileDetails converts echo context to params.

func (*ServerInterfaceWrapper) Login

func (w *ServerInterfaceWrapper) Login(ctx echo.Context) error

Login converts echo context to params.

func (*ServerInterfaceWrapper) ToggleMonitorPause

func (w *ServerInterfaceWrapper) ToggleMonitorPause(ctx echo.Context) error

ToggleMonitorPause converts echo context to params.

type ToggleMonitorPauseJSONRequestBody

type ToggleMonitorPauseJSONRequestBody = ToggleMonitorPauseRequest

ToggleMonitorPauseJSONRequestBody defines body for ToggleMonitorPause for application/json ContentType.

type ToggleMonitorPauseRequest

type ToggleMonitorPauseRequest struct {
	Pause bool `json:"pause"`
}

ToggleMonitorPauseRequest defines model for ToggleMonitorPauseRequest.

type User

type User struct {
	CreatedAt time.Time `json:"created_at"`
	Email     string    `json:"email"`
	FirstName string    `json:"first_name"`
	Id        string    `json:"id"`
	LastName  string    `json:"last_name"`
	Role      string    `json:"role"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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