http

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: AGPL-3.0 Imports: 28 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 Config

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

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

type SendMessageJSONRequestBody = SendMessageRequest

SendMessageJSONRequestBody defines body for SendMessage for application/json ContentType.

type SendMessageRequest

type SendMessageRequest struct {
	EventTypeId string `json:"event_type_id"`
	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
	// Creates a new application
	// (POST /applications)
	CreateApplication(ctx echo.Context) 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 string) error
	// Get all environments
	// (GET /environments)
	GetEnvironments(ctx echo.Context) error
	// Creates a new event type
	// (POST /event-types)
	CreateEventType(ctx echo.Context) 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) GetEnvironments

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

GetEnvironments 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