server

package
v0.0.0-...-e3bc3df Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server provides primitives to interact the openapi HTTP API.

Code generated by github.com/indigonote/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource2Ctx

func CreateResource2Ctx(next http.Handler) http.Handler

CreateResource2 operation middleware

func CreateResourceCtx

func CreateResourceCtx(next http.Handler) http.Handler

CreateResource operation middleware

func GetEveryTypeOptionalCtx

func GetEveryTypeOptionalCtx(next http.Handler) http.Handler

GetEveryTypeOptional operation middleware

func GetReservedKeywordCtx

func GetReservedKeywordCtx(next http.Handler) http.Handler

GetReservedKeyword operation middleware

func GetResponseWithReferenceCtx

func GetResponseWithReferenceCtx(next http.Handler) http.Handler

GetResponseWithReference operation middleware

func GetSimpleCtx

func GetSimpleCtx(next http.Handler) http.Handler

GetSimple operation middleware

func GetWithArgsCtx

func GetWithArgsCtx(next http.Handler) http.Handler

GetWithArgs operation middleware

func GetWithContentTypeCtx

func GetWithContentTypeCtx(next http.Handler) http.Handler

GetWithContentType operation middleware

func GetWithReferencesCtx

func GetWithReferencesCtx(next http.Handler) http.Handler

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.

func UpdateResource3Ctx

func UpdateResource3Ctx(next http.Handler) http.Handler

UpdateResource3 operation middleware

Types

type Argument

type Argument string

Argument defines model for argument.

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 Resource

type Resource struct {
	Name  string  `json:"name"`
	Value float32 `json:"value"`
}

Resource defines model for Resource.

type ResponseWithReference

type ResponseWithReference SomeObject

ResponseWithReference defines model for ResponseWithReference.

type ServerInterface

type ServerInterface interface {
	// get every type optional (GET /every-type-optional)
	GetEveryTypeOptional(w http.ResponseWriter, r *http.Request)
	// 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)
	// get with reserved keyword (GET /reserved-keyword)
	GetReservedKeyword(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)
	// get response with reference (GET /response-with-reference)
	GetResponseWithReference(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)

	// GetEveryTypeOptionalFunc mocks the GetEveryTypeOptional method.
	GetEveryTypeOptionalFunc func(w http.ResponseWriter, r *http.Request)

	// GetReservedKeywordFunc mocks the GetReservedKeyword method.
	GetReservedKeywordFunc func(w http.ResponseWriter, r *http.Request)

	// GetResponseWithReferenceFunc mocks the GetResponseWithReference method.
	GetResponseWithReferenceFunc 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")
            },
            GetEveryTypeOptionalFunc: func(w http.ResponseWriter, r *http.Request)  {
	               panic("mock out the GetEveryTypeOptional method")
            },
            GetReservedKeywordFunc: func(w http.ResponseWriter, r *http.Request)  {
	               panic("mock out the GetReservedKeyword method")
            },
            GetResponseWithReferenceFunc: func(w http.ResponseWriter, r *http.Request)  {
	               panic("mock out the GetResponseWithReference 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) GetEveryTypeOptional

func (mock *ServerInterfaceMock) GetEveryTypeOptional(w http.ResponseWriter, r *http.Request)

GetEveryTypeOptional calls GetEveryTypeOptionalFunc.

func (*ServerInterfaceMock) GetEveryTypeOptionalCalls

func (mock *ServerInterfaceMock) GetEveryTypeOptionalCalls() []struct {
	W http.ResponseWriter
	R *http.Request
}

GetEveryTypeOptionalCalls gets all the calls that were made to GetEveryTypeOptional. Check the length with:

len(mockedServerInterface.GetEveryTypeOptionalCalls())

func (*ServerInterfaceMock) GetReservedKeyword

func (mock *ServerInterfaceMock) GetReservedKeyword(w http.ResponseWriter, r *http.Request)

GetReservedKeyword calls GetReservedKeywordFunc.

func (*ServerInterfaceMock) GetReservedKeywordCalls

func (mock *ServerInterfaceMock) GetReservedKeywordCalls() []struct {
	W http.ResponseWriter
	R *http.Request
}

GetReservedKeywordCalls gets all the calls that were made to GetReservedKeyword. Check the length with:

len(mockedServerInterface.GetReservedKeywordCalls())

func (*ServerInterfaceMock) GetResponseWithReference

func (mock *ServerInterfaceMock) GetResponseWithReference(w http.ResponseWriter, r *http.Request)

GetResponseWithReference calls GetResponseWithReferenceFunc.

func (*ServerInterfaceMock) GetResponseWithReferenceCalls

func (mock *ServerInterfaceMock) GetResponseWithReferenceCalls() []struct {
	W http.ResponseWriter
	R *http.Request
}

GetResponseWithReferenceCalls gets all the calls that were made to GetResponseWithReference. Check the length with:

len(mockedServerInterface.GetResponseWithReferenceCalls())

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.

Jump to

Keyboard shortcuts

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