(projectId string, file stream.Stream, contentType string, uploadBar *visualization.ProgressBar, cancel context.CancelCauseFunc)
| 55 | } |
| 56 | |
| 57 | func (c DuClient) createStartDigitizationRequest(projectId string, file stream.Stream, contentType string, uploadBar *visualization.ProgressBar, cancel context.CancelCauseFunc) *network.HttpRequest { |
| 58 | streamSize, _ := file.Size() |
| 59 | bodyReader, bodyWriter := io.Pipe() |
| 60 | formDataContentType := c.writeMultipartBody(bodyWriter, file, contentType, cancel) |
| 61 | uploadReader := c.progressReader("uploading...", "completing ", bodyReader, streamSize, uploadBar) |
| 62 | |
| 63 | uri := c.newUriBuilder("/api/framework/projects/{projectId}/digitization/start"). |
| 64 | FormatPath("projectId", projectId). |
| 65 | AddQueryString("api-version", "1"). |
| 66 | Build() |
| 67 | header := http.Header{ |
| 68 | "Content-Type": {formDataContentType}, |
| 69 | } |
| 70 | return network.NewHttpPostRequest(uri, c.toAuthorization(c.token), header, uploadReader, -1) |
| 71 | } |
| 72 | |
| 73 | func (c DuClient) GetDigitizationResult(projectId string, documentId string) (string, error) { |
| 74 | request := c.createDigitizeStatusRequest(projectId, documentId) |
no test coverage detected