(folderId int, bucketId int, path string)
| 519 | } |
| 520 | |
| 521 | func (c OrchestratorClient) GetReadUrl(folderId int, bucketId int, path string) (string, error) { |
| 522 | request := c.createReadUrlRequest(folderId, bucketId, path) |
| 523 | client := network.NewHttpClient(c.logger, c.httpClientSettings()) |
| 524 | response, err := client.Send(request) |
| 525 | if err != nil { |
| 526 | return "", fmt.Errorf("Error sending request: %w", err) |
| 527 | } |
| 528 | defer func() { _ = response.Body.Close() }() |
| 529 | body, err := io.ReadAll(response.Body) |
| 530 | if err != nil { |
| 531 | return "", fmt.Errorf("Error reading response: %w", err) |
| 532 | } |
| 533 | if response.StatusCode != http.StatusOK { |
| 534 | return "", fmt.Errorf("Orchestrator returned status code '%v' and body '%v'", response.StatusCode, string(body)) |
| 535 | } |
| 536 | var result urlResponse |
| 537 | err = json.Unmarshal(body, &result) |
| 538 | if err != nil { |
| 539 | return "", fmt.Errorf("Error parsing json response: %w", err) |
| 540 | } |
| 541 | return result.Uri, nil |
| 542 | } |
| 543 | |
| 544 | func (c OrchestratorClient) createReadUrlRequest(folderId int, bucketId int, path string) *network.HttpRequest { |
| 545 | uri := c.newUriBuilder("/odata/Buckets({bucketId})/UiPath.Server.Configuration.OData.GetReadUri"). |
no test coverage detected