(documentId string, ctx plugin.ExecutionContext, writer output.OutputWriter, logger log.Logger)
| 72 | } |
| 73 | |
| 74 | func (c DigitizeCommand) waitForDigitization(documentId string, ctx plugin.ExecutionContext, writer output.OutputWriter, logger log.Logger) (bool, error) { |
| 75 | projectId := c.getProjectId(ctx.Parameters) |
| 76 | client := api.NewDuClient(ctx.BaseUri, ctx.Organization, ctx.Tenant, ctx.Auth.Token, ctx.Debug, ctx.Settings, logger) |
| 77 | result, err := client.GetDigitizationResult(projectId, documentId) |
| 78 | if err != nil { |
| 79 | return true, err |
| 80 | } |
| 81 | if result == "" { |
| 82 | return false, nil |
| 83 | } |
| 84 | |
| 85 | err = writer.WriteResponse(*output.NewResponseInfo(http.StatusOK, "200 OK", "HTTP/1.1", map[string][]string{}, strings.NewReader(result))) |
| 86 | return true, err |
| 87 | } |
| 88 | |
| 89 | func (c DigitizeCommand) getProjectId(parameters []plugin.ExecutionParameter) string { |
| 90 | return c.getStringParameter("project-id", "00000000-0000-0000-0000-000000000000", parameters) |
no test coverage detected