github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_list_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 24 "github.com/go-openapi/swag" 25 ) 26 27 // ObjectsListURL generates an URL for the objects list operation 28 type ObjectsListURL struct { 29 After *string 30 Class *string 31 Include *string 32 Limit *int64 33 Offset *int64 34 Order *string 35 Sort *string 36 Tenant *string 37 38 _basePath string 39 // avoid unkeyed usage 40 _ struct{} 41 } 42 43 // WithBasePath sets the base path for this url builder, only required when it's different from the 44 // base path specified in the swagger spec. 45 // When the value of the base path is an empty string 46 func (o *ObjectsListURL) WithBasePath(bp string) *ObjectsListURL { 47 o.SetBasePath(bp) 48 return o 49 } 50 51 // SetBasePath sets the base path for this url builder, only required when it's different from the 52 // base path specified in the swagger spec. 53 // When the value of the base path is an empty string 54 func (o *ObjectsListURL) SetBasePath(bp string) { 55 o._basePath = bp 56 } 57 58 // Build a url path and query string 59 func (o *ObjectsListURL) Build() (*url.URL, error) { 60 var _result url.URL 61 62 var _path = "/objects" 63 64 _basePath := o._basePath 65 if _basePath == "" { 66 _basePath = "/v1" 67 } 68 _result.Path = golangswaggerpaths.Join(_basePath, _path) 69 70 qs := make(url.Values) 71 72 var afterQ string 73 if o.After != nil { 74 afterQ = *o.After 75 } 76 if afterQ != "" { 77 qs.Set("after", afterQ) 78 } 79 80 var classQ string 81 if o.Class != nil { 82 classQ = *o.Class 83 } 84 if classQ != "" { 85 qs.Set("class", classQ) 86 } 87 88 var includeQ string 89 if o.Include != nil { 90 includeQ = *o.Include 91 } 92 if includeQ != "" { 93 qs.Set("include", includeQ) 94 } 95 96 var limitQ string 97 if o.Limit != nil { 98 limitQ = swag.FormatInt64(*o.Limit) 99 } 100 if limitQ != "" { 101 qs.Set("limit", limitQ) 102 } 103 104 var offsetQ string 105 if o.Offset != nil { 106 offsetQ = swag.FormatInt64(*o.Offset) 107 } 108 if offsetQ != "" { 109 qs.Set("offset", offsetQ) 110 } 111 112 var orderQ string 113 if o.Order != nil { 114 orderQ = *o.Order 115 } 116 if orderQ != "" { 117 qs.Set("order", orderQ) 118 } 119 120 var sortQ string 121 if o.Sort != nil { 122 sortQ = *o.Sort 123 } 124 if sortQ != "" { 125 qs.Set("sort", sortQ) 126 } 127 128 var tenantQ string 129 if o.Tenant != nil { 130 tenantQ = *o.Tenant 131 } 132 if tenantQ != "" { 133 qs.Set("tenant", tenantQ) 134 } 135 136 _result.RawQuery = qs.Encode() 137 138 return &_result, nil 139 } 140 141 // Must is a helper function to panic when the url builder returns an error 142 func (o *ObjectsListURL) Must(u *url.URL, err error) *url.URL { 143 if err != nil { 144 panic(err) 145 } 146 if u == nil { 147 panic("url can't be nil") 148 } 149 return u 150 } 151 152 // String returns the string representation of the path with query string 153 func (o *ObjectsListURL) String() string { 154 return o.Must(o.Build()).String() 155 } 156 157 // BuildFull builds a full url with scheme, host, path and query string 158 func (o *ObjectsListURL) BuildFull(scheme, host string) (*url.URL, error) { 159 if scheme == "" { 160 return nil, errors.New("scheme is required for a full url on ObjectsListURL") 161 } 162 if host == "" { 163 return nil, errors.New("host is required for a full url on ObjectsListURL") 164 } 165 166 base, err := o.Build() 167 if err != nil { 168 return nil, err 169 } 170 171 base.Scheme = scheme 172 base.Host = host 173 return base, nil 174 } 175 176 // StringFull returns the string representation of a complete url 177 func (o *ObjectsListURL) StringFull(scheme, host string) string { 178 return o.Must(o.BuildFull(scheme, host)).String() 179 }