public_api

package
v0.0.0-...-513cc63 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.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 DeleteUserParams

type DeleteUserParams struct {
	// Username Username of the user to be deleted
	Username string `form:"username" json:"username"`
}

DeleteUserParams defines parameters for DeleteUser.

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type GetUserParams

type GetUserParams struct {
	// Username Username to fetch the user information
	Username string `form:"username" json:"username"`
}

GetUserParams defines parameters for GetUser.

type IdmStore

type IdmStore struct {
	IdmService *Service
	JwtSecret  string
}

func (*IdmStore) DeleteUser

func (h *IdmStore) DeleteUser(w http.ResponseWriter, r *http.Request, params DeleteUserParams)

func (*IdmStore) GetPublic

func (h *IdmStore) GetPublic(w http.ResponseWriter, r *http.Request)

func (*IdmStore) GetUser

func (h *IdmStore) GetUser(w http.ResponseWriter, r *http.Request, params GetUserParams)
 curl --location -X GET 'localhost:4000/api/get?username=torpago_usr2' \
		--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0b3JwYWdvX3VzcjIifQ.TEfIz4cfqhvq5evhsvvw9bSuoAWvCnlgzaXV1Lrf5Vc'

func (*IdmStore) PostUser

func (h *IdmStore) PostUser(w http.ResponseWriter, r *http.Request)
curl --location -X POST 'localhost:4000/api/post' \
    --header 'Content-Type: application/json' \
	--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0b3JwYWdvX3VzcjIifQ.TEfIz4cfqhvq5evhsvvw9bSuoAWvCnlgzaXV1Lrf5Vc' \
    --data-raw '{
        "username": "elliot123",
        "password": "pwd",
		"firstname": "Jessie",
		"lastname": "Lee"
    }'

func (*IdmStore) PutUser

func (h *IdmStore) PutUser(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 MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type PostUser

type PostUser struct {
	Firstname string  `json:"firstname"`
	Lastname  *string `json:"lastname,omitempty"`
	Password  string  `json:"password"`
	Username  string  `json:"username"`
}

PostUser defines model for PostUser.

type PostUserJSONRequestBody

type PostUserJSONRequestBody = PostUser

PostUserJSONRequestBody defines body for PostUser for application/json ContentType.

type PutUserFormdataRequestBody

type PutUserFormdataRequestBody = User

PutUserFormdataRequestBody defines body for PutUser for application/x-www-form-urlencoded ContentType.

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 {

	// (DELETE /delete)
	DeleteUser(w http.ResponseWriter, r *http.Request, params DeleteUserParams)

	// (GET /get)
	GetUser(w http.ResponseWriter, r *http.Request, params GetUserParams)

	// (POST /post)
	PostUser(w http.ResponseWriter, r *http.Request)

	// (PUT /put)
	PutUser(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) DeleteUser

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

DeleteUser operation middleware

func (*ServerInterfaceWrapper) GetUser

GetUser operation middleware

func (*ServerInterfaceWrapper) PostUser

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

PostUser operation middleware

func (*ServerInterfaceWrapper) PutUser

PutUser operation middleware

type Service

type Service struct {
	Queries *idm.Queries
}

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

func (_ Unimplemented) DeleteUser(w http.ResponseWriter, r *http.Request, params DeleteUserParams)

(DELETE /delete)

func (Unimplemented) GetUser

func (_ Unimplemented) GetUser(w http.ResponseWriter, r *http.Request, params GetUserParams)

(GET /get)

func (Unimplemented) PostUser

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

(POST /post)

func (Unimplemented) PutUser

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

(PUT /put)

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 User

type User struct {
	Firstname string  `json:"firstname"`
	Lastname  *string `json:"lastname,omitempty"`
	Password  string  `json:"password"`
	Userid    string  `json:"userid"`
	Username  string  `json:"username"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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