http

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 12 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.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

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, m ServeMux) http.Handler

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

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) 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 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 MessageRequest

type MessageRequest struct {
	DisableNotification *bool   `json:"disable_notification,omitempty"`
	ParseMode           *string `json:"parse_mode,omitempty"`
	ProtectContent      *bool   `json:"protect_content,omitempty"`
	Text                string  `json:"text"`
}

MessageRequest defines model for MessageRequest.

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 Send200JSONResponse

type Send200JSONResponse SendMessageResponse

func (Send200JSONResponse) VisitSendResponse

func (response Send200JSONResponse) VisitSendResponse(w http.ResponseWriter) error

type SendJSONRequestBody

type SendJSONRequestBody = SendMessageRequest

SendJSONRequestBody defines body for Send for application/json ContentType.

type SendMessageRequest

type SendMessageRequest struct {
	BotName  *string        `json:"bot_name,omitempty"`
	ChatName *string        `json:"chat_name,omitempty"`
	Message  MessageRequest `json:"message"`
}

SendMessageRequest defines model for SendMessageRequest.

type SendMessageResponse

type SendMessageResponse struct {
	Ok     *bool      `json:"ok,omitempty"`
	Result *TgMessage `json:"result,omitempty"`
}

SendMessageResponse defines model for SendMessageResponse.

type SendRequestObject

type SendRequestObject struct {
	Body *SendJSONRequestBody
}

type SendResponseObject

type SendResponseObject interface {
	VisitSendResponse(w http.ResponseWriter) error
}

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {

	// (POST /api/v1/messages/send)
	Send(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

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

Send operation middleware

type StdHTTPServerOptions

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

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictServerInterface

type StrictServerInterface interface {

	// (POST /api/v1/messages/send)
	Send(ctx context.Context, request SendRequestObject) (SendResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TgChat added in v1.0.1

type TgChat struct {
	FirstName *string `json:"first_name,omitempty"`
	Id        int64   `json:"id"`
	IsForum   *bool   `json:"is_forum,omitempty"`
	LastName  *string `json:"last_name,omitempty"`
	Title     *string `json:"title,omitempty"`
	Type      string  `json:"type"`
}

TgChat defines model for TgChat.

type TgMessage

type TgMessage struct {
	Chat            *TgChat `json:"chat,omitempty"`
	Date            *uint64 `json:"date,omitempty"`
	From            *TgUser `json:"from,omitempty"`
	MessageId       *int64  `json:"message_id,omitempty"`
	MessageThreadId *int64  `json:"message_thread_id,omitempty"`
}

TgMessage defines model for TgMessage.

type TgUser

type TgUser struct {
	AddedToAttachmentMenu   *bool   `json:"added_to_attachment_menu,omitempty"`
	CanConnectToBusiness    *bool   `json:"can_connect_to_business,omitempty"`
	CanJoinGroups           *bool   `json:"can_join_groups,omitempty"`
	CanReadAllGroupMessages *bool   `json:"can_read_all_group_messages,omitempty"`
	FirstName               *string `json:"first_name,omitempty"`
	Id                      *int64  `json:"id,omitempty"`
	IsBot                   *bool   `json:"is_bot,omitempty"`
	IsPremium               *bool   `json:"is_premium,omitempty"`
	LanguageCode            *string `json:"language_code,omitempty"`
	LastName                *string `json:"last_name,omitempty"`
	SupportsInlineQueries   *bool   `json:"supports_inline_queries,omitempty"`
	Username                *string `json:"username,omitempty"`
}

TgUser defines model for TgUser.

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

Jump to

Keyboard shortcuts

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