(folderId int, bucketId int, path string)
| 553 | } |
| 554 | |
| 555 | func (c OrchestratorClient) GetWriteUrl(folderId int, bucketId int, path string) (string, error) { |
| 556 | request := c.createWriteUrlRequest(folderId, bucketId, path) |
| 557 | client := network.NewHttpClient(c.logger, c.httpClientSettings()) |
| 558 | response, err := client.Send(request) |
| 559 | if err != nil { |
| 560 | return "", err |
| 561 | } |
| 562 | defer func() { _ = response.Body.Close() }() |
| 563 | body, err := io.ReadAll(response.Body) |
| 564 | if err != nil { |
| 565 | return "", fmt.Errorf("Error reading response: %w", err) |
| 566 | } |
| 567 | if response.StatusCode != http.StatusOK { |
| 568 | return "", fmt.Errorf("Orchestrator returned status code '%v' and body '%v'", response.StatusCode, string(body)) |
| 569 | } |
| 570 | var result urlResponse |
| 571 | err = json.Unmarshal(body, &result) |
| 572 | if err != nil { |
| 573 | return "", fmt.Errorf("Error parsing json response: %w", err) |
| 574 | } |
| 575 | return result.Uri, nil |
| 576 | } |
| 577 | |
| 578 | func (c OrchestratorClient) createWriteUrlRequest(folderId int, bucketId int, path string) *network.HttpRequest { |
| 579 | uri := c.newUriBuilder("/odata/Buckets({bucketId})/UiPath.Server.Configuration.OData.GetWriteUri"). |
no test coverage detected