Documentation ¶
Overview ¶
Package server provides primitives to interact the openapi HTTP API.
Code generated by github.com/algobolson/oapi-codegen DO NOT EDIT.
Index ¶
- func CreateResource2Ctx(next http.Handler) http.Handler
- func CreateResourceCtx(next http.Handler) http.Handler
- func GetSimpleCtx(next http.Handler) http.Handler
- func GetWithArgsCtx(next http.Handler) http.Handler
- func GetWithContentTypeCtx(next http.Handler) http.Handler
- func GetWithReferencesCtx(next http.Handler) http.Handler
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func UpdateResource3Ctx(next http.Handler) http.Handler
- type Argument
- type CreateResource2JSONBody
- type CreateResource2JSONRequestBody
- type CreateResource2Params
- type CreateResourceJSONBody
- type CreateResourceJSONRequestBody
- type EveryTypeOptional
- type EveryTypeRequired
- type GetWithArgsParams
- type ReservedKeyword
- type Resource
- type ResponseWithReference
- type ServerInterface
- type ServerInterfaceMock
- func (mock *ServerInterfaceMock) CreateResource(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) CreateResource2(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) CreateResource2Calls() []struct{ ... }
- func (mock *ServerInterfaceMock) CreateResourceCalls() []struct{ ... }
- func (mock *ServerInterfaceMock) GetSimple(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) GetSimpleCalls() []struct{ ... }
- func (mock *ServerInterfaceMock) GetWithArgs(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) GetWithArgsCalls() []struct{ ... }
- func (mock *ServerInterfaceMock) GetWithContentType(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) GetWithContentTypeCalls() []struct{ ... }
- func (mock *ServerInterfaceMock) GetWithReferences(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) GetWithReferencesCalls() []struct{ ... }
- func (mock *ServerInterfaceMock) UpdateResource3(w http.ResponseWriter, r *http.Request)
- func (mock *ServerInterfaceMock) UpdateResource3Calls() []struct{ ... }
- type SimpleResponse
- type SomeObject
- type UpdateResource3JSONBody
- type UpdateResource3JSONRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateResource2Ctx ¶
CreateResource2 operation middleware
func CreateResourceCtx ¶
CreateResource operation middleware
func GetSimpleCtx ¶
GetSimple operation middleware
func GetWithArgsCtx ¶
GetWithArgs operation middleware
func GetWithContentTypeCtx ¶
GetWithContentType operation middleware
func GetWithReferencesCtx ¶
GetWithReferences operation middleware
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.
Types ¶
type CreateResource2JSONBody ¶
type CreateResource2JSONBody Resource
CreateResource2JSONBody defines parameters for CreateResource2.
type CreateResource2JSONRequestBody ¶
type CreateResource2JSONRequestBody CreateResource2JSONBody
CreateResource2RequestBody defines body for CreateResource2 for application/json ContentType.
type CreateResource2Params ¶
type CreateResource2Params struct { // Some query argument InlineQueryArgument *int `json:"inline_query_argument,omitempty"` }
CreateResource2Params defines parameters for CreateResource2.
func ParamsForCreateResource2 ¶
func ParamsForCreateResource2(ctx context.Context) *CreateResource2Params
ParamsForCreateResource2 operation parameters from context
type CreateResourceJSONBody ¶
type CreateResourceJSONBody EveryTypeRequired
CreateResourceJSONBody defines parameters for CreateResource.
type CreateResourceJSONRequestBody ¶
type CreateResourceJSONRequestBody CreateResourceJSONBody
CreateResourceRequestBody defines body for CreateResource for application/json ContentType.
type EveryTypeOptional ¶
type EveryTypeOptional struct { ArrayInlineField *[]int `json:"array_inline_field,omitempty"` ArrayReferencedField *[]SomeObject `json:"array_referenced_field,omitempty"` BoolField *bool `json:"bool_field,omitempty"` ByteField *[]byte `json:"byte_field,omitempty"` DateField *openapi_types.Date `json:"date_field,omitempty"` DateTimeField *time.Time `json:"date_time_field,omitempty"` DoubleField *float64 `json:"double_field,omitempty"` FloatField *float32 `json:"float_field,omitempty"` InlineObjectField *struct { Name string `json:"name"` Number int `json:"number"` } `json:"inline_object_field,omitempty"` Int32Field *int32 `json:"int32_field,omitempty"` Int64Field *int64 `json:"int64_field,omitempty"` IntField *int `json:"int_field,omitempty"` NumberField *float32 `json:"number_field,omitempty"` ReferencedField *SomeObject `json:"referenced_field,omitempty"` StringField *string `json:"string_field,omitempty"` }
EveryTypeOptional defines model for EveryTypeOptional.
type EveryTypeRequired ¶
type EveryTypeRequired struct { ArrayInlineField []int `json:"array_inline_field"` ArrayReferencedField []SomeObject `json:"array_referenced_field"` BoolField bool `json:"bool_field"` ByteField []byte `json:"byte_field"` DateField openapi_types.Date `json:"date_field"` DateTimeField time.Time `json:"date_time_field"` DoubleField float64 `json:"double_field"` FloatField float32 `json:"float_field"` InlineObjectField struct { Name string `json:"name"` Number int `json:"number"` } `json:"inline_object_field"` Int32Field int32 `json:"int32_field"` Int64Field int64 `json:"int64_field"` IntField int `json:"int_field"` NumberField float32 `json:"number_field"` ReferencedField SomeObject `json:"referenced_field"` StringField string `json:"string_field"` }
EveryTypeRequired defines model for EveryTypeRequired.
type GetWithArgsParams ¶
type GetWithArgsParams struct { // An optional query argument OptionalArgument *int64 `json:"optional_argument,omitempty"` // An optional query argument RequiredArgument int64 `json:"required_argument"` // An optional query argument HeaderArgument *int32 `json:"header_argument,omitempty"` }
GetWithArgsParams defines parameters for GetWithArgs.
func ParamsForGetWithArgs ¶
func ParamsForGetWithArgs(ctx context.Context) *GetWithArgsParams
ParamsForGetWithArgs operation parameters from context
type ReservedKeyword ¶
type ReservedKeyword struct {
Channel *string `json:"channel,omitempty"`
}
ReservedKeyword defines model for ReservedKeyword.
type ResponseWithReference ¶
type ResponseWithReference SomeObject
ResponseWithReference defines model for ResponseWithReference.
type ServerInterface ¶
type ServerInterface interface { // Get resource via simple path (GET /get-simple) GetSimple(w http.ResponseWriter, r *http.Request) // Getter with referenced parameter and referenced response (GET /get-with-args) GetWithArgs(w http.ResponseWriter, r *http.Request) // Getter with referenced parameter and referenced response (GET /get-with-references/{global_argument}/{argument}) GetWithReferences(w http.ResponseWriter, r *http.Request) // Get an object by ID (GET /get-with-type/{content_type}) GetWithContentType(w http.ResponseWriter, r *http.Request) // Create a resource (POST /resource/{argument}) CreateResource(w http.ResponseWriter, r *http.Request) // Create a resource with inline parameter (POST /resource2/{inline_argument}) CreateResource2(w http.ResponseWriter, r *http.Request) // Update a resource with inline body. The parameter name is a reservedkeyword, so make sure that gets prefixed to avoid syntax errors (PUT /resource3/{fallthrough}) UpdateResource3(w http.ResponseWriter, r *http.Request) }
type ServerInterfaceMock ¶
type ServerInterfaceMock struct { // CreateResourceFunc mocks the CreateResource method. CreateResourceFunc func(w http.ResponseWriter, r *http.Request) // CreateResource2Func mocks the CreateResource2 method. CreateResource2Func func(w http.ResponseWriter, r *http.Request) // GetSimpleFunc mocks the GetSimple method. GetSimpleFunc func(w http.ResponseWriter, r *http.Request) // GetWithArgsFunc mocks the GetWithArgs method. GetWithArgsFunc func(w http.ResponseWriter, r *http.Request) // GetWithContentTypeFunc mocks the GetWithContentType method. GetWithContentTypeFunc func(w http.ResponseWriter, r *http.Request) // GetWithReferencesFunc mocks the GetWithReferences method. GetWithReferencesFunc func(w http.ResponseWriter, r *http.Request) // UpdateResource3Func mocks the UpdateResource3 method. UpdateResource3Func func(w http.ResponseWriter, r *http.Request) // contains filtered or unexported fields }
ServerInterfaceMock is a mock implementation of ServerInterface.
func TestSomethingThatUsesServerInterface(t *testing.T) { // make and configure a mocked ServerInterface mockedServerInterface := &ServerInterfaceMock{ CreateResourceFunc: func(w http.ResponseWriter, r *http.Request) { panic("mock out the CreateResource method") }, CreateResource2Func: func(w http.ResponseWriter, r *http.Request) { panic("mock out the CreateResource2 method") }, GetSimpleFunc: func(w http.ResponseWriter, r *http.Request) { panic("mock out the GetSimple method") }, GetWithArgsFunc: func(w http.ResponseWriter, r *http.Request) { panic("mock out the GetWithArgs method") }, GetWithContentTypeFunc: func(w http.ResponseWriter, r *http.Request) { panic("mock out the GetWithContentType method") }, GetWithReferencesFunc: func(w http.ResponseWriter, r *http.Request) { panic("mock out the GetWithReferences method") }, UpdateResource3Func: func(w http.ResponseWriter, r *http.Request) { panic("mock out the UpdateResource3 method") }, } // use mockedServerInterface in code that requires ServerInterface // and then make assertions. }
func (*ServerInterfaceMock) CreateResource ¶
func (mock *ServerInterfaceMock) CreateResource(w http.ResponseWriter, r *http.Request)
CreateResource calls CreateResourceFunc.
func (*ServerInterfaceMock) CreateResource2 ¶
func (mock *ServerInterfaceMock) CreateResource2(w http.ResponseWriter, r *http.Request)
CreateResource2 calls CreateResource2Func.
func (*ServerInterfaceMock) CreateResource2Calls ¶
func (mock *ServerInterfaceMock) CreateResource2Calls() []struct { W http.ResponseWriter R *http.Request }
CreateResource2Calls gets all the calls that were made to CreateResource2. Check the length with:
len(mockedServerInterface.CreateResource2Calls())
func (*ServerInterfaceMock) CreateResourceCalls ¶
func (mock *ServerInterfaceMock) CreateResourceCalls() []struct { W http.ResponseWriter R *http.Request }
CreateResourceCalls gets all the calls that were made to CreateResource. Check the length with:
len(mockedServerInterface.CreateResourceCalls())
func (*ServerInterfaceMock) GetSimple ¶
func (mock *ServerInterfaceMock) GetSimple(w http.ResponseWriter, r *http.Request)
GetSimple calls GetSimpleFunc.
func (*ServerInterfaceMock) GetSimpleCalls ¶
func (mock *ServerInterfaceMock) GetSimpleCalls() []struct { W http.ResponseWriter R *http.Request }
GetSimpleCalls gets all the calls that were made to GetSimple. Check the length with:
len(mockedServerInterface.GetSimpleCalls())
func (*ServerInterfaceMock) GetWithArgs ¶
func (mock *ServerInterfaceMock) GetWithArgs(w http.ResponseWriter, r *http.Request)
GetWithArgs calls GetWithArgsFunc.
func (*ServerInterfaceMock) GetWithArgsCalls ¶
func (mock *ServerInterfaceMock) GetWithArgsCalls() []struct { W http.ResponseWriter R *http.Request }
GetWithArgsCalls gets all the calls that were made to GetWithArgs. Check the length with:
len(mockedServerInterface.GetWithArgsCalls())
func (*ServerInterfaceMock) GetWithContentType ¶
func (mock *ServerInterfaceMock) GetWithContentType(w http.ResponseWriter, r *http.Request)
GetWithContentType calls GetWithContentTypeFunc.
func (*ServerInterfaceMock) GetWithContentTypeCalls ¶
func (mock *ServerInterfaceMock) GetWithContentTypeCalls() []struct { W http.ResponseWriter R *http.Request }
GetWithContentTypeCalls gets all the calls that were made to GetWithContentType. Check the length with:
len(mockedServerInterface.GetWithContentTypeCalls())
func (*ServerInterfaceMock) GetWithReferences ¶
func (mock *ServerInterfaceMock) GetWithReferences(w http.ResponseWriter, r *http.Request)
GetWithReferences calls GetWithReferencesFunc.
func (*ServerInterfaceMock) GetWithReferencesCalls ¶
func (mock *ServerInterfaceMock) GetWithReferencesCalls() []struct { W http.ResponseWriter R *http.Request }
GetWithReferencesCalls gets all the calls that were made to GetWithReferences. Check the length with:
len(mockedServerInterface.GetWithReferencesCalls())
func (*ServerInterfaceMock) UpdateResource3 ¶
func (mock *ServerInterfaceMock) UpdateResource3(w http.ResponseWriter, r *http.Request)
UpdateResource3 calls UpdateResource3Func.
func (*ServerInterfaceMock) UpdateResource3Calls ¶
func (mock *ServerInterfaceMock) UpdateResource3Calls() []struct { W http.ResponseWriter R *http.Request }
UpdateResource3Calls gets all the calls that were made to UpdateResource3. Check the length with:
len(mockedServerInterface.UpdateResource3Calls())
type SimpleResponse ¶
type SimpleResponse struct {
Name string `json:"name"`
}
SimpleResponse defines model for SimpleResponse.
type SomeObject ¶
type SomeObject struct {
Name string `json:"name"`
}
SomeObject defines model for some_object.
type UpdateResource3JSONBody ¶
type UpdateResource3JSONBody struct { Id *int `json:"id,omitempty"` Name *string `json:"name,omitempty"` }
UpdateResource3JSONBody defines parameters for UpdateResource3.
type UpdateResource3JSONRequestBody ¶
type UpdateResource3JSONRequestBody UpdateResource3JSONBody
UpdateResource3RequestBody defines body for UpdateResource3 for application/json ContentType.