api

package
v0.0.0-...-524bf5b Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220629212257-2cf7fcf5b26d DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220629212257-2cf7fcf5b26d DO NOT EDIT.

Index

Constants

View Source
const (
	AuthBearerTokenScopes   = "authBearerToken.Scopes"
	UnauthBearerTokenScopes = "unauthBearerToken.Scopes"
)

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

type LoginJSONBody struct {
	// Password of an user account
	Password string `json:"password" validate:"required"`

	// Username of an user account
	Username string `json:"username" validate:"required"`
}

LoginJSONBody defines parameters for Login.

type LoginJSONRequestBody

type LoginJSONRequestBody LoginJSONBody

LoginJSONRequestBody defines body for Login for application/json ContentType.

type LoginRequest

type LoginRequest struct {
	// Password of an user account
	Password string `json:"password" validate:"required"`

	// Username of an user account
	Username string `json:"username" validate:"required"`
}

LoginRequest defines model for LoginRequest.

type LoginResponse

type LoginResponse struct {
	// An unauthenticated JWT access token needed in 2FA.
	UnauthToken string `json:"unauth_token"`
}

LoginResponse defines model for LoginResponse.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type ProblemDetails

type ProblemDetails struct {
	// Human-readable explanation specific to this occurrence of the problem
	Detail string `json:"detail"`

	// A URI reference that identifies the specific occurrence of the problem
	Instance string `json:"instance"`

	// A http status code describing a problem
	StatusCode int `json:"status_code"`

	// A short, human-readable summary of the problem type
	Title string `json:"title"`
}

A problem details response, which occured during processing of a request. (Trying to adhere to RFC 7807)

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 Secret2FAResponse

type Secret2FAResponse struct {
	QrURI *string `json:"qrURI,omitempty"`
}

Secret2FAResponse defines model for Secret2FAResponse.

type ServerInterface

type ServerInterface interface {

	// (POST /2fa/setup)
	Setup2FA(w http.ResponseWriter, r *http.Request)

	// (POST /2fa/verify)
	Verify2FA(w http.ResponseWriter, r *http.Request)

	// (POST /login)
	Login(w http.ResponseWriter, r *http.Request)

	// (POST /signup)
	Signup(w http.ResponseWriter, r *http.Request)

	// (GET /test-auth)
	TestAuth(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) Login

Login operation middleware

func (*ServerInterfaceWrapper) Setup2FA

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

Setup2FA operation middleware

func (*ServerInterfaceWrapper) Signup

Signup operation middleware

func (*ServerInterfaceWrapper) TestAuth

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

TestAuth operation middleware

func (*ServerInterfaceWrapper) Verify2FA

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

Verify2FA operation middleware

type SignupJSONBody

type SignupJSONBody struct {
	// Email address of a new user account
	Email string `json:"email" validate:"required"`

	// Password for getting access to the new user account
	Password string `json:"password" validate:"required"`

	// Username with which new user account will be identified in the system
	Username string `json:"username" validate:"required"`
}

SignupJSONBody defines parameters for Signup.

type SignupJSONRequestBody

type SignupJSONRequestBody SignupJSONBody

SignupJSONRequestBody defines body for Signup for application/json ContentType.

type SignupRequest

type SignupRequest struct {
	// Email address of a new user account
	Email string `json:"email" validate:"required"`

	// Password for getting access to the new user account
	Password string `json:"password" validate:"required"`

	// Username with which new user account will be identified in the system
	Username string `json:"username" validate:"required"`
}

SignupRequest defines model for SignupRequest.

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

type Verify2FAJSONBody

type Verify2FAJSONBody struct {
	// OTP for 2FA
	Otp int `json:"otp" validate:"required"`
}

Verify2FAJSONBody defines parameters for Verify2FA.

type Verify2FAJSONRequestBody

type Verify2FAJSONRequestBody Verify2FAJSONBody

Verify2FAJSONRequestBody defines body for Verify2FA for application/json ContentType.

type Verify2FARequest

type Verify2FARequest struct {
	// OTP for 2FA
	Otp int `json:"otp" validate:"required"`
}

Verify2FARequest defines model for Verify2FARequest.

type VerifyResponse

type VerifyResponse struct {
	// An full access JWT.
	AccessToken string `json:"access_token"`
}

VerifyResponse defines model for VerifyResponse.

Jump to

Keyboard shortcuts

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