ports

package
v0.0.0-...-d2e3589 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 15 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.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

Types

type ChiServerOptions

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

type HttpServer

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

func NewHttpServer

func NewHttpServer(service app.ChatService, sessionStore *SessionStore) HttpServer

func (HttpServer) CreateChannel

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

Create a channel

func (HttpServer) CreateMembership

func (h HttpServer) CreateMembership(w http.ResponseWriter, r *http.Request, channelID string)

Create a membership

func (HttpServer) CreateUser

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

Create a user

func (HttpServer) DeleteChannelById

func (h HttpServer) DeleteChannelById(w http.ResponseWriter, r *http.Request, channelID string)

Delete a channel

func (HttpServer) DeleteMembershipById

func (h HttpServer) DeleteMembershipById(w http.ResponseWriter, r *http.Request, channelID string, membershipID string)

Remove a membership

func (HttpServer) DeleteUserById

func (h HttpServer) DeleteUserById(w http.ResponseWriter, r *http.Request, userID string)

Delete a user

func (HttpServer) GetChannelById

func (h HttpServer) GetChannelById(w http.ResponseWriter, r *http.Request, channelID string)

Retrieve a channel

func (HttpServer) GetChannels

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

func (HttpServer) GetMembershipById

func (h HttpServer) GetMembershipById(w http.ResponseWriter, r *http.Request, channelID string, membershipID string)

Retrieve a membership

func (HttpServer) GetUserAccessToken

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

func (HttpServer) GetUserById

func (h HttpServer) GetUserById(w http.ResponseWriter, r *http.Request, userID string)

Retrieve a user

func (HttpServer) GetUsers

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

Retrieve all users

func (HttpServer) Websocket

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

Opens a WebSocket connection

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 MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

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 ServerInterface

type ServerInterface interface {
	// Login to the API
	// (POST /auth/token/)
	GetUserAccessToken(w http.ResponseWriter, r *http.Request)
	// Retrieve all channels
	// (GET /v1/channels)
	GetChannels(w http.ResponseWriter, r *http.Request)
	// Create a channel
	// (POST /v1/channels)
	CreateChannel(w http.ResponseWriter, r *http.Request)
	// Delete a channel
	// (DELETE /v1/channels/{channelID})
	DeleteChannelById(w http.ResponseWriter, r *http.Request, channelID string)
	// Retrieve a channel
	// (GET /v1/channels/{channelID})
	GetChannelById(w http.ResponseWriter, r *http.Request, channelID string)
	// Create a membership
	// (POST /v1/channels/{channelID}/memberships)
	CreateMembership(w http.ResponseWriter, r *http.Request, channelID string)
	// Remove a membership
	// (DELETE /v1/channels/{channelID}/memberships/{membershipID})
	DeleteMembershipById(w http.ResponseWriter, r *http.Request, channelID string, membershipID string)
	// Retrieve a membership
	// (GET /v1/channels/{channelID}/memberships/{membershipID})
	GetMembershipById(w http.ResponseWriter, r *http.Request, channelID string, membershipID string)
	// Opens a WebSocket connection
	// (GET /v1/stream)
	Websocket(w http.ResponseWriter, r *http.Request)
	// Retrieve all users
	// (GET /v1/users)
	GetUsers(w http.ResponseWriter, r *http.Request)
	// Create a user
	// (POST /v1/users)
	CreateUser(w http.ResponseWriter, r *http.Request)
	// Delete a user
	// (DELETE /v1/users/{userID})
	DeleteUserById(w http.ResponseWriter, r *http.Request, userID string)
	// Retrieve a user
	// (GET /v1/users/{userID})
	GetUserById(w http.ResponseWriter, r *http.Request, userID string)
}

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) CreateChannel

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

CreateChannel operation middleware

func (*ServerInterfaceWrapper) CreateMembership

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

CreateMembership operation middleware

func (*ServerInterfaceWrapper) CreateUser

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

CreateUser operation middleware

func (*ServerInterfaceWrapper) DeleteChannelById

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

DeleteChannelById operation middleware

func (*ServerInterfaceWrapper) DeleteMembershipById

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

DeleteMembershipById operation middleware

func (*ServerInterfaceWrapper) DeleteUserById

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

DeleteUserById operation middleware

func (*ServerInterfaceWrapper) GetChannelById

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

GetChannelById operation middleware

func (*ServerInterfaceWrapper) GetChannels

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

GetChannels operation middleware

func (*ServerInterfaceWrapper) GetMembershipById

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

GetMembershipById operation middleware

func (*ServerInterfaceWrapper) GetUserAccessToken

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

GetUserAccessToken operation middleware

func (*ServerInterfaceWrapper) GetUserById

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

GetUserById operation middleware

func (*ServerInterfaceWrapper) GetUsers

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

GetUsers operation middleware

func (*ServerInterfaceWrapper) Websocket

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

Websocket operation middleware

type SessionStore

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

SessionStore holds live sessions. Sessions are stored in a map indexed by session ID.

func NewSessionStore

func NewSessionStore() *SessionStore

NewSessionStore initializes a session store.

func (*SessionStore) Delete

func (s *SessionStore) Delete(session *session.Session)

Delete removes session from store.

func (*SessionStore) Get

func (s *SessionStore) Get(id string) *session.Session

Get fetches a session from store by session ID.

func (*SessionStore) NewWebsocketSession

func (s *SessionStore) NewWebsocketSession(conn *websocket.Conn, app *app.ChatService) (*session.Session, int)

NewSession creates a new session and saves it to the session store.

func (*SessionStore) Shutdown

func (s *SessionStore) Shutdown()

Shutdown terminates sessionStore.

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 UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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