github.com/minio/console@v1.4.1/api/operations/user/list_users_urlbuilder.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // This file is part of MinIO Console Server 4 // Copyright (c) 2023 MinIO, Inc. 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU Affero General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU Affero General Public License for more details. 15 // 16 // You should have received a copy of the GNU Affero General Public License 17 // along with this program. If not, see <http://www.gnu.org/licenses/>. 18 // 19 20 package user 21 22 // This file was generated by the swagger tool. 23 // Editing this file might prove futile when you re-run the generate command 24 25 import ( 26 "errors" 27 "net/url" 28 golangswaggerpaths "path" 29 30 "github.com/go-openapi/swag" 31 ) 32 33 // ListUsersURL generates an URL for the list users operation 34 type ListUsersURL struct { 35 Limit *int32 36 Offset *int32 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 *ListUsersURL) WithBasePath(bp string) *ListUsersURL { 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 *ListUsersURL) SetBasePath(bp string) { 55 o._basePath = bp 56 } 57 58 // Build a url path and query string 59 func (o *ListUsersURL) Build() (*url.URL, error) { 60 var _result url.URL 61 62 var _path = "/users" 63 64 _basePath := o._basePath 65 if _basePath == "" { 66 _basePath = "/api/v1" 67 } 68 _result.Path = golangswaggerpaths.Join(_basePath, _path) 69 70 qs := make(url.Values) 71 72 var limitQ string 73 if o.Limit != nil { 74 limitQ = swag.FormatInt32(*o.Limit) 75 } 76 if limitQ != "" { 77 qs.Set("limit", limitQ) 78 } 79 80 var offsetQ string 81 if o.Offset != nil { 82 offsetQ = swag.FormatInt32(*o.Offset) 83 } 84 if offsetQ != "" { 85 qs.Set("offset", offsetQ) 86 } 87 88 _result.RawQuery = qs.Encode() 89 90 return &_result, nil 91 } 92 93 // Must is a helper function to panic when the url builder returns an error 94 func (o *ListUsersURL) Must(u *url.URL, err error) *url.URL { 95 if err != nil { 96 panic(err) 97 } 98 if u == nil { 99 panic("url can't be nil") 100 } 101 return u 102 } 103 104 // String returns the string representation of the path with query string 105 func (o *ListUsersURL) String() string { 106 return o.Must(o.Build()).String() 107 } 108 109 // BuildFull builds a full url with scheme, host, path and query string 110 func (o *ListUsersURL) BuildFull(scheme, host string) (*url.URL, error) { 111 if scheme == "" { 112 return nil, errors.New("scheme is required for a full url on ListUsersURL") 113 } 114 if host == "" { 115 return nil, errors.New("host is required for a full url on ListUsersURL") 116 } 117 118 base, err := o.Build() 119 if err != nil { 120 return nil, err 121 } 122 123 base.Scheme = scheme 124 base.Host = host 125 return base, nil 126 } 127 128 // StringFull returns the string representation of a complete url 129 func (o *ListUsersURL) StringFull(scheme, host string) string { 130 return o.Must(o.BuildFull(scheme, host)).String() 131 }