api

package
v0.0.0-...-71b0ef4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.0 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, 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 NewServer

func NewServer(cfg config.Config, DB *sql.DB) (http.Handler, 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 RequestLogger

func RequestLogger(handler http.Handler) http.Handler

Types

type ChiServerOptions

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

type DocumentPayload

type DocumentPayload struct {
	Device     *string  `json:"device,omitempty"`
	DeviceId   *string  `json:"device_id,omitempty"`
	Document   *string  `json:"document,omitempty"`
	Percentage *float32 `json:"percentage,omitempty"`
	Progress   *string  `json:"progress,omitempty"`
}

DocumentPayload defines model for DocumentPayload.

type GetDoc200TexthtmlResponse

type GetDoc200TexthtmlResponse struct {
	Body          io.Reader
	ContentLength int64
}

func (GetDoc200TexthtmlResponse) VisitGetDocResponse

func (response GetDoc200TexthtmlResponse) VisitGetDocResponse(w http.ResponseWriter) error

type GetDoc400JSONResponse

type GetDoc400JSONResponse Response

func (GetDoc400JSONResponse) VisitGetDocResponse

func (response GetDoc400JSONResponse) VisitGetDocResponse(w http.ResponseWriter) error

type GetDocRequestObject

type GetDocRequestObject struct {
}

type GetDocResponseObject

type GetDocResponseObject interface {
	VisitGetDocResponse(w http.ResponseWriter) error
}

type GetHealthcheck200JSONResponse

type GetHealthcheck200JSONResponse Response

func (GetHealthcheck200JSONResponse) VisitGetHealthcheckResponse

func (response GetHealthcheck200JSONResponse) VisitGetHealthcheckResponse(w http.ResponseWriter) error

type GetHealthcheckRequestObject

type GetHealthcheckRequestObject struct {
}

type GetHealthcheckResponseObject

type GetHealthcheckResponseObject interface {
	VisitGetHealthcheckResponse(w http.ResponseWriter) error
}

type GetOpenapiYaml200ApplicationyamlResponse

type GetOpenapiYaml200ApplicationyamlResponse struct {
	Body          io.Reader
	ContentLength int64
}

func (GetOpenapiYaml200ApplicationyamlResponse) VisitGetOpenapiYamlResponse

func (response GetOpenapiYaml200ApplicationyamlResponse) VisitGetOpenapiYamlResponse(w http.ResponseWriter) error

type GetOpenapiYaml400JSONResponse

type GetOpenapiYaml400JSONResponse Response

func (GetOpenapiYaml400JSONResponse) VisitGetOpenapiYamlResponse

func (response GetOpenapiYaml400JSONResponse) VisitGetOpenapiYamlResponse(w http.ResponseWriter) error

type GetOpenapiYamlRequestObject

type GetOpenapiYamlRequestObject struct {
}

type GetOpenapiYamlResponseObject

type GetOpenapiYamlResponseObject interface {
	VisitGetOpenapiYamlResponse(w http.ResponseWriter) error
}

type GetSyncProgressResponse

type GetSyncProgressResponse struct {
	Device     *string  `json:"device,omitempty"`
	DeviceId   *string  `json:"device_id,omitempty"`
	Document   *string  `json:"document,omitempty"`
	Percentage *float32 `json:"percentage,omitempty"`
	Progress   *string  `json:"progress,omitempty"`
}

GetSyncProgressResponse defines model for GetSyncProgressResponse.

type GetSyncsProgressDocumentHash200JSONResponse

type GetSyncsProgressDocumentHash200JSONResponse GetSyncProgressResponse

func (GetSyncsProgressDocumentHash200JSONResponse) VisitGetSyncsProgressDocumentHashResponse

func (response GetSyncsProgressDocumentHash200JSONResponse) VisitGetSyncsProgressDocumentHashResponse(w http.ResponseWriter) error

type GetSyncsProgressDocumentHash401JSONResponse

type GetSyncsProgressDocumentHash401JSONResponse Response

func (GetSyncsProgressDocumentHash401JSONResponse) VisitGetSyncsProgressDocumentHashResponse

func (response GetSyncsProgressDocumentHash401JSONResponse) VisitGetSyncsProgressDocumentHashResponse(w http.ResponseWriter) error

type GetSyncsProgressDocumentHash502JSONResponse

type GetSyncsProgressDocumentHash502JSONResponse Response

func (GetSyncsProgressDocumentHash502JSONResponse) VisitGetSyncsProgressDocumentHashResponse

func (response GetSyncsProgressDocumentHash502JSONResponse) VisitGetSyncsProgressDocumentHashResponse(w http.ResponseWriter) error

type GetSyncsProgressDocumentHashParams

type GetSyncsProgressDocumentHashParams struct {
	XAuthUser string `json:"x-auth-user"`
	XAuthKey  string `json:"x-auth-key"`
}

GetSyncsProgressDocumentHashParams defines parameters for GetSyncsProgressDocumentHash.

type GetSyncsProgressDocumentHashRequestObject

type GetSyncsProgressDocumentHashRequestObject struct {
	DocumentHash string `json:"documentHash,omitempty"`
	Params       GetSyncsProgressDocumentHashParams
}

type GetSyncsProgressDocumentHashResponseObject

type GetSyncsProgressDocumentHashResponseObject interface {
	VisitGetSyncsProgressDocumentHashResponse(w http.ResponseWriter) error
}

type GetUsersAuth200JSONResponse

type GetUsersAuth200JSONResponse Response

func (GetUsersAuth200JSONResponse) VisitGetUsersAuthResponse

func (response GetUsersAuth200JSONResponse) VisitGetUsersAuthResponse(w http.ResponseWriter) error

type GetUsersAuth401JSONResponse

type GetUsersAuth401JSONResponse Response

func (GetUsersAuth401JSONResponse) VisitGetUsersAuthResponse

func (response GetUsersAuth401JSONResponse) VisitGetUsersAuthResponse(w http.ResponseWriter) error

type GetUsersAuthParams

type GetUsersAuthParams struct {
	XAuthUser string `json:"x-auth-user"`
	XAuthKey  string `json:"x-auth-key"`
}

GetUsersAuthParams defines parameters for GetUsersAuth.

type GetUsersAuthRequestObject

type GetUsersAuthRequestObject struct {
	Params GetUsersAuthParams
}

type GetUsersAuthResponseObject

type GetUsersAuthResponseObject interface {
	VisitGetUsersAuthResponse(w http.ResponseWriter) error
}

type HttpMethod

type HttpMethod struct{}

type HttpPath

type HttpPath struct{}

type IP

type IP struct{}

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

type PostUsersCreate201JSONResponse

type PostUsersCreate201JSONResponse Response

func (PostUsersCreate201JSONResponse) VisitPostUsersCreateResponse

func (response PostUsersCreate201JSONResponse) VisitPostUsersCreateResponse(w http.ResponseWriter) error

type PostUsersCreate402JSONResponse

type PostUsersCreate402JSONResponse Response

func (PostUsersCreate402JSONResponse) VisitPostUsersCreateResponse

func (response PostUsersCreate402JSONResponse) VisitPostUsersCreateResponse(w http.ResponseWriter) error

type PostUsersCreateJSONRequestBody

type PostUsersCreateJSONRequestBody = UserPayload

PostUsersCreateJSONRequestBody defines body for PostUsersCreate for application/json ContentType.

type PostUsersCreateRequestObject

type PostUsersCreateRequestObject struct {
	Body *PostUsersCreateJSONRequestBody
}

type PostUsersCreateResponseObject

type PostUsersCreateResponseObject interface {
	VisitPostUsersCreateResponse(w http.ResponseWriter) error
}

type PutSyncsProgress200JSONResponse

type PutSyncsProgress200JSONResponse Response

func (PutSyncsProgress200JSONResponse) VisitPutSyncsProgressResponse

func (response PutSyncsProgress200JSONResponse) VisitPutSyncsProgressResponse(w http.ResponseWriter) error

type PutSyncsProgress401JSONResponse

type PutSyncsProgress401JSONResponse Response

func (PutSyncsProgress401JSONResponse) VisitPutSyncsProgressResponse

func (response PutSyncsProgress401JSONResponse) VisitPutSyncsProgressResponse(w http.ResponseWriter) error

type PutSyncsProgressJSONRequestBody

type PutSyncsProgressJSONRequestBody = DocumentPayload

PutSyncsProgressJSONRequestBody defines body for PutSyncsProgress for application/json ContentType.

type PutSyncsProgressParams

type PutSyncsProgressParams struct {
	XAuthUser string `json:"x-auth-user"`
	XAuthKey  string `json:"x-auth-key"`
}

PutSyncsProgressParams defines parameters for PutSyncsProgress.

type PutSyncsProgressRequestObject

type PutSyncsProgressRequestObject struct {
	Params PutSyncsProgressParams
	Body   *PutSyncsProgressJSONRequestBody
}

type PutSyncsProgressResponseObject

type PutSyncsProgressResponseObject interface {
	VisitPutSyncsProgressResponse(w http.ResponseWriter) error
}

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 Response

type Response struct {
	Message  *string `json:"message,omitempty"`
	UserName *string `json:"userName,omitempty"`
}

Response defines model for Response.

type Server

type Server struct {
	Cfg         config.Config
	UserService service.UserServiceInterface
}

func (*Server) GetDoc

func (*Server) GetHealthcheck

func (*Server) GetOpenapiYaml

func (*Server) GetUsersAuth

func (*Server) PostUsersCreate

func (*Server) PutSyncsProgress

type ServerInterface

type ServerInterface interface {

	// (GET /doc)
	GetDoc(w http.ResponseWriter, r *http.Request)

	// (GET /healthcheck)
	GetHealthcheck(w http.ResponseWriter, r *http.Request)

	// (GET /openapi.yaml)
	GetOpenapiYaml(w http.ResponseWriter, r *http.Request)

	// (PUT /syncs/progress)
	PutSyncsProgress(w http.ResponseWriter, r *http.Request, params PutSyncsProgressParams)

	// (GET /syncs/progress/{documentHash})
	GetSyncsProgressDocumentHash(w http.ResponseWriter, r *http.Request, documentHash string, params GetSyncsProgressDocumentHashParams)

	// (GET /users/auth)
	GetUsersAuth(w http.ResponseWriter, r *http.Request, params GetUsersAuthParams)

	// (POST /users/create)
	PostUsersCreate(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) GetDoc

GetDoc operation middleware

func (*ServerInterfaceWrapper) GetHealthcheck

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

GetHealthcheck operation middleware

func (*ServerInterfaceWrapper) GetOpenapiYaml

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

GetOpenapiYaml operation middleware

func (*ServerInterfaceWrapper) GetSyncsProgressDocumentHash

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

GetSyncsProgressDocumentHash operation middleware

func (*ServerInterfaceWrapper) GetUsersAuth

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

GetUsersAuth operation middleware

func (*ServerInterfaceWrapper) PostUsersCreate

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

PostUsersCreate operation middleware

func (*ServerInterfaceWrapper) PutSyncsProgress

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

PutSyncsProgress operation middleware

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 {

	// (GET /doc)
	GetDoc(ctx context.Context, request GetDocRequestObject) (GetDocResponseObject, error)

	// (GET /healthcheck)
	GetHealthcheck(ctx context.Context, request GetHealthcheckRequestObject) (GetHealthcheckResponseObject, error)

	// (GET /openapi.yaml)
	GetOpenapiYaml(ctx context.Context, request GetOpenapiYamlRequestObject) (GetOpenapiYamlResponseObject, error)

	// (PUT /syncs/progress)
	PutSyncsProgress(ctx context.Context, request PutSyncsProgressRequestObject) (PutSyncsProgressResponseObject, error)

	// (GET /syncs/progress/{documentHash})
	GetSyncsProgressDocumentHash(ctx context.Context, request GetSyncsProgressDocumentHashRequestObject) (GetSyncsProgressDocumentHashResponseObject, error)

	// (GET /users/auth)
	GetUsersAuth(ctx context.Context, request GetUsersAuthRequestObject) (GetUsersAuthResponseObject, error)

	// (POST /users/create)
	PostUsersCreate(ctx context.Context, request PostUsersCreateRequestObject) (PostUsersCreateResponseObject, error)
}

StrictServerInterface represents all server handlers.

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 Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetDoc

func (_ Unimplemented) GetDoc(w http.ResponseWriter, r *http.Request)

(GET /doc)

func (Unimplemented) GetHealthcheck

func (_ Unimplemented) GetHealthcheck(w http.ResponseWriter, r *http.Request)

(GET /healthcheck)

func (Unimplemented) GetOpenapiYaml

func (_ Unimplemented) GetOpenapiYaml(w http.ResponseWriter, r *http.Request)

(GET /openapi.yaml)

func (Unimplemented) GetSyncsProgressDocumentHash

func (_ Unimplemented) GetSyncsProgressDocumentHash(w http.ResponseWriter, r *http.Request, documentHash string, params GetSyncsProgressDocumentHashParams)

(GET /syncs/progress/{documentHash})

func (Unimplemented) GetUsersAuth

func (_ Unimplemented) GetUsersAuth(w http.ResponseWriter, r *http.Request, params GetUsersAuthParams)

(GET /users/auth)

func (Unimplemented) PostUsersCreate

func (_ Unimplemented) PostUsersCreate(w http.ResponseWriter, r *http.Request)

(POST /users/create)

func (Unimplemented) PutSyncsProgress

func (_ Unimplemented) PutSyncsProgress(w http.ResponseWriter, r *http.Request, params PutSyncsProgressParams)

(PUT /syncs/progress)

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

type UserPayload

type UserPayload struct {
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

UserPayload defines model for UserPayload.

Jump to

Keyboard shortcuts

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