repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
sequence
docstring
stringlengths
6
2.61k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one_responses.go
WithStatusCode
func (o *DestroyOneDefault) WithStatusCode(code int) *DestroyOneDefault { o._statusCode = code return o }
go
func (o *DestroyOneDefault) WithStatusCode(code int) *DestroyOneDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "DestroyOneDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "DestroyOneDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the destroy one default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "destroy", "one", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one_responses.go#L65-L68
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one_responses.go
WithPayload
func (o *DestroyOneDefault) WithPayload(payload *models.Error) *DestroyOneDefault { o.Payload = payload return o }
go
func (o *DestroyOneDefault) WithPayload(payload *models.Error) *DestroyOneDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "DestroyOneDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "DestroyOneDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the destroy one default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "destroy", "one", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one_responses.go#L76-L79
train
go-swagger/go-swagger
examples/stream-server/restapi/operations/elapse_parameters.go
bindLength
func (o *ElapseParams) bindLength(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route value, err := swag.ConvertInt64(raw) if err != nil { return errors.InvalidType("length", "path", "int64", raw) } o.Length = value if err := o.validateLength(formats); err != nil { return err } return nil }
go
func (o *ElapseParams) bindLength(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route value, err := swag.ConvertInt64(raw) if err != nil { return errors.InvalidType("length", "path", "int64", raw) } o.Length = value if err := o.validateLength(formats); err != nil { return err } return nil }
[ "func", "(", "o", "*", "ElapseParams", ")", "bindLength", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: true", "// Parameter is provided by construction from the route", "value", ",", "err", ":=", "swag", ".", "ConvertInt64", "(", "raw", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "InvalidType", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "raw", ")", "\n", "}", "\n", "o", ".", "Length", "=", "value", "\n\n", "if", "err", ":=", "o", ".", "validateLength", "(", "formats", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// bindLength binds and validates parameter Length from path.
[ "bindLength", "binds", "and", "validates", "parameter", "Length", "from", "path", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/elapse_parameters.go#L65-L85
train
go-swagger/go-swagger
examples/stream-server/restapi/operations/elapse_parameters.go
validateLength
func (o *ElapseParams) validateLength(formats strfmt.Registry) error { if err := validate.MinimumInt("length", "path", int64(o.Length), 2, false); err != nil { return err } if err := validate.MaximumInt("length", "path", int64(o.Length), 30, false); err != nil { return err } return nil }
go
func (o *ElapseParams) validateLength(formats strfmt.Registry) error { if err := validate.MinimumInt("length", "path", int64(o.Length), 2, false); err != nil { return err } if err := validate.MaximumInt("length", "path", int64(o.Length), 30, false); err != nil { return err } return nil }
[ "func", "(", "o", "*", "ElapseParams", ")", "validateLength", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "if", "err", ":=", "validate", ".", "MinimumInt", "(", "\"", "\"", ",", "\"", "\"", ",", "int64", "(", "o", ".", "Length", ")", ",", "2", ",", "false", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "validate", ".", "MaximumInt", "(", "\"", "\"", ",", "\"", "\"", ",", "int64", "(", "o", ".", "Length", ")", ",", "30", ",", "false", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// validateLength carries on validations for parameter Length
[ "validateLength", "carries", "on", "validations", "for", "parameter", "Length" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/elapse_parameters.go#L88-L99
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_create_responses.go
WithPayload
func (o *PetCreateCreated) WithPayload(payload *models.Pet) *PetCreateCreated { o.Payload = payload return o }
go
func (o *PetCreateCreated) WithPayload(payload *models.Pet) *PetCreateCreated { o.Payload = payload return o }
[ "func", "(", "o", "*", "PetCreateCreated", ")", "WithPayload", "(", "payload", "*", "models", ".", "Pet", ")", "*", "PetCreateCreated", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the pet create created response
[ "WithPayload", "adds", "the", "payload", "to", "the", "pet", "create", "created", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_create_responses.go#L38-L41
train
go-swagger/go-swagger
examples/stream-server/restapi/operations/elapse_responses.go
WithPayload
func (o *ElapseOK) WithPayload(payload io.ReadCloser) *ElapseOK { o.Payload = payload return o }
go
func (o *ElapseOK) WithPayload(payload io.ReadCloser) *ElapseOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "ElapseOK", ")", "WithPayload", "(", "payload", "io", ".", "ReadCloser", ")", "*", "ElapseOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the elapse o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "elapse", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/elapse_responses.go#L37-L40
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/login_user.go
NewLoginUser
func NewLoginUser(ctx *middleware.Context, handler LoginUserHandler) *LoginUser { return &LoginUser{Context: ctx, Handler: handler} }
go
func NewLoginUser(ctx *middleware.Context, handler LoginUserHandler) *LoginUser { return &LoginUser{Context: ctx, Handler: handler} }
[ "func", "NewLoginUser", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "LoginUserHandler", ")", "*", "LoginUser", "{", "return", "&", "LoginUser", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewLoginUser creates a new http.Handler for the login user operation
[ "NewLoginUser", "creates", "a", "new", "http", ".", "Handler", "for", "the", "login", "user", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/login_user.go#L28-L30
train
go-swagger/go-swagger
examples/authentication/restapi/operations/customers/create_responses.go
WithPayload
func (o *CreateCreated) WithPayload(payload *models.Customer) *CreateCreated { o.Payload = payload return o }
go
func (o *CreateCreated) WithPayload(payload *models.Customer) *CreateCreated { o.Payload = payload return o }
[ "func", "(", "o", "*", "CreateCreated", ")", "WithPayload", "(", "payload", "*", "models", ".", "Customer", ")", "*", "CreateCreated", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the create created response
[ "WithPayload", "adds", "the", "payload", "to", "the", "create", "created", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/create_responses.go#L38-L41
train
go-swagger/go-swagger
examples/authentication/restapi/operations/customers/create_responses.go
WithStatusCode
func (o *CreateDefault) WithStatusCode(code int) *CreateDefault { o._statusCode = code return o }
go
func (o *CreateDefault) WithStatusCode(code int) *CreateDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "CreateDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "CreateDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the create default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "create", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/create_responses.go#L85-L88
train
go-swagger/go-swagger
examples/authentication/restapi/operations/customers/create_responses.go
WithPayload
func (o *CreateDefault) WithPayload(payload *models.Error) *CreateDefault { o.Payload = payload return o }
go
func (o *CreateDefault) WithPayload(payload *models.Error) *CreateDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "CreateDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "CreateDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the create default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "create", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/create_responses.go#L96-L99
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/add_order_responses.go
WithStatusCode
func (o *AddOrderDefault) WithStatusCode(code int) *AddOrderDefault { o._statusCode = code return o }
go
func (o *AddOrderDefault) WithStatusCode(code int) *AddOrderDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "AddOrderDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "AddOrderDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the add order default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "add", "order", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/add_order_responses.go#L113-L116
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/add_order_responses.go
WithPayload
func (o *AddOrderDefault) WithPayload(payload *models.Error) *AddOrderDefault { o.Payload = payload return o }
go
func (o *AddOrderDefault) WithPayload(payload *models.Error) *AddOrderDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "AddOrderDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "AddOrderDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the add order default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "add", "order", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/add_order_responses.go#L124-L127
train
go-swagger/go-swagger
generator/config.go
ConfigureOpts
func (d *LanguageDefinition) ConfigureOpts(opts *GenOpts) error { opts.Sections = d.Layout if opts.LanguageOpts == nil { opts.LanguageOpts = GoLangOpts() } return nil }
go
func (d *LanguageDefinition) ConfigureOpts(opts *GenOpts) error { opts.Sections = d.Layout if opts.LanguageOpts == nil { opts.LanguageOpts = GoLangOpts() } return nil }
[ "func", "(", "d", "*", "LanguageDefinition", ")", "ConfigureOpts", "(", "opts", "*", "GenOpts", ")", "error", "{", "opts", ".", "Sections", "=", "d", ".", "Layout", "\n", "if", "opts", ".", "LanguageOpts", "==", "nil", "{", "opts", ".", "LanguageOpts", "=", "GoLangOpts", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ConfigureOpts for generation
[ "ConfigureOpts", "for", "generation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/config.go#L17-L23
train
go-swagger/go-swagger
examples/composed-auth/restapi/server.go
NewServer
func NewServer(api *operations.MultiAuthExampleAPI) *Server { s := new(Server) s.shutdown = make(chan struct{}) s.api = api s.interrupt = make(chan os.Signal, 1) return s }
go
func NewServer(api *operations.MultiAuthExampleAPI) *Server { s := new(Server) s.shutdown = make(chan struct{}) s.api = api s.interrupt = make(chan os.Signal, 1) return s }
[ "func", "NewServer", "(", "api", "*", "operations", ".", "MultiAuthExampleAPI", ")", "*", "Server", "{", "s", ":=", "new", "(", "Server", ")", "\n\n", "s", ".", "shutdown", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "s", ".", "api", "=", "api", "\n", "s", ".", "interrupt", "=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "return", "s", "\n", "}" ]
// NewServer creates a new api multi auth example server but does not configure it
[ "NewServer", "creates", "a", "new", "api", "multi", "auth", "example", "server", "but", "does", "not", "configure", "it" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/server.go#L46-L53
train
go-swagger/go-swagger
examples/todo-list/client/todos/update_one_parameters.go
WithTimeout
func (o *UpdateOneParams) WithTimeout(timeout time.Duration) *UpdateOneParams { o.SetTimeout(timeout) return o }
go
func (o *UpdateOneParams) WithTimeout(timeout time.Duration) *UpdateOneParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "UpdateOneParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "UpdateOneParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the update one params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "update", "one", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/update_one_parameters.go#L77-L80
train
go-swagger/go-swagger
examples/todo-list/client/todos/update_one_parameters.go
WithContext
func (o *UpdateOneParams) WithContext(ctx context.Context) *UpdateOneParams { o.SetContext(ctx) return o }
go
func (o *UpdateOneParams) WithContext(ctx context.Context) *UpdateOneParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "UpdateOneParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "UpdateOneParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the update one params
[ "WithContext", "adds", "the", "context", "to", "the", "update", "one", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/update_one_parameters.go#L88-L91
train
go-swagger/go-swagger
examples/todo-list/client/todos/update_one_parameters.go
WithHTTPClient
func (o *UpdateOneParams) WithHTTPClient(client *http.Client) *UpdateOneParams { o.SetHTTPClient(client) return o }
go
func (o *UpdateOneParams) WithHTTPClient(client *http.Client) *UpdateOneParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "UpdateOneParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "UpdateOneParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the update one params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "update", "one", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/update_one_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/todo-list/client/todos/update_one_parameters.go
WithBody
func (o *UpdateOneParams) WithBody(body *models.Item) *UpdateOneParams { o.SetBody(body) return o }
go
func (o *UpdateOneParams) WithBody(body *models.Item) *UpdateOneParams { o.SetBody(body) return o }
[ "func", "(", "o", "*", "UpdateOneParams", ")", "WithBody", "(", "body", "*", "models", ".", "Item", ")", "*", "UpdateOneParams", "{", "o", ".", "SetBody", "(", "body", ")", "\n", "return", "o", "\n", "}" ]
// WithBody adds the body to the update one params
[ "WithBody", "adds", "the", "body", "to", "the", "update", "one", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/update_one_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/todo-list/client/todos/update_one_parameters.go
WithID
func (o *UpdateOneParams) WithID(id string) *UpdateOneParams { o.SetID(id) return o }
go
func (o *UpdateOneParams) WithID(id string) *UpdateOneParams { o.SetID(id) return o }
[ "func", "(", "o", "*", "UpdateOneParams", ")", "WithID", "(", "id", "string", ")", "*", "UpdateOneParams", "{", "o", ".", "SetID", "(", "id", ")", "\n", "return", "o", "\n", "}" ]
// WithID adds the id to the update one params
[ "WithID", "adds", "the", "id", "to", "the", "update", "one", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/update_one_parameters.go#L121-L124
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go
WithTimeout
func (o *PetDeleteParams) WithTimeout(timeout time.Duration) *PetDeleteParams { o.SetTimeout(timeout) return o }
go
func (o *PetDeleteParams) WithTimeout(timeout time.Duration) *PetDeleteParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "PetDeleteParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "PetDeleteParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the pet delete params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "pet", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go#L79-L82
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go
WithContext
func (o *PetDeleteParams) WithContext(ctx context.Context) *PetDeleteParams { o.SetContext(ctx) return o }
go
func (o *PetDeleteParams) WithContext(ctx context.Context) *PetDeleteParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "PetDeleteParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "PetDeleteParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the pet delete params
[ "WithContext", "adds", "the", "context", "to", "the", "pet", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go#L90-L93
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go
WithHTTPClient
func (o *PetDeleteParams) WithHTTPClient(client *http.Client) *PetDeleteParams { o.SetHTTPClient(client) return o }
go
func (o *PetDeleteParams) WithHTTPClient(client *http.Client) *PetDeleteParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "PetDeleteParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "PetDeleteParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the pet delete params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "pet", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go#L101-L104
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go
WithAPIKey
func (o *PetDeleteParams) WithAPIKey(aPIKey *string) *PetDeleteParams { o.SetAPIKey(aPIKey) return o }
go
func (o *PetDeleteParams) WithAPIKey(aPIKey *string) *PetDeleteParams { o.SetAPIKey(aPIKey) return o }
[ "func", "(", "o", "*", "PetDeleteParams", ")", "WithAPIKey", "(", "aPIKey", "*", "string", ")", "*", "PetDeleteParams", "{", "o", ".", "SetAPIKey", "(", "aPIKey", ")", "\n", "return", "o", "\n", "}" ]
// WithAPIKey adds the aPIKey to the pet delete params
[ "WithAPIKey", "adds", "the", "aPIKey", "to", "the", "pet", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go#L112-L115
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go
WithPetID
func (o *PetDeleteParams) WithPetID(petID int64) *PetDeleteParams { o.SetPetID(petID) return o }
go
func (o *PetDeleteParams) WithPetID(petID int64) *PetDeleteParams { o.SetPetID(petID) return o }
[ "func", "(", "o", "*", "PetDeleteParams", ")", "WithPetID", "(", "petID", "int64", ")", "*", "PetDeleteParams", "{", "o", ".", "SetPetID", "(", "petID", ")", "\n", "return", "o", "\n", "}" ]
// WithPetID adds the petID to the pet delete params
[ "WithPetID", "adds", "the", "petID", "to", "the", "pet", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go#L123-L126
train
go-swagger/go-swagger
generator/types.go
knownDefGoType
func knownDefGoType(def string, schema spec.Schema, clear func(string) string) (string, string, string) { debugLog("known def type: %q", def) ext := schema.Extensions if nm, ok := ext.GetString(xGoName); ok { if clear == nil { debugLog("known def type %s no clear: %q", xGoName, nm) return nm, "", "" } debugLog("known def type %s clear: %q -> %q", xGoName, nm, clear(nm)) return clear(nm), "", "" } v, ok := ext[xGoType] if !ok { if clear == nil { debugLog("known def type no clear: %q", def) return def, "", "" } debugLog("known def type clear: %q -> %q", def, clear(def)) return clear(def), "", "" } xt := v.(map[string]interface{}) t := xt["type"].(string) impIface, ok := xt["import"] if !ok { return t, "", "" } imp := impIface.(map[string]interface{}) pkg := imp["package"].(string) al, ok := imp["alias"] var alias string if ok { alias = al.(string) } else { alias = path.Base(pkg) } debugLog("known def type %s no clear: %q: pkg=%s, alias=%s", xGoType, alias+"."+t, pkg, alias) return alias + "." + t, pkg, alias }
go
func knownDefGoType(def string, schema spec.Schema, clear func(string) string) (string, string, string) { debugLog("known def type: %q", def) ext := schema.Extensions if nm, ok := ext.GetString(xGoName); ok { if clear == nil { debugLog("known def type %s no clear: %q", xGoName, nm) return nm, "", "" } debugLog("known def type %s clear: %q -> %q", xGoName, nm, clear(nm)) return clear(nm), "", "" } v, ok := ext[xGoType] if !ok { if clear == nil { debugLog("known def type no clear: %q", def) return def, "", "" } debugLog("known def type clear: %q -> %q", def, clear(def)) return clear(def), "", "" } xt := v.(map[string]interface{}) t := xt["type"].(string) impIface, ok := xt["import"] if !ok { return t, "", "" } imp := impIface.(map[string]interface{}) pkg := imp["package"].(string) al, ok := imp["alias"] var alias string if ok { alias = al.(string) } else { alias = path.Base(pkg) } debugLog("known def type %s no clear: %q: pkg=%s, alias=%s", xGoType, alias+"."+t, pkg, alias) return alias + "." + t, pkg, alias }
[ "func", "knownDefGoType", "(", "def", "string", ",", "schema", "spec", ".", "Schema", ",", "clear", "func", "(", "string", ")", "string", ")", "(", "string", ",", "string", ",", "string", ")", "{", "debugLog", "(", "\"", "\"", ",", "def", ")", "\n", "ext", ":=", "schema", ".", "Extensions", "\n", "if", "nm", ",", "ok", ":=", "ext", ".", "GetString", "(", "xGoName", ")", ";", "ok", "{", "if", "clear", "==", "nil", "{", "debugLog", "(", "\"", "\"", ",", "xGoName", ",", "nm", ")", "\n", "return", "nm", ",", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "debugLog", "(", "\"", "\"", ",", "xGoName", ",", "nm", ",", "clear", "(", "nm", ")", ")", "\n", "return", "clear", "(", "nm", ")", ",", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "v", ",", "ok", ":=", "ext", "[", "xGoType", "]", "\n", "if", "!", "ok", "{", "if", "clear", "==", "nil", "{", "debugLog", "(", "\"", "\"", ",", "def", ")", "\n", "return", "def", ",", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "debugLog", "(", "\"", "\"", ",", "def", ",", "clear", "(", "def", ")", ")", "\n", "return", "clear", "(", "def", ")", ",", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "xt", ":=", "v", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "t", ":=", "xt", "[", "\"", "\"", "]", ".", "(", "string", ")", "\n", "impIface", ",", "ok", ":=", "xt", "[", "\"", "\"", "]", "\n\n", "if", "!", "ok", "{", "return", "t", ",", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n\n", "imp", ":=", "impIface", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "pkg", ":=", "imp", "[", "\"", "\"", "]", ".", "(", "string", ")", "\n", "al", ",", "ok", ":=", "imp", "[", "\"", "\"", "]", "\n", "var", "alias", "string", "\n", "if", "ok", "{", "alias", "=", "al", ".", "(", "string", ")", "\n", "}", "else", "{", "alias", "=", "path", ".", "Base", "(", "pkg", ")", "\n", "}", "\n", "debugLog", "(", "\"", "\"", ",", "xGoType", ",", "alias", "+", "\"", "\"", "+", "t", ",", "pkg", ",", "alias", ")", "\n", "return", "alias", "+", "\"", "\"", "+", "t", ",", "pkg", ",", "alias", "\n", "}" ]
// knownDefGoType returns go type, package and package alias for definition
[ "knownDefGoType", "returns", "go", "type", "package", "and", "package", "alias", "for", "definition" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/types.go#L134-L173
train
go-swagger/go-swagger
generator/types.go
NewWithModelName
func (t *typeResolver) NewWithModelName(name string) *typeResolver { tt := newTypeResolver(t.ModelsPackage, t.Doc) tt.ModelName = name // propagates kept definitions tt.keepDefinitionsPkg = t.keepDefinitionsPkg tt.knownDefsKept = t.knownDefsKept return tt }
go
func (t *typeResolver) NewWithModelName(name string) *typeResolver { tt := newTypeResolver(t.ModelsPackage, t.Doc) tt.ModelName = name // propagates kept definitions tt.keepDefinitionsPkg = t.keepDefinitionsPkg tt.knownDefsKept = t.knownDefsKept return tt }
[ "func", "(", "t", "*", "typeResolver", ")", "NewWithModelName", "(", "name", "string", ")", "*", "typeResolver", "{", "tt", ":=", "newTypeResolver", "(", "t", ".", "ModelsPackage", ",", "t", ".", "Doc", ")", "\n", "tt", ".", "ModelName", "=", "name", "\n\n", "// propagates kept definitions", "tt", ".", "keepDefinitionsPkg", "=", "t", ".", "keepDefinitionsPkg", "\n", "tt", ".", "knownDefsKept", "=", "t", ".", "knownDefsKept", "\n", "return", "tt", "\n", "}" ]
// NewWithModelName clones a type resolver and specifies a new model name
[ "NewWithModelName", "clones", "a", "type", "resolver", "and", "specifies", "a", "new", "model", "name" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/types.go#L186-L194
train
go-swagger/go-swagger
generator/types.go
withKeepDefinitionsPackage
func (t *typeResolver) withKeepDefinitionsPackage(definitionsPackage string) *typeResolver { t.keepDefinitionsPkg = definitionsPackage t.knownDefsKept = make(map[string]struct{}, len(t.KnownDefs)) for k := range t.KnownDefs { t.knownDefsKept[k] = struct{}{} } return t }
go
func (t *typeResolver) withKeepDefinitionsPackage(definitionsPackage string) *typeResolver { t.keepDefinitionsPkg = definitionsPackage t.knownDefsKept = make(map[string]struct{}, len(t.KnownDefs)) for k := range t.KnownDefs { t.knownDefsKept[k] = struct{}{} } return t }
[ "func", "(", "t", "*", "typeResolver", ")", "withKeepDefinitionsPackage", "(", "definitionsPackage", "string", ")", "*", "typeResolver", "{", "t", ".", "keepDefinitionsPkg", "=", "definitionsPackage", "\n", "t", ".", "knownDefsKept", "=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ",", "len", "(", "t", ".", "KnownDefs", ")", ")", "\n", "for", "k", ":=", "range", "t", ".", "KnownDefs", "{", "t", ".", "knownDefsKept", "[", "k", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "t", "\n", "}" ]
// withKeepDefinitionsPackage instructs the type resolver to keep previously resolved package name for // definitions known at the moment it is first called.
[ "withKeepDefinitionsPackage", "instructs", "the", "type", "resolver", "to", "keep", "previously", "resolved", "package", "name", "for", "definitions", "known", "at", "the", "moment", "it", "is", "first", "called", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/types.go#L198-L205
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/multi_auth_example_api.go
NewMultiAuthExampleAPI
func NewMultiAuthExampleAPI(spec *loads.Document) *MultiAuthExampleAPI { return &MultiAuthExampleAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), AddOrderHandler: AddOrderHandlerFunc(func(params AddOrderParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation AddOrder has not yet been implemented") }), GetAccountHandler: GetAccountHandlerFunc(func(params GetAccountParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetAccount has not yet been implemented") }), GetItemsHandler: GetItemsHandlerFunc(func(params GetItemsParams) middleware.Responder { return middleware.NotImplemented("operation GetItems has not yet been implemented") }), GetOrderHandler: GetOrderHandlerFunc(func(params GetOrderParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetOrder has not yet been implemented") }), GetOrdersForItemHandler: GetOrdersForItemHandlerFunc(func(params GetOrdersForItemParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetOrdersForItem has not yet been implemented") }), HasRoleAuth: func(token string, scopes []string) (*models.Principal, error) { return nil, errors.NotImplemented("oauth2 bearer auth (hasRole) has not yet been implemented") }, // Applies when the Authorization header is set with the Basic scheme IsRegisteredAuth: func(user string, pass string) (*models.Principal, error) { return nil, errors.NotImplemented("basic auth (isRegistered) has not yet been implemented") }, // Applies when the "X-Custom-Key" header is set IsResellerAuth: func(token string) (*models.Principal, error) { return nil, errors.NotImplemented("api key auth (isReseller) X-Custom-Key from header param [X-Custom-Key] has not yet been implemented") }, // Applies when the "CustomKeyAsQuery" query is set IsResellerQueryAuth: func(token string) (*models.Principal, error) { return nil, errors.NotImplemented("api key auth (isResellerQuery) CustomKeyAsQuery from query param [CustomKeyAsQuery] has not yet been implemented") }, // default authorizer is authorized meaning no requests are blocked APIAuthorizer: security.Authorized(), } }
go
func NewMultiAuthExampleAPI(spec *loads.Document) *MultiAuthExampleAPI { return &MultiAuthExampleAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), AddOrderHandler: AddOrderHandlerFunc(func(params AddOrderParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation AddOrder has not yet been implemented") }), GetAccountHandler: GetAccountHandlerFunc(func(params GetAccountParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetAccount has not yet been implemented") }), GetItemsHandler: GetItemsHandlerFunc(func(params GetItemsParams) middleware.Responder { return middleware.NotImplemented("operation GetItems has not yet been implemented") }), GetOrderHandler: GetOrderHandlerFunc(func(params GetOrderParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetOrder has not yet been implemented") }), GetOrdersForItemHandler: GetOrdersForItemHandlerFunc(func(params GetOrdersForItemParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation GetOrdersForItem has not yet been implemented") }), HasRoleAuth: func(token string, scopes []string) (*models.Principal, error) { return nil, errors.NotImplemented("oauth2 bearer auth (hasRole) has not yet been implemented") }, // Applies when the Authorization header is set with the Basic scheme IsRegisteredAuth: func(user string, pass string) (*models.Principal, error) { return nil, errors.NotImplemented("basic auth (isRegistered) has not yet been implemented") }, // Applies when the "X-Custom-Key" header is set IsResellerAuth: func(token string) (*models.Principal, error) { return nil, errors.NotImplemented("api key auth (isReseller) X-Custom-Key from header param [X-Custom-Key] has not yet been implemented") }, // Applies when the "CustomKeyAsQuery" query is set IsResellerQueryAuth: func(token string) (*models.Principal, error) { return nil, errors.NotImplemented("api key auth (isResellerQuery) CustomKeyAsQuery from query param [CustomKeyAsQuery] has not yet been implemented") }, // default authorizer is authorized meaning no requests are blocked APIAuthorizer: security.Authorized(), } }
[ "func", "NewMultiAuthExampleAPI", "(", "spec", "*", "loads", ".", "Document", ")", "*", "MultiAuthExampleAPI", "{", "return", "&", "MultiAuthExampleAPI", "{", "handlers", ":", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "http", ".", "Handler", ")", ",", "formats", ":", "strfmt", ".", "Default", ",", "defaultConsumes", ":", "\"", "\"", ",", "defaultProduces", ":", "\"", "\"", ",", "customConsumers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Consumer", ")", ",", "customProducers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Producer", ")", ",", "ServerShutdown", ":", "func", "(", ")", "{", "}", ",", "spec", ":", "spec", ",", "ServeError", ":", "errors", ".", "ServeError", ",", "BasicAuthenticator", ":", "security", ".", "BasicAuth", ",", "APIKeyAuthenticator", ":", "security", ".", "APIKeyAuth", ",", "BearerAuthenticator", ":", "security", ".", "BearerAuth", ",", "JSONConsumer", ":", "runtime", ".", "JSONConsumer", "(", ")", ",", "JSONProducer", ":", "runtime", ".", "JSONProducer", "(", ")", ",", "AddOrderHandler", ":", "AddOrderHandlerFunc", "(", "func", "(", "params", "AddOrderParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "GetAccountHandler", ":", "GetAccountHandlerFunc", "(", "func", "(", "params", "GetAccountParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "GetItemsHandler", ":", "GetItemsHandlerFunc", "(", "func", "(", "params", "GetItemsParams", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "GetOrderHandler", ":", "GetOrderHandlerFunc", "(", "func", "(", "params", "GetOrderParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "GetOrdersForItemHandler", ":", "GetOrdersForItemHandlerFunc", "(", "func", "(", "params", "GetOrdersForItemParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "HasRoleAuth", ":", "func", "(", "token", "string", ",", "scopes", "[", "]", "string", ")", "(", "*", "models", ".", "Principal", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ",", "// Applies when the Authorization header is set with the Basic scheme", "IsRegisteredAuth", ":", "func", "(", "user", "string", ",", "pass", "string", ")", "(", "*", "models", ".", "Principal", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ",", "// Applies when the \"X-Custom-Key\" header is set", "IsResellerAuth", ":", "func", "(", "token", "string", ")", "(", "*", "models", ".", "Principal", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ",", "// Applies when the \"CustomKeyAsQuery\" query is set", "IsResellerQueryAuth", ":", "func", "(", "token", "string", ")", "(", "*", "models", ".", "Principal", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ",", "// default authorizer is authorized meaning no requests are blocked", "APIAuthorizer", ":", "security", ".", "Authorized", "(", ")", ",", "}", "\n", "}" ]
// NewMultiAuthExampleAPI creates a new MultiAuthExample instance
[ "NewMultiAuthExampleAPI", "creates", "a", "new", "MultiAuthExample", "instance" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/multi_auth_example_api.go#L26-L79
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/multi_auth_example_api.go
Validate
func (o *MultiAuthExampleAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.JSONProducer == nil { unregistered = append(unregistered, "JSONProducer") } if o.HasRoleAuth == nil { unregistered = append(unregistered, "HasRoleAuth") } if o.IsRegisteredAuth == nil { unregistered = append(unregistered, "IsRegisteredAuth") } if o.IsResellerAuth == nil { unregistered = append(unregistered, "XCustomKeyAuth") } if o.IsResellerQueryAuth == nil { unregistered = append(unregistered, "CustomKeyAsQueryAuth") } if o.AddOrderHandler == nil { unregistered = append(unregistered, "AddOrderHandler") } if o.GetAccountHandler == nil { unregistered = append(unregistered, "GetAccountHandler") } if o.GetItemsHandler == nil { unregistered = append(unregistered, "GetItemsHandler") } if o.GetOrderHandler == nil { unregistered = append(unregistered, "GetOrderHandler") } if o.GetOrdersForItemHandler == nil { unregistered = append(unregistered, "GetOrdersForItemHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
go
func (o *MultiAuthExampleAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.JSONProducer == nil { unregistered = append(unregistered, "JSONProducer") } if o.HasRoleAuth == nil { unregistered = append(unregistered, "HasRoleAuth") } if o.IsRegisteredAuth == nil { unregistered = append(unregistered, "IsRegisteredAuth") } if o.IsResellerAuth == nil { unregistered = append(unregistered, "XCustomKeyAuth") } if o.IsResellerQueryAuth == nil { unregistered = append(unregistered, "CustomKeyAsQueryAuth") } if o.AddOrderHandler == nil { unregistered = append(unregistered, "AddOrderHandler") } if o.GetAccountHandler == nil { unregistered = append(unregistered, "GetAccountHandler") } if o.GetItemsHandler == nil { unregistered = append(unregistered, "GetItemsHandler") } if o.GetOrderHandler == nil { unregistered = append(unregistered, "GetOrderHandler") } if o.GetOrdersForItemHandler == nil { unregistered = append(unregistered, "GetOrdersForItemHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
[ "func", "(", "o", "*", "MultiAuthExampleAPI", ")", "Validate", "(", ")", "error", "{", "var", "unregistered", "[", "]", "string", "\n\n", "if", "o", ".", "JSONConsumer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "JSONProducer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "HasRoleAuth", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "IsRegisteredAuth", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "IsResellerAuth", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "IsResellerQueryAuth", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "AddOrderHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetAccountHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetItemsHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetOrderHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetOrdersForItemHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "unregistered", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "unregistered", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Validate validates the registrations in the MultiAuthExampleAPI
[ "Validate", "validates", "the", "registrations", "in", "the", "MultiAuthExampleAPI" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/multi_auth_example_api.go#L216-L268
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/multi_auth_example_api.go
HandlerFor
func (o *MultiAuthExampleAPI) HandlerFor(method, path string) (http.Handler, bool) { if o.handlers == nil { return nil, false } um := strings.ToUpper(method) if _, ok := o.handlers[um]; !ok { return nil, false } if path == "/" { path = "" } h, ok := o.handlers[um][path] return h, ok }
go
func (o *MultiAuthExampleAPI) HandlerFor(method, path string) (http.Handler, bool) { if o.handlers == nil { return nil, false } um := strings.ToUpper(method) if _, ok := o.handlers[um]; !ok { return nil, false } if path == "/" { path = "" } h, ok := o.handlers[um][path] return h, ok }
[ "func", "(", "o", "*", "MultiAuthExampleAPI", ")", "HandlerFor", "(", "method", ",", "path", "string", ")", "(", "http", ".", "Handler", ",", "bool", ")", "{", "if", "o", ".", "handlers", "==", "nil", "{", "return", "nil", ",", "false", "\n", "}", "\n", "um", ":=", "strings", ".", "ToUpper", "(", "method", ")", "\n", "if", "_", ",", "ok", ":=", "o", ".", "handlers", "[", "um", "]", ";", "!", "ok", "{", "return", "nil", ",", "false", "\n", "}", "\n", "if", "path", "==", "\"", "\"", "{", "path", "=", "\"", "\"", "\n", "}", "\n", "h", ",", "ok", ":=", "o", ".", "handlers", "[", "um", "]", "[", "path", "]", "\n", "return", "h", ",", "ok", "\n", "}" ]
// HandlerFor gets a http.Handler for the provided operation method and path
[ "HandlerFor", "gets", "a", "http", ".", "Handler", "for", "the", "provided", "operation", "method", "and", "path" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/multi_auth_example_api.go#L360-L373
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/multi_auth_example_api.go
Context
func (o *MultiAuthExampleAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
go
func (o *MultiAuthExampleAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
[ "func", "(", "o", "*", "MultiAuthExampleAPI", ")", "Context", "(", ")", "*", "middleware", ".", "Context", "{", "if", "o", ".", "context", "==", "nil", "{", "o", ".", "context", "=", "middleware", ".", "NewRoutableContext", "(", "o", ".", "spec", ",", "o", ",", "nil", ")", "\n", "}", "\n\n", "return", "o", ".", "context", "\n", "}" ]
// Context returns the middleware context for the multi auth example API
[ "Context", "returns", "the", "middleware", "context", "for", "the", "multi", "auth", "example", "API" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/multi_auth_example_api.go#L376-L382
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/create_users_with_list_input_responses.go
WithStatusCode
func (o *CreateUsersWithListInputDefault) WithStatusCode(code int) *CreateUsersWithListInputDefault { o._statusCode = code return o }
go
func (o *CreateUsersWithListInputDefault) WithStatusCode(code int) *CreateUsersWithListInputDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "CreateUsersWithListInputDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "CreateUsersWithListInputDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the create users with list input default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "create", "users", "with", "list", "input", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/create_users_with_list_input_responses.go#L34-L37
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one.go
NewUpdateOne
func NewUpdateOne(ctx *middleware.Context, handler UpdateOneHandler) *UpdateOne { return &UpdateOne{Context: ctx, Handler: handler} }
go
func NewUpdateOne(ctx *middleware.Context, handler UpdateOneHandler) *UpdateOne { return &UpdateOne{Context: ctx, Handler: handler} }
[ "func", "NewUpdateOne", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "UpdateOneHandler", ")", "*", "UpdateOne", "{", "return", "&", "UpdateOne", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewUpdateOne creates a new http.Handler for the update one operation
[ "NewUpdateOne", "creates", "a", "new", "http", ".", "Handler", "for", "the", "update", "one", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one.go#L28-L30
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/create_users_with_array_input_responses.go
WithStatusCode
func (o *CreateUsersWithArrayInputDefault) WithStatusCode(code int) *CreateUsersWithArrayInputDefault { o._statusCode = code return o }
go
func (o *CreateUsersWithArrayInputDefault) WithStatusCode(code int) *CreateUsersWithArrayInputDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "CreateUsersWithArrayInputDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "CreateUsersWithArrayInputDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the create users with array input default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "create", "users", "with", "array", "input", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/create_users_with_array_input_responses.go#L34-L37
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/login_user_responses.go
WithPayload
func (o *LoginUserOK) WithPayload(payload string) *LoginUserOK { o.Payload = payload return o }
go
func (o *LoginUserOK) WithPayload(payload string) *LoginUserOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "LoginUserOK", ")", "WithPayload", "(", "payload", "string", ")", "*", "LoginUserOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the login user o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "login", "user", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/login_user_responses.go#L36-L39
train
go-swagger/go-swagger
examples/generated/restapi/operations/pet/add_pet.go
NewAddPet
func NewAddPet(ctx *middleware.Context, handler AddPetHandler) *AddPet { return &AddPet{Context: ctx, Handler: handler} }
go
func NewAddPet(ctx *middleware.Context, handler AddPetHandler) *AddPet { return &AddPet{Context: ctx, Handler: handler} }
[ "func", "NewAddPet", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "AddPetHandler", ")", "*", "AddPet", "{", "return", "&", "AddPet", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewAddPet creates a new http.Handler for the add pet operation
[ "NewAddPet", "creates", "a", "new", "http", ".", "Handler", "for", "the", "add", "pet", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/add_pet.go#L28-L30
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one.go
NewAddOne
func NewAddOne(ctx *middleware.Context, handler AddOneHandler) *AddOne { return &AddOne{Context: ctx, Handler: handler} }
go
func NewAddOne(ctx *middleware.Context, handler AddOneHandler) *AddOne { return &AddOne{Context: ctx, Handler: handler} }
[ "func", "NewAddOne", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "AddOneHandler", ")", "*", "AddOne", "{", "return", "&", "AddOne", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewAddOne creates a new http.Handler for the add one operation
[ "NewAddOne", "creates", "a", "new", "http", ".", "Handler", "for", "the", "add", "one", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/delete_task_parameters.go
WithTimeout
func (o *DeleteTaskParams) WithTimeout(timeout time.Duration) *DeleteTaskParams { o.SetTimeout(timeout) return o }
go
func (o *DeleteTaskParams) WithTimeout(timeout time.Duration) *DeleteTaskParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "DeleteTaskParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "DeleteTaskParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the delete task params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "delete", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/delete_task_parameters.go#L77-L80
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/delete_task_parameters.go
WithContext
func (o *DeleteTaskParams) WithContext(ctx context.Context) *DeleteTaskParams { o.SetContext(ctx) return o }
go
func (o *DeleteTaskParams) WithContext(ctx context.Context) *DeleteTaskParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "DeleteTaskParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "DeleteTaskParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the delete task params
[ "WithContext", "adds", "the", "context", "to", "the", "delete", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/delete_task_parameters.go#L88-L91
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/delete_task_parameters.go
WithHTTPClient
func (o *DeleteTaskParams) WithHTTPClient(client *http.Client) *DeleteTaskParams { o.SetHTTPClient(client) return o }
go
func (o *DeleteTaskParams) WithHTTPClient(client *http.Client) *DeleteTaskParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "DeleteTaskParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "DeleteTaskParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the delete task params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "delete", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/delete_task_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/delete_task_parameters.go
WithID
func (o *DeleteTaskParams) WithID(id int64) *DeleteTaskParams { o.SetID(id) return o }
go
func (o *DeleteTaskParams) WithID(id int64) *DeleteTaskParams { o.SetID(id) return o }
[ "func", "(", "o", "*", "DeleteTaskParams", ")", "WithID", "(", "id", "int64", ")", "*", "DeleteTaskParams", "{", "o", ".", "SetID", "(", "id", ")", "\n", "return", "o", "\n", "}" ]
// WithID adds the id to the delete task params
[ "WithID", "adds", "the", "id", "to", "the", "delete", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/delete_task_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/list_tasks.go
NewListTasks
func NewListTasks(ctx *middleware.Context, handler ListTasksHandler) *ListTasks { return &ListTasks{Context: ctx, Handler: handler} }
go
func NewListTasks(ctx *middleware.Context, handler ListTasksHandler) *ListTasks { return &ListTasks{Context: ctx, Handler: handler} }
[ "func", "NewListTasks", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "ListTasksHandler", ")", "*", "ListTasks", "{", "return", "&", "ListTasks", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewListTasks creates a new http.Handler for the list tasks operation
[ "NewListTasks", "creates", "a", "new", "http", ".", "Handler", "for", "the", "list", "tasks", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks.go#L28-L30
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/store/order_get_responses.go
WithPayload
func (o *OrderGetOK) WithPayload(payload *models.Order) *OrderGetOK { o.Payload = payload return o }
go
func (o *OrderGetOK) WithPayload(payload *models.Order) *OrderGetOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "OrderGetOK", ")", "WithPayload", "(", "payload", "*", "models", ".", "Order", ")", "*", "OrderGetOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the order get o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "order", "get", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/store/order_get_responses.go#L38-L41
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/create_users_with_list_input.go
NewCreateUsersWithListInput
func NewCreateUsersWithListInput(ctx *middleware.Context, handler CreateUsersWithListInputHandler) *CreateUsersWithListInput { return &CreateUsersWithListInput{Context: ctx, Handler: handler} }
go
func NewCreateUsersWithListInput(ctx *middleware.Context, handler CreateUsersWithListInputHandler) *CreateUsersWithListInput { return &CreateUsersWithListInput{Context: ctx, Handler: handler} }
[ "func", "NewCreateUsersWithListInput", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "CreateUsersWithListInputHandler", ")", "*", "CreateUsersWithListInput", "{", "return", "&", "CreateUsersWithListInput", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewCreateUsersWithListInput creates a new http.Handler for the create users with list input operation
[ "NewCreateUsersWithListInput", "creates", "a", "new", "http", ".", "Handler", "for", "the", "create", "users", "with", "list", "input", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/create_users_with_list_input.go#L28-L30
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/petstore_api.go
Context
func (o *PetstoreAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
go
func (o *PetstoreAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
[ "func", "(", "o", "*", "PetstoreAPI", ")", "Context", "(", ")", "*", "middleware", ".", "Context", "{", "if", "o", ".", "context", "==", "nil", "{", "o", ".", "context", "=", "middleware", ".", "NewRoutableContext", "(", "o", ".", "spec", ",", "o", ",", "nil", ")", "\n", "}", "\n\n", "return", "o", ".", "context", "\n", "}" ]
// Context returns the middleware context for the petstore API
[ "Context", "returns", "the", "middleware", "context", "for", "the", "petstore", "API" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/petstore_api.go#L339-L345
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go
WithTimeout
func (o *OrderDeleteParams) WithTimeout(timeout time.Duration) *OrderDeleteParams { o.SetTimeout(timeout) return o }
go
func (o *OrderDeleteParams) WithTimeout(timeout time.Duration) *OrderDeleteParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "OrderDeleteParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "OrderDeleteParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the order delete params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "order", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go#L77-L80
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go
WithContext
func (o *OrderDeleteParams) WithContext(ctx context.Context) *OrderDeleteParams { o.SetContext(ctx) return o }
go
func (o *OrderDeleteParams) WithContext(ctx context.Context) *OrderDeleteParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "OrderDeleteParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "OrderDeleteParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the order delete params
[ "WithContext", "adds", "the", "context", "to", "the", "order", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go#L88-L91
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go
WithHTTPClient
func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams { o.SetHTTPClient(client) return o }
go
func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "OrderDeleteParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "OrderDeleteParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the order delete params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "order", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go
WithOrderID
func (o *OrderDeleteParams) WithOrderID(orderID int64) *OrderDeleteParams { o.SetOrderID(orderID) return o }
go
func (o *OrderDeleteParams) WithOrderID(orderID int64) *OrderDeleteParams { o.SetOrderID(orderID) return o }
[ "func", "(", "o", "*", "OrderDeleteParams", ")", "WithOrderID", "(", "orderID", "int64", ")", "*", "OrderDeleteParams", "{", "o", ".", "SetOrderID", "(", "orderID", ")", "\n", "return", "o", "\n", "}" ]
// WithOrderID adds the orderID to the order delete params
[ "WithOrderID", "adds", "the", "orderID", "to", "the", "order", "delete", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/order_delete_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/store/inventory_get_responses.go
WithPayload
func (o *InventoryGetOK) WithPayload(payload map[string]int32) *InventoryGetOK { o.Payload = payload return o }
go
func (o *InventoryGetOK) WithPayload(payload map[string]int32) *InventoryGetOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "InventoryGetOK", ")", "WithPayload", "(", "payload", "map", "[", "string", "]", "int32", ")", "*", "InventoryGetOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the inventory get o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "inventory", "get", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/store/inventory_get_responses.go#L36-L39
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/get_task_comments_parameters.go
validateSince
func (o *GetTaskCommentsParams) validateSince(formats strfmt.Registry) error { if err := validate.FormatOf("since", "query", "date-time", o.Since.String(), formats); err != nil { return err } return nil }
go
func (o *GetTaskCommentsParams) validateSince(formats strfmt.Registry) error { if err := validate.FormatOf("since", "query", "date-time", o.Since.String(), formats); err != nil { return err } return nil }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "validateSince", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "if", "err", ":=", "validate", ".", "FormatOf", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "o", ".", "Since", ".", "String", "(", ")", ",", "formats", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// validateSince carries on validations for parameter Since
[ "validateSince", "carries", "on", "validations", "for", "parameter", "Since" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_comments_parameters.go#L162-L168
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_orders_for_item.go
NewGetOrdersForItem
func NewGetOrdersForItem(ctx *middleware.Context, handler GetOrdersForItemHandler) *GetOrdersForItem { return &GetOrdersForItem{Context: ctx, Handler: handler} }
go
func NewGetOrdersForItem(ctx *middleware.Context, handler GetOrdersForItemHandler) *GetOrdersForItem { return &GetOrdersForItem{Context: ctx, Handler: handler} }
[ "func", "NewGetOrdersForItem", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "GetOrdersForItemHandler", ")", "*", "GetOrdersForItem", "{", "return", "&", "GetOrdersForItem", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewGetOrdersForItem creates a new http.Handler for the get orders for item operation
[ "NewGetOrdersForItem", "creates", "a", "new", "http", ".", "Handler", "for", "the", "get", "orders", "for", "item", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_orders_for_item.go#L30-L32
train
go-swagger/go-swagger
examples/authentication/restapi/operations/customers/create.go
NewCreate
func NewCreate(ctx *middleware.Context, handler CreateHandler) *Create { return &Create{Context: ctx, Handler: handler} }
go
func NewCreate(ctx *middleware.Context, handler CreateHandler) *Create { return &Create{Context: ctx, Handler: handler} }
[ "func", "NewCreate", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "CreateHandler", ")", "*", "Create", "{", "return", "&", "Create", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewCreate creates a new http.Handler for the create operation
[ "NewCreate", "creates", "a", "new", "http", ".", "Handler", "for", "the", "create", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/create.go#L30-L32
train
go-swagger/go-swagger
examples/generated/restapi/operations/pet/find_pets_by_tags_responses.go
WithPayload
func (o *FindPetsByTagsOK) WithPayload(payload []*models.Pet) *FindPetsByTagsOK { o.Payload = payload return o }
go
func (o *FindPetsByTagsOK) WithPayload(payload []*models.Pet) *FindPetsByTagsOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "FindPetsByTagsOK", ")", "WithPayload", "(", "payload", "[", "]", "*", "models", ".", "Pet", ")", "*", "FindPetsByTagsOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the find pets by tags o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "find", "pets", "by", "tags", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/find_pets_by_tags_responses.go#L38-L41
train
go-swagger/go-swagger
examples/oauth2/restapi/operations/get_login_responses.go
WithPayload
func (o *GetLoginOK) WithPayload(payload *GetLoginOKBody) *GetLoginOK { o.Payload = payload return o }
go
func (o *GetLoginOK) WithPayload(payload *GetLoginOKBody) *GetLoginOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetLoginOK", ")", "WithPayload", "(", "payload", "*", "GetLoginOKBody", ")", "*", "GetLoginOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get login o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "login", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/get_login_responses.go#L38-L41
train
go-swagger/go-swagger
examples/oauth2/restapi/operations/get_login_responses.go
WithStatusCode
func (o *GetLoginDefault) WithStatusCode(code int) *GetLoginDefault { o._statusCode = code return o }
go
func (o *GetLoginDefault) WithStatusCode(code int) *GetLoginDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "GetLoginDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "GetLoginDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the get login default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "get", "login", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/get_login_responses.go#L85-L88
train
go-swagger/go-swagger
examples/oauth2/restapi/operations/get_login_responses.go
WithPayload
func (o *GetLoginDefault) WithPayload(payload *models.Error) *GetLoginDefault { o.Payload = payload return o }
go
func (o *GetLoginDefault) WithPayload(payload *models.Error) *GetLoginDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetLoginDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "GetLoginDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get login default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "login", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/get_login_responses.go#L96-L99
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_create.go
NewPetCreate
func NewPetCreate(ctx *middleware.Context, handler PetCreateHandler) *PetCreate { return &PetCreate{Context: ctx, Handler: handler} }
go
func NewPetCreate(ctx *middleware.Context, handler PetCreateHandler) *PetCreate { return &PetCreate{Context: ctx, Handler: handler} }
[ "func", "NewPetCreate", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "PetCreateHandler", ")", "*", "PetCreate", "{", "return", "&", "PetCreate", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewPetCreate creates a new http.Handler for the pet create operation
[ "NewPetCreate", "creates", "a", "new", "http", ".", "Handler", "for", "the", "pet", "create", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_create.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/upload_task_file_parameters.go
bindDescription
func (o *UploadTaskFileParams) bindDescription(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: false if raw == "" { // empty values pass all other validations return nil } o.Description = &raw return nil }
go
func (o *UploadTaskFileParams) bindDescription(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: false if raw == "" { // empty values pass all other validations return nil } o.Description = &raw return nil }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "bindDescription", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: false", "if", "raw", "==", "\"", "\"", "{", "// empty values pass all other validations", "return", "nil", "\n", "}", "\n\n", "o", ".", "Description", "=", "&", "raw", "\n\n", "return", "nil", "\n", "}" ]
// bindDescription binds and validates parameter Description from formData.
[ "bindDescription", "binds", "and", "validates", "parameter", "Description", "from", "formData", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/upload_task_file_parameters.go#L98-L113
train
go-swagger/go-swagger
examples/generated/restapi/operations/pet/find_pets_by_status_responses.go
WithPayload
func (o *FindPetsByStatusOK) WithPayload(payload []*models.Pet) *FindPetsByStatusOK { o.Payload = payload return o }
go
func (o *FindPetsByStatusOK) WithPayload(payload []*models.Pet) *FindPetsByStatusOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "FindPetsByStatusOK", ")", "WithPayload", "(", "payload", "[", "]", "*", "models", ".", "Pet", ")", "*", "FindPetsByStatusOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the find pets by status o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "find", "pets", "by", "status", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/find_pets_by_status_responses.go#L38-L41
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/update_task_responses.go
WithPayload
func (o *UpdateTaskOK) WithPayload(payload *models.Task) *UpdateTaskOK { o.Payload = payload return o }
go
func (o *UpdateTaskOK) WithPayload(payload *models.Task) *UpdateTaskOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "UpdateTaskOK", ")", "WithPayload", "(", "payload", "*", "models", ".", "Task", ")", "*", "UpdateTaskOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the update task o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "update", "task", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task_responses.go#L38-L41
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/update_task_responses.go
WithPayload
func (o *UpdateTaskUnprocessableEntity) WithPayload(payload *models.ValidationError) *UpdateTaskUnprocessableEntity { o.Payload = payload return o }
go
func (o *UpdateTaskUnprocessableEntity) WithPayload(payload *models.ValidationError) *UpdateTaskUnprocessableEntity { o.Payload = payload return o }
[ "func", "(", "o", "*", "UpdateTaskUnprocessableEntity", ")", "WithPayload", "(", "payload", "*", "models", ".", "ValidationError", ")", "*", "UpdateTaskUnprocessableEntity", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the update task unprocessable entity response
[ "WithPayload", "adds", "the", "payload", "to", "the", "update", "task", "unprocessable", "entity", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task_responses.go#L82-L85
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/update_task_responses.go
WithStatusCode
func (o *UpdateTaskDefault) WithStatusCode(code int) *UpdateTaskDefault { o._statusCode = code return o }
go
func (o *UpdateTaskDefault) WithStatusCode(code int) *UpdateTaskDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "UpdateTaskDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "UpdateTaskDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the update task default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "update", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task_responses.go#L133-L136
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/update_task_responses.go
WithXErrorCode
func (o *UpdateTaskDefault) WithXErrorCode(xErrorCode string) *UpdateTaskDefault { o.XErrorCode = xErrorCode return o }
go
func (o *UpdateTaskDefault) WithXErrorCode(xErrorCode string) *UpdateTaskDefault { o.XErrorCode = xErrorCode return o }
[ "func", "(", "o", "*", "UpdateTaskDefault", ")", "WithXErrorCode", "(", "xErrorCode", "string", ")", "*", "UpdateTaskDefault", "{", "o", ".", "XErrorCode", "=", "xErrorCode", "\n", "return", "o", "\n", "}" ]
// WithXErrorCode adds the xErrorCode to the update task default response
[ "WithXErrorCode", "adds", "the", "xErrorCode", "to", "the", "update", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task_responses.go#L144-L147
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/update_task_responses.go
WithPayload
func (o *UpdateTaskDefault) WithPayload(payload *models.Error) *UpdateTaskDefault { o.Payload = payload return o }
go
func (o *UpdateTaskDefault) WithPayload(payload *models.Error) *UpdateTaskDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "UpdateTaskDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "UpdateTaskDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the update task default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "update", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task_responses.go#L155-L158
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go
WithTimeout
func (o *PetGetParams) WithTimeout(timeout time.Duration) *PetGetParams { o.SetTimeout(timeout) return o }
go
func (o *PetGetParams) WithTimeout(timeout time.Duration) *PetGetParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "PetGetParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "PetGetParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the pet get params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "pet", "get", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go#L77-L80
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go
WithContext
func (o *PetGetParams) WithContext(ctx context.Context) *PetGetParams { o.SetContext(ctx) return o }
go
func (o *PetGetParams) WithContext(ctx context.Context) *PetGetParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "PetGetParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "PetGetParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the pet get params
[ "WithContext", "adds", "the", "context", "to", "the", "pet", "get", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go#L88-L91
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go
WithHTTPClient
func (o *PetGetParams) WithHTTPClient(client *http.Client) *PetGetParams { o.SetHTTPClient(client) return o }
go
func (o *PetGetParams) WithHTTPClient(client *http.Client) *PetGetParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "PetGetParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "PetGetParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the pet get params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "pet", "get", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go
WithPetID
func (o *PetGetParams) WithPetID(petID int64) *PetGetParams { o.SetPetID(petID) return o }
go
func (o *PetGetParams) WithPetID(petID int64) *PetGetParams { o.SetPetID(petID) return o }
[ "func", "(", "o", "*", "PetGetParams", ")", "WithPetID", "(", "petID", "int64", ")", "*", "PetGetParams", "{", "o", ".", "SetPetID", "(", "petID", ")", "\n", "return", "o", "\n", "}" ]
// WithPetID adds the petID to the pet get params
[ "WithPetID", "adds", "the", "petID", "to", "the", "pet", "get", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_get_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/todo-list/restapi/server.go
NewServer
func NewServer(api *operations.TodoListAPI) *Server { s := new(Server) s.EnabledListeners = enabledListeners s.CleanupTimeout = cleanupTimeout s.GracefulTimeout = gracefulTimeout s.MaxHeaderSize = maxHeaderSize s.SocketPath = socketPath s.Host = stringEnvOverride(host, "", "HOST") s.Port = intEnvOverride(port, 0, "PORT") s.ListenLimit = listenLimit s.KeepAlive = keepAlive s.ReadTimeout = readTimeout s.WriteTimeout = writeTimeout s.TLSHost = stringEnvOverride(tlsHost, s.Host, "TLS_HOST", "HOST") s.TLSPort = intEnvOverride(tlsPort, 0, "TLS_PORT") s.TLSCertificate = stringEnvOverride(tlsCertificate, "", "TLS_CERTIFICATE") s.TLSCertificateKey = stringEnvOverride(tlsCertificateKey, "", "TLS_PRIVATE_KEY") s.TLSCACertificate = stringEnvOverride(tlsCACertificate, "", "TLS_CA_CERTIFICATE") s.TLSListenLimit = tlsListenLimit s.TLSKeepAlive = tlsKeepAlive s.TLSReadTimeout = tlsReadTimeout s.TLSWriteTimeout = tlsWriteTimeout s.shutdown = make(chan struct{}) s.api = api s.interrupt = make(chan os.Signal, 1) return s }
go
func NewServer(api *operations.TodoListAPI) *Server { s := new(Server) s.EnabledListeners = enabledListeners s.CleanupTimeout = cleanupTimeout s.GracefulTimeout = gracefulTimeout s.MaxHeaderSize = maxHeaderSize s.SocketPath = socketPath s.Host = stringEnvOverride(host, "", "HOST") s.Port = intEnvOverride(port, 0, "PORT") s.ListenLimit = listenLimit s.KeepAlive = keepAlive s.ReadTimeout = readTimeout s.WriteTimeout = writeTimeout s.TLSHost = stringEnvOverride(tlsHost, s.Host, "TLS_HOST", "HOST") s.TLSPort = intEnvOverride(tlsPort, 0, "TLS_PORT") s.TLSCertificate = stringEnvOverride(tlsCertificate, "", "TLS_CERTIFICATE") s.TLSCertificateKey = stringEnvOverride(tlsCertificateKey, "", "TLS_PRIVATE_KEY") s.TLSCACertificate = stringEnvOverride(tlsCACertificate, "", "TLS_CA_CERTIFICATE") s.TLSListenLimit = tlsListenLimit s.TLSKeepAlive = tlsKeepAlive s.TLSReadTimeout = tlsReadTimeout s.TLSWriteTimeout = tlsWriteTimeout s.shutdown = make(chan struct{}) s.api = api s.interrupt = make(chan os.Signal, 1) return s }
[ "func", "NewServer", "(", "api", "*", "operations", ".", "TodoListAPI", ")", "*", "Server", "{", "s", ":=", "new", "(", "Server", ")", "\n\n", "s", ".", "EnabledListeners", "=", "enabledListeners", "\n", "s", ".", "CleanupTimeout", "=", "cleanupTimeout", "\n", "s", ".", "GracefulTimeout", "=", "gracefulTimeout", "\n", "s", ".", "MaxHeaderSize", "=", "maxHeaderSize", "\n", "s", ".", "SocketPath", "=", "socketPath", "\n", "s", ".", "Host", "=", "stringEnvOverride", "(", "host", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "Port", "=", "intEnvOverride", "(", "port", ",", "0", ",", "\"", "\"", ")", "\n", "s", ".", "ListenLimit", "=", "listenLimit", "\n", "s", ".", "KeepAlive", "=", "keepAlive", "\n", "s", ".", "ReadTimeout", "=", "readTimeout", "\n", "s", ".", "WriteTimeout", "=", "writeTimeout", "\n", "s", ".", "TLSHost", "=", "stringEnvOverride", "(", "tlsHost", ",", "s", ".", "Host", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "TLSPort", "=", "intEnvOverride", "(", "tlsPort", ",", "0", ",", "\"", "\"", ")", "\n", "s", ".", "TLSCertificate", "=", "stringEnvOverride", "(", "tlsCertificate", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "TLSCertificateKey", "=", "stringEnvOverride", "(", "tlsCertificateKey", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "TLSCACertificate", "=", "stringEnvOverride", "(", "tlsCACertificate", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "TLSListenLimit", "=", "tlsListenLimit", "\n", "s", ".", "TLSKeepAlive", "=", "tlsKeepAlive", "\n", "s", ".", "TLSReadTimeout", "=", "tlsReadTimeout", "\n", "s", ".", "TLSWriteTimeout", "=", "tlsWriteTimeout", "\n", "s", ".", "shutdown", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "s", ".", "api", "=", "api", "\n", "s", ".", "interrupt", "=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "return", "s", "\n", "}" ]
// NewServer creates a new api todo list server but does not configure it
[ "NewServer", "creates", "a", "new", "api", "todo", "list", "server", "but", "does", "not", "configure", "it" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/restapi/server.go#L131-L158
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithTimeout
func (o *PetUploadImageParams) WithTimeout(timeout time.Duration) *PetUploadImageParams { o.SetTimeout(timeout) return o }
go
func (o *PetUploadImageParams) WithTimeout(timeout time.Duration) *PetUploadImageParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the pet upload image params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L87-L90
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithContext
func (o *PetUploadImageParams) WithContext(ctx context.Context) *PetUploadImageParams { o.SetContext(ctx) return o }
go
func (o *PetUploadImageParams) WithContext(ctx context.Context) *PetUploadImageParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the pet upload image params
[ "WithContext", "adds", "the", "context", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L98-L101
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithHTTPClient
func (o *PetUploadImageParams) WithHTTPClient(client *http.Client) *PetUploadImageParams { o.SetHTTPClient(client) return o }
go
func (o *PetUploadImageParams) WithHTTPClient(client *http.Client) *PetUploadImageParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the pet upload image params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L109-L112
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithAdditionalMetadata
func (o *PetUploadImageParams) WithAdditionalMetadata(additionalMetadata *string) *PetUploadImageParams { o.SetAdditionalMetadata(additionalMetadata) return o }
go
func (o *PetUploadImageParams) WithAdditionalMetadata(additionalMetadata *string) *PetUploadImageParams { o.SetAdditionalMetadata(additionalMetadata) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithAdditionalMetadata", "(", "additionalMetadata", "*", "string", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetAdditionalMetadata", "(", "additionalMetadata", ")", "\n", "return", "o", "\n", "}" ]
// WithAdditionalMetadata adds the additionalMetadata to the pet upload image params
[ "WithAdditionalMetadata", "adds", "the", "additionalMetadata", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L120-L123
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithFile
func (o *PetUploadImageParams) WithFile(file runtime.NamedReadCloser) *PetUploadImageParams { o.SetFile(file) return o }
go
func (o *PetUploadImageParams) WithFile(file runtime.NamedReadCloser) *PetUploadImageParams { o.SetFile(file) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithFile", "(", "file", "runtime", ".", "NamedReadCloser", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetFile", "(", "file", ")", "\n", "return", "o", "\n", "}" ]
// WithFile adds the file to the pet upload image params
[ "WithFile", "adds", "the", "file", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L131-L134
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go
WithPetID
func (o *PetUploadImageParams) WithPetID(petID int64) *PetUploadImageParams { o.SetPetID(petID) return o }
go
func (o *PetUploadImageParams) WithPetID(petID int64) *PetUploadImageParams { o.SetPetID(petID) return o }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "WithPetID", "(", "petID", "int64", ")", "*", "PetUploadImageParams", "{", "o", ".", "SetPetID", "(", "petID", ")", "\n", "return", "o", "\n", "}" ]
// WithPetID adds the petID to the pet upload image params
[ "WithPetID", "adds", "the", "petID", "to", "the", "pet", "upload", "image", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_parameters.go#L142-L145
train
go-swagger/go-swagger
examples/generated/restapi/operations/store/get_order_by_id.go
NewGetOrderByID
func NewGetOrderByID(ctx *middleware.Context, handler GetOrderByIDHandler) *GetOrderByID { return &GetOrderByID{Context: ctx, Handler: handler} }
go
func NewGetOrderByID(ctx *middleware.Context, handler GetOrderByIDHandler) *GetOrderByID { return &GetOrderByID{Context: ctx, Handler: handler} }
[ "func", "NewGetOrderByID", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "GetOrderByIDHandler", ")", "*", "GetOrderByID", "{", "return", "&", "GetOrderByID", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewGetOrderByID creates a new http.Handler for the get order by Id operation
[ "NewGetOrderByID", "creates", "a", "new", "http", ".", "Handler", "for", "the", "get", "order", "by", "Id", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/store/get_order_by_id.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/create_task_parameters.go
WithTimeout
func (o *CreateTaskParams) WithTimeout(timeout time.Duration) *CreateTaskParams { o.SetTimeout(timeout) return o }
go
func (o *CreateTaskParams) WithTimeout(timeout time.Duration) *CreateTaskParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "CreateTaskParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "CreateTaskParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the create task params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "create", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/create_task_parameters.go#L78-L81
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/create_task_parameters.go
WithContext
func (o *CreateTaskParams) WithContext(ctx context.Context) *CreateTaskParams { o.SetContext(ctx) return o }
go
func (o *CreateTaskParams) WithContext(ctx context.Context) *CreateTaskParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "CreateTaskParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "CreateTaskParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the create task params
[ "WithContext", "adds", "the", "context", "to", "the", "create", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/create_task_parameters.go#L89-L92
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/create_task_parameters.go
WithHTTPClient
func (o *CreateTaskParams) WithHTTPClient(client *http.Client) *CreateTaskParams { o.SetHTTPClient(client) return o }
go
func (o *CreateTaskParams) WithHTTPClient(client *http.Client) *CreateTaskParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "CreateTaskParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "CreateTaskParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the create task params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "create", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/create_task_parameters.go#L100-L103
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/create_task_parameters.go
WithBody
func (o *CreateTaskParams) WithBody(body *models.Task) *CreateTaskParams { o.SetBody(body) return o }
go
func (o *CreateTaskParams) WithBody(body *models.Task) *CreateTaskParams { o.SetBody(body) return o }
[ "func", "(", "o", "*", "CreateTaskParams", ")", "WithBody", "(", "body", "*", "models", ".", "Task", ")", "*", "CreateTaskParams", "{", "o", ".", "SetBody", "(", "body", ")", "\n", "return", "o", "\n", "}" ]
// WithBody adds the body to the create task params
[ "WithBody", "adds", "the", "body", "to", "the", "create", "task", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/create_task_parameters.go#L111-L114
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_account.go
NewGetAccount
func NewGetAccount(ctx *middleware.Context, handler GetAccountHandler) *GetAccount { return &GetAccount{Context: ctx, Handler: handler} }
go
func NewGetAccount(ctx *middleware.Context, handler GetAccountHandler) *GetAccount { return &GetAccount{Context: ctx, Handler: handler} }
[ "func", "NewGetAccount", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "GetAccountHandler", ")", "*", "GetAccount", "{", "return", "&", "GetAccount", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewGetAccount creates a new http.Handler for the get account operation
[ "NewGetAccount", "creates", "a", "new", "http", ".", "Handler", "for", "the", "get", "account", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_account.go#L30-L32
train
go-swagger/go-swagger
examples/authentication/models/social_id.go
Validate
func (m *SocialID) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSsn(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
go
func (m *SocialID) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSsn(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func", "(", "m", "*", "SocialID", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateSsn", "(", "formats", ")", ";", "err", "!=", "nil", "{", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Validate validates this social id
[ "Validate", "validates", "this", "social", "id" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/models/social_id.go#L27-L38
train
go-swagger/go-swagger
cmd/swagger/commands/serve.go
Execute
func (s *ServeCmd) Execute(args []string) error { if len(args) == 0 { return errors.New("specify the spec to serve as argument to the serve command") } specDoc, err := loads.Spec(args[0]) if err != nil { return err } b, err := json.MarshalIndent(specDoc.Spec(), "", " ") if err != nil { return err } basePath := s.BasePath if basePath == "" { basePath = "/" } listener, err := net.Listen("tcp4", net.JoinHostPort(s.Host, strconv.Itoa(s.Port))) if err != nil { return err } sh, sp, err := swag.SplitHostPort(listener.Addr().String()) if err != nil { return err } if sh == "0.0.0.0" { sh = "localhost" } visit := s.DocURL handler := http.NotFoundHandler() if !s.NoUI { if s.Flavor == "redoc" { handler = middleware.Redoc(middleware.RedocOpts{ BasePath: basePath, SpecURL: path.Join(basePath, "swagger.json"), Path: "docs", }, handler) visit = fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "docs")) } else if visit != "" || s.Flavor == "swagger" { if visit == "" { visit = "http://petstore.swagger.io/" } u, err := url.Parse(visit) if err != nil { return err } q := u.Query() q.Add("url", fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "swagger.json"))) u.RawQuery = q.Encode() visit = u.String() } } handler = handlers.CORS()(middleware.Spec(basePath, b, handler)) errFuture := make(chan error) go func() { docServer := new(http.Server) docServer.SetKeepAlivesEnabled(true) docServer.Handler = handler errFuture <- docServer.Serve(listener) }() if !s.NoOpen && !s.NoUI { err := webbrowser.Open(visit) if err != nil { return err } } log.Println("serving docs at", visit) return <-errFuture }
go
func (s *ServeCmd) Execute(args []string) error { if len(args) == 0 { return errors.New("specify the spec to serve as argument to the serve command") } specDoc, err := loads.Spec(args[0]) if err != nil { return err } b, err := json.MarshalIndent(specDoc.Spec(), "", " ") if err != nil { return err } basePath := s.BasePath if basePath == "" { basePath = "/" } listener, err := net.Listen("tcp4", net.JoinHostPort(s.Host, strconv.Itoa(s.Port))) if err != nil { return err } sh, sp, err := swag.SplitHostPort(listener.Addr().String()) if err != nil { return err } if sh == "0.0.0.0" { sh = "localhost" } visit := s.DocURL handler := http.NotFoundHandler() if !s.NoUI { if s.Flavor == "redoc" { handler = middleware.Redoc(middleware.RedocOpts{ BasePath: basePath, SpecURL: path.Join(basePath, "swagger.json"), Path: "docs", }, handler) visit = fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "docs")) } else if visit != "" || s.Flavor == "swagger" { if visit == "" { visit = "http://petstore.swagger.io/" } u, err := url.Parse(visit) if err != nil { return err } q := u.Query() q.Add("url", fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "swagger.json"))) u.RawQuery = q.Encode() visit = u.String() } } handler = handlers.CORS()(middleware.Spec(basePath, b, handler)) errFuture := make(chan error) go func() { docServer := new(http.Server) docServer.SetKeepAlivesEnabled(true) docServer.Handler = handler errFuture <- docServer.Serve(listener) }() if !s.NoOpen && !s.NoUI { err := webbrowser.Open(visit) if err != nil { return err } } log.Println("serving docs at", visit) return <-errFuture }
[ "func", "(", "s", "*", "ServeCmd", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "if", "len", "(", "args", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "specDoc", ",", "err", ":=", "loads", ".", "Spec", "(", "args", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "specDoc", ".", "Spec", "(", ")", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "basePath", ":=", "s", ".", "BasePath", "\n", "if", "basePath", "==", "\"", "\"", "{", "basePath", "=", "\"", "\"", "\n", "}", "\n\n", "listener", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "net", ".", "JoinHostPort", "(", "s", ".", "Host", ",", "strconv", ".", "Itoa", "(", "s", ".", "Port", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "sh", ",", "sp", ",", "err", ":=", "swag", ".", "SplitHostPort", "(", "listener", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "sh", "==", "\"", "\"", "{", "sh", "=", "\"", "\"", "\n", "}", "\n\n", "visit", ":=", "s", ".", "DocURL", "\n", "handler", ":=", "http", ".", "NotFoundHandler", "(", ")", "\n", "if", "!", "s", ".", "NoUI", "{", "if", "s", ".", "Flavor", "==", "\"", "\"", "{", "handler", "=", "middleware", ".", "Redoc", "(", "middleware", ".", "RedocOpts", "{", "BasePath", ":", "basePath", ",", "SpecURL", ":", "path", ".", "Join", "(", "basePath", ",", "\"", "\"", ")", ",", "Path", ":", "\"", "\"", ",", "}", ",", "handler", ")", "\n", "visit", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sh", ",", "sp", ",", "path", ".", "Join", "(", "basePath", ",", "\"", "\"", ")", ")", "\n", "}", "else", "if", "visit", "!=", "\"", "\"", "||", "s", ".", "Flavor", "==", "\"", "\"", "{", "if", "visit", "==", "\"", "\"", "{", "visit", "=", "\"", "\"", "\n", "}", "\n", "u", ",", "err", ":=", "url", ".", "Parse", "(", "visit", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "q", ":=", "u", ".", "Query", "(", ")", "\n", "q", ".", "Add", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sh", ",", "sp", ",", "path", ".", "Join", "(", "basePath", ",", "\"", "\"", ")", ")", ")", "\n", "u", ".", "RawQuery", "=", "q", ".", "Encode", "(", ")", "\n", "visit", "=", "u", ".", "String", "(", ")", "\n", "}", "\n", "}", "\n\n", "handler", "=", "handlers", ".", "CORS", "(", ")", "(", "middleware", ".", "Spec", "(", "basePath", ",", "b", ",", "handler", ")", ")", "\n", "errFuture", ":=", "make", "(", "chan", "error", ")", "\n", "go", "func", "(", ")", "{", "docServer", ":=", "new", "(", "http", ".", "Server", ")", "\n", "docServer", ".", "SetKeepAlivesEnabled", "(", "true", ")", "\n", "docServer", ".", "Handler", "=", "handler", "\n\n", "errFuture", "<-", "docServer", ".", "Serve", "(", "listener", ")", "\n", "}", "(", ")", "\n\n", "if", "!", "s", ".", "NoOpen", "&&", "!", "s", ".", "NoUI", "{", "err", ":=", "webbrowser", ".", "Open", "(", "visit", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "log", ".", "Println", "(", "\"", "\"", ",", "visit", ")", "\n", "return", "<-", "errFuture", "\n", "}" ]
// Execute the serve command
[ "Execute", "the", "serve", "command" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/cmd/swagger/commands/serve.go#L33-L107
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image.go
NewPetUploadImage
func NewPetUploadImage(ctx *middleware.Context, handler PetUploadImageHandler) *PetUploadImage { return &PetUploadImage{Context: ctx, Handler: handler} }
go
func NewPetUploadImage(ctx *middleware.Context, handler PetUploadImageHandler) *PetUploadImage { return &PetUploadImage{Context: ctx, Handler: handler} }
[ "func", "NewPetUploadImage", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "PetUploadImageHandler", ")", "*", "PetUploadImage", "{", "return", "&", "PetUploadImage", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewPetUploadImage creates a new http.Handler for the pet upload image operation
[ "NewPetUploadImage", "creates", "a", "new", "http", ".", "Handler", "for", "the", "pet", "upload", "image", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image.go#L28-L30
train
go-swagger/go-swagger
cmd/swagger/commands/validate.go
Execute
func (c *ValidateSpec) Execute(args []string) error { if len(args) == 0 { return errors.New(missingArgMsg) } swaggerDoc := args[0] specDoc, err := loads.Spec(swaggerDoc) if err != nil { return err } // Attempts to report about all errors validate.SetContinueOnErrors(!c.StopOnError) v := validate.NewSpecValidator(specDoc.Schema(), strfmt.Default) result, _ := v.Validate(specDoc) // returns fully detailed result with errors and warnings if result.IsValid() { log.Printf(validSpecMsg, swaggerDoc, specDoc.Version()) } if result.HasWarnings() { log.Printf(warningSpecMsg, swaggerDoc) if !c.SkipWarnings { log.Printf("See warnings below:\n") for _, desc := range result.Warnings { log.Printf("- WARNING: %s\n", desc.Error()) } } } if result.HasErrors() { str := fmt.Sprintf(invalidSpecMsg, swaggerDoc, specDoc.Version()) for _, desc := range result.Errors { str += fmt.Sprintf("- %s\n", desc.Error()) } return errors.New(str) } return nil }
go
func (c *ValidateSpec) Execute(args []string) error { if len(args) == 0 { return errors.New(missingArgMsg) } swaggerDoc := args[0] specDoc, err := loads.Spec(swaggerDoc) if err != nil { return err } // Attempts to report about all errors validate.SetContinueOnErrors(!c.StopOnError) v := validate.NewSpecValidator(specDoc.Schema(), strfmt.Default) result, _ := v.Validate(specDoc) // returns fully detailed result with errors and warnings if result.IsValid() { log.Printf(validSpecMsg, swaggerDoc, specDoc.Version()) } if result.HasWarnings() { log.Printf(warningSpecMsg, swaggerDoc) if !c.SkipWarnings { log.Printf("See warnings below:\n") for _, desc := range result.Warnings { log.Printf("- WARNING: %s\n", desc.Error()) } } } if result.HasErrors() { str := fmt.Sprintf(invalidSpecMsg, swaggerDoc, specDoc.Version()) for _, desc := range result.Errors { str += fmt.Sprintf("- %s\n", desc.Error()) } return errors.New(str) } return nil }
[ "func", "(", "c", "*", "ValidateSpec", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "if", "len", "(", "args", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "missingArgMsg", ")", "\n", "}", "\n\n", "swaggerDoc", ":=", "args", "[", "0", "]", "\n\n", "specDoc", ",", "err", ":=", "loads", ".", "Spec", "(", "swaggerDoc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Attempts to report about all errors", "validate", ".", "SetContinueOnErrors", "(", "!", "c", ".", "StopOnError", ")", "\n\n", "v", ":=", "validate", ".", "NewSpecValidator", "(", "specDoc", ".", "Schema", "(", ")", ",", "strfmt", ".", "Default", ")", "\n", "result", ",", "_", ":=", "v", ".", "Validate", "(", "specDoc", ")", "// returns fully detailed result with errors and warnings", "\n\n", "if", "result", ".", "IsValid", "(", ")", "{", "log", ".", "Printf", "(", "validSpecMsg", ",", "swaggerDoc", ",", "specDoc", ".", "Version", "(", ")", ")", "\n", "}", "\n", "if", "result", ".", "HasWarnings", "(", ")", "{", "log", ".", "Printf", "(", "warningSpecMsg", ",", "swaggerDoc", ")", "\n", "if", "!", "c", ".", "SkipWarnings", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ")", "\n", "for", "_", ",", "desc", ":=", "range", "result", ".", "Warnings", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "desc", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "result", ".", "HasErrors", "(", ")", "{", "str", ":=", "fmt", ".", "Sprintf", "(", "invalidSpecMsg", ",", "swaggerDoc", ",", "specDoc", ".", "Version", "(", ")", ")", "\n", "for", "_", ",", "desc", ":=", "range", "result", ".", "Errors", "{", "str", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "desc", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "errors", ".", "New", "(", "str", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Execute validates the spec
[ "Execute", "validates", "the", "spec" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/cmd/swagger/commands/validate.go#L44-L83
train
go-swagger/go-swagger
examples/todo-list/restapi/operations/todos/find_parameters.go
bindXRateLimit
func (o *FindParams) bindXRateLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("X-Rate-Limit", "header") } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true if err := validate.RequiredString("X-Rate-Limit", "header", raw); err != nil { return err } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("X-Rate-Limit", "header", "int32", raw) } o.XRateLimit = value return nil }
go
func (o *FindParams) bindXRateLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("X-Rate-Limit", "header") } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true if err := validate.RequiredString("X-Rate-Limit", "header", raw); err != nil { return err } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("X-Rate-Limit", "header", "int32", raw) } o.XRateLimit = value return nil }
[ "func", "(", "o", "*", "FindParams", ")", "bindXRateLimit", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "if", "!", "hasKey", "{", "return", "errors", ".", "Required", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: true", "if", "err", ":=", "validate", ".", "RequiredString", "(", "\"", "\"", ",", "\"", "\"", ",", "raw", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "value", ",", "err", ":=", "swag", ".", "ConvertInt32", "(", "raw", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "InvalidType", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "raw", ")", "\n", "}", "\n", "o", ".", "XRateLimit", "=", "value", "\n\n", "return", "nil", "\n", "}" ]
// bindXRateLimit binds and validates parameter XRateLimit from header.
[ "bindXRateLimit", "binds", "and", "validates", "parameter", "XRateLimit", "from", "header", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/restapi/operations/todos/find_parameters.go#L94-L116
train
go-swagger/go-swagger
examples/todo-list/restapi/operations/todos/find_parameters.go
bindLimit
func (o *FindParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("limit", "formData") } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true if raw == "" { // empty values pass all other validations return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("limit", "formData", "int32", raw) } o.Limit = value return nil }
go
func (o *FindParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("limit", "formData") } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true if raw == "" { // empty values pass all other validations return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("limit", "formData", "int32", raw) } o.Limit = value return nil }
[ "func", "(", "o", "*", "FindParams", ")", "bindLimit", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "if", "!", "hasKey", "{", "return", "errors", ".", "Required", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: true", "if", "raw", "==", "\"", "\"", "{", "// empty values pass all other validations", "return", "nil", "\n", "}", "\n\n", "value", ",", "err", ":=", "swag", ".", "ConvertInt32", "(", "raw", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "InvalidType", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "raw", ")", "\n", "}", "\n", "o", ".", "Limit", "=", "value", "\n\n", "return", "nil", "\n", "}" ]
// bindLimit binds and validates parameter Limit from formData.
[ "bindLimit", "binds", "and", "validates", "parameter", "Limit", "from", "formData", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/restapi/operations/todos/find_parameters.go#L119-L141
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go
WithPayload
func (o *AddOneCreated) WithPayload(payload *models.Item) *AddOneCreated { o.Payload = payload return o }
go
func (o *AddOneCreated) WithPayload(payload *models.Item) *AddOneCreated { o.Payload = payload return o }
[ "func", "(", "o", "*", "AddOneCreated", ")", "WithPayload", "(", "payload", "*", "models", ".", "Item", ")", "*", "AddOneCreated", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the add one created response
[ "WithPayload", "adds", "the", "payload", "to", "the", "add", "one", "created", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go#L38-L41
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go
WithStatusCode
func (o *AddOneDefault) WithStatusCode(code int) *AddOneDefault { o._statusCode = code return o }
go
func (o *AddOneDefault) WithStatusCode(code int) *AddOneDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "AddOneDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "AddOneDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the add one default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "add", "one", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go#L85-L88
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go
WithPayload
func (o *AddOneDefault) WithPayload(payload *models.Error) *AddOneDefault { o.Payload = payload return o }
go
func (o *AddOneDefault) WithPayload(payload *models.Error) *AddOneDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "AddOneDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "AddOneDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the add one default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "add", "one", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/add_one_responses.go#L96-L99
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_get_responses.go
WithPayload
func (o *PetGetOK) WithPayload(payload *models.Pet) *PetGetOK { o.Payload = payload return o }
go
func (o *PetGetOK) WithPayload(payload *models.Pet) *PetGetOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "PetGetOK", ")", "WithPayload", "(", "payload", "*", "models", ".", "Pet", ")", "*", "PetGetOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the pet get o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "pet", "get", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_get_responses.go#L38-L41
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/update_user_parameters.go
bindUsername
func (o *UpdateUserParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route o.Username = raw return nil }
go
func (o *UpdateUserParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route o.Username = raw return nil }
[ "func", "(", "o", "*", "UpdateUserParams", ")", "bindUsername", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: true", "// Parameter is provided by construction from the route", "o", ".", "Username", "=", "raw", "\n\n", "return", "nil", "\n", "}" ]
// bindUsername binds and validates parameter Username from path.
[ "bindUsername", "binds", "and", "validates", "parameter", "Username", "from", "path", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/update_user_parameters.go#L84-L96
train
go-swagger/go-swagger
examples/tutorials/todo-list/server-complete/models/item.go
Validate
func (m *Item) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDescription(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
go
func (m *Item) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDescription(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func", "(", "m", "*", "Item", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateDescription", "(", "formats", ")", ";", "err", "!=", "nil", "{", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Validate validates this item
[ "Validate", "validates", "this", "item" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/models/item.go#L34-L45
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_parameters.go
bindAdditionalMetadata
func (o *PetUploadImageParams) bindAdditionalMetadata(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: false if raw == "" { // empty values pass all other validations return nil } o.AdditionalMetadata = &raw return nil }
go
func (o *PetUploadImageParams) bindAdditionalMetadata(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: false if raw == "" { // empty values pass all other validations return nil } o.AdditionalMetadata = &raw return nil }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "bindAdditionalMetadata", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: false", "if", "raw", "==", "\"", "\"", "{", "// empty values pass all other validations", "return", "nil", "\n", "}", "\n\n", "o", ".", "AdditionalMetadata", "=", "&", "raw", "\n\n", "return", "nil", "\n", "}" ]
// bindAdditionalMetadata binds and validates parameter AdditionalMetadata from formData.
[ "bindAdditionalMetadata", "binds", "and", "validates", "parameter", "AdditionalMetadata", "from", "formData", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_parameters.go#L98-L113
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_parameters.go
bindFile
func (o *PetUploadImageParams) bindFile(file multipart.File, header *multipart.FileHeader) error { return nil }
go
func (o *PetUploadImageParams) bindFile(file multipart.File, header *multipart.FileHeader) error { return nil }
[ "func", "(", "o", "*", "PetUploadImageParams", ")", "bindFile", "(", "file", "multipart", ".", "File", ",", "header", "*", "multipart", ".", "FileHeader", ")", "error", "{", "return", "nil", "\n", "}" ]
// bindFile binds file parameter File. // // The only supported validations on files are MinLength and MaxLength
[ "bindFile", "binds", "file", "parameter", "File", ".", "The", "only", "supported", "validations", "on", "files", "are", "MinLength", "and", "MaxLength" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_parameters.go#L118-L120
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_orders_for_item_responses.go
WithPayload
func (o *GetOrdersForItemOK) WithPayload(payload []*models.Order) *GetOrdersForItemOK { o.Payload = payload return o }
go
func (o *GetOrdersForItemOK) WithPayload(payload []*models.Order) *GetOrdersForItemOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetOrdersForItemOK", ")", "WithPayload", "(", "payload", "[", "]", "*", "models", ".", "Order", ")", "*", "GetOrdersForItemOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get orders for item o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "orders", "for", "item", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_orders_for_item_responses.go#L38-L41
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_orders_for_item_responses.go
WithStatusCode
func (o *GetOrdersForItemDefault) WithStatusCode(code int) *GetOrdersForItemDefault { o._statusCode = code return o }
go
func (o *GetOrdersForItemDefault) WithStatusCode(code int) *GetOrdersForItemDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "GetOrdersForItemDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "GetOrdersForItemDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the get orders for item default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "get", "orders", "for", "item", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_orders_for_item_responses.go#L136-L139
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_orders_for_item_responses.go
WithPayload
func (o *GetOrdersForItemDefault) WithPayload(payload *models.Error) *GetOrdersForItemDefault { o.Payload = payload return o }
go
func (o *GetOrdersForItemDefault) WithPayload(payload *models.Error) *GetOrdersForItemDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetOrdersForItemDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "GetOrdersForItemDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get orders for item default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "orders", "for", "item", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_orders_for_item_responses.go#L147-L150
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/delete_user.go
NewDeleteUser
func NewDeleteUser(ctx *middleware.Context, handler DeleteUserHandler) *DeleteUser { return &DeleteUser{Context: ctx, Handler: handler} }
go
func NewDeleteUser(ctx *middleware.Context, handler DeleteUserHandler) *DeleteUser { return &DeleteUser{Context: ctx, Handler: handler} }
[ "func", "NewDeleteUser", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "DeleteUserHandler", ")", "*", "DeleteUser", "{", "return", "&", "DeleteUser", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewDeleteUser creates a new http.Handler for the delete user operation
[ "NewDeleteUser", "creates", "a", "new", "http", ".", "Handler", "for", "the", "delete", "user", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/delete_user.go#L28-L30
train