| 217 | } |
| 218 | |
| 219 | func getVariables(client *http.Client, host, path string) ([]shared.Variable, error) { |
| 220 | var results []shared.Variable |
| 221 | apiClient := api.NewClientFromHTTP(client) |
| 222 | path = fmt.Sprintf("%s?per_page=100", path) |
| 223 | for path != "" { |
| 224 | response := struct { |
| 225 | Variables []shared.Variable |
| 226 | }{} |
| 227 | var err error |
| 228 | path, err = apiClient.RESTWithNext(host, "GET", path, nil, &response) |
| 229 | if err != nil { |
| 230 | return nil, err |
| 231 | } |
| 232 | results = append(results, response.Variables...) |
| 233 | } |
| 234 | return results, nil |
| 235 | } |