api

package
v0.0.0-...-74a3a5e Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 5 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.1 DO NOT EDIT.

Index

Constants

View Source
const (
	Api_keyScopes       = "api_key.Scopes"
	Petstore_authScopes = "petstore_auth.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, 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

Types

type AddPetFormdataRequestBody

type AddPetFormdataRequestBody = Pet

AddPetFormdataRequestBody defines body for AddPet for application/x-www-form-urlencoded ContentType.

type AddPetJSONRequestBody

type AddPetJSONRequestBody = Pet

AddPetJSONRequestBody defines body for AddPet for application/json ContentType.

type ApiResponse

type ApiResponse struct {
	Code    *int32  `json:"code,omitempty"`
	Message *string `json:"message,omitempty"`
	Type    *string `json:"type,omitempty"`
}

ApiResponse defines model for ApiResponse.

type Category

type Category struct {
	Id   *int64  `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

Category defines model for Category.

type CreateUserFormdataRequestBody

type CreateUserFormdataRequestBody = User

CreateUserFormdataRequestBody defines body for CreateUser for application/x-www-form-urlencoded ContentType.

type CreateUserJSONRequestBody

type CreateUserJSONRequestBody = User

CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.

type CreateUsersWithListInputJSONBody

type CreateUsersWithListInputJSONBody = []User

CreateUsersWithListInputJSONBody defines parameters for CreateUsersWithListInput.

type CreateUsersWithListInputJSONRequestBody

type CreateUsersWithListInputJSONRequestBody = CreateUsersWithListInputJSONBody

CreateUsersWithListInputJSONRequestBody defines body for CreateUsersWithListInput for application/json ContentType.

type DeletePetParams

type DeletePetParams struct {
	ApiKey *string `json:"api_key,omitempty"`
}

DeletePetParams defines parameters for DeletePet.

type FindPetsByStatusParams

type FindPetsByStatusParams struct {
	// Status Status values that need to be considered for filter
	Status *FindPetsByStatusParamsStatus `form:"status,omitempty" json:"status,omitempty"`
}

FindPetsByStatusParams defines parameters for FindPetsByStatus.

type FindPetsByStatusParamsStatus

type FindPetsByStatusParamsStatus string

FindPetsByStatusParamsStatus defines parameters for FindPetsByStatus.

const (
	FindPetsByStatusParamsStatusAvailable FindPetsByStatusParamsStatus = "available"
	FindPetsByStatusParamsStatusPending   FindPetsByStatusParamsStatus = "pending"
	FindPetsByStatusParamsStatusSold      FindPetsByStatusParamsStatus = "sold"
)

Defines values for FindPetsByStatusParamsStatus.

type FindPetsByTagsParams

type FindPetsByTagsParams struct {
	// Tags Tags to filter by
	Tags *[]string `form:"tags,omitempty" json:"tags,omitempty"`
}

FindPetsByTagsParams defines parameters for FindPetsByTags.

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 LoginUserParams

type LoginUserParams struct {
	// Username The user name for login
	Username *string `form:"username,omitempty" json:"username,omitempty"`

	// Password The password for login in clear text
	Password *string `form:"password,omitempty" json:"password,omitempty"`
}

LoginUserParams defines parameters for LoginUser.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Order

type Order struct {
	Complete *bool      `json:"complete,omitempty"`
	Id       *int64     `json:"id,omitempty"`
	PetId    *int64     `json:"petId,omitempty"`
	Quantity *int32     `json:"quantity,omitempty"`
	ShipDate *time.Time `json:"shipDate,omitempty"`

	// Status Order Status
	Status *OrderStatus `json:"status,omitempty"`
}

Order defines model for Order.

type OrderStatus

type OrderStatus string

OrderStatus Order Status

const (
	Approved  OrderStatus = "approved"
	Delivered OrderStatus = "delivered"
	Placed    OrderStatus = "placed"
)

Defines values for OrderStatus.

type Pet

type Pet struct {
	Category  *Category `json:"category,omitempty"`
	Id        *int64    `json:"id,omitempty"`
	Name      string    `json:"name"`
	PhotoUrls []string  `json:"photoUrls"`

	// Status pet status in the store
	Status *PetStatus `json:"status,omitempty"`
	Tags   *[]Tag     `json:"tags,omitempty"`
}

Pet defines model for Pet.

type PetStatus

type PetStatus string

PetStatus pet status in the store

const (
	PetStatusAvailable PetStatus = "available"
	PetStatusPending   PetStatus = "pending"
	PetStatusSold      PetStatus = "sold"
)

Defines values for PetStatus.

type PlaceOrderFormdataRequestBody

type PlaceOrderFormdataRequestBody = Order

PlaceOrderFormdataRequestBody defines body for PlaceOrder for application/x-www-form-urlencoded ContentType.

type PlaceOrderJSONRequestBody

type PlaceOrderJSONRequestBody = Order

PlaceOrderJSONRequestBody defines body for PlaceOrder for application/json 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 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 {
	// Add a new pet to the store
	// (POST /pet)
	AddPet(w http.ResponseWriter, r *http.Request)
	// Update an existing pet
	// (PUT /pet)
	UpdatePet(w http.ResponseWriter, r *http.Request)
	// Finds Pets by status
	// (GET /pet/findByStatus)
	FindPetsByStatus(w http.ResponseWriter, r *http.Request, params FindPetsByStatusParams)
	// Finds Pets by tags
	// (GET /pet/findByTags)
	FindPetsByTags(w http.ResponseWriter, r *http.Request, params FindPetsByTagsParams)
	// Deletes a pet
	// (DELETE /pet/{petId})
	DeletePet(w http.ResponseWriter, r *http.Request, petId int64, params DeletePetParams)
	// Find pet by ID
	// (GET /pet/{petId})
	GetPetById(w http.ResponseWriter, r *http.Request, petId int64)
	// Updates a pet in the store with form data
	// (POST /pet/{petId})
	UpdatePetWithForm(w http.ResponseWriter, r *http.Request, petId int64, params UpdatePetWithFormParams)
	// uploads an image
	// (POST /pet/{petId}/uploadImage)
	UploadFile(w http.ResponseWriter, r *http.Request, petId int64, params UploadFileParams)
	// Returns pet inventories by status
	// (GET /store/inventory)
	GetInventory(w http.ResponseWriter, r *http.Request)
	// Place an order for a pet
	// (POST /store/order)
	PlaceOrder(w http.ResponseWriter, r *http.Request)
	// Delete purchase order by ID
	// (DELETE /store/order/{orderId})
	DeleteOrder(w http.ResponseWriter, r *http.Request, orderId int64)
	// Find purchase order by ID
	// (GET /store/order/{orderId})
	GetOrderById(w http.ResponseWriter, r *http.Request, orderId int64)
	// Create user
	// (POST /user)
	CreateUser(w http.ResponseWriter, r *http.Request)
	// Creates list of users with given input array
	// (POST /user/createWithList)
	CreateUsersWithListInput(w http.ResponseWriter, r *http.Request)
	// Logs user into the system
	// (GET /user/login)
	LoginUser(w http.ResponseWriter, r *http.Request, params LoginUserParams)
	// Logs out current logged in user session
	// (GET /user/logout)
	LogoutUser(w http.ResponseWriter, r *http.Request)
	// Delete user
	// (DELETE /user/{username})
	DeleteUser(w http.ResponseWriter, r *http.Request, username string)
	// Get user by user name
	// (GET /user/{username})
	GetUserByName(w http.ResponseWriter, r *http.Request, username string)
	// Update user
	// (PUT /user/{username})
	UpdateUser(w http.ResponseWriter, r *http.Request, username 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) AddPet

AddPet operation middleware

func (*ServerInterfaceWrapper) CreateUser

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

CreateUser operation middleware

func (*ServerInterfaceWrapper) CreateUsersWithListInput

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

CreateUsersWithListInput operation middleware

func (*ServerInterfaceWrapper) DeleteOrder

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

DeleteOrder operation middleware

func (*ServerInterfaceWrapper) DeletePet

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

DeletePet operation middleware

func (*ServerInterfaceWrapper) DeleteUser

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

DeleteUser operation middleware

func (*ServerInterfaceWrapper) FindPetsByStatus

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

FindPetsByStatus operation middleware

func (*ServerInterfaceWrapper) FindPetsByTags

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

FindPetsByTags operation middleware

func (*ServerInterfaceWrapper) GetInventory

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

GetInventory operation middleware

func (*ServerInterfaceWrapper) GetOrderById

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

GetOrderById operation middleware

func (*ServerInterfaceWrapper) GetPetById

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

GetPetById operation middleware

func (*ServerInterfaceWrapper) GetUserByName

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

GetUserByName operation middleware

func (*ServerInterfaceWrapper) LoginUser

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

LoginUser operation middleware

func (*ServerInterfaceWrapper) LogoutUser

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

LogoutUser operation middleware

func (*ServerInterfaceWrapper) PlaceOrder

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

PlaceOrder operation middleware

func (*ServerInterfaceWrapper) UpdatePet

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

UpdatePet operation middleware

func (*ServerInterfaceWrapper) UpdatePetWithForm

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

UpdatePetWithForm operation middleware

func (*ServerInterfaceWrapper) UpdateUser

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

UpdateUser operation middleware

func (*ServerInterfaceWrapper) UploadFile

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

UploadFile operation middleware

type StdHTTPServerOptions

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

type Tag

type Tag struct {
	Id   *int64  `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

Tag defines model for Tag.

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 UpdatePetFormdataRequestBody

type UpdatePetFormdataRequestBody = Pet

UpdatePetFormdataRequestBody defines body for UpdatePet for application/x-www-form-urlencoded ContentType.

type UpdatePetJSONRequestBody

type UpdatePetJSONRequestBody = Pet

UpdatePetJSONRequestBody defines body for UpdatePet for application/json ContentType.

type UpdatePetWithFormParams

type UpdatePetWithFormParams struct {
	// Name Name of pet that needs to be updated
	Name *string `form:"name,omitempty" json:"name,omitempty"`

	// Status Status of pet that needs to be updated
	Status *string `form:"status,omitempty" json:"status,omitempty"`
}

UpdatePetWithFormParams defines parameters for UpdatePetWithForm.

type UpdateUserFormdataRequestBody

type UpdateUserFormdataRequestBody = User

UpdateUserFormdataRequestBody defines body for UpdateUser for application/x-www-form-urlencoded ContentType.

type UpdateUserJSONRequestBody

type UpdateUserJSONRequestBody = User

UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.

type UploadFileParams

type UploadFileParams struct {
	// AdditionalMetadata Additional Metadata
	AdditionalMetadata *string `form:"additionalMetadata,omitempty" json:"additionalMetadata,omitempty"`
}

UploadFileParams defines parameters for UploadFile.

type User

type User struct {
	Email     *string `json:"email,omitempty"`
	FirstName *string `json:"firstName,omitempty"`
	Id        *int64  `json:"id,omitempty"`
	LastName  *string `json:"lastName,omitempty"`
	Password  *string `json:"password,omitempty"`
	Phone     *string `json:"phone,omitempty"`

	// UserStatus User Status
	UserStatus *int32  `json:"userStatus,omitempty"`
	Username   *string `json:"username,omitempty"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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