github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/nodes/nodes_get_class_parameters.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 // Code generated by go-swagger; DO NOT EDIT. 13 14 package nodes 15 16 // This file was generated by the swagger tool. 17 // Editing this file might prove futile when you re-run the swagger generate command 18 19 import ( 20 "net/http" 21 22 "github.com/go-openapi/errors" 23 "github.com/go-openapi/runtime" 24 "github.com/go-openapi/runtime/middleware" 25 "github.com/go-openapi/strfmt" 26 ) 27 28 // NewNodesGetClassParams creates a new NodesGetClassParams object 29 // with the default values initialized. 30 func NewNodesGetClassParams() NodesGetClassParams { 31 32 var ( 33 // initialize parameters with default values 34 35 outputDefault = string("minimal") 36 ) 37 38 return NodesGetClassParams{ 39 Output: &outputDefault, 40 } 41 } 42 43 // NodesGetClassParams contains all the bound params for the nodes get class operation 44 // typically these are obtained from a http.Request 45 // 46 // swagger:parameters nodes.get.class 47 type NodesGetClassParams struct { 48 49 // HTTP Request Object 50 HTTPRequest *http.Request `json:"-"` 51 52 /* 53 Required: true 54 In: path 55 */ 56 ClassName string 57 /*Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". 58 In: query 59 Default: "minimal" 60 */ 61 Output *string 62 } 63 64 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 65 // for simple values it will use straight method calls. 66 // 67 // To ensure default values, the struct must have been initialized with NewNodesGetClassParams() beforehand. 68 func (o *NodesGetClassParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 69 var res []error 70 71 o.HTTPRequest = r 72 73 qs := runtime.Values(r.URL.Query()) 74 75 rClassName, rhkClassName, _ := route.Params.GetOK("className") 76 if err := o.bindClassName(rClassName, rhkClassName, route.Formats); err != nil { 77 res = append(res, err) 78 } 79 80 qOutput, qhkOutput, _ := qs.GetOK("output") 81 if err := o.bindOutput(qOutput, qhkOutput, route.Formats); err != nil { 82 res = append(res, err) 83 } 84 if len(res) > 0 { 85 return errors.CompositeValidationError(res...) 86 } 87 return nil 88 } 89 90 // bindClassName binds and validates parameter ClassName from path. 91 func (o *NodesGetClassParams) bindClassName(rawData []string, hasKey bool, formats strfmt.Registry) error { 92 var raw string 93 if len(rawData) > 0 { 94 raw = rawData[len(rawData)-1] 95 } 96 97 // Required: true 98 // Parameter is provided by construction from the route 99 o.ClassName = raw 100 101 return nil 102 } 103 104 // bindOutput binds and validates parameter Output from query. 105 func (o *NodesGetClassParams) bindOutput(rawData []string, hasKey bool, formats strfmt.Registry) error { 106 var raw string 107 if len(rawData) > 0 { 108 raw = rawData[len(rawData)-1] 109 } 110 111 // Required: false 112 // AllowEmptyValue: false 113 114 if raw == "" { // empty values pass all other validations 115 // Default values have been previously initialized by NewNodesGetClassParams() 116 return nil 117 } 118 o.Output = &raw 119 120 return nil 121 }