http

package
v0.0.0-...-ead2a4b Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

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

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

Index

Constants

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

Variables

This section is empty.

Functions

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 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 AddEndpointJSONRequestBody

type AddEndpointJSONRequestBody = AddEndpointRequest

AddEndpointJSONRequestBody defines body for AddEndpoint for application/json ContentType.

type AddEndpointRequest

type AddEndpointRequest struct {
	Description  *string   `json:"description,omitempty"`
	EventTypeIds *[]string `json:"event_type_ids,omitempty"`
	Url          string    `json:"url"`
}

AddEndpointRequest defines model for AddEndpointRequest.

type ApiKey

type ApiKey struct {
	CreatedAt       time.Time  `json:"created_at"`
	EnvironmentId   string     `json:"environment_id"`
	ExpiresAt       *time.Time `json:"expires_at,omitempty"`
	Id              string     `json:"id"`
	MaskedSecretKey string     `json:"masked_secret_key"`
	Name            string     `json:"name"`
	OrganizationId  string     `json:"organization_id"`
}

ApiKey defines model for ApiKey.

type Application

type Application struct {
	CreatedAt     time.Time `json:"created_at"`
	EnvironmentId string    `json:"environment_id"`
	Id            string    `json:"id"`
	Name          string    `json:"name"`
}

Application defines model for Application.

type ApplicationId

type ApplicationId = string

ApplicationId defines model for applicationId.

type Config

type Config struct {
	Application        *app.App
	Port               int
	AllowedCorsOrigin  []string
	Logger             *logs.Logger
	IsDebug            bool
	Ctx                context.Context
	JwtSecret          string
	WebFrontendEnabled bool
}

type CreateApiKeyJSONRequestBody

type CreateApiKeyJSONRequestBody = CreateApiKeyRequest

CreateApiKeyJSONRequestBody defines body for CreateApiKey for application/json ContentType.

type CreateApiKeyPayload

type CreateApiKeyPayload struct {
	UnmaskedApiKey string `json:"unmasked_api_key"`
}

CreateApiKeyPayload defines model for CreateApiKeyPayload.

type CreateApiKeyRequest

type CreateApiKeyRequest struct {
	EnvironmentId string     `json:"environment_id"`
	ExpiresAt     *time.Time `json:"expires_at"`
	Name          string     `json:"name"`
}

CreateApiKeyRequest defines model for CreateApiKeyRequest.

type CreateApplicationJSONRequestBody

type CreateApplicationJSONRequestBody = CreateApplicationRequest

CreateApplicationJSONRequestBody defines body for CreateApplication for application/json ContentType.

type CreateApplicationPayload

type CreateApplicationPayload struct {
	Id string `json:"id"`
}

CreateApplicationPayload defines model for CreateApplicationPayload.

type CreateApplicationRequest

type CreateApplicationRequest struct {
	Name string `json:"name"`
}

CreateApplicationRequest defines model for CreateApplicationRequest.

type CreateEventTypeJSONRequestBody

type CreateEventTypeJSONRequestBody = CreateEventTypeRequest

CreateEventTypeJSONRequestBody defines body for CreateEventType for application/json ContentType.

type CreateEventTypePayload

type CreateEventTypePayload struct {
	Id string `json:"id"`
}

CreateEventTypePayload defines model for CreateEventTypePayload.

type CreateEventTypeRequest

type CreateEventTypeRequest struct {
	Description   *string `json:"description,omitempty"`
	Name          string  `json:"name"`
	Schema        *string `json:"schema,omitempty"`
	SchemaExample *string `json:"schema_example,omitempty"`
}

CreateEventTypeRequest defines model for CreateEventTypeRequest.

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 Environment

type Environment struct {
	ArchivedAt     *time.Time      `json:"archived_at,omitempty"`
	CreatedAt      time.Time       `json:"created_at"`
	Id             string          `json:"id"`
	Name           string          `json:"name"`
	OrganizationId string          `json:"organization_id"`
	Type           EnvironmentType `json:"type"`
}

Environment defines model for Environment.

type EnvironmentId

