github.com/minio/console@v1.4.1/api/operations/user/get_user_info_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 "strings" 30 ) 31 32 // GetUserInfoURL generates an URL for the get user info operation 33 type GetUserInfoURL struct { 34 Name string 35 36 _basePath string 37 // avoid unkeyed usage 38 _ struct{} 39 } 40 41 // WithBasePath sets the base path for this url builder, only required when it's different from the 42 // base path specified in the swagger spec. 43 // When the value of the base path is an empty string 44 func (o *GetUserInfoURL) WithBasePath(bp string) *GetUserInfoURL { 45 o.SetBasePath(bp) 46 return o 47 } 48 49 // SetBasePath sets the base path for this url builder, only required when it's different from the 50 // base path specified in the swagger spec. 51 // When the value of the base path is an empty string 52 func (o *GetUserInfoURL) SetBasePath(bp string) { 53 o._basePath = bp 54 } 55 56 // Build a url path and query string 57 func (o *GetUserInfoURL) Build() (*url.URL, error) { 58 var _result url.URL 59 60 var _path = "/user/{name}" 61 62 name := o.Name 63 if name != "" { 64 _path = strings.Replace(_path, "{name}", name, -1) 65 } else { 66 return nil, errors.New("name is required on GetUserInfoURL") 67 } 68 69 _basePath := o._basePath 70 if _basePath == "" { 71 _basePath = "/api/v1" 72 } 73 _result.Path = golangswaggerpaths.Join(_basePath, _path) 74 75 return &_result, nil 76 } 77 78 // Must is a helper function to panic when the url builder returns an error 79 func (o *GetUserInfoURL) Must(u *url.URL, err error) *url.URL { 80 if err != nil { 81 panic(err) 82 } 83 if u == nil { 84 panic("url can't be nil") 85 } 86 return u 87 } 88 89 // String returns the string representation of the path with query string 90 func (o *GetUserInfoURL) String() string { 91 return o.Must(o.Build()).String() 92 } 93 94 // BuildFull builds a full url with scheme, host, path and query string 95 func (o *GetUserInfoURL) BuildFull(scheme, host string) (*url.URL, error) { 96 if scheme == "" { 97 return nil, errors.New("scheme is required for a full url on GetUserInfoURL") 98 } 99 if host == "" { 100 return nil, errors.New("host is required for a full url on GetUserInfoURL") 101 } 102 103 base, err := o.Build() 104 if err != nil { 105 return nil, err 106 } 107 108 base.Scheme = scheme 109 base.Host = host 110 return base, nil 111 } 112 113 // StringFull returns the string representation of a complete url 114 func (o *GetUserInfoURL) StringFull(scheme, host string) string { 115 return o.Must(o.BuildFull(scheme, host)).String() 116 }