MCPcopy Create free account
hub / github.com/UiPath/uipathcli / GetWriteUrl

Method GetWriteUrl

utils/api/orchestrator_client.go:555–576  ·  view source on GitHub ↗
(folderId int, bucketId int, path string)

Source from the content-addressed store, hash-verified

553}
554
555func (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
578func (c OrchestratorClient) createWriteUrlRequest(folderId int, bucketId int, path string) *network.HttpRequest {
579 uri := c.newUriBuilder("/odata/Buckets({bucketId})/UiPath.Server.Configuration.OData.GetWriteUri").

Callers 1

getWriteUrlMethod · 0.95

Calls 5

createWriteUrlRequestMethod · 0.95
httpClientSettingsMethod · 0.95
SendMethod · 0.95
NewHttpClientFunction · 0.92
CloseMethod · 0.80

Tested by

no test coverage detected