github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_update_urlbuilder.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 generate command 18 19 import ( 20 "errors" 21 "net/url" 22 golangswaggerpaths "path" 23 "strings" 24 25 "github.com/go-openapi/strfmt" 26 ) 27 28 // ObjectsUpdateURL generates an URL for the objects update operation 29 type ObjectsUpdateURL struct { 30 ID strfmt.UUID 31 32 ConsistencyLevel *string 33 34 _basePath string 35 // avoid unkeyed usage 36 _ struct{} 37 } 38 39 // WithBasePath sets the base path for this url builder, only required when it's different from the 40 // base path specified in the swagger spec. 41 // When the value of the base path is an empty string 42 func (o *ObjectsUpdateURL) WithBasePath(bp string) *ObjectsUpdateURL { 43 o.SetBasePath(bp) 44 return o 45 } 46 47 // SetBasePath sets the base path for this url builder, only required when it's different from the 48 // base path specified in the swagger spec. 49 // When the value of the base path is an empty string 50 func (o *ObjectsUpdateURL) SetBasePath(bp string) { 51 o._basePath = bp 52 } 53 54 // Build a url path and query string 55 func (o *ObjectsUpdateURL) Build() (*url.URL, error) { 56 var _result url.URL 57 58 var _path = "/objects/{id}" 59 60 id := o.ID.String() 61 if id != "" { 62 _path = strings.Replace(_path, "{id}", id, -1) 63 } else { 64 return nil, errors.New("id is required on ObjectsUpdateURL") 65 } 66 67 _basePath := o._basePath 68 if _basePath == "" { 69 _basePath = "/v1" 70 } 71 _result.Path = golangswaggerpaths.Join(_basePath, _path) 72 73 qs := make(url.Values) 74 75 var consistencyLevelQ string 76 if o.ConsistencyLevel != nil { 77 consistencyLevelQ = *o.ConsistencyLevel 78 } 79 if consistencyLevelQ != "" { 80 qs.Set("consistency_level", consistencyLevelQ) 81 } 82 83 _result.RawQuery = qs.Encode() 84 85 return &_result, nil 86 } 87 88 // Must is a helper function to panic when the url builder returns an error 89 func (o *ObjectsUpdateURL) Must(u *url.URL, err error) *url.URL { 90 if err != nil { 91 panic(err) 92 } 93 if u == nil { 94 panic("url can't be nil") 95 } 96 return u 97 } 98 99 // String returns the string representation of the path with query string 100 func (o *ObjectsUpdateURL) String() string { 101 return o.Must(o.Build()).String() 102 } 103 104 // BuildFull builds a full url with scheme, host, path and query string 105 func (o *ObjectsUpdateURL) BuildFull(scheme, host string) (*url.URL, error) { 106 if scheme == "" { 107 return nil, errors.New("scheme is required for a full url on ObjectsUpdateURL") 108 } 109 if host == "" { 110 return nil, errors.New("host is required for a full url on ObjectsUpdateURL") 111 } 112 113 base, err := o.Build() 114 if err != nil { 115 return nil, err 116 } 117 118 base.Scheme = scheme 119 base.Host = host 120 return base, nil 121 } 122 123 // StringFull returns the string representation of a complete url 124 func (o *ObjectsUpdateURL) StringFull(scheme, host string) string { 125 return o.Must(o.BuildFull(scheme, host)).String() 126 }