go-swagger: github.com/go-swagger/go-swagger/examples/composed-auth/restapi/operations Index | Files

package operations

import "github.com/go-swagger/go-swagger/examples/composed-auth/restapi/operations"

Index

Package Files

add_order.go add_order_parameters.go add_order_responses.go add_order_urlbuilder.go get_account.go get_account_parameters.go get_account_responses.go get_account_urlbuilder.go get_items.go get_items_parameters.go get_items_responses.go get_items_urlbuilder.go get_order.go get_order_parameters.go get_order_responses.go get_order_urlbuilder.go get_orders_for_item.go get_orders_for_item_parameters.go get_orders_for_item_responses.go get_orders_for_item_urlbuilder.go multi_auth_example_api.go

Constants

const AddOrderForbiddenCode int = 403

AddOrderForbiddenCode is the HTTP code returned for type AddOrderForbidden

const AddOrderOKCode int = 200

AddOrderOKCode is the HTTP code returned for type AddOrderOK

const AddOrderUnauthorizedCode int = 401

AddOrderUnauthorizedCode is the HTTP code returned for type AddOrderUnauthorized

const GetAccountOKCode int = 200

GetAccountOKCode is the HTTP code returned for type GetAccountOK

const GetAccountUnauthorizedCode int = 401

GetAccountUnauthorizedCode is the HTTP code returned for type GetAccountUnauthorized

const GetItemsOKCode int = 200

GetItemsOKCode is the HTTP code returned for type GetItemsOK

const GetOrderForbiddenCode int = 403

GetOrderForbiddenCode is the HTTP code returned for type GetOrderForbidden

const GetOrderOKCode int = 200

GetOrderOKCode is the HTTP code returned for type GetOrderOK

const GetOrderUnauthorizedCode int = 401

GetOrderUnauthorizedCode is the HTTP code returned for type GetOrderUnauthorized

const GetOrdersForItemForbiddenCode int = 403

GetOrdersForItemForbiddenCode is the HTTP code returned for type GetOrdersForItemForbidden

const GetOrdersForItemOKCode int = 200

GetOrdersForItemOKCode is the HTTP code returned for type GetOrdersForItemOK

const GetOrdersForItemUnauthorizedCode int = 401

GetOrdersForItemUnauthorizedCode is the HTTP code returned for type GetOrdersForItemUnauthorized

type AddOrder Uses

type AddOrder struct {
    Context *middleware.Context
    Handler AddOrderHandler
}

AddOrder swagger:route POST /order/add addOrder

post a new order

Registered customers should be able to add purchase orders. Registered inventory managers should be able to add replenishment orders.

func NewAddOrder Uses

func NewAddOrder(ctx *middleware.Context, handler AddOrderHandler) *AddOrder

NewAddOrder creates a new http.Handler for the add order operation

func (*AddOrder) ServeHTTP Uses

func (o *AddOrder) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type AddOrderDefault Uses

type AddOrderDefault struct {

    /*
      In: Body
    */
    Payload *models.Error `json:"body,omitempty"`
    // contains filtered or unexported fields
}

AddOrderDefault other error response

swagger:response addOrderDefault

func NewAddOrderDefault Uses

func NewAddOrderDefault(code int) *AddOrderDefault

NewAddOrderDefault creates AddOrderDefault with default headers values

func (*AddOrderDefault) SetPayload Uses

func (o *AddOrderDefault) SetPayload(payload *models.Error)

SetPayload sets the payload to the add order default response

func (*AddOrderDefault) SetStatusCode Uses

func (o *AddOrderDefault) SetStatusCode(code int)

SetStatusCode sets the status to the add order default response

func (*AddOrderDefault) WithPayload Uses

func (o *AddOrderDefault) WithPayload(payload *models.Error) *AddOrderDefault

WithPayload adds the payload to the add order default response

func (*AddOrderDefault) WithStatusCode Uses

func (o *AddOrderDefault) WithStatusCode(code int) *AddOrderDefault

WithStatusCode adds the status to the add order default response

func (*AddOrderDefault) WriteResponse Uses

