parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
(obj interface{}, collectionFormat string)
| 133 | |
| 134 | // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. |
| 135 | func parameterToString(obj interface{}, collectionFormat string) string { |
| 136 | var delimiter string |
| 137 | |
| 138 | switch collectionFormat { |
| 139 | case "pipes": |
| 140 | delimiter = "|" |
| 141 | case "ssv": |
| 142 | delimiter = " " |
| 143 | case "tsv": |
| 144 | delimiter = "\t" |
| 145 | case "csv": |
| 146 | delimiter = "," |
| 147 | } |
| 148 | |
| 149 | if reflect.TypeOf(obj).Kind() == reflect.Slice { |
| 150 | return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") |
| 151 | } |
| 152 | |
| 153 | return fmt.Sprintf("%v", obj) |
| 154 | } |
| 155 | |
| 156 | // callAPI do the request. |
| 157 | func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { |
no outgoing calls
no test coverage detected