ports

package
v0.0.0-...-a3d3c85 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.12.2 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.12.2 DO NOT EDIT.

Index

Constants

View Source
const (
	ApiKeyAuthScopes = "ApiKeyAuth.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 Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

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

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

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Error

type Error struct {
	Message string `json:"message"`
	Slug    string `json:"slug"`
}

Error defines model for Error.

type HttpServer

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

func NewHttpServer

func NewHttpServer(application app.Application) HttpServer

func (HttpServer) SendNotification

func (h HttpServer) SendNotification(w http.ResponseWriter, r *http.Request)

func (HttpServer) SubscribeNotification

func (h HttpServer) SubscribeNotification(w http.ResponseWriter, r *http.Request)

func (HttpServer) SubscriberStats

func (h HttpServer) SubscriberStats(w http.ResponseWriter, r *http.Request)

func (HttpServer) SubscriberStatus

func (h HttpServer) SubscriberStatus(w http.ResponseWriter, r *http.Request)

func (HttpServer) UnsubscribeNotification

func (h HttpServer) UnsubscribeNotification(w http.ResponseWriter, r *http.Request)

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Message

type Message struct {
	// Message Notification message
	Message string `json:"message"`

	// Title Notification title
	Title string `json:"title"`
}

Message defines model for Message.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type SendNotificationJSONRequestBody

type SendNotificationJSONRequestBody = Message

SendNotificationJSONRequestBody defines body for SendNotification for application/json ContentType.

type ServerInterface

type ServerInterface interface {
	// Send notification to all subscriber
	// (POST /notification/send)
	SendNotification(w http.ResponseWriter, r *http.Request)
	// Subscriber Stats
	// (GET /notification/stats)
	SubscriberStats(w http.ResponseWriter, r *http.Request)
	// Subscriber Status
	// (POST /notification/status)
	SubscriberStatus(w http.ResponseWriter, r *http.Request)
	// Subscribe to notification
	// (POST /notification/subscribe)
	SubscribeNotification(w http.ResponseWriter, r *http.Request)
	// Unsubscribe to notification
	// (POST /notification/unsubscribe)
	UnsubscribeNotification(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) SendNotification

func (siw *ServerInterfaceWrapper) SendNotification(w http.ResponseWriter, r *http.Request)

SendNotification operation middleware

func (*ServerInterfaceWrapper) SubscribeNotification

func (siw *ServerInterfaceWrapper) SubscribeNotification(w http.ResponseWriter, r *http.Request)

SubscribeNotification operation middleware

func (*ServerInterfaceWrapper) SubscriberStats

func (siw *ServerInterfaceWrapper) SubscriberStats(w http.ResponseWriter, r *http.Request)

SubscriberStats operation middleware

func (*ServerInterfaceWrapper) SubscriberStatus

func (siw *ServerInterfaceWrapper) SubscriberStatus(w http.ResponseWriter, r *http.Request)

SubscriberStatus operation middleware

func (*ServerInterfaceWrapper) UnsubscribeNotification

func (siw *ServerInterfaceWrapper) UnsubscribeNotification(w http.ResponseWriter, r *http.Request)

UnsubscribeNotification operation middleware

type Stats

type Stats struct {
	// TotalActiveSubs Totala active subscribers
	TotalActiveSubs int `json:"totalActiveSubs"`

	// TotalInactiveSubs Total inactive subscribers
	TotalInactiveSubs int `json:"totalInactiveSubs"`

	// TotalSubs Total subscribers
	TotalSubs int `json:"totalSubs"`
}

Stats defines model for Stats.

type Status

type Status struct {
	// IsActive Subscriber status
	IsActive bool `json:"isActive"`

	// UpdatedAt Last updated date
	UpdatedAt int64 `json:"updatedAt"`
}

Status defines model for Status.

type SubscribeNotificationJSONRequestBody

type SubscribeNotificationJSONRequestBody = Subscriber

SubscribeNotificationJSONRequestBody defines body for SubscribeNotification for application/json ContentType.

type Subscriber

type Subscriber struct {
	// TokenID Client Token
	TokenID string `json:"tokenID"`

	// UpdatedAt Last updated date
	UpdatedAt int64 `json:"updatedAt"`
}

Subscriber defines model for Subscriber.

type SubscriberStatusJSONRequestBody

type SubscriberStatusJSONRequestBody = Subscriber

SubscriberStatusJSONRequestBody defines body for SubscriberStatus for application/json ContentType.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

type UnsubscribeNotificationJSONRequestBody

type UnsubscribeNotificationJSONRequestBody = Subscriber

UnsubscribeNotificationJSONRequestBody defines body for UnsubscribeNotification for application/json ContentType.

Jump to

Keyboard shortcuts

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