func (o *AddOrderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type AddOrderForbidden Uses

type AddOrderForbidden struct {
}

AddOrderForbidden forbidden access for a lack of sufficient privileges

swagger:response addOrderForbidden

func NewAddOrderForbidden Uses

func NewAddOrderForbidden() *AddOrderForbidden

NewAddOrderForbidden creates AddOrderForbidden with default headers values

func (*AddOrderForbidden) WriteResponse Uses

func (o *AddOrderForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type AddOrderHandler Uses

type AddOrderHandler interface {
    Handle(AddOrderParams, *models.Principal) middleware.Responder
}

AddOrderHandler interface for that can handle valid add order params

type AddOrderHandlerFunc Uses

type AddOrderHandlerFunc func(AddOrderParams, *models.Principal) middleware.Responder

AddOrderHandlerFunc turns a function with the right signature into a add order handler

func (AddOrderHandlerFunc) Handle Uses

func (fn AddOrderHandlerFunc) Handle(params AddOrderParams, principal *models.Principal) middleware.Responder

Handle executing the request and returning a response

type AddOrderOK Uses

type AddOrderOK struct {
}

AddOrderOK empty response

swagger:response addOrderOK

func NewAddOrderOK Uses

func NewAddOrderOK() *AddOrderOK

NewAddOrderOK creates AddOrderOK with default headers values

func (*AddOrderOK) WriteResponse Uses

func (o *AddOrderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type AddOrderParams Uses

type AddOrderParams struct {

    // HTTP Request Object
    HTTPRequest *http.Request `json:"-"`

    /*
      Required: true
      In: body
    */
    Order *models.Order
}

AddOrderParams contains all the bound params for the add order operation typically these are obtained from a http.Request

swagger:parameters AddOrder

func NewAddOrderParams Uses

func NewAddOrderParams() AddOrderParams

NewAddOrderParams creates a new AddOrderParams object no default values defined in spec.

func (*AddOrderParams) BindRequest Uses

func (o *AddOrderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewAddOrderParams() beforehand.

type AddOrderURL Uses

type AddOrderURL struct {
    // contains filtered or unexported fields
}

AddOrderURL generates an URL for the add order operation

func (*AddOrderURL) Build Uses

func (o *AddOrderURL) Build() (*url.URL, error)

Build a url path and query string

func (*AddOrderURL) BuildFull Uses

func (o *AddOrderURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*AddOrderURL) Must Uses

func (o *AddOrderURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*AddOrderURL) SetBasePath Uses

func (o *AddOrderURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*AddOrderURL) String Uses

func (o *AddOrderURL) String() string

String returns the string representation of the path with query string

func (*AddOrderURL) StringFull Uses

func (o *AddOrderURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*AddOrderURL) WithBasePath Uses

func (o *AddOrderURL) WithBasePath(bp string) *AddOrderURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type AddOrderUnauthorized Uses

type AddOrderUnauthorized struct {
}

AddOrderUnauthorized unauthorized access for a lack of authentication

swagger:response addOrderUnauthorized

func NewAddOrderUnauthorized Uses

func NewAddOrderUnauthorized() *AddOrderUnauthorized

NewAddOrderUnauthorized creates AddOrderUnauthorized with default headers values

func (*AddOrderUnauthorized) WriteResponse Uses

func (o *AddOrderUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetAccount Uses

type GetAccount struct {
    Context *middleware.Context
    Handler GetAccountHandler
}

GetAccount swagger:route GET /account getAccount

registered user account

Every registered user should be able to access this operation

func NewGetAccount Uses

func NewGetAccount(ctx *middleware.Context, handler GetAccountHandler) *GetAccount

NewGetAccount creates a new http.Handler for the get account operation

func (*GetAccount) ServeHTTP Uses

func (o *GetAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type GetAccountDefault Uses

type GetAccountDefault struct {

    /*
      In: Body
    */
    Payload *models.Error `json:"body,omitempty"`
    // contains filtered or unexported fields
}

GetAccountDefault other error response

swagger:response getAccountDefault

func NewGetAccountDefault Uses

func NewGetAccountDefault(code int) *GetAccountDefault

NewGetAccountDefault creates GetAccountDefault with default headers values

func (*GetAccountDefault) SetPayload Uses

func (o *GetAccountDefault) SetPayload(payload *models.Error)

SetPayload sets the payload to the get account default response

func (*GetAccountDefault) SetStatusCode Uses

func (o *GetAccountDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get account default response

func (*GetAccountDefault) WithPayload Uses

func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault

WithPayload adds the payload to the get account default response

func (*GetAccountDefault) WithStatusCode Uses

func (o *GetAccountDefault) WithStatusCode(code int) *GetAccountDefault

WithStatusCode adds the status to the get account default response

func (*GetAccountDefault) WriteResponse Uses

func (o *GetAccountDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetAccountHandler Uses

type GetAccountHandler interface {
    Handle(GetAccountParams, *models.Principal) middleware.Responder
}

GetAccountHandler interface for that can handle valid get account params

type GetAccountHandlerFunc Uses

type GetAccountHandlerFunc func(GetAccountParams, *models.Principal) middleware.Responder

GetAccountHandlerFunc turns a function with the right signature into a get account handler

func (GetAccountHandlerFunc) Handle Uses

func (fn GetAccountHandlerFunc) Handle(params GetAccountParams, principal *models.Principal) middleware.Responder

Handle executing the request and returning a response

type GetAccountOK Uses

type GetAccountOK struct {

    /*
      In: Body
    */
    Payload interface{} `json:"body,omitempty"`
}

GetAccountOK registered user personal account infos

swagger:response getAccountOK

func NewGetAccountOK Uses

func NewGetAccountOK() *GetAccountOK

NewGetAccountOK creates GetAccountOK with default headers values

func (*GetAccountOK) SetPayload Uses

func (o *GetAccountOK) SetPayload(payload interface{})

SetPayload sets the payload to the get account o k response

func (*GetAccountOK) WithPayload Uses

func (o *GetAccountOK) WithPayload(payload interface{}) *GetAccountOK

WithPayload adds the payload to the get account o k response

func (*GetAccountOK) WriteResponse Uses

func (o *GetAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetAccountParams Uses

type GetAccountParams struct {

    // HTTP Request Object
    HTTPRequest *http.Request `json:"-"`
}

GetAccountParams contains all the bound params for the get account operation typically these are obtained from a http.Request

swagger:parameters GetAccount

func NewGetAccountParams Uses

func NewGetAccountParams() GetAccountParams

NewGetAccountParams creates a new GetAccountParams object no default values defined in spec.

func (*GetAccountParams) BindRequest Uses

func (o *GetAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewGetAccountParams() beforehand.

type GetAccountURL Uses

type GetAccountURL struct {
    // contains filtered or unexported fields
}

GetAccountURL generates an URL for the get account operation

func (*GetAccountURL) Build Uses

func (o *GetAccountURL) Build() (*url.URL, error)

Build a url path and query string

func (*GetAccountURL) BuildFull Uses

func (o *GetAccountURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*GetAccountURL) Must Uses

func (o *GetAccountURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*GetAccountURL) SetBasePath Uses

func (o *GetAccountURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*GetAccountURL) String Uses

func (o *GetAccountURL) String() string

String returns the string representation of the path with query string

func (*GetAccountURL) StringFull Uses

func (o *GetAccountURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*GetAccountURL) WithBasePath Uses

func (o *GetAccountURL) WithBasePath(bp string) *GetAccountURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type GetAccountUnauthorized Uses

type GetAccountUnauthorized struct {
}

GetAccountUnauthorized unauthorized access for a lack of authentication

swagger:response getAccountUnauthorized

func NewGetAccountUnauthorized Uses

func NewGetAccountUnauthorized() *GetAccountUnauthorized

NewGetAccountUnauthorized creates GetAccountUnauthorized with default headers values

func (*GetAccountUnauthorized) WriteResponse Uses

func (o *GetAccountUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetItems Uses

type GetItems struct {
    Context *middleware.Context
    Handler GetItemsHandler
}

GetItems swagger:route GET /items getItems

items on sale

Everybody should be able to access this operation

func NewGetItems Uses

func NewGetItems(ctx *middleware.Context, handler GetItemsHandler) *GetItems

NewGetItems creates a new http.Handler for the get items operation

func (*GetItems) ServeHTTP Uses

func (o *GetItems) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type GetItemsDefault Uses

type GetItemsDefault struct {

    /*
      In: Body
    */
    Payload *models.Error `json:"body,omitempty"`
    // contains filtered or unexported fields
}

GetItemsDefault other error response

swagger:response getItemsDefault

func NewGetItemsDefault Uses

func NewGetItemsDefault(code int) *GetItemsDefault

NewGetItemsDefault creates GetItemsDefault with default headers values

func (*GetItemsDefault) SetPayload Uses

func (o *GetItemsDefault) SetPayload(payload *models.Error)

SetPayload sets the payload to the get items default response

func (*GetItemsDefault) SetStatusCode Uses

func (o *GetItemsDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get items default response

func (*GetItemsDefault) WithPayload Uses

func (o *GetItemsDefault) WithPayload(payload *models.Error) *GetItemsDefault

WithPayload adds the payload to the get items default response

func (*GetItemsDefault) WithStatusCode Uses

func (o *GetItemsDefault) WithStatusCode(code int) *GetItemsDefault

WithStatusCode adds the status to the get items default response

func (*GetItemsDefault) WriteResponse Uses

func (o *GetItemsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetItemsHandler Uses

type GetItemsHandler interface {
    Handle(GetItemsParams) middleware.Responder
}

GetItemsHandler interface for that can handle valid get items params

type GetItemsHandlerFunc Uses

type GetItemsHandlerFunc func(GetItemsParams) middleware.Responder

GetItemsHandlerFunc turns a function with the right signature into a get items handler

func (GetItemsHandlerFunc) Handle Uses

func (fn GetItemsHandlerFunc) Handle(params GetItemsParams) middleware.Responder

Handle executing the request and returning a response

type GetItemsOK Uses

type GetItemsOK struct {

    /*
      In: Body
    */
    Payload []models.Item `json:"body,omitempty"`
}

GetItemsOK multiple items

swagger:response getItemsOK

func NewGetItemsOK Uses

func NewGetItemsOK() *GetItemsOK

NewGetItemsOK creates GetItemsOK with default headers values

func (*GetItemsOK) SetPayload Uses

func (o *GetItemsOK) SetPayload(payload []models.Item)

SetPayload sets the payload to the get items o k response

func (*GetItemsOK) WithPayload Uses

func (o *GetItemsOK) WithPayload(payload []models.Item) *GetItemsOK

WithPayload adds the payload to the get items o k response

func (*GetItemsOK) WriteResponse Uses

func (o *GetItemsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetItemsParams Uses

type GetItemsParams struct {

    // HTTP Request Object
    HTTPRequest *http.Request `json:"-"`
}

GetItemsParams contains all the bound params for the get items operation typically these are obtained from a http.Request

swagger:parameters GetItems

func NewGetItemsParams Uses

func NewGetItemsParams() GetItemsParams

NewGetItemsParams creates a new GetItemsParams object no default values defined in spec.

func (*GetItemsParams) BindRequest Uses

func (o *GetItemsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewGetItemsParams() beforehand.

type GetItemsURL Uses

type GetItemsURL struct {
    // contains filtered or unexported fields
}

GetItemsURL generates an URL for the get items operation

func (*GetItemsURL) Build Uses

func (o *GetItemsURL) Build() (*url.URL, error)

Build a url path and query string

func (*GetItemsURL) BuildFull Uses

func (o *GetItemsURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*GetItemsURL) Must Uses

func (o *GetItemsURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*GetItemsURL) SetBasePath Uses

func (o *GetItemsURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*GetItemsURL) String Uses

func (o *GetItemsURL) String() string

String returns the string representation of the path with query string

func (*GetItemsURL) StringFull Uses

func (o *GetItemsURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*GetItemsURL) WithBasePath Uses

func (o *GetItemsURL) WithBasePath(bp string) *GetItemsURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type GetOrder Uses

type GetOrder struct {
    Context *middleware.Context
    Handler GetOrderHandler
}

GetOrder swagger:route GET /order/{orderID} getOrder

retrieves an order

Only registered customers should be able to retrieve orders

func NewGetOrder Uses

func NewGetOrder(ctx *middleware.Context, handler GetOrderHandler) *GetOrder

NewGetOrder creates a new http.Handler for the get order operation

func (*GetOrder) ServeHTTP Uses

func (o *GetOrder) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type GetOrderDefault Uses

type GetOrderDefault struct {

    /*
      In: Body
    */
    Payload *models.Error `json:"body,omitempty"`
    // contains filtered or unexported fields
}

GetOrderDefault other error response

swagger:response getOrderDefault

func NewGetOrderDefault Uses

func NewGetOrderDefault(code int) *GetOrderDefault

NewGetOrderDefault creates GetOrderDefault with default headers values

func (*GetOrderDefault) SetPayload Uses

func (o *GetOrderDefault) SetPayload(payload *models.Error)

SetPayload sets the payload to the get order default response

func (*GetOrderDefault) SetStatusCode Uses

func (o *GetOrderDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get order default response

func (*GetOrderDefault) WithPayload Uses

func (o *GetOrderDefault) WithPayload(payload *models.Error) *GetOrderDefault

WithPayload adds the payload to the get order default response

func (*GetOrderDefault) WithStatusCode Uses

func (o *GetOrderDefault) WithStatusCode(code int) *GetOrderDefault

WithStatusCode adds the status to the get order default response

func (*GetOrderDefault) WriteResponse Uses

func (o *GetOrderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrderForbidden Uses

type GetOrderForbidden struct {
}

GetOrderForbidden forbidden access for a lack of sufficient privileges

swagger:response getOrderForbidden

func NewGetOrderForbidden Uses

func NewGetOrderForbidden() *GetOrderForbidden

NewGetOrderForbidden creates GetOrderForbidden with default headers values

func (*GetOrderForbidden) WriteResponse Uses

func (o *GetOrderForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrderHandler Uses

type GetOrderHandler interface {
    Handle(GetOrderParams, *models.Principal) middleware.Responder
}

GetOrderHandler interface for that can handle valid get order params

type GetOrderHandlerFunc Uses

type GetOrderHandlerFunc func(GetOrderParams, *models.Principal) middleware.Responder

GetOrderHandlerFunc turns a function with the right signature into a get order handler

func (GetOrderHandlerFunc) Handle Uses

func (fn GetOrderHandlerFunc) Handle(params GetOrderParams, principal *models.Principal) middleware.Responder

Handle executing the request and returning a response

type GetOrderOK Uses

type GetOrderOK struct {

    /*
      In: Body
    */
    Payload *models.Order `json:"body,omitempty"`
}

GetOrderOK content of an order

swagger:response getOrderOK

func NewGetOrderOK Uses

func NewGetOrderOK() *GetOrderOK

NewGetOrderOK creates GetOrderOK with default headers values

func (*GetOrderOK) SetPayload Uses

func (o *GetOrderOK) SetPayload(payload *models.Order)

SetPayload sets the payload to the get order o k response

func (*GetOrderOK) WithPayload Uses

func (o *GetOrderOK) WithPayload(payload *models.Order) *GetOrderOK

WithPayload adds the payload to the get order o k response

func (*GetOrderOK) WriteResponse Uses

func (o *GetOrderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrderParams Uses

type GetOrderParams struct {

    // HTTP Request Object
    HTTPRequest *http.Request `json:"-"`

    /*
      Required: true
      In: path
    */
    OrderID string
}

GetOrderParams contains all the bound params for the get order operation typically these are obtained from a http.Request

swagger:parameters GetOrder

func NewGetOrderParams Uses

func NewGetOrderParams() GetOrderParams

NewGetOrderParams creates a new GetOrderParams object no default values defined in spec.

func (*GetOrderParams) BindRequest Uses

func (o *GetOrderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewGetOrderParams() beforehand.

type GetOrderURL Uses

type GetOrderURL struct {
    OrderID string
    // contains filtered or unexported fields
}

GetOrderURL generates an URL for the get order operation

func (*GetOrderURL) Build Uses

func (o *GetOrderURL) Build() (*url.URL, error)

Build a url path and query string

func (*GetOrderURL) BuildFull Uses

func (o *GetOrderURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*GetOrderURL) Must Uses

func (o *GetOrderURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*GetOrderURL) SetBasePath Uses

func (o *GetOrderURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*GetOrderURL) String Uses

func (o *GetOrderURL) String() string

String returns the string representation of the path with query string

func (*GetOrderURL) StringFull Uses

func (o *GetOrderURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*GetOrderURL) WithBasePath Uses

func (o *GetOrderURL) WithBasePath(bp string) *GetOrderURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type GetOrderUnauthorized Uses

type GetOrderUnauthorized struct {
}

GetOrderUnauthorized unauthorized access for a lack of authentication

swagger:response getOrderUnauthorized

func NewGetOrderUnauthorized Uses

func NewGetOrderUnauthorized() *GetOrderUnauthorized

NewGetOrderUnauthorized creates GetOrderUnauthorized with default headers values

func (*GetOrderUnauthorized) WriteResponse Uses

func (o *GetOrderUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrdersForItem Uses

type GetOrdersForItem struct {
    Context *middleware.Context
    Handler GetOrdersForItemHandler
}

GetOrdersForItem swagger:route GET /orders/{itemID} getOrdersForItem

retrieves all orders for an item

Only registered resellers should be able to search orders for an item

func NewGetOrdersForItem Uses

func NewGetOrdersForItem(ctx *middleware.Context, handler GetOrdersForItemHandler) *GetOrdersForItem

NewGetOrdersForItem creates a new http.Handler for the get orders for item operation

func (*GetOrdersForItem) ServeHTTP Uses

func (o *GetOrdersForItem) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type GetOrdersForItemDefault Uses

type GetOrdersForItemDefault struct {

    /*
      In: Body
    */
    Payload *models.Error `json:"body,omitempty"`
    // contains filtered or unexported fields
}

GetOrdersForItemDefault other error response

swagger:response getOrdersForItemDefault

func NewGetOrdersForItemDefault Uses

func NewGetOrdersForItemDefault(code int) *GetOrdersForItemDefault

NewGetOrdersForItemDefault creates GetOrdersForItemDefault with default headers values

func (*GetOrdersForItemDefault) SetPayload Uses

func (o *GetOrdersForItemDefault) SetPayload(payload *models.Error)

SetPayload sets the payload to the get orders for item default response

func (*GetOrdersForItemDefault) SetStatusCode Uses

func (o *GetOrdersForItemDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get orders for item default response

func (*GetOrdersForItemDefault) WithPayload Uses

func (o *GetOrdersForItemDefault) WithPayload(payload *models.Error) *GetOrdersForItemDefault

WithPayload adds the payload to the get orders for item default response

func (*GetOrdersForItemDefault) WithStatusCode Uses

func (o *GetOrdersForItemDefault) WithStatusCode(code int) *GetOrdersForItemDefault

WithStatusCode adds the status to the get orders for item default response

func (*GetOrdersForItemDefault) WriteResponse Uses

func (o *GetOrdersForItemDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrdersForItemForbidden Uses

type GetOrdersForItemForbidden struct {
}

GetOrdersForItemForbidden forbidden access for a lack of sufficient privileges

swagger:response getOrdersForItemForbidden

func NewGetOrdersForItemForbidden Uses

func NewGetOrdersForItemForbidden() *GetOrdersForItemForbidden

NewGetOrdersForItemForbidden creates GetOrdersForItemForbidden with default headers values

func (*GetOrdersForItemForbidden) WriteResponse Uses

func (o *GetOrdersForItemForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrdersForItemHandler Uses

type GetOrdersForItemHandler interface {
    Handle(GetOrdersForItemParams, *models.Principal) middleware.Responder
}

GetOrdersForItemHandler interface for that can handle valid get orders for item params

type GetOrdersForItemHandlerFunc Uses

type GetOrdersForItemHandlerFunc func(GetOrdersForItemParams, *models.Principal) middleware.Responder

GetOrdersForItemHandlerFunc turns a function with the right signature into a get orders for item handler

func (GetOrdersForItemHandlerFunc) Handle Uses

func (fn GetOrdersForItemHandlerFunc) Handle(params GetOrdersForItemParams, principal *models.Principal) middleware.Responder

Handle executing the request and returning a response

type GetOrdersForItemOK Uses

type GetOrdersForItemOK struct {

    /*
      In: Body
    */
    Payload []*models.Order `json:"body,omitempty"`
}

GetOrdersForItemOK multiple orders

swagger:response getOrdersForItemOK

func NewGetOrdersForItemOK Uses

func NewGetOrdersForItemOK() *GetOrdersForItemOK

NewGetOrdersForItemOK creates GetOrdersForItemOK with default headers values

func (*GetOrdersForItemOK) SetPayload Uses

func (o *GetOrdersForItemOK) SetPayload(payload []*models.Order)

SetPayload sets the payload to the get orders for item o k response

func (*GetOrdersForItemOK) WithPayload Uses

func (o *GetOrdersForItemOK) WithPayload(payload []*models.Order) *GetOrdersForItemOK

WithPayload adds the payload to the get orders for item o k response

func (*GetOrdersForItemOK) WriteResponse Uses

func (o *GetOrdersForItemOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetOrdersForItemParams Uses

type GetOrdersForItemParams struct {

    // HTTP Request Object
    HTTPRequest *http.Request `json:"-"`

    /*
      Required: true
      In: path
    */
    ItemID string
}

GetOrdersForItemParams contains all the bound params for the get orders for item operation typically these are obtained from a http.Request

swagger:parameters GetOrdersForItem

func NewGetOrdersForItemParams Uses

func NewGetOrdersForItemParams() GetOrdersForItemParams

NewGetOrdersForItemParams creates a new GetOrdersForItemParams object no default values defined in spec.

func (*GetOrdersForItemParams) BindRequest Uses

func (o *GetOrdersForItemParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewGetOrdersForItemParams() beforehand.

type GetOrdersForItemURL Uses

type GetOrdersForItemURL struct {
    ItemID string
    // contains filtered or unexported fields
}

GetOrdersForItemURL generates an URL for the get orders for item operation

func (*GetOrdersForItemURL) Build Uses

func (o *GetOrdersForItemURL) Build() (*url.URL, error)

Build a url path and query string

func (*GetOrdersForItemURL) BuildFull Uses

func (o *GetOrdersForItemURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*GetOrdersForItemURL) Must Uses

func (o *GetOrdersForItemURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*GetOrdersForItemURL) SetBasePath Uses

func (o *GetOrdersForItemURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*GetOrdersForItemURL) String Uses

func (o *GetOrdersForItemURL) String() string

String returns the string representation of the path with query string

func (*GetOrdersForItemURL) StringFull Uses

func (o *GetOrdersForItemURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*GetOrdersForItemURL) WithBasePath Uses

func (o *GetOrdersForItemURL) WithBasePath(bp string) *GetOrdersForItemURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type GetOrdersForItemUnauthorized Uses

type GetOrdersForItemUnauthorized struct {
}

GetOrdersForItemUnauthorized unauthorized access for a lack of authentication

swagger:response getOrdersForItemUnauthorized

func NewGetOrdersForItemUnauthorized Uses

func NewGetOrdersForItemUnauthorized() *GetOrdersForItemUnauthorized

NewGetOrdersForItemUnauthorized creates GetOrdersForItemUnauthorized with default headers values

func (*GetOrdersForItemUnauthorized) WriteResponse Uses

func (o *GetOrdersForItemUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type MultiAuthExampleAPI Uses

type MultiAuthExampleAPI struct {
    Middleware func(middleware.Builder) http.Handler

    // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
    // It has a default implementation in the security package, however you can replace it for your particular usage.
    BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
    // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
    // It has a default implementation in the security package, however you can replace it for your particular usage.
    APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
    // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
    // It has a default implementation in the security package, however you can replace it for your particular usage.
    BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator

    // JSONConsumer registers a consumer for the following mime types:
    //   - application/json
    JSONConsumer runtime.Consumer

    // JSONProducer registers a producer for the following mime types:
    //   - application/json
    JSONProducer runtime.Producer

    // HasRoleAuth registers a function that takes an access token and a collection of required scopes and returns a principal
    // it performs authentication based on an oauth2 bearer token provided in the request
    HasRoleAuth func(string, []string) (*models.Principal, error)

    // IsRegisteredAuth registers a function that takes username and password and returns a principal
    // it performs authentication with basic auth
    IsRegisteredAuth func(string, string) (*models.Principal, error)

    // IsResellerAuth registers a function that takes a token and returns a principal
    // it performs authentication based on an api key X-Custom-Key provided in the header
    IsResellerAuth func(string) (*models.Principal, error)

    // IsResellerQueryAuth registers a function that takes a token and returns a principal
    // it performs authentication based on an api key CustomKeyAsQuery provided in the query
    IsResellerQueryAuth func(string) (*models.Principal, error)

    // APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
    APIAuthorizer runtime.Authorizer

    // AddOrderHandler sets the operation handler for the add order operation
    AddOrderHandler AddOrderHandler
    // GetAccountHandler sets the operation handler for the get account operation
    GetAccountHandler GetAccountHandler
    // GetItemsHandler sets the operation handler for the get items operation
    GetItemsHandler GetItemsHandler
    // GetOrderHandler sets the operation handler for the get order operation
    GetOrderHandler GetOrderHandler
    // GetOrdersForItemHandler sets the operation handler for the get orders for item operation
    GetOrdersForItemHandler GetOrdersForItemHandler
    // ServeError is called when an error is received, there is a default handler
    // but you can set your own with this
    ServeError func(http.ResponseWriter, *http.Request, error)

    // PreServerShutdown is called before the HTTP(S) server is shutdown
    // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
    PreServerShutdown func()

    // ServerShutdown is called when the HTTP(S) server is shut down and done
    // handling all active connections and does not accept connections any more
    ServerShutdown func()

    // Custom command line argument groups with their descriptions
    CommandLineOptionsGroups []swag.CommandLineOptionsGroup

    // User defined logger function.
    Logger func(string, ...interface{})
    // contains filtered or unexported fields
}

MultiAuthExampleAPI This sample API demonstrates how to compose several authentication schemes and configure complex security requirements for your operations.

This API simulates a very simple market place with customers and resellers of items.

Personas:

- as a first time user, I want to see all items on sales
- as a registered customer, I want to post orders for items and
  consult my past orders
- as a registered reseller, I want to see all pending orders on the items
  I am selling on the market place
- as a reseller managing my own inventories, I want to post replenishment orders for the items I provide
- as a register user, I want to consult my personal account infos

The situation we defined on the authentication side is as follows:

- every known user is authenticated using a basic token
- resellers are authenticated using API keys - we let the option to authenticate using a header or query param
- any registered user (customer or reseller) will add a signed JWT to access more API endpoints

Obviously, there are several ways to achieve the same result. We just wanted to demonstrate here how security requirements may compose several schemes.

Note that we used the "OAuth2" declaration here but don't implement a real OAuth2 workflow: our intend here is just to be able to extract scopes from a passed JWT token (the only way to manipulate scoped authorizers with Swagger 2.0 is to declare them with type "oauth2").

func NewMultiAuthExampleAPI Uses

func NewMultiAuthExampleAPI(spec *loads.Document) *MultiAuthExampleAPI

NewMultiAuthExampleAPI creates a new MultiAuthExample instance

func (*MultiAuthExampleAPI) AddMiddlewareFor Uses

func (o *MultiAuthExampleAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)

AddMiddlewareFor adds a http middleware to existing handler

func (*MultiAuthExampleAPI) AuthenticatorsFor Uses

func (o *MultiAuthExampleAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*MultiAuthExampleAPI) Authorizer Uses

func (o *MultiAuthExampleAPI) Authorizer() runtime.Authorizer

Authorizer returns the registered authorizer

func (*MultiAuthExampleAPI) ConsumersFor Uses

func (o *MultiAuthExampleAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer

ConsumersFor gets the consumers for the specified media types. MIME type parameters are ignored here.

func (*MultiAuthExampleAPI) Context Uses

func (o *MultiAuthExampleAPI) Context() *middleware.Context

Context returns the middleware context for the multi auth example API

func (*MultiAuthExampleAPI) DefaultConsumes Uses

func (o *MultiAuthExampleAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*MultiAuthExampleAPI) DefaultProduces Uses

func (o *MultiAuthExampleAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*MultiAuthExampleAPI) Formats Uses

func (o *MultiAuthExampleAPI) Formats() strfmt.Registry

Formats returns the registered string formats

func (*MultiAuthExampleAPI) HandlerFor Uses

func (o *MultiAuthExampleAPI) HandlerFor(method, path string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation method and path

func (*MultiAuthExampleAPI) Init Uses

func (o *MultiAuthExampleAPI) Init()

Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit

func (*MultiAuthExampleAPI) ProducersFor Uses

func (o *MultiAuthExampleAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer

ProducersFor gets the producers for the specified media types. MIME type parameters are ignored here.

func (*MultiAuthExampleAPI) RegisterConsumer Uses

func (o *MultiAuthExampleAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)

RegisterConsumer allows you to add (or override) a consumer for a media type.

func (*MultiAuthExampleAPI) RegisterFormat Uses

func (o *MultiAuthExampleAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)

RegisterFormat registers a custom format validator

func (*MultiAuthExampleAPI) RegisterProducer Uses

func (o *MultiAuthExampleAPI) RegisterProducer(mediaType string, producer runtime.Producer)

RegisterProducer allows you to add (or override) a producer for a media type.

func (*MultiAuthExampleAPI) Serve Uses

func (o *MultiAuthExampleAPI) Serve(builder middleware.Builder) http.Handler

Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve(nil))

func (*MultiAuthExampleAPI) ServeErrorFor Uses

func (o *MultiAuthExampleAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)

ServeErrorFor gets a error handler for a given operation id

func (*MultiAuthExampleAPI) SetDefaultConsumes Uses

func (o *MultiAuthExampleAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*MultiAuthExampleAPI) SetDefaultProduces Uses

func (o *MultiAuthExampleAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*MultiAuthExampleAPI) SetSpec Uses

func (o *MultiAuthExampleAPI) SetSpec(spec *loads.Document)

SetSpec sets a spec that will be served for the clients.

func (*MultiAuthExampleAPI) UseRedoc Uses

func (o *MultiAuthExampleAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*MultiAuthExampleAPI) UseSwaggerUI Uses

func (o *MultiAuthExampleAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*MultiAuthExampleAPI) Validate Uses

func (o *MultiAuthExampleAPI) Validate() error

Validate validates the registrations in the MultiAuthExampleAPI

Package operations imports 16 packages (graph) and is imported by 1 packages. Updated 2020-07-31. Refresh now. Tools for package owners.