github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_head_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 objects 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/middleware" 24 "github.com/go-openapi/strfmt" 25 "github.com/go-openapi/validate" 26 ) 27 28 // NewObjectsHeadParams creates a new ObjectsHeadParams object 29 // 30 // There are no default values defined in the spec. 31 func NewObjectsHeadParams() ObjectsHeadParams { 32 33 return ObjectsHeadParams{} 34 } 35 36 // ObjectsHeadParams contains all the bound params for the objects head operation 37 // typically these are obtained from a http.Request 38 // 39 // swagger:parameters objects.head 40 type ObjectsHeadParams struct { 41 42 // HTTP Request Object 43 HTTPRequest *http.Request `json:"-"` 44 45 /*Unique ID of the Object. 46 Required: true 47 In: path 48 */ 49 ID strfmt.UUID 50 } 51 52 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 53 // for simple values it will use straight method calls. 54 // 55 // To ensure default values, the struct must have been initialized with NewObjectsHeadParams() beforehand. 56 func (o *ObjectsHeadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 57 var res []error 58 59 o.HTTPRequest = r 60 61 rID, rhkID, _ := route.Params.GetOK("id") 62 if err := o.bindID(rID, rhkID, route.Formats); err != nil { 63 res = append(res, err) 64 } 65 if len(res) > 0 { 66 return errors.CompositeValidationError(res...) 67 } 68 return nil 69 } 70 71 // bindID binds and validates parameter ID from path. 72 func (o *ObjectsHeadParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { 73 var raw string 74 if len(rawData) > 0 { 75 raw = rawData[len(rawData)-1] 76 } 77 78 // Required: true 79 // Parameter is provided by construction from the route 80 81 // Format: uuid 82 value, err := formats.Parse("uuid", raw) 83 if err != nil { 84 return errors.InvalidType("id", "path", "strfmt.UUID", raw) 85 } 86 o.ID = *(value.(*strfmt.UUID)) 87 88 if err := o.validateID(formats); err != nil { 89 return err 90 } 91 92 return nil 93 } 94 95 // validateID carries on validations for parameter ID 96 func (o *ObjectsHeadParams) validateID(formats strfmt.Registry) error { 97 98 if err := validate.FormatOf("id", "path", "uuid", o.ID.String(), formats); err != nil { 99 return err 100 } 101 return nil 102 }