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

Method GetDigitizationResult

utils/api/du_client.go:73–97  ·  view source on GitHub ↗
(projectId string, documentId string)

Source from the content-addressed store, hash-verified

71}
72
73func (c DuClient) GetDigitizationResult(projectId string, documentId string) (string, error) {
74 request := c.createDigitizeStatusRequest(projectId, documentId)
75 client := network.NewHttpClient(c.logger, c.httpClientSettings())
76 response, err := client.Send(request)
77 if err != nil {
78 return "", err
79 }
80 defer func() { _ = response.Body.Close() }()
81 body, err := io.ReadAll(response.Body)
82 if err != nil {
83 return "", fmt.Errorf("Error reading response: %w", err)
84 }
85 if response.StatusCode != http.StatusOK {
86 return "", fmt.Errorf("Digitizer returned status code '%v' and body '%v'", response.StatusCode, string(body))
87 }
88 var result digitizeResultResponse
89 err = json.Unmarshal(body, &result)
90 if err != nil {
91 return "", fmt.Errorf("Error parsing json response: %w", err)
92 }
93 if result.Status == "NotStarted" || result.Status == "Running" {
94 return "", nil
95 }
96 return string(body), err
97}
98
99func (c DuClient) createDigitizeStatusRequest(projectId string, documentId string) *network.HttpRequest {
100 uri := c.newUriBuilder("/api/framework/projects/{projectId}/digitization/result/{documentId}").

Callers 1

waitForDigitizationMethod · 0.95

Calls 5

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

Tested by

no test coverage detected