type EnvironmentId = string

EnvironmentId defines model for environmentId.

type EnvironmentType

type EnvironmentType string

EnvironmentType defines model for Environment.Type.

const (
	Development EnvironmentType = "development"
	Production  EnvironmentType = "production"
)

Defines values for EnvironmentType.

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 EventType

type EventType struct {
	ArchivedAt    *time.Time `json:"archived_at,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
	Description   string     `json:"description"`
	Id            string     `json:"id"`
	Name          string     `json:"name"`
	Schema        string     `json:"schema"`
	SchemaExample string     `json:"schema_example"`
}

EventType defines model for EventType.

type GetAllApiKeysParams

type GetAllApiKeysParams struct {
	EnvironmentId string `form:"environment_id" json:"environment_id"`
}

GetAllApiKeysParams defines parameters for GetAllApiKeys.

type GetAllApiKeysPayload

type GetAllApiKeysPayload struct {
	Data []ApiKey `json:"data"`
}

GetAllApiKeysPayload defines model for GetAllApiKeysPayload.

type GetAllEnvironmentsPayload

type GetAllEnvironmentsPayload struct {
	Data []Environment `json:"data"`
}

GetAllEnvironmentsPayload defines model for GetAllEnvironmentsPayload.

type GetApplicationByIdPayload

type GetApplicationByIdPayload struct {
	Data Application `json:"data"`
}

GetApplicationByIdPayload defines model for GetApplicationByIdPayload.

type GetApplicationsParams

type GetApplicationsParams struct {
	EnvironmentID EnvironmentId `form:"environmentID" json:"environmentID"`

	// Limit The number of items per page
	Limit *PaginationParamLimit `form:"limit,omitempty" json:"limit,omitempty"`

	// Page The page number
	Page *PaginationParamPage `form:"page,omitempty" json:"page,omitempty"`
}

GetApplicationsParams defines parameters for GetApplications.

type GetApplicationsPayload

type GetApplicationsPayload struct {
	Data       []Application `json:"data"`
	Pagination Pagination    `json:"pagination"`
}

GetApplicationsPayload defines model for GetApplicationsPayload.

type GetEventTypeByIdPayload

type GetEventTypeByIdPayload struct {
	Data EventType `json:"data"`
}

GetEventTypeByIdPayload defines model for GetEventTypeByIdPayload.

type GetEventTypesParams

type GetEventTypesParams struct {
	// Limit The number of items per page
	Limit *PaginationParamLimit `form:"limit,omitempty" json:"limit,omitempty"`

	// Page The page number
	Page *PaginationParamPage `form:"page,omitempty" json:"page,omitempty"`
}

GetEventTypesParams defines parameters for GetEventTypes.

type GetEventTypesPayload

type GetEventTypesPayload struct {
	Data       []EventType `json:"data"`
	Pagination Pagination  `json:"pagination"`
}

GetEventTypesPayload defines model for GetEventTypesPayload.

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 NotFoundError

type NotFoundError = ErrorResponse

NotFoundError defines model for NotFoundError.

type Pagination

type Pagination struct {
	CurrentPage int `json:"current_page"`
	PerPage     int `json:"per_page"`
	Total       int `json:"total"`
	TotalPages  int `json:"total_pages"`
}

Pagination defines model for Pagination.

type PaginationParamLimit

type PaginationParamLimit = int

PaginationParamLimit defines model for paginationParamLimit.

type PaginationParamPage

type PaginationParamPage = int

PaginationParamPage defines model for paginationParamPage.

type SendMessageJSONRequestBody

type SendMessageJSONRequestBody = SendMessageRequest

SendMessageJSONRequestBody defines body for SendMessage for application/json ContentType.

type SendMessageRequest

type SendMessageRequest struct {
	EventTypeId *string `json:"event_type_id,omitempty"`
	Payload     string  `json:"payload"`
}

SendMessageRequest defines model for SendMessageRequest.

type Server

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

func NewServer

func NewServer(config Config) (*Server, error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type ServerInterface

type ServerInterface interface {
	// Get all api keys
	// (GET /api-keys)
	GetAllApiKeys(ctx echo.Context, params GetAllApiKeysParams) error
	// Create a new api key
	// (POST /api-keys)
	CreateApiKey(ctx echo.Context) error
	// Destroy a new api key given an id
	// (DELETE /api-keys/{apiKeyId})
	DestroyApiKey(ctx echo.Context, apiKeyId string) error
	// Returns a list of applications based on the org_id and environment_id
	// (GET /applications)
	GetApplications(ctx echo.Context, params GetApplicationsParams) error
	// Creates a new application
	// (POST /applications)
	CreateApplication(ctx echo.Context) error
	// Returns an application
	// (GET /applications/{applicationID})
	GetApplicationById(ctx echo.Context, applicationID ApplicationId) error
	// Add an endpoint to an application
	// (POST /applications/{applicationID}/endpoints)
	AddEndpoint(ctx echo.Context, applicationID string) error
	// Send a message to an application
	// (POST /applications/{applicationID}/messages)
	SendMessage(ctx echo.Context, applicationID ApplicationId) error
	// Get all environments
	// (GET /environments)
	GetEnvironments(ctx echo.Context) error
	// Get event types by org_id
	// (GET /event-types)
	GetEventTypes(ctx echo.Context, params GetEventTypesParams) error
	// Creates a new event type
	// (POST /event-types)
	CreateEventType(ctx echo.Context) error
	// Get event type by id and org_id
	// (GET /event-types/{eventTypeID})
	GetEventTypeById(ctx echo.Context, eventTypeID string) error

	// (GET /health)
	HealthCheck(ctx echo.Context) error
	// Authenticates a user
	// (POST /signin)
	SignIn(ctx echo.Context) error
	// Creates a new organization and it's first member
	// (POST /signup)
	SignUp(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) AddEndpoint

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

AddEndpoint converts echo context to params.

func (*ServerInterfaceWrapper) CreateApiKey

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

CreateApiKey converts echo context to params.

func (*ServerInterfaceWrapper) CreateApplication

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

CreateApplication converts echo context to params.

func (*ServerInterfaceWrapper) CreateEventType

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

CreateEventType converts echo context to params.

func (*ServerInterfaceWrapper) DestroyApiKey

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

DestroyApiKey converts echo context to params.

func (*ServerInterfaceWrapper) GetAllApiKeys

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

GetAllApiKeys converts echo context to params.

func (*ServerInterfaceWrapper) GetApplicationById

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

GetApplicationById converts echo context to params.

func (*ServerInterfaceWrapper) GetApplications

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

GetApplications converts echo context to params.

func (*ServerInterfaceWrapper) GetEnvironments

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

GetEnvironments converts echo context to params.

func (*ServerInterfaceWrapper) GetEventTypeById

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

GetEventTypeById converts echo context to params.

func (*ServerInterfaceWrapper) GetEventTypes

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

GetEventTypes converts echo context to params.

func (*ServerInterfaceWrapper) HealthCheck

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

HealthCheck converts echo context to params.

func (*ServerInterfaceWrapper) SendMessage

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

SendMessage converts echo context to params.

func (*ServerInterfaceWrapper) SignIn

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

SignIn converts echo context to params.

func (*ServerInterfaceWrapper) SignUp

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

SignUp converts echo context to params.

type SignInJSONRequestBody

type SignInJSONRequestBody = SigninRequest

SignInJSONRequestBody defines body for SignIn for application/json ContentType.

type SignInPayload

type SignInPayload struct {
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	Id        string `json:"id"`
	LastName  string `json:"last_name"`
	Token     string `json:"token"`
}

SignInPayload defines model for SignInPayload.

type SignUpJSONRequestBody

type SignUpJSONRequestBody = SignupRequest

SignUpJSONRequestBody defines body for SignUp for application/json ContentType.

type SigninRequest

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

SigninRequest defines model for SigninRequest.

type SignupRequest

type SignupRequest struct {
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Password  string `json:"password"`
}

SignupRequest defines model for SignupRequest.

Jump to

Keyboard shortcuts

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