github.com/minio/console@v1.4.1/api/operations/system/dashboard_widget_details_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 system 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 "github.com/go-openapi/swag" 32 ) 33 34 // DashboardWidgetDetailsURL generates an URL for the dashboard widget details operation 35 type DashboardWidgetDetailsURL struct { 36 WidgetID int32 37 38 End *int64 39 Start *int64 40 Step *int32 41 42 _basePath string 43 // avoid unkeyed usage 44 _ struct{} 45 } 46 47 // WithBasePath 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 *DashboardWidgetDetailsURL) WithBasePath(bp string) *DashboardWidgetDetailsURL { 51 o.SetBasePath(bp) 52 return o 53 } 54 55 // SetBasePath sets the base path for this url builder, only required when it's different from the 56 // base path specified in the swagger spec. 57 // When the value of the base path is an empty string 58 func (o *DashboardWidgetDetailsURL) SetBasePath(bp string) { 59 o._basePath = bp 60 } 61 62 // Build a url path and query string 63 func (o *DashboardWidgetDetailsURL) Build() (*url.URL, error) { 64 var _result url.URL 65 66 var _path = "/admin/info/widgets/{widgetId}" 67 68 widgetID := swag.FormatInt32(o.WidgetID) 69 if widgetID != "" { 70 _path = strings.Replace(_path, "{widgetId}", widgetID, -1) 71 } else { 72 return nil, errors.New("widgetId is required on DashboardWidgetDetailsURL") 73 } 74 75 _basePath := o._basePath 76 if _basePath == "" { 77 _basePath = "/api/v1" 78 } 79 _result.Path = golangswaggerpaths.Join(_basePath, _path) 80 81 qs := make(url.Values) 82 83 var endQ string 84 if o.End != nil { 85 endQ = swag.FormatInt64(*o.End) 86 } 87 if endQ != "" { 88 qs.Set("end", endQ) 89 } 90 91 var startQ string 92 if o.Start != nil { 93 startQ = swag.FormatInt64(*o.Start) 94 } 95 if startQ != "" { 96 qs.Set("start", startQ) 97 } 98 99 var stepQ string 100 if o.Step != nil { 101 stepQ = swag.FormatInt32(*o.Step) 102 } 103 if stepQ != "" { 104 qs.Set("step", stepQ) 105 } 106 107 _result.RawQuery = qs.Encode() 108 109 return &_result, nil 110 } 111 112 // Must is a helper function to panic when the url builder returns an error 113 func (o *DashboardWidgetDetailsURL) Must(u *url.URL, err error) *url.URL { 114 if err != nil { 115 panic(err) 116 } 117 if u == nil { 118 panic("url can't be nil") 119 } 120 return u 121 } 122 123 // String returns the string representation of the path with query string 124 func (o *DashboardWidgetDetailsURL) String() string { 125 return o.Must(o.Build()).String() 126 } 127 128 // BuildFull builds a full url with scheme, host, path and query string 129 func (o *DashboardWidgetDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { 130 if scheme == "" { 131 return nil, errors.New("scheme is required for a full url on DashboardWidgetDetailsURL") 132 } 133 if host == "" { 134 return nil, errors.New("host is required for a full url on DashboardWidgetDetailsURL") 135 } 136 137 base, err := o.Build() 138 if err != nil { 139 return nil, err 140 } 141 142 base.Scheme = scheme 143 base.Host = host 144 return base, nil 145 } 146 147 // StringFull returns the string representation of a complete url 148 func (o *DashboardWidgetDetailsURL) StringFull(scheme, host string) string { 149 return o.Must(o.BuildFull(scheme, host)).String() 150 }