@azure-rest/ai-document-intelligence
Advanced tools
Comparing version 1.0.0-alpha.20241216.1 to 1.0.0-alpha.20241218.1
117
CHANGELOG.md
# Release History | ||
## 1.0.0 (Unreleased) | ||
## 1.0.0 (2024-12-16) | ||
### Features Added | ||
- Exports method `streamToUint8Array` to support converting a `NodeJS.ReadableStream` to a `Uint8Array`. This is necessary to read the pdf and png responses from the results of an analysis. | ||
```js | ||
- Adds `streamToUint8Array`, a convenience function that buffers a `NodeJS.ReadableStream` in a `Uint8Array`. It can be used to read the pdf and png responses from the results of an analysis. | ||
```ts | ||
import DocumentIntelligence from "@azure-rest/ai-document-intelligence"; | ||
import { streamToUint8Array } from "@azure-rest/ai-document-intelligence"; | ||
const client = DocumentIntelligence("<DOCUMENT_INTELLIGENCE_ENDPOINT>", { | ||
key: "<DOCUMENT_INTELLIGENCE_API_KEY>", | ||
}); | ||
// Do analysis on you document and get the resultId, figureId | ||
// Example for the figures api that provides an image output | ||
const output = await client | ||
.path( | ||
"/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}", | ||
"prebuilt-layout", | ||
operationId, | ||
figureId, | ||
) | ||
.get() | ||
.asNodeStream(); | ||
const output = await client | ||
.path( | ||
"/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}", | ||
"prebuilt-layout", | ||
resultId, | ||
figureId | ||
) | ||
.get() | ||
.asNodeStream(); // output.body would be NodeJS.ReadableStream | ||
if (output.status !== "200" || !output.body) { | ||
throw new Error("The response was unexpected."); | ||
} | ||
if (output.status !== "200" || !output.body) { | ||
throw new Error("The response was unexpected, expected NodeJS.ReadableStream in the body."); | ||
} | ||
const imageData = await streamToUint8Array(output.body); | ||
fs.promises.writeFile(`./figures/${figureId}.png`, imageData); // Or you can consume the NodeJS.ReadableStream directly | ||
``` | ||
- Adds `parseResultIdFromResponse`, a convenience function that extracts the `operationId` from the batch analysis response. | ||
```js | ||
// Example | ||
const initialResponse = await client | ||
.path("/documentModels/{modelId}:analyzeBatch", "prebuilt-layout") | ||
.post({ | ||
contentType: "application/json", | ||
body: { | ||
azureBlobSource: { | ||
containerUrl: batchTrainingFilesContainerUrl(), | ||
}, | ||
resultContainerUrl: batchTrainingFilesResultContainerUrl(), | ||
resultPrefix: "result", | ||
}, | ||
}); | ||
if (isUnexpected(initialResponse)) { | ||
throw initialResponse.body.error; | ||
} | ||
const batchResultId = parseResultIdFromResponse(initialResponse); | ||
const response = await client | ||
.path( | ||
"/documentModels/{modelId}/analyzeBatchResults/{resultId}", | ||
"prebuilt-layout", | ||
batchResultId | ||
) | ||
.get(); | ||
``` | ||
- Changes the following interfaces as follows: | ||
- `AnalyzeBatchDocumentsBodyParam`: | ||
- Updates `body` to be required. | ||
- `AnalyzeBatchOperationOutput`: | ||
- Adds `resultId`. | ||
- `AnalyzeDocumentBodyParam`: | ||
- Changes `body` from optional to required. | ||
- `DocumentClassifierDetailsOutput`: | ||
- Adds `modifiedDateTime`. | ||
- `DocumentModelDetailsOutput`: | ||
- Adds `modifiedDateTime`. | ||
- Introduces new interfaces to define query parameters for document analysis requests, allowing customizable `style` and `explode` options: | ||
- **AnalyzeBatchDocumentsFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values. | ||
- **AnalyzeBatchDocumentsOutputQueryParam**: Accepts AnalyzeOutputOption[] values. | ||
- **AnalyzeBatchDocumentsQueryFieldsQueryParam**: Accepts string[] values. | ||
- **AnalyzeDocumentFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values. | ||
- **AnalyzeDocumentFromStreamFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values. | ||
### Breaking Changes | ||
- Removes the `poller.getOperationId()` for a given polling operation. Use `parseResultIdFromResponse` to extract the `operationId` directly. | ||
- `getLongRunningPoller` function is not async anymore, do not `await` on it. | ||
### Other Changes | ||
The following types are renamed | ||
- `CopyAuthorization` to `ModelCopyAuthorization` | ||
- `ErrorResponseOutput` to `DocumentIntelligenceErrorResponseOutput` | ||
- `ErrorModelOutput` to `DocumentIntelligenceErrorOutput` | ||
- `InnerErrorOutput` to `DocumentIntelligenceInnerErrorOutput` | ||
- `WarningOutput` to `DocumentIntelligenceWarningOutput` | ||
- `ContentFormat` to `DocumentContentFormat` | ||
- `ContentFormatOutput` to `DocumentContentFormatOutput` | ||
- `OperationDetailsOutputParent` to `DocumentIntelligenceOperationDetailsOutputParent` | ||
- `OperationDetailsOutput` to `DocumentIntelligenceOperationDetailsOutput` | ||
- `OperationStatusOutput` to `DocumentIntelligenceOperationStatusOutput` | ||
- `ResourceDetailsOutput` to `DocumentIntelligenceResourceDetailsOutput` | ||
- `PagedOperationDetailsOutput` to `PagedDocumentIntelligenceOperationDetailsOutput` | ||
- `GetResourceInfo` to `GetResourceDetails` | ||
## 1.0.0-beta.3 (2024-08-20) | ||
@@ -26,0 +113,0 @@ |
@@ -1,3 +0,3 @@ | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceInfoParameters, GetAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceDetailsParameters, GetAnalyzeResultParameters, DeleteAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, DeleteAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, ListAnalyzeBatchResultsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { Client, StreamableMethod } from "@azure-rest/core-client"; | ||
@@ -22,5 +22,5 @@ export interface ListOperations { | ||
} | ||
export interface GetResourceInfo { | ||
export interface GetResourceDetails { | ||
/** Return information about the current resource. */ | ||
get(options?: GetResourceInfoParameters): StreamableMethod<GetResourceInfo200Response | GetResourceInfoDefaultResponse>; | ||
get(options?: GetResourceDetailsParameters): StreamableMethod<GetResourceDetails200Response | GetResourceDetailsDefaultResponse>; | ||
} | ||
@@ -30,2 +30,4 @@ export interface GetAnalyzeResult { | ||
get(options?: GetAnalyzeResultParameters): StreamableMethod<GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse>; | ||
/** Mark the result of document analysis for deletion. */ | ||
delete(options?: DeleteAnalyzeResultParameters): StreamableMethod<DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse>; | ||
} | ||
@@ -49,2 +51,4 @@ export interface GetAnalyzeResultPdf { | ||
get(options?: GetAnalyzeBatchResultParameters): StreamableMethod<GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse>; | ||
/** Mark the batch document analysis result for deletion. */ | ||
delete(options?: DeleteAnalyzeBatchResultParameters): StreamableMethod<DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse>; | ||
} | ||
@@ -55,2 +59,6 @@ export interface AnalyzeBatchDocuments { | ||
} | ||
export interface ListAnalyzeBatchResults { | ||
/** List batch document analysis results. */ | ||
get(options?: ListAnalyzeBatchResultsParameters): StreamableMethod<ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse>; | ||
} | ||
export interface GetModel { | ||
@@ -126,4 +134,4 @@ /** Gets detailed document model information. */ | ||
/** Resource for '/info' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceInfo; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceDetails; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeResults/{resultId}", modelId: string, resultId: string): GetAnalyzeResult; | ||
@@ -136,6 +144,8 @@ /** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}/pdf' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}:analyze", modelId: string): AnalyzeDocumentFromStream; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get */ | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults/{resultId}", modelId: string, resultId: string): GetAnalyzeBatchResult; | ||
/** Resource for '/documentModels/\{modelId\}:analyzeBatch' has methods for the following verbs: post */ | ||
(path: "/documentModels/{modelId}:analyzeBatch", modelId: string): AnalyzeBatchDocuments; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults", modelId: string): ListAnalyzeBatchResults; | ||
/** Resource for '/documentModels/\{modelId\}' has methods for the following verbs: get, delete */ | ||
@@ -142,0 +152,0 @@ (path: "/documentModels/{modelId}", modelId: string): GetModel; |
@@ -14,5 +14,5 @@ // Copyright (c) Microsoft Corporation. | ||
var _b, _c, _d, _e, _f, _g, _h, _j; | ||
var { apiVersion = "2024-07-31-preview" } = _a, options = __rest(_a, ["apiVersion"]); | ||
var { apiVersion = "2024-11-30" } = _a, options = __rest(_a, ["apiVersion"]); | ||
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.1`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`; | ||
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
@@ -19,0 +19,0 @@ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` |
@@ -1,2 +0,2 @@ | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
export declare function isUnexpected(response: ListOperations200Response | ListOperationsDefaultResponse): response is ListOperationsDefaultResponse; | ||
@@ -9,4 +9,5 @@ export declare function isUnexpected(response: GetDocumentModelBuildOperation200Response | GetDocumentModelBuildOperationDefaultResponse): response is GetDocumentModelBuildOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetOperation200Response | GetOperationDefaultResponse): response is GetOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceInfo200Response | GetResourceInfoDefaultResponse): response is GetResourceInfoDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceDetails200Response | GetResourceDetailsDefaultResponse): response is GetResourceDetailsDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse): response is GetAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse): response is DeleteAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResultPdf200Response | GetAnalyzeResultPdfDefaultResponse): response is GetAnalyzeResultPdfDefaultResponse; | ||
@@ -17,3 +18,5 @@ export declare function isUnexpected(response: GetAnalyzeResultFigure200Response | GetAnalyzeResultFigureDefaultResponse): response is GetAnalyzeResultFigureDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse): response is GetAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse): response is DeleteAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse): response is AnalyzeBatchDocumentsDefaultResponse; | ||
export declare function isUnexpected(response: ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse): response is ListAnalyzeBatchResultsDefaultResponse; | ||
export declare function isUnexpected(response: GetModel200Response | GetModelDefaultResponse): response is GetModelDefaultResponse; | ||
@@ -20,0 +23,0 @@ export declare function isUnexpected(response: DeleteModel204Response | DeleteModelDefaultResponse): response is DeleteModelDefaultResponse; |
@@ -8,2 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}/pdf": ["200"], | ||
@@ -14,4 +15,6 @@ "GET /documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}": ["200"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}:analyzeBatch": ["200", "202"], | ||
"POST /documentModels/{modelId}:analyzeBatch": ["202"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults": ["200"], | ||
"GET /documentModels/{modelId}": ["200"], | ||
@@ -18,0 +21,0 @@ "DELETE /documentModels/{modelId}": ["204"], |
@@ -22,3 +22,3 @@ /** Azure Blob Storage content. */ | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -117,3 +117,3 @@ buildMode?: DocumentBuildMode; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -170,3 +170,3 @@ buildMode: DocumentBuildMode; | ||
*/ | ||
export interface CopyAuthorization { | ||
export interface ModelCopyAuthorization { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -253,6 +253,6 @@ targetResourceId: string; | ||
export type StringIndexType = string; | ||
/** Alias for ContentFormat */ | ||
export type ContentFormat = string; | ||
/** Alias for DocumentContentFormat */ | ||
export type DocumentContentFormat = string; | ||
/** Alias for AnalyzeOutputOption */ | ||
export type AnalyzeOutputOption = string; | ||
//# sourceMappingURL=models.d.ts.map |
@@ -1,4 +0,10 @@ | ||
import type { Paged } from "@azure/core-paging"; | ||
/** Paged collection of DocumentIntelligenceOperationDetails items */ | ||
export interface PagedDocumentIntelligenceOperationDetailsOutput { | ||
/** The DocumentIntelligenceOperationDetails items on this page */ | ||
value: Array<DocumentIntelligenceOperationDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Operation info. */ | ||
export interface OperationDetailsOutputParent { | ||
export interface DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation ID */ | ||
@@ -9,5 +15,5 @@ operationId: string; | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Operation progress (0-100). */ | ||
@@ -26,7 +32,7 @@ percentCompleted?: number; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
kind: OperationKindOutput; | ||
} | ||
/** The error object. */ | ||
export interface ErrorModelOutput { | ||
export interface DocumentIntelligenceErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -39,8 +45,8 @@ code: string; | ||
/** An array of details about specific errors that led to this reported error. */ | ||
details?: Array<ErrorModelOutput>; | ||
details?: Array<DocumentIntelligenceErrorOutput>; | ||
/** An object containing more specific information than the current object about the error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** An object containing more specific information about the error. */ | ||
export interface InnerErrorOutput { | ||
export interface DocumentIntelligenceInnerErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -51,6 +57,6 @@ code?: string; | ||
/** Inner error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** Get Operation response object. */ | ||
export interface DocumentModelBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -71,2 +77,4 @@ result?: DocumentModelDetailsOutput; | ||
readonly expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document model. */ | ||
@@ -79,3 +87,3 @@ readonly apiVersion?: string; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -104,3 +112,3 @@ readonly buildMode?: DocumentBuildModeOutput; | ||
/** List of warnings encountered while building the model. */ | ||
readonly warnings?: Array<WarningOutput>; | ||
readonly warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
/** Number of V100-equivalent GPU hours consumed for model training. */ | ||
@@ -130,3 +138,3 @@ readonly trainingHours?: number; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -167,3 +175,3 @@ buildMode?: DocumentBuildModeOutput; | ||
/** The error object. */ | ||
export interface WarningOutput { | ||
export interface DocumentIntelligenceWarningOutput { | ||
/** One of a server-defined set of warning codes. */ | ||
@@ -177,3 +185,3 @@ code: string; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelComposeOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelComposeOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -185,3 +193,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -193,3 +201,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -210,2 +218,4 @@ result?: DocumentClassifierDetailsOutput; | ||
expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document classifier. */ | ||
@@ -218,3 +228,3 @@ apiVersion: string; | ||
/** List of warnings encountered while building the classifier. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -243,3 +253,3 @@ /** Classifier document type info. */ | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -251,8 +261,8 @@ result?: DocumentClassifierDetailsOutput; | ||
/** Error response object. */ | ||
export interface ErrorResponseOutput { | ||
export interface DocumentIntelligenceErrorResponseOutput { | ||
/** Error info. */ | ||
error: ErrorModelOutput; | ||
error: DocumentIntelligenceErrorOutput; | ||
} | ||
/** General information regarding the current resource. */ | ||
export interface ResourceDetailsOutput { | ||
export interface DocumentIntelligenceResourceDetailsOutput { | ||
/** Details regarding custom document models. */ | ||
@@ -269,9 +279,9 @@ customDocumentModels: CustomDocumentModelsDetailsOutput; | ||
/** Status and result of the analyze operation. */ | ||
export interface AnalyzeResultOperationOutput { | ||
export interface AnalyzeOperationOutput { | ||
/** | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the analyze operation was submitted. */ | ||
@@ -282,3 +292,3 @@ createdDateTime: string; | ||
/** Encountered error during document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Document analysis result. */ | ||
@@ -304,3 +314,3 @@ analyzeResult?: AnalyzeResultOutput; | ||
*/ | ||
contentFormat?: ContentFormatOutput; | ||
contentFormat?: DocumentContentFormatOutput; | ||
/** | ||
@@ -328,5 +338,5 @@ * Concatenate string representation of all textual and visual elements in reading | ||
/** Extracted documents. */ | ||
documents?: Array<DocumentOutput>; | ||
documents?: Array<AnalyzedDocumentOutput>; | ||
/** List of warnings encountered. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -634,3 +644,3 @@ /** Content and layout elements extracted from a page from the input. */ | ||
*/ | ||
fontStyle?: FontStyleOutput; | ||
fontStyle?: DocumentFontStyleOutput; | ||
/** | ||
@@ -641,3 +651,3 @@ * Font weight. | ||
*/ | ||
fontWeight?: FontWeightOutput; | ||
fontWeight?: DocumentFontWeightOutput; | ||
/** Foreground color in #rrggbb hexadecimal format. */ | ||
@@ -668,3 +678,3 @@ color?: string; | ||
/** An object describing the location and semantic content of a document. */ | ||
export interface DocumentOutput { | ||
export interface AnalyzedDocumentOutput { | ||
/** Document type. */ | ||
@@ -780,9 +790,11 @@ docType: string; | ||
/** Status and result of the analyze batch operation. */ | ||
export interface AnalyzeBatchResultOperationOutput { | ||
export interface AnalyzeBatchOperationOutput { | ||
/** Analyze batch operation result ID. */ | ||
resultId?: string; | ||
/** | ||
* Operation status. notStarted, running, completed, or failed | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the operation was submitted. */ | ||
@@ -795,3 +807,3 @@ createdDateTime: string; | ||
/** Encountered error during batch document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Batch document analysis result. */ | ||
@@ -809,3 +821,3 @@ result?: AnalyzeBatchResultOutput; | ||
/** Operation detail for each document in the batch. */ | ||
details: Array<AnalyzeBatchOperationDetailOutput>; | ||
details?: Array<AnalyzeBatchOperationDetailOutput>; | ||
} | ||
@@ -817,5 +829,5 @@ /** Operation detail for a document in a batch analysis. */ | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** URL of the source document. */ | ||
@@ -826,4 +838,11 @@ sourceUrl: string; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
} | ||
/** Paged collection of AnalyzeBatchOperation items */ | ||
export interface PagedAnalyzeBatchOperationOutput { | ||
/** The AnalyzeBatchOperation items on this page */ | ||
value: Array<AnalyzeBatchOperationOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -833,3 +852,3 @@ * Authorization to copy a document model to the specified target resource and | ||
*/ | ||
export interface CopyAuthorizationOutput { | ||
export interface ModelCopyAuthorizationOutput { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -851,2 +870,16 @@ targetResourceId: string; | ||
} | ||
/** Paged collection of DocumentModelDetails items */ | ||
export interface PagedDocumentModelDetailsOutput { | ||
/** The DocumentModelDetails items on this page */ | ||
value: Array<DocumentModelDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export interface PagedDocumentClassifierDetailsOutput { | ||
/** The DocumentClassifierDetails items on this page */ | ||
value: Array<DocumentClassifierDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -874,7 +907,5 @@ * Authorization to copy a document classifier to the specified target resource and | ||
/** Operation info. */ | ||
export type OperationDetailsOutput = OperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Paged collection of OperationDetails items */ | ||
export type PagedOperationDetailsOutput = Paged<OperationDetailsOutput>; | ||
/** Alias for OperationStatusOutput */ | ||
export type OperationStatusOutput = string; | ||
export type DocumentIntelligenceOperationDetailsOutput = DocumentIntelligenceOperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Alias for DocumentIntelligenceOperationStatusOutput */ | ||
export type DocumentIntelligenceOperationStatusOutput = string; | ||
/** Alias for OperationKindOutput */ | ||
@@ -894,4 +925,4 @@ export type OperationKindOutput = string; | ||
export type StringIndexTypeOutput = string; | ||
/** Alias for ContentFormatOutput */ | ||
export type ContentFormatOutput = string; | ||
/** Alias for DocumentContentFormatOutput */ | ||
export type DocumentContentFormatOutput = string; | ||
/** Alias for LengthUnitOutput */ | ||
@@ -909,12 +940,8 @@ export type LengthUnitOutput = string; | ||
export type DocumentTableCellKindOutput = string; | ||
/** Alias for FontStyleOutput */ | ||
export type FontStyleOutput = string; | ||
/** Alias for FontWeightOutput */ | ||
export type FontWeightOutput = string; | ||
/** Alias for DocumentFontStyleOutput */ | ||
export type DocumentFontStyleOutput = string; | ||
/** Alias for DocumentFontWeightOutput */ | ||
export type DocumentFontWeightOutput = string; | ||
/** Alias for DocumentSignatureTypeOutput */ | ||
export type DocumentSignatureTypeOutput = string; | ||
/** Paged collection of DocumentModelDetails items */ | ||
export type PagedDocumentModelDetailsOutput = Paged<DocumentModelDetailsOutput>; | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export type PagedDocumentClassifierDetailsOutput = Paged<DocumentClassifierDetailsOutput>; | ||
//# sourceMappingURL=outputModels.d.ts.map |
@@ -1,4 +0,29 @@ | ||
import type { PagedAsyncIterableIterator } from "@azure/core-paging"; | ||
import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; | ||
/** | ||
* An interface that tracks the settings for paged iteration | ||
*/ | ||
export interface PageSettings { | ||
/** | ||
* The token that keeps track of where to continue the iterator | ||
*/ | ||
continuationToken?: string; | ||
} | ||
/** | ||
* An interface that allows async iterable iteration both to completion and by page. | ||
*/ | ||
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> { | ||
/** | ||
* The next method, part of the iteration protocol | ||
*/ | ||
next(): Promise<IteratorResult<TElement>>; | ||
/** | ||
* The connection to the async iterator, part of the iteration protocol | ||
*/ | ||
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>; | ||
/** | ||
* Return an AsyncIterableIterator that works a page at a time | ||
*/ | ||
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>; | ||
} | ||
/** | ||
* Helper type to extract the type of an array | ||
@@ -10,3 +35,3 @@ */ | ||
*/ | ||
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{ | ||
export type GetPage<TPage> = (pageLink: string) => Promise<{ | ||
page: TPage; | ||
@@ -13,0 +38,0 @@ nextPageLink?: string; |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { getPagedAsyncIterator } from "@azure/core-paging"; | ||
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; | ||
import { createRestError } from "@azure-rest/core-client"; | ||
/** | ||
* returns an async iterator that iterates over results. It also has a `byPage` | ||
* method that returns pages of items at once. | ||
* | ||
* @param pagedResult - an object that specifies how to get pages. | ||
* @returns a paged async iterator that iterates over results. | ||
*/ | ||
function getPagedAsyncIterator(pagedResult) { | ||
var _a; | ||
const iter = getItemAsyncIterator(pagedResult); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { | ||
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {}; | ||
return getPageAsyncIterator(pagedResult, { | ||
pageLink: continuationToken, | ||
}); | ||
}), | ||
}; | ||
} | ||
function getItemAsyncIterator(pagedResult) { | ||
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { | ||
var _a, e_1, _b, _c, _d, e_2, _e, _f; | ||
const pages = getPageAsyncIterator(pagedResult); | ||
const firstVal = yield __await(pages.next()); | ||
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is | ||
if (!Array.isArray(firstVal.value)) { | ||
// can extract elements from this page | ||
const { toElements } = pagedResult; | ||
if (toElements) { | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(firstVal.value)))); | ||
try { | ||
for (var _g = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) { | ||
_c = pages_1_1.value; | ||
_g = false; | ||
const page = _c; | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(page)))); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_g && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
else { | ||
yield yield __await(firstVal.value); | ||
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case | ||
yield __await(yield* __asyncDelegator(__asyncValues(pages))); | ||
} | ||
} | ||
else { | ||
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value))); | ||
try { | ||
for (var _h = true, pages_2 = __asyncValues(pages), pages_2_1; pages_2_1 = yield __await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) { | ||
_f = pages_2_1.value; | ||
_h = false; | ||
const page = _f; | ||
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch, | ||
// it must be the case that `TPage = TElement[]` | ||
yield __await(yield* __asyncDelegator(__asyncValues(page))); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_h && !_d && (_e = pages_2.return)) yield __await(_e.call(pages_2)); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
} | ||
}); | ||
} | ||
function getPageAsyncIterator(pagedResult_1) { | ||
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) { | ||
const { pageLink } = options; | ||
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
while (response.nextPageLink) { | ||
response = yield __await(pagedResult.getPage(response.nextPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
} | ||
}); | ||
} | ||
/** | ||
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension | ||
@@ -7,0 +104,0 @@ * @param client - Client to use for sending the next page requests |
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; | ||
import type { RequestParameters } from "@azure-rest/core-client"; | ||
import type { StringIndexType, DocumentAnalysisFeature, ContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, CopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
import type { StringIndexType, DocumentAnalysisFeature, DocumentContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, ModelCopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
export interface ListOperationsHeaders { | ||
@@ -60,6 +60,7 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
export type GetOperationParameters = GetOperationHeaderParam & RequestParameters; | ||
export type GetResourceInfoParameters = RequestParameters; | ||
export type GetResourceDetailsParameters = RequestParameters; | ||
export type GetAnalyzeResultParameters = RequestParameters; | ||
export type GetAnalyzeResultPdfParameters = RequestParameters; | ||
export type GetAnalyzeResultFigureParameters = RequestParameters; | ||
export type DeleteAnalyzeResultParameters = RequestParameters; | ||
export interface AnalyzeDocumentFromStreamBodyParam { | ||
@@ -73,4 +74,31 @@ /** | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentFromStreamQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -89,5 +117,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFromStreamFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentFromStreamQueryFieldsQueryParam; | ||
/** | ||
@@ -98,5 +126,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentFromStreamOutputQueryParam; | ||
} | ||
@@ -113,6 +141,33 @@ export interface AnalyzeDocumentFromStreamQueryParam { | ||
/** Analyze request parameters. */ | ||
body?: AnalyzeDocumentRequest; | ||
body: AnalyzeDocumentRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -131,5 +186,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentQueryFieldsQueryParam; | ||
/** | ||
@@ -140,5 +195,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentOutputQueryParam; | ||
} | ||
@@ -156,6 +211,33 @@ export interface AnalyzeDocumentQueryParam { | ||
/** Analyze batch request parameters. */ | ||
body?: AnalyzeBatchDocumentsRequest; | ||
body: AnalyzeBatchDocumentsRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeBatchDocumentsQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -174,5 +256,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeBatchDocumentsFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeBatchDocumentsQueryFieldsQueryParam; | ||
/** | ||
@@ -183,5 +265,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeBatchDocumentsOutputQueryParam; | ||
} | ||
@@ -196,2 +278,4 @@ export interface AnalyzeBatchDocumentsQueryParam { | ||
export type AnalyzeBatchDocumentsParameters = AnalyzeBatchDocumentsQueryParam & AnalyzeBatchDocumentsMediaTypesParam & AnalyzeBatchDocumentsBodyParam & RequestParameters; | ||
export type ListAnalyzeBatchResultsParameters = RequestParameters; | ||
export type DeleteAnalyzeBatchResultParameters = RequestParameters; | ||
export interface GetModelHeaders { | ||
@@ -222,3 +306,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
/** Copy to request parameters. */ | ||
body: CopyAuthorization; | ||
body: ModelCopyAuthorization; | ||
} | ||
@@ -292,3 +376,3 @@ export type CopyModelToParameters = CopyModelToBodyParam & RequestParameters; | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -321,3 +405,3 @@ } | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -324,0 +408,0 @@ } |
import type { Client } from "@azure-rest/core-client"; | ||
import type { AbortSignalLike } from "@azure/abort-controller"; | ||
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro"; | ||
import type { OperationState, PollerLike } from "@azure/core-lro"; | ||
import type { AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, AnalyzeBatchDocumentsLogicalResponse, BuildModel202Response, BuildModelDefaultResponse, BuildModelLogicalResponse, ComposeModel202Response, ComposeModelDefaultResponse, ComposeModelLogicalResponse, CopyModelTo202Response, CopyModelToDefaultResponse, CopyModelToLogicalResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, BuildClassifierLogicalResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocumentFromStreamLogicalResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse, CopyClassifierToLogicalResponse } from "./responses.js"; | ||
/** | ||
* A simple poller that can be used to poll a long running operation. | ||
* Options for `getLongRunningPoller`. | ||
*/ | ||
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> { | ||
export interface GetLongRunningPollerOptions { | ||
/** | ||
* Returns true if the poller has finished polling. | ||
* Defines how much time the poller is going to wait before making a new request to the service. | ||
*/ | ||
isDone(): boolean; | ||
intervalInMs?: number; | ||
/** | ||
* Returns the state of the operation. | ||
* A serialized poller which can be used to resume an existing paused Long-Running-Operation. | ||
*/ | ||
getOperationState(): TState; | ||
/** | ||
* Returns the id of the operation. | ||
*/ | ||
getOperationId(): string; | ||
/** | ||
* Returns the result value of the operation, | ||
* regardless of the state of the poller. | ||
* It can return undefined or an incomplete form of the final TResult value | ||
* depending on the implementation. | ||
*/ | ||
getResult(): TResult | undefined; | ||
/** | ||
* Returns a promise that will resolve once a single polling request finishes. | ||
* It does this by calling the update method of the Poller's operation. | ||
*/ | ||
poll(options?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TState>; | ||
/** | ||
* Returns a promise that will resolve once the underlying operation is completed. | ||
*/ | ||
pollUntilDone(pollOptions?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TResult>; | ||
/** | ||
* Invokes the provided callback after each polling is completed, | ||
* sending the current state of the poller's operation. | ||
* | ||
* It returns a method that can be used to stop receiving updates on the given callback function. | ||
*/ | ||
onProgress(callback: (state: TState) => void): CancelOnProgress; | ||
/** | ||
* Returns a promise that could be used for serialized version of the poller's operation | ||
* by invoking the operation's serialize method. | ||
*/ | ||
serialize(): Promise<string>; | ||
/** | ||
* Wait the poller to be submitted. | ||
*/ | ||
submitted(): Promise<void>; | ||
/** | ||
* Returns a string representation of the poller's operation. Similar to serialize but returns a string. | ||
* @deprecated Use serialize() instead. | ||
*/ | ||
toString(): string; | ||
/** | ||
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling | ||
* @deprecated Use abortSignal to stop polling instead. | ||
*/ | ||
stopPolling(): void; | ||
/** | ||
* Returns true if the poller is stopped. | ||
* @deprecated Use abortSignal status to track this instead. | ||
*/ | ||
isStopped(): boolean; | ||
restoreFrom?: string; | ||
} | ||
@@ -80,10 +24,18 @@ /** | ||
*/ | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export declare function parseResultIdFromResponse(initialResponse: { | ||
headers: { | ||
"operation-location": string; | ||
}; | ||
}): string; | ||
//# sourceMappingURL=pollingHelper.d.ts.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { createHttpPoller } from "@azure/core-lro"; | ||
export async function getLongRunningPoller(client, initialResponse, options = {}) { | ||
var _a; | ||
export function getLongRunningPoller(client, initialResponse, options = {}) { | ||
const abortController = new AbortController(); | ||
@@ -46,47 +45,3 @@ const poller = { | ||
}; | ||
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true; | ||
const httpPoller = createHttpPoller(poller, Object.assign(Object.assign({}, options), { updateState: (state, response) => { | ||
const flatResponse = response.flatResponse; | ||
if (!("body" in flatResponse)) | ||
return; | ||
const flatResponseBody = flatResponse.body; | ||
if (!("status" in flatResponseBody && flatResponseBody.status === "completed")) | ||
return; | ||
state.status = "succeeded"; | ||
} })); | ||
const simplePoller = { | ||
isDone() { | ||
return httpPoller.isDone; | ||
}, | ||
isStopped() { | ||
return abortController.signal.aborted; | ||
}, | ||
getOperationState() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return httpPoller.operationState; | ||
}, | ||
getResult() { | ||
return httpPoller.result; | ||
}, | ||
toString() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return JSON.stringify({ | ||
state: httpPoller.operationState, | ||
}); | ||
}, | ||
stopPolling() { | ||
abortController.abort(); | ||
}, | ||
onProgress: httpPoller.onProgress, | ||
poll: httpPoller.poll, | ||
pollUntilDone: httpPoller.pollUntilDone, | ||
serialize: httpPoller.serialize, | ||
submitted: httpPoller.submitted, | ||
getOperationId: () => parseOperationId(initialResponse.headers["operation-location"]), | ||
}; | ||
return simplePoller; | ||
return createHttpPoller(poller, options); | ||
} | ||
@@ -96,3 +51,3 @@ /** | ||
*/ | ||
function parseOperationId(operationLocationHeader) { | ||
function parseResultId(operationLocationHeader) { | ||
// regex to extract the operation id from the operation-location header with the regex "[^:]+://[^/]+/documentintelligence/.+/([^?/]+)" | ||
@@ -102,3 +57,3 @@ const regex = /[^:]+:\/\/[^/]+\/documentintelligence\/.+\/([^?/]+)/; | ||
if (!match) { | ||
throw new Error(`Failed to parse operation id from the operation-location header: ${operationLocationHeader}`); | ||
throw new Error(`Failed to parse result id from the operation-location header: ${operationLocationHeader}`); | ||
} | ||
@@ -108,2 +63,9 @@ return match[1]; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export function parseResultIdFromResponse(initialResponse) { | ||
const operationLocationHeader = initialResponse.headers["operation-location"]; | ||
return parseResultId(operationLocationHeader); | ||
} | ||
/** | ||
* Converts a Rest Client response to a response that the LRO implementation understands | ||
@@ -110,0 +72,0 @@ * @param response - a rest client http response |
import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; | ||
import type { HttpResponse } from "@azure-rest/core-client"; | ||
import type { PagedOperationDetailsOutput, ErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, OperationDetailsOutput, ResourceDetailsOutput, AnalyzeResultOperationOutput, AnalyzeBatchResultOperationOutput, DocumentModelDetailsOutput, CopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
import type { PagedDocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, DocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceResourceDetailsOutput, AnalyzeOperationOutput, AnalyzeBatchOperationOutput, PagedAnalyzeBatchOperationOutput, DocumentModelDetailsOutput, ModelCopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
export interface ListOperations200Headers { | ||
@@ -11,3 +11,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: "200"; | ||
body: PagedOperationDetailsOutput; | ||
body: PagedDocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & ListOperations200Headers; | ||
@@ -17,3 +17,3 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -32,3 +32,3 @@ export interface GetDocumentModelBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -47,3 +47,3 @@ export interface GetDocumentModelComposeOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -62,3 +62,3 @@ export interface GetDocumentModelCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -77,3 +77,3 @@ export interface GetDocumentClassifierCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -92,3 +92,3 @@ export interface GetDocumentClassifierBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -102,3 +102,3 @@ export interface GetOperation200Headers { | ||
status: "200"; | ||
body: OperationDetailsOutput; | ||
body: DocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & GetOperation200Headers; | ||
@@ -108,12 +108,12 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** The request has succeeded. */ | ||
export interface GetResourceInfo200Response extends HttpResponse { | ||
export interface GetResourceDetails200Response extends HttpResponse { | ||
status: "200"; | ||
body: ResourceDetailsOutput; | ||
body: DocumentIntelligenceResourceDetailsOutput; | ||
} | ||
export interface GetResourceInfoDefaultResponse extends HttpResponse { | ||
export interface GetResourceDetailsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -123,7 +123,7 @@ /** The request has succeeded. */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -143,3 +143,3 @@ export interface GetAnalyzeResultPdf200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -159,4 +159,12 @@ export interface GetAnalyzeResultFigure200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface AnalyzeDocumentFromStream202Headers { | ||
@@ -174,3 +182,3 @@ /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -193,3 +201,3 @@ /** The final response for long-running analyzeDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -203,7 +211,7 @@ /** The final response for long-running analyzeDocument operation */ | ||
status: "200"; | ||
body: AnalyzeBatchResultOperationOutput; | ||
body: AnalyzeBatchOperationOutput; | ||
} | ||
export interface GetAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -222,3 +230,3 @@ export interface AnalyzeBatchDocuments202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -229,2 +237,19 @@ /** The final response for long-running analyzeBatchDocuments operation */ | ||
} | ||
/** The request has succeeded. */ | ||
export interface ListAnalyzeBatchResults200Response extends HttpResponse { | ||
status: "200"; | ||
body: PagedAnalyzeBatchOperationOutput; | ||
} | ||
export interface ListAnalyzeBatchResultsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeBatchResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface GetModel200Headers { | ||
@@ -242,3 +267,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -257,3 +282,3 @@ export interface BuildModel202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -276,3 +301,3 @@ /** The final response for long-running buildModel operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -286,7 +311,7 @@ /** The final response for long-running composeModel operation */ | ||
status: "200"; | ||
body: CopyAuthorizationOutput; | ||
body: ModelCopyAuthorizationOutput; | ||
} | ||
export interface AuthorizeModelCopyDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -305,3 +330,3 @@ export interface CopyModelTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -324,3 +349,3 @@ /** The final response for long-running copyModelTo operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -338,3 +363,3 @@ export interface DeleteModel204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -353,3 +378,3 @@ export interface BuildClassifier202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -372,3 +397,3 @@ /** The final response for long-running buildClassifier operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -387,3 +412,3 @@ export interface GetClassifier200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -401,3 +426,3 @@ export interface DeleteClassifier204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -416,3 +441,3 @@ export interface ClassifyDocumentFromStream202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -435,3 +460,3 @@ /** The final response for long-running classifyDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -445,7 +470,7 @@ /** The final response for long-running classifyDocument operation */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetClassifyResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -459,3 +484,3 @@ /** The request has succeeded. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -474,3 +499,3 @@ export interface CopyClassifierTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -477,0 +502,0 @@ /** The final response for long-running copyClassifierTo operation */ |
@@ -1,3 +0,3 @@ | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceInfoParameters, GetAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceDetailsParameters, GetAnalyzeResultParameters, DeleteAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, DeleteAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, ListAnalyzeBatchResultsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { Client, StreamableMethod } from "@azure-rest/core-client"; | ||
@@ -22,5 +22,5 @@ export interface ListOperations { | ||
} | ||
export interface GetResourceInfo { | ||
export interface GetResourceDetails { | ||
/** Return information about the current resource. */ | ||
get(options?: GetResourceInfoParameters): StreamableMethod<GetResourceInfo200Response | GetResourceInfoDefaultResponse>; | ||
get(options?: GetResourceDetailsParameters): StreamableMethod<GetResourceDetails200Response | GetResourceDetailsDefaultResponse>; | ||
} | ||
@@ -30,2 +30,4 @@ export interface GetAnalyzeResult { | ||
get(options?: GetAnalyzeResultParameters): StreamableMethod<GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse>; | ||
/** Mark the result of document analysis for deletion. */ | ||
delete(options?: DeleteAnalyzeResultParameters): StreamableMethod<DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse>; | ||
} | ||
@@ -49,2 +51,4 @@ export interface GetAnalyzeResultPdf { | ||
get(options?: GetAnalyzeBatchResultParameters): StreamableMethod<GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse>; | ||
/** Mark the batch document analysis result for deletion. */ | ||
delete(options?: DeleteAnalyzeBatchResultParameters): StreamableMethod<DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse>; | ||
} | ||
@@ -55,2 +59,6 @@ export interface AnalyzeBatchDocuments { | ||
} | ||
export interface ListAnalyzeBatchResults { | ||
/** List batch document analysis results. */ | ||
get(options?: ListAnalyzeBatchResultsParameters): StreamableMethod<ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse>; | ||
} | ||
export interface GetModel { | ||
@@ -126,4 +134,4 @@ /** Gets detailed document model information. */ | ||
/** Resource for '/info' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceInfo; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceDetails; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeResults/{resultId}", modelId: string, resultId: string): GetAnalyzeResult; | ||
@@ -136,6 +144,8 @@ /** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}/pdf' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}:analyze", modelId: string): AnalyzeDocumentFromStream; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get */ | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults/{resultId}", modelId: string, resultId: string): GetAnalyzeBatchResult; | ||
/** Resource for '/documentModels/\{modelId\}:analyzeBatch' has methods for the following verbs: post */ | ||
(path: "/documentModels/{modelId}:analyzeBatch", modelId: string): AnalyzeBatchDocuments; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults", modelId: string): ListAnalyzeBatchResults; | ||
/** Resource for '/documentModels/\{modelId\}' has methods for the following verbs: get, delete */ | ||
@@ -142,0 +152,0 @@ (path: "/documentModels/{modelId}", modelId: string): GetModel; |
@@ -17,5 +17,5 @@ "use strict"; | ||
var _b, _c, _d, _e, _f, _g, _h, _j; | ||
var { apiVersion = "2024-07-31-preview" } = _a, options = tslib_1.__rest(_a, ["apiVersion"]); | ||
var { apiVersion = "2024-11-30" } = _a, options = tslib_1.__rest(_a, ["apiVersion"]); | ||
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.1`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`; | ||
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
@@ -22,0 +22,0 @@ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` |
@@ -1,2 +0,2 @@ | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
export declare function isUnexpected(response: ListOperations200Response | ListOperationsDefaultResponse): response is ListOperationsDefaultResponse; | ||
@@ -9,4 +9,5 @@ export declare function isUnexpected(response: GetDocumentModelBuildOperation200Response | GetDocumentModelBuildOperationDefaultResponse): response is GetDocumentModelBuildOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetOperation200Response | GetOperationDefaultResponse): response is GetOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceInfo200Response | GetResourceInfoDefaultResponse): response is GetResourceInfoDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceDetails200Response | GetResourceDetailsDefaultResponse): response is GetResourceDetailsDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse): response is GetAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse): response is DeleteAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResultPdf200Response | GetAnalyzeResultPdfDefaultResponse): response is GetAnalyzeResultPdfDefaultResponse; | ||
@@ -17,3 +18,5 @@ export declare function isUnexpected(response: GetAnalyzeResultFigure200Response | GetAnalyzeResultFigureDefaultResponse): response is GetAnalyzeResultFigureDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse): response is GetAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse): response is DeleteAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse): response is AnalyzeBatchDocumentsDefaultResponse; | ||
export declare function isUnexpected(response: ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse): response is ListAnalyzeBatchResultsDefaultResponse; | ||
export declare function isUnexpected(response: GetModel200Response | GetModelDefaultResponse): response is GetModelDefaultResponse; | ||
@@ -20,0 +23,0 @@ export declare function isUnexpected(response: DeleteModel204Response | DeleteModelDefaultResponse): response is DeleteModelDefaultResponse; |
@@ -11,2 +11,3 @@ "use strict"; | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}/pdf": ["200"], | ||
@@ -17,4 +18,6 @@ "GET /documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}": ["200"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}:analyzeBatch": ["200", "202"], | ||
"POST /documentModels/{modelId}:analyzeBatch": ["202"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults": ["200"], | ||
"GET /documentModels/{modelId}": ["200"], | ||
@@ -21,0 +24,0 @@ "DELETE /documentModels/{modelId}": ["204"], |
@@ -22,3 +22,3 @@ /** Azure Blob Storage content. */ | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -117,3 +117,3 @@ buildMode?: DocumentBuildMode; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -170,3 +170,3 @@ buildMode: DocumentBuildMode; | ||
*/ | ||
export interface CopyAuthorization { | ||
export interface ModelCopyAuthorization { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -253,6 +253,6 @@ targetResourceId: string; | ||
export type StringIndexType = string; | ||
/** Alias for ContentFormat */ | ||
export type ContentFormat = string; | ||
/** Alias for DocumentContentFormat */ | ||
export type DocumentContentFormat = string; | ||
/** Alias for AnalyzeOutputOption */ | ||
export type AnalyzeOutputOption = string; | ||
//# sourceMappingURL=models.d.ts.map |
@@ -1,4 +0,10 @@ | ||
import type { Paged } from "@azure/core-paging"; | ||
/** Paged collection of DocumentIntelligenceOperationDetails items */ | ||
export interface PagedDocumentIntelligenceOperationDetailsOutput { | ||
/** The DocumentIntelligenceOperationDetails items on this page */ | ||
value: Array<DocumentIntelligenceOperationDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Operation info. */ | ||
export interface OperationDetailsOutputParent { | ||
export interface DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation ID */ | ||
@@ -9,5 +15,5 @@ operationId: string; | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Operation progress (0-100). */ | ||
@@ -26,7 +32,7 @@ percentCompleted?: number; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
kind: OperationKindOutput; | ||
} | ||
/** The error object. */ | ||
export interface ErrorModelOutput { | ||
export interface DocumentIntelligenceErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -39,8 +45,8 @@ code: string; | ||
/** An array of details about specific errors that led to this reported error. */ | ||
details?: Array<ErrorModelOutput>; | ||
details?: Array<DocumentIntelligenceErrorOutput>; | ||
/** An object containing more specific information than the current object about the error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** An object containing more specific information about the error. */ | ||
export interface InnerErrorOutput { | ||
export interface DocumentIntelligenceInnerErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -51,6 +57,6 @@ code?: string; | ||
/** Inner error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** Get Operation response object. */ | ||
export interface DocumentModelBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -71,2 +77,4 @@ result?: DocumentModelDetailsOutput; | ||
readonly expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document model. */ | ||
@@ -79,3 +87,3 @@ readonly apiVersion?: string; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -104,3 +112,3 @@ readonly buildMode?: DocumentBuildModeOutput; | ||
/** List of warnings encountered while building the model. */ | ||
readonly warnings?: Array<WarningOutput>; | ||
readonly warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
/** Number of V100-equivalent GPU hours consumed for model training. */ | ||
@@ -130,3 +138,3 @@ readonly trainingHours?: number; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -167,3 +175,3 @@ buildMode?: DocumentBuildModeOutput; | ||
/** The error object. */ | ||
export interface WarningOutput { | ||
export interface DocumentIntelligenceWarningOutput { | ||
/** One of a server-defined set of warning codes. */ | ||
@@ -177,3 +185,3 @@ code: string; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelComposeOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelComposeOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -185,3 +193,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -193,3 +201,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -210,2 +218,4 @@ result?: DocumentClassifierDetailsOutput; | ||
expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document classifier. */ | ||
@@ -218,3 +228,3 @@ apiVersion: string; | ||
/** List of warnings encountered while building the classifier. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -243,3 +253,3 @@ /** Classifier document type info. */ | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -251,8 +261,8 @@ result?: DocumentClassifierDetailsOutput; | ||
/** Error response object. */ | ||
export interface ErrorResponseOutput { | ||
export interface DocumentIntelligenceErrorResponseOutput { | ||
/** Error info. */ | ||
error: ErrorModelOutput; | ||
error: DocumentIntelligenceErrorOutput; | ||
} | ||
/** General information regarding the current resource. */ | ||
export interface ResourceDetailsOutput { | ||
export interface DocumentIntelligenceResourceDetailsOutput { | ||
/** Details regarding custom document models. */ | ||
@@ -269,9 +279,9 @@ customDocumentModels: CustomDocumentModelsDetailsOutput; | ||
/** Status and result of the analyze operation. */ | ||
export interface AnalyzeResultOperationOutput { | ||
export interface AnalyzeOperationOutput { | ||
/** | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the analyze operation was submitted. */ | ||
@@ -282,3 +292,3 @@ createdDateTime: string; | ||
/** Encountered error during document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Document analysis result. */ | ||
@@ -304,3 +314,3 @@ analyzeResult?: AnalyzeResultOutput; | ||
*/ | ||
contentFormat?: ContentFormatOutput; | ||
contentFormat?: DocumentContentFormatOutput; | ||
/** | ||
@@ -328,5 +338,5 @@ * Concatenate string representation of all textual and visual elements in reading | ||
/** Extracted documents. */ | ||
documents?: Array<DocumentOutput>; | ||
documents?: Array<AnalyzedDocumentOutput>; | ||
/** List of warnings encountered. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -634,3 +644,3 @@ /** Content and layout elements extracted from a page from the input. */ | ||
*/ | ||
fontStyle?: FontStyleOutput; | ||
fontStyle?: DocumentFontStyleOutput; | ||
/** | ||
@@ -641,3 +651,3 @@ * Font weight. | ||
*/ | ||
fontWeight?: FontWeightOutput; | ||
fontWeight?: DocumentFontWeightOutput; | ||
/** Foreground color in #rrggbb hexadecimal format. */ | ||
@@ -668,3 +678,3 @@ color?: string; | ||
/** An object describing the location and semantic content of a document. */ | ||
export interface DocumentOutput { | ||
export interface AnalyzedDocumentOutput { | ||
/** Document type. */ | ||
@@ -780,9 +790,11 @@ docType: string; | ||
/** Status and result of the analyze batch operation. */ | ||
export interface AnalyzeBatchResultOperationOutput { | ||
export interface AnalyzeBatchOperationOutput { | ||
/** Analyze batch operation result ID. */ | ||
resultId?: string; | ||
/** | ||
* Operation status. notStarted, running, completed, or failed | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the operation was submitted. */ | ||
@@ -795,3 +807,3 @@ createdDateTime: string; | ||
/** Encountered error during batch document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Batch document analysis result. */ | ||
@@ -809,3 +821,3 @@ result?: AnalyzeBatchResultOutput; | ||
/** Operation detail for each document in the batch. */ | ||
details: Array<AnalyzeBatchOperationDetailOutput>; | ||
details?: Array<AnalyzeBatchOperationDetailOutput>; | ||
} | ||
@@ -817,5 +829,5 @@ /** Operation detail for a document in a batch analysis. */ | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** URL of the source document. */ | ||
@@ -826,4 +838,11 @@ sourceUrl: string; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
} | ||
/** Paged collection of AnalyzeBatchOperation items */ | ||
export interface PagedAnalyzeBatchOperationOutput { | ||
/** The AnalyzeBatchOperation items on this page */ | ||
value: Array<AnalyzeBatchOperationOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -833,3 +852,3 @@ * Authorization to copy a document model to the specified target resource and | ||
*/ | ||
export interface CopyAuthorizationOutput { | ||
export interface ModelCopyAuthorizationOutput { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -851,2 +870,16 @@ targetResourceId: string; | ||
} | ||
/** Paged collection of DocumentModelDetails items */ | ||
export interface PagedDocumentModelDetailsOutput { | ||
/** The DocumentModelDetails items on this page */ | ||
value: Array<DocumentModelDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export interface PagedDocumentClassifierDetailsOutput { | ||
/** The DocumentClassifierDetails items on this page */ | ||
value: Array<DocumentClassifierDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -874,7 +907,5 @@ * Authorization to copy a document classifier to the specified target resource and | ||
/** Operation info. */ | ||
export type OperationDetailsOutput = OperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Paged collection of OperationDetails items */ | ||
export type PagedOperationDetailsOutput = Paged<OperationDetailsOutput>; | ||
/** Alias for OperationStatusOutput */ | ||
export type OperationStatusOutput = string; | ||
export type DocumentIntelligenceOperationDetailsOutput = DocumentIntelligenceOperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Alias for DocumentIntelligenceOperationStatusOutput */ | ||
export type DocumentIntelligenceOperationStatusOutput = string; | ||
/** Alias for OperationKindOutput */ | ||
@@ -894,4 +925,4 @@ export type OperationKindOutput = string; | ||
export type StringIndexTypeOutput = string; | ||
/** Alias for ContentFormatOutput */ | ||
export type ContentFormatOutput = string; | ||
/** Alias for DocumentContentFormatOutput */ | ||
export type DocumentContentFormatOutput = string; | ||
/** Alias for LengthUnitOutput */ | ||
@@ -909,12 +940,8 @@ export type LengthUnitOutput = string; | ||
export type DocumentTableCellKindOutput = string; | ||
/** Alias for FontStyleOutput */ | ||
export type FontStyleOutput = string; | ||
/** Alias for FontWeightOutput */ | ||
export type FontWeightOutput = string; | ||
/** Alias for DocumentFontStyleOutput */ | ||
export type DocumentFontStyleOutput = string; | ||
/** Alias for DocumentFontWeightOutput */ | ||
export type DocumentFontWeightOutput = string; | ||
/** Alias for DocumentSignatureTypeOutput */ | ||
export type DocumentSignatureTypeOutput = string; | ||
/** Paged collection of DocumentModelDetails items */ | ||
export type PagedDocumentModelDetailsOutput = Paged<DocumentModelDetailsOutput>; | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export type PagedDocumentClassifierDetailsOutput = Paged<DocumentClassifierDetailsOutput>; | ||
//# sourceMappingURL=outputModels.d.ts.map |
@@ -1,4 +0,29 @@ | ||
import type { PagedAsyncIterableIterator } from "@azure/core-paging"; | ||
import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; | ||
/** | ||
* An interface that tracks the settings for paged iteration | ||
*/ | ||
export interface PageSettings { | ||
/** | ||
* The token that keeps track of where to continue the iterator | ||
*/ | ||
continuationToken?: string; | ||
} | ||
/** | ||
* An interface that allows async iterable iteration both to completion and by page. | ||
*/ | ||
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> { | ||
/** | ||
* The next method, part of the iteration protocol | ||
*/ | ||
next(): Promise<IteratorResult<TElement>>; | ||
/** | ||
* The connection to the async iterator, part of the iteration protocol | ||
*/ | ||
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>; | ||
/** | ||
* Return an AsyncIterableIterator that works a page at a time | ||
*/ | ||
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>; | ||
} | ||
/** | ||
* Helper type to extract the type of an array | ||
@@ -10,3 +35,3 @@ */ | ||
*/ | ||
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{ | ||
export type GetPage<TPage> = (pageLink: string) => Promise<{ | ||
page: TPage; | ||
@@ -13,0 +38,0 @@ nextPageLink?: string; |
@@ -6,5 +6,102 @@ "use strict"; | ||
exports.paginate = paginate; | ||
const core_paging_1 = require("@azure/core-paging"); | ||
const tslib_1 = require("tslib"); | ||
const core_client_1 = require("@azure-rest/core-client"); | ||
/** | ||
* returns an async iterator that iterates over results. It also has a `byPage` | ||
* method that returns pages of items at once. | ||
* | ||
* @param pagedResult - an object that specifies how to get pages. | ||
* @returns a paged async iterator that iterates over results. | ||
*/ | ||
function getPagedAsyncIterator(pagedResult) { | ||
var _a; | ||
const iter = getItemAsyncIterator(pagedResult); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { | ||
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {}; | ||
return getPageAsyncIterator(pagedResult, { | ||
pageLink: continuationToken, | ||
}); | ||
}), | ||
}; | ||
} | ||
function getItemAsyncIterator(pagedResult) { | ||
return tslib_1.__asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { | ||
var _a, e_1, _b, _c, _d, e_2, _e, _f; | ||
const pages = getPageAsyncIterator(pagedResult); | ||
const firstVal = yield tslib_1.__await(pages.next()); | ||
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is | ||
if (!Array.isArray(firstVal.value)) { | ||
// can extract elements from this page | ||
const { toElements } = pagedResult; | ||
if (toElements) { | ||
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(toElements(firstVal.value)))); | ||
try { | ||
for (var _g = true, pages_1 = tslib_1.__asyncValues(pages), pages_1_1; pages_1_1 = yield tslib_1.__await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) { | ||
_c = pages_1_1.value; | ||
_g = false; | ||
const page = _c; | ||
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(toElements(page)))); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_g && !_a && (_b = pages_1.return)) yield tslib_1.__await(_b.call(pages_1)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
else { | ||
yield yield tslib_1.__await(firstVal.value); | ||
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case | ||
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(pages))); | ||
} | ||
} | ||
else { | ||
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(firstVal.value))); | ||
try { | ||
for (var _h = true, pages_2 = tslib_1.__asyncValues(pages), pages_2_1; pages_2_1 = yield tslib_1.__await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) { | ||
_f = pages_2_1.value; | ||
_h = false; | ||
const page = _f; | ||
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch, | ||
// it must be the case that `TPage = TElement[]` | ||
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page))); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_h && !_d && (_e = pages_2.return)) yield tslib_1.__await(_e.call(pages_2)); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
} | ||
}); | ||
} | ||
function getPageAsyncIterator(pagedResult_1) { | ||
return tslib_1.__asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) { | ||
const { pageLink } = options; | ||
let response = yield tslib_1.__await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink)); | ||
if (!response) { | ||
return yield tslib_1.__await(void 0); | ||
} | ||
yield yield tslib_1.__await(response.page); | ||
while (response.nextPageLink) { | ||
response = yield tslib_1.__await(pagedResult.getPage(response.nextPageLink)); | ||
if (!response) { | ||
return yield tslib_1.__await(void 0); | ||
} | ||
yield yield tslib_1.__await(response.page); | ||
} | ||
}); | ||
} | ||
/** | ||
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension | ||
@@ -37,3 +134,3 @@ * @param client - Client to use for sending the next page requests | ||
}; | ||
return (0, core_paging_1.getPagedAsyncIterator)(pagedResult); | ||
return getPagedAsyncIterator(pagedResult); | ||
} | ||
@@ -40,0 +137,0 @@ /** |
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; | ||
import type { RequestParameters } from "@azure-rest/core-client"; | ||
import type { StringIndexType, DocumentAnalysisFeature, ContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, CopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
import type { StringIndexType, DocumentAnalysisFeature, DocumentContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, ModelCopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
export interface ListOperationsHeaders { | ||
@@ -60,6 +60,7 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
export type GetOperationParameters = GetOperationHeaderParam & RequestParameters; | ||
export type GetResourceInfoParameters = RequestParameters; | ||
export type GetResourceDetailsParameters = RequestParameters; | ||
export type GetAnalyzeResultParameters = RequestParameters; | ||
export type GetAnalyzeResultPdfParameters = RequestParameters; | ||
export type GetAnalyzeResultFigureParameters = RequestParameters; | ||
export type DeleteAnalyzeResultParameters = RequestParameters; | ||
export interface AnalyzeDocumentFromStreamBodyParam { | ||
@@ -73,4 +74,31 @@ /** | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentFromStreamQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -89,5 +117,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFromStreamFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentFromStreamQueryFieldsQueryParam; | ||
/** | ||
@@ -98,5 +126,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentFromStreamOutputQueryParam; | ||
} | ||
@@ -113,6 +141,33 @@ export interface AnalyzeDocumentFromStreamQueryParam { | ||
/** Analyze request parameters. */ | ||
body?: AnalyzeDocumentRequest; | ||
body: AnalyzeDocumentRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -131,5 +186,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentQueryFieldsQueryParam; | ||
/** | ||
@@ -140,5 +195,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentOutputQueryParam; | ||
} | ||
@@ -156,6 +211,33 @@ export interface AnalyzeDocumentQueryParam { | ||
/** Analyze batch request parameters. */ | ||
body?: AnalyzeBatchDocumentsRequest; | ||
body: AnalyzeBatchDocumentsRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeBatchDocumentsQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -174,5 +256,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeBatchDocumentsFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeBatchDocumentsQueryFieldsQueryParam; | ||
/** | ||
@@ -183,5 +265,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeBatchDocumentsOutputQueryParam; | ||
} | ||
@@ -196,2 +278,4 @@ export interface AnalyzeBatchDocumentsQueryParam { | ||
export type AnalyzeBatchDocumentsParameters = AnalyzeBatchDocumentsQueryParam & AnalyzeBatchDocumentsMediaTypesParam & AnalyzeBatchDocumentsBodyParam & RequestParameters; | ||
export type ListAnalyzeBatchResultsParameters = RequestParameters; | ||
export type DeleteAnalyzeBatchResultParameters = RequestParameters; | ||
export interface GetModelHeaders { | ||
@@ -222,3 +306,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
/** Copy to request parameters. */ | ||
body: CopyAuthorization; | ||
body: ModelCopyAuthorization; | ||
} | ||
@@ -292,3 +376,3 @@ export type CopyModelToParameters = CopyModelToBodyParam & RequestParameters; | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -321,3 +405,3 @@ } | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -324,0 +408,0 @@ } |
import type { Client } from "@azure-rest/core-client"; | ||
import type { AbortSignalLike } from "@azure/abort-controller"; | ||
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro"; | ||
import type { OperationState, PollerLike } from "@azure/core-lro"; | ||
import type { AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, AnalyzeBatchDocumentsLogicalResponse, BuildModel202Response, BuildModelDefaultResponse, BuildModelLogicalResponse, ComposeModel202Response, ComposeModelDefaultResponse, ComposeModelLogicalResponse, CopyModelTo202Response, CopyModelToDefaultResponse, CopyModelToLogicalResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, BuildClassifierLogicalResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocumentFromStreamLogicalResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse, CopyClassifierToLogicalResponse } from "./responses.js"; | ||
/** | ||
* A simple poller that can be used to poll a long running operation. | ||
* Options for `getLongRunningPoller`. | ||
*/ | ||
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> { | ||
export interface GetLongRunningPollerOptions { | ||
/** | ||
* Returns true if the poller has finished polling. | ||
* Defines how much time the poller is going to wait before making a new request to the service. | ||
*/ | ||
isDone(): boolean; | ||
intervalInMs?: number; | ||
/** | ||
* Returns the state of the operation. | ||
* A serialized poller which can be used to resume an existing paused Long-Running-Operation. | ||
*/ | ||
getOperationState(): TState; | ||
/** | ||
* Returns the id of the operation. | ||
*/ | ||
getOperationId(): string; | ||
/** | ||
* Returns the result value of the operation, | ||
* regardless of the state of the poller. | ||
* It can return undefined or an incomplete form of the final TResult value | ||
* depending on the implementation. | ||
*/ | ||
getResult(): TResult | undefined; | ||
/** | ||
* Returns a promise that will resolve once a single polling request finishes. | ||
* It does this by calling the update method of the Poller's operation. | ||
*/ | ||
poll(options?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TState>; | ||
/** | ||
* Returns a promise that will resolve once the underlying operation is completed. | ||
*/ | ||
pollUntilDone(pollOptions?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TResult>; | ||
/** | ||
* Invokes the provided callback after each polling is completed, | ||
* sending the current state of the poller's operation. | ||
* | ||
* It returns a method that can be used to stop receiving updates on the given callback function. | ||
*/ | ||
onProgress(callback: (state: TState) => void): CancelOnProgress; | ||
/** | ||
* Returns a promise that could be used for serialized version of the poller's operation | ||
* by invoking the operation's serialize method. | ||
*/ | ||
serialize(): Promise<string>; | ||
/** | ||
* Wait the poller to be submitted. | ||
*/ | ||
submitted(): Promise<void>; | ||
/** | ||
* Returns a string representation of the poller's operation. Similar to serialize but returns a string. | ||
* @deprecated Use serialize() instead. | ||
*/ | ||
toString(): string; | ||
/** | ||
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling | ||
* @deprecated Use abortSignal to stop polling instead. | ||
*/ | ||
stopPolling(): void; | ||
/** | ||
* Returns true if the poller is stopped. | ||
* @deprecated Use abortSignal status to track this instead. | ||
*/ | ||
isStopped(): boolean; | ||
restoreFrom?: string; | ||
} | ||
@@ -80,10 +24,18 @@ /** | ||
*/ | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export declare function parseResultIdFromResponse(initialResponse: { | ||
headers: { | ||
"operation-location": string; | ||
}; | ||
}): string; | ||
//# sourceMappingURL=pollingHelper.d.ts.map |
@@ -6,5 +6,5 @@ "use strict"; | ||
exports.getLongRunningPoller = getLongRunningPoller; | ||
exports.parseResultIdFromResponse = parseResultIdFromResponse; | ||
const core_lro_1 = require("@azure/core-lro"); | ||
async function getLongRunningPoller(client, initialResponse, options = {}) { | ||
var _a; | ||
function getLongRunningPoller(client, initialResponse, options = {}) { | ||
const abortController = new AbortController(); | ||
@@ -50,47 +50,3 @@ const poller = { | ||
}; | ||
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true; | ||
const httpPoller = (0, core_lro_1.createHttpPoller)(poller, Object.assign(Object.assign({}, options), { updateState: (state, response) => { | ||
const flatResponse = response.flatResponse; | ||
if (!("body" in flatResponse)) | ||
return; | ||
const flatResponseBody = flatResponse.body; | ||
if (!("status" in flatResponseBody && flatResponseBody.status === "completed")) | ||
return; | ||
state.status = "succeeded"; | ||
} })); | ||
const simplePoller = { | ||
isDone() { | ||
return httpPoller.isDone; | ||
}, | ||
isStopped() { | ||
return abortController.signal.aborted; | ||
}, | ||
getOperationState() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return httpPoller.operationState; | ||
}, | ||
getResult() { | ||
return httpPoller.result; | ||
}, | ||
toString() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return JSON.stringify({ | ||
state: httpPoller.operationState, | ||
}); | ||
}, | ||
stopPolling() { | ||
abortController.abort(); | ||
}, | ||
onProgress: httpPoller.onProgress, | ||
poll: httpPoller.poll, | ||
pollUntilDone: httpPoller.pollUntilDone, | ||
serialize: httpPoller.serialize, | ||
submitted: httpPoller.submitted, | ||
getOperationId: () => parseOperationId(initialResponse.headers["operation-location"]), | ||
}; | ||
return simplePoller; | ||
return (0, core_lro_1.createHttpPoller)(poller, options); | ||
} | ||
@@ -100,3 +56,3 @@ /** | ||
*/ | ||
function parseOperationId(operationLocationHeader) { | ||
function parseResultId(operationLocationHeader) { | ||
// regex to extract the operation id from the operation-location header with the regex "[^:]+://[^/]+/documentintelligence/.+/([^?/]+)" | ||
@@ -106,3 +62,3 @@ const regex = /[^:]+:\/\/[^/]+\/documentintelligence\/.+\/([^?/]+)/; | ||
if (!match) { | ||
throw new Error(`Failed to parse operation id from the operation-location header: ${operationLocationHeader}`); | ||
throw new Error(`Failed to parse result id from the operation-location header: ${operationLocationHeader}`); | ||
} | ||
@@ -112,2 +68,9 @@ return match[1]; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
function parseResultIdFromResponse(initialResponse) { | ||
const operationLocationHeader = initialResponse.headers["operation-location"]; | ||
return parseResultId(operationLocationHeader); | ||
} | ||
/** | ||
* Converts a Rest Client response to a response that the LRO implementation understands | ||
@@ -114,0 +77,0 @@ * @param response - a rest client http response |
import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; | ||
import type { HttpResponse } from "@azure-rest/core-client"; | ||
import type { PagedOperationDetailsOutput, ErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, OperationDetailsOutput, ResourceDetailsOutput, AnalyzeResultOperationOutput, AnalyzeBatchResultOperationOutput, DocumentModelDetailsOutput, CopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
import type { PagedDocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, DocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceResourceDetailsOutput, AnalyzeOperationOutput, AnalyzeBatchOperationOutput, PagedAnalyzeBatchOperationOutput, DocumentModelDetailsOutput, ModelCopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
export interface ListOperations200Headers { | ||
@@ -11,3 +11,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: "200"; | ||
body: PagedOperationDetailsOutput; | ||
body: PagedDocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & ListOperations200Headers; | ||
@@ -17,3 +17,3 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -32,3 +32,3 @@ export interface GetDocumentModelBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -47,3 +47,3 @@ export interface GetDocumentModelComposeOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -62,3 +62,3 @@ export interface GetDocumentModelCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -77,3 +77,3 @@ export interface GetDocumentClassifierCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -92,3 +92,3 @@ export interface GetDocumentClassifierBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -102,3 +102,3 @@ export interface GetOperation200Headers { | ||
status: "200"; | ||
body: OperationDetailsOutput; | ||
body: DocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & GetOperation200Headers; | ||
@@ -108,12 +108,12 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** The request has succeeded. */ | ||
export interface GetResourceInfo200Response extends HttpResponse { | ||
export interface GetResourceDetails200Response extends HttpResponse { | ||
status: "200"; | ||
body: ResourceDetailsOutput; | ||
body: DocumentIntelligenceResourceDetailsOutput; | ||
} | ||
export interface GetResourceInfoDefaultResponse extends HttpResponse { | ||
export interface GetResourceDetailsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -123,7 +123,7 @@ /** The request has succeeded. */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -143,3 +143,3 @@ export interface GetAnalyzeResultPdf200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -159,4 +159,12 @@ export interface GetAnalyzeResultFigure200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface AnalyzeDocumentFromStream202Headers { | ||
@@ -174,3 +182,3 @@ /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -193,3 +201,3 @@ /** The final response for long-running analyzeDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -203,7 +211,7 @@ /** The final response for long-running analyzeDocument operation */ | ||
status: "200"; | ||
body: AnalyzeBatchResultOperationOutput; | ||
body: AnalyzeBatchOperationOutput; | ||
} | ||
export interface GetAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -222,3 +230,3 @@ export interface AnalyzeBatchDocuments202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -229,2 +237,19 @@ /** The final response for long-running analyzeBatchDocuments operation */ | ||
} | ||
/** The request has succeeded. */ | ||
export interface ListAnalyzeBatchResults200Response extends HttpResponse { | ||
status: "200"; | ||
body: PagedAnalyzeBatchOperationOutput; | ||
} | ||
export interface ListAnalyzeBatchResultsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeBatchResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface GetModel200Headers { | ||
@@ -242,3 +267,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -257,3 +282,3 @@ export interface BuildModel202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -276,3 +301,3 @@ /** The final response for long-running buildModel operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -286,7 +311,7 @@ /** The final response for long-running composeModel operation */ | ||
status: "200"; | ||
body: CopyAuthorizationOutput; | ||
body: ModelCopyAuthorizationOutput; | ||
} | ||
export interface AuthorizeModelCopyDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -305,3 +330,3 @@ export interface CopyModelTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -324,3 +349,3 @@ /** The final response for long-running copyModelTo operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -338,3 +363,3 @@ export interface DeleteModel204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -353,3 +378,3 @@ export interface BuildClassifier202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -372,3 +397,3 @@ /** The final response for long-running buildClassifier operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -387,3 +412,3 @@ export interface GetClassifier200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -401,3 +426,3 @@ export interface DeleteClassifier204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -416,3 +441,3 @@ export interface ClassifyDocumentFromStream202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -435,3 +460,3 @@ /** The final response for long-running classifyDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -445,7 +470,7 @@ /** The final response for long-running classifyDocument operation */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetClassifyResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -459,3 +484,3 @@ /** The request has succeeded. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -474,3 +499,3 @@ export interface CopyClassifierTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -477,0 +502,0 @@ /** The final response for long-running copyClassifierTo operation */ |
@@ -1,3 +0,3 @@ | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceInfoParameters, GetAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceDetailsParameters, GetAnalyzeResultParameters, DeleteAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, DeleteAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, ListAnalyzeBatchResultsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { Client, StreamableMethod } from "@azure-rest/core-client"; | ||
@@ -22,5 +22,5 @@ export interface ListOperations { | ||
} | ||
export interface GetResourceInfo { | ||
export interface GetResourceDetails { | ||
/** Return information about the current resource. */ | ||
get(options?: GetResourceInfoParameters): StreamableMethod<GetResourceInfo200Response | GetResourceInfoDefaultResponse>; | ||
get(options?: GetResourceDetailsParameters): StreamableMethod<GetResourceDetails200Response | GetResourceDetailsDefaultResponse>; | ||
} | ||
@@ -30,2 +30,4 @@ export interface GetAnalyzeResult { | ||
get(options?: GetAnalyzeResultParameters): StreamableMethod<GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse>; | ||
/** Mark the result of document analysis for deletion. */ | ||
delete(options?: DeleteAnalyzeResultParameters): StreamableMethod<DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse>; | ||
} | ||
@@ -49,2 +51,4 @@ export interface GetAnalyzeResultPdf { | ||
get(options?: GetAnalyzeBatchResultParameters): StreamableMethod<GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse>; | ||
/** Mark the batch document analysis result for deletion. */ | ||
delete(options?: DeleteAnalyzeBatchResultParameters): StreamableMethod<DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse>; | ||
} | ||
@@ -55,2 +59,6 @@ export interface AnalyzeBatchDocuments { | ||
} | ||
export interface ListAnalyzeBatchResults { | ||
/** List batch document analysis results. */ | ||
get(options?: ListAnalyzeBatchResultsParameters): StreamableMethod<ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse>; | ||
} | ||
export interface GetModel { | ||
@@ -126,4 +134,4 @@ /** Gets detailed document model information. */ | ||
/** Resource for '/info' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceInfo; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceDetails; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeResults/{resultId}", modelId: string, resultId: string): GetAnalyzeResult; | ||
@@ -136,6 +144,8 @@ /** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}/pdf' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}:analyze", modelId: string): AnalyzeDocumentFromStream; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get */ | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults/{resultId}", modelId: string, resultId: string): GetAnalyzeBatchResult; | ||
/** Resource for '/documentModels/\{modelId\}:analyzeBatch' has methods for the following verbs: post */ | ||
(path: "/documentModels/{modelId}:analyzeBatch", modelId: string): AnalyzeBatchDocuments; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults", modelId: string): ListAnalyzeBatchResults; | ||
/** Resource for '/documentModels/\{modelId\}' has methods for the following verbs: get, delete */ | ||
@@ -142,0 +152,0 @@ (path: "/documentModels/{modelId}", modelId: string): GetModel; |
@@ -14,5 +14,5 @@ // Copyright (c) Microsoft Corporation. | ||
var _b, _c, _d, _e, _f, _g, _h, _j; | ||
var { apiVersion = "2024-07-31-preview" } = _a, options = __rest(_a, ["apiVersion"]); | ||
var { apiVersion = "2024-11-30" } = _a, options = __rest(_a, ["apiVersion"]); | ||
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.1`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`; | ||
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
@@ -19,0 +19,0 @@ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` |
@@ -1,2 +0,2 @@ | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
export declare function isUnexpected(response: ListOperations200Response | ListOperationsDefaultResponse): response is ListOperationsDefaultResponse; | ||
@@ -9,4 +9,5 @@ export declare function isUnexpected(response: GetDocumentModelBuildOperation200Response | GetDocumentModelBuildOperationDefaultResponse): response is GetDocumentModelBuildOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetOperation200Response | GetOperationDefaultResponse): response is GetOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceInfo200Response | GetResourceInfoDefaultResponse): response is GetResourceInfoDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceDetails200Response | GetResourceDetailsDefaultResponse): response is GetResourceDetailsDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse): response is GetAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse): response is DeleteAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResultPdf200Response | GetAnalyzeResultPdfDefaultResponse): response is GetAnalyzeResultPdfDefaultResponse; | ||
@@ -17,3 +18,5 @@ export declare function isUnexpected(response: GetAnalyzeResultFigure200Response | GetAnalyzeResultFigureDefaultResponse): response is GetAnalyzeResultFigureDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse): response is GetAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse): response is DeleteAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse): response is AnalyzeBatchDocumentsDefaultResponse; | ||
export declare function isUnexpected(response: ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse): response is ListAnalyzeBatchResultsDefaultResponse; | ||
export declare function isUnexpected(response: GetModel200Response | GetModelDefaultResponse): response is GetModelDefaultResponse; | ||
@@ -20,0 +23,0 @@ export declare function isUnexpected(response: DeleteModel204Response | DeleteModelDefaultResponse): response is DeleteModelDefaultResponse; |
@@ -8,2 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}/pdf": ["200"], | ||
@@ -14,4 +15,6 @@ "GET /documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}": ["200"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}:analyzeBatch": ["200", "202"], | ||
"POST /documentModels/{modelId}:analyzeBatch": ["202"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults": ["200"], | ||
"GET /documentModels/{modelId}": ["200"], | ||
@@ -18,0 +21,0 @@ "DELETE /documentModels/{modelId}": ["204"], |
@@ -22,3 +22,3 @@ /** Azure Blob Storage content. */ | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -117,3 +117,3 @@ buildMode?: DocumentBuildMode; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -170,3 +170,3 @@ buildMode: DocumentBuildMode; | ||
*/ | ||
export interface CopyAuthorization { | ||
export interface ModelCopyAuthorization { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -253,6 +253,6 @@ targetResourceId: string; | ||
export type StringIndexType = string; | ||
/** Alias for ContentFormat */ | ||
export type ContentFormat = string; | ||
/** Alias for DocumentContentFormat */ | ||
export type DocumentContentFormat = string; | ||
/** Alias for AnalyzeOutputOption */ | ||
export type AnalyzeOutputOption = string; | ||
//# sourceMappingURL=models.d.ts.map |
@@ -1,4 +0,10 @@ | ||
import type { Paged } from "@azure/core-paging"; | ||
/** Paged collection of DocumentIntelligenceOperationDetails items */ | ||
export interface PagedDocumentIntelligenceOperationDetailsOutput { | ||
/** The DocumentIntelligenceOperationDetails items on this page */ | ||
value: Array<DocumentIntelligenceOperationDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Operation info. */ | ||
export interface OperationDetailsOutputParent { | ||
export interface DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation ID */ | ||
@@ -9,5 +15,5 @@ operationId: string; | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Operation progress (0-100). */ | ||
@@ -26,7 +32,7 @@ percentCompleted?: number; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
kind: OperationKindOutput; | ||
} | ||
/** The error object. */ | ||
export interface ErrorModelOutput { | ||
export interface DocumentIntelligenceErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -39,8 +45,8 @@ code: string; | ||
/** An array of details about specific errors that led to this reported error. */ | ||
details?: Array<ErrorModelOutput>; | ||
details?: Array<DocumentIntelligenceErrorOutput>; | ||
/** An object containing more specific information than the current object about the error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** An object containing more specific information about the error. */ | ||
export interface InnerErrorOutput { | ||
export interface DocumentIntelligenceInnerErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -51,6 +57,6 @@ code?: string; | ||
/** Inner error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** Get Operation response object. */ | ||
export interface DocumentModelBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -71,2 +77,4 @@ result?: DocumentModelDetailsOutput; | ||
readonly expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document model. */ | ||
@@ -79,3 +87,3 @@ readonly apiVersion?: string; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -104,3 +112,3 @@ readonly buildMode?: DocumentBuildModeOutput; | ||
/** List of warnings encountered while building the model. */ | ||
readonly warnings?: Array<WarningOutput>; | ||
readonly warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
/** Number of V100-equivalent GPU hours consumed for model training. */ | ||
@@ -130,3 +138,3 @@ readonly trainingHours?: number; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -167,3 +175,3 @@ buildMode?: DocumentBuildModeOutput; | ||
/** The error object. */ | ||
export interface WarningOutput { | ||
export interface DocumentIntelligenceWarningOutput { | ||
/** One of a server-defined set of warning codes. */ | ||
@@ -177,3 +185,3 @@ code: string; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelComposeOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelComposeOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -185,3 +193,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -193,3 +201,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -210,2 +218,4 @@ result?: DocumentClassifierDetailsOutput; | ||
expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document classifier. */ | ||
@@ -218,3 +228,3 @@ apiVersion: string; | ||
/** List of warnings encountered while building the classifier. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -243,3 +253,3 @@ /** Classifier document type info. */ | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -251,8 +261,8 @@ result?: DocumentClassifierDetailsOutput; | ||
/** Error response object. */ | ||
export interface ErrorResponseOutput { | ||
export interface DocumentIntelligenceErrorResponseOutput { | ||
/** Error info. */ | ||
error: ErrorModelOutput; | ||
error: DocumentIntelligenceErrorOutput; | ||
} | ||
/** General information regarding the current resource. */ | ||
export interface ResourceDetailsOutput { | ||
export interface DocumentIntelligenceResourceDetailsOutput { | ||
/** Details regarding custom document models. */ | ||
@@ -269,9 +279,9 @@ customDocumentModels: CustomDocumentModelsDetailsOutput; | ||
/** Status and result of the analyze operation. */ | ||
export interface AnalyzeResultOperationOutput { | ||
export interface AnalyzeOperationOutput { | ||
/** | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the analyze operation was submitted. */ | ||
@@ -282,3 +292,3 @@ createdDateTime: string; | ||
/** Encountered error during document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Document analysis result. */ | ||
@@ -304,3 +314,3 @@ analyzeResult?: AnalyzeResultOutput; | ||
*/ | ||
contentFormat?: ContentFormatOutput; | ||
contentFormat?: DocumentContentFormatOutput; | ||
/** | ||
@@ -328,5 +338,5 @@ * Concatenate string representation of all textual and visual elements in reading | ||
/** Extracted documents. */ | ||
documents?: Array<DocumentOutput>; | ||
documents?: Array<AnalyzedDocumentOutput>; | ||
/** List of warnings encountered. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -634,3 +644,3 @@ /** Content and layout elements extracted from a page from the input. */ | ||
*/ | ||
fontStyle?: FontStyleOutput; | ||
fontStyle?: DocumentFontStyleOutput; | ||
/** | ||
@@ -641,3 +651,3 @@ * Font weight. | ||
*/ | ||
fontWeight?: FontWeightOutput; | ||
fontWeight?: DocumentFontWeightOutput; | ||
/** Foreground color in #rrggbb hexadecimal format. */ | ||
@@ -668,3 +678,3 @@ color?: string; | ||
/** An object describing the location and semantic content of a document. */ | ||
export interface DocumentOutput { | ||
export interface AnalyzedDocumentOutput { | ||
/** Document type. */ | ||
@@ -780,9 +790,11 @@ docType: string; | ||
/** Status and result of the analyze batch operation. */ | ||
export interface AnalyzeBatchResultOperationOutput { | ||
export interface AnalyzeBatchOperationOutput { | ||
/** Analyze batch operation result ID. */ | ||
resultId?: string; | ||
/** | ||
* Operation status. notStarted, running, completed, or failed | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the operation was submitted. */ | ||
@@ -795,3 +807,3 @@ createdDateTime: string; | ||
/** Encountered error during batch document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Batch document analysis result. */ | ||
@@ -809,3 +821,3 @@ result?: AnalyzeBatchResultOutput; | ||
/** Operation detail for each document in the batch. */ | ||
details: Array<AnalyzeBatchOperationDetailOutput>; | ||
details?: Array<AnalyzeBatchOperationDetailOutput>; | ||
} | ||
@@ -817,5 +829,5 @@ /** Operation detail for a document in a batch analysis. */ | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** URL of the source document. */ | ||
@@ -826,4 +838,11 @@ sourceUrl: string; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
} | ||
/** Paged collection of AnalyzeBatchOperation items */ | ||
export interface PagedAnalyzeBatchOperationOutput { | ||
/** The AnalyzeBatchOperation items on this page */ | ||
value: Array<AnalyzeBatchOperationOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -833,3 +852,3 @@ * Authorization to copy a document model to the specified target resource and | ||
*/ | ||
export interface CopyAuthorizationOutput { | ||
export interface ModelCopyAuthorizationOutput { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -851,2 +870,16 @@ targetResourceId: string; | ||
} | ||
/** Paged collection of DocumentModelDetails items */ | ||
export interface PagedDocumentModelDetailsOutput { | ||
/** The DocumentModelDetails items on this page */ | ||
value: Array<DocumentModelDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export interface PagedDocumentClassifierDetailsOutput { | ||
/** The DocumentClassifierDetails items on this page */ | ||
value: Array<DocumentClassifierDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -874,7 +907,5 @@ * Authorization to copy a document classifier to the specified target resource and | ||
/** Operation info. */ | ||
export type OperationDetailsOutput = OperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Paged collection of OperationDetails items */ | ||
export type PagedOperationDetailsOutput = Paged<OperationDetailsOutput>; | ||
/** Alias for OperationStatusOutput */ | ||
export type OperationStatusOutput = string; | ||
export type DocumentIntelligenceOperationDetailsOutput = DocumentIntelligenceOperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Alias for DocumentIntelligenceOperationStatusOutput */ | ||
export type DocumentIntelligenceOperationStatusOutput = string; | ||
/** Alias for OperationKindOutput */ | ||
@@ -894,4 +925,4 @@ export type OperationKindOutput = string; | ||
export type StringIndexTypeOutput = string; | ||
/** Alias for ContentFormatOutput */ | ||
export type ContentFormatOutput = string; | ||
/** Alias for DocumentContentFormatOutput */ | ||
export type DocumentContentFormatOutput = string; | ||
/** Alias for LengthUnitOutput */ | ||
@@ -909,12 +940,8 @@ export type LengthUnitOutput = string; | ||
export type DocumentTableCellKindOutput = string; | ||
/** Alias for FontStyleOutput */ | ||
export type FontStyleOutput = string; | ||
/** Alias for FontWeightOutput */ | ||
export type FontWeightOutput = string; | ||
/** Alias for DocumentFontStyleOutput */ | ||
export type DocumentFontStyleOutput = string; | ||
/** Alias for DocumentFontWeightOutput */ | ||
export type DocumentFontWeightOutput = string; | ||
/** Alias for DocumentSignatureTypeOutput */ | ||
export type DocumentSignatureTypeOutput = string; | ||
/** Paged collection of DocumentModelDetails items */ | ||
export type PagedDocumentModelDetailsOutput = Paged<DocumentModelDetailsOutput>; | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export type PagedDocumentClassifierDetailsOutput = Paged<DocumentClassifierDetailsOutput>; | ||
//# sourceMappingURL=outputModels.d.ts.map |
@@ -1,4 +0,29 @@ | ||
import type { PagedAsyncIterableIterator } from "@azure/core-paging"; | ||
import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; | ||
/** | ||
* An interface that tracks the settings for paged iteration | ||
*/ | ||
export interface PageSettings { | ||
/** | ||
* The token that keeps track of where to continue the iterator | ||
*/ | ||
continuationToken?: string; | ||
} | ||
/** | ||
* An interface that allows async iterable iteration both to completion and by page. | ||
*/ | ||
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> { | ||
/** | ||
* The next method, part of the iteration protocol | ||
*/ | ||
next(): Promise<IteratorResult<TElement>>; | ||
/** | ||
* The connection to the async iterator, part of the iteration protocol | ||
*/ | ||
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>; | ||
/** | ||
* Return an AsyncIterableIterator that works a page at a time | ||
*/ | ||
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>; | ||
} | ||
/** | ||
* Helper type to extract the type of an array | ||
@@ -10,3 +35,3 @@ */ | ||
*/ | ||
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{ | ||
export type GetPage<TPage> = (pageLink: string) => Promise<{ | ||
page: TPage; | ||
@@ -13,0 +38,0 @@ nextPageLink?: string; |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { getPagedAsyncIterator } from "@azure/core-paging"; | ||
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; | ||
import { createRestError } from "@azure-rest/core-client"; | ||
/** | ||
* returns an async iterator that iterates over results. It also has a `byPage` | ||
* method that returns pages of items at once. | ||
* | ||
* @param pagedResult - an object that specifies how to get pages. | ||
* @returns a paged async iterator that iterates over results. | ||
*/ | ||
function getPagedAsyncIterator(pagedResult) { | ||
var _a; | ||
const iter = getItemAsyncIterator(pagedResult); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { | ||
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {}; | ||
return getPageAsyncIterator(pagedResult, { | ||
pageLink: continuationToken, | ||
}); | ||
}), | ||
}; | ||
} | ||
function getItemAsyncIterator(pagedResult) { | ||
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { | ||
var _a, e_1, _b, _c, _d, e_2, _e, _f; | ||
const pages = getPageAsyncIterator(pagedResult); | ||
const firstVal = yield __await(pages.next()); | ||
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is | ||
if (!Array.isArray(firstVal.value)) { | ||
// can extract elements from this page | ||
const { toElements } = pagedResult; | ||
if (toElements) { | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(firstVal.value)))); | ||
try { | ||
for (var _g = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) { | ||
_c = pages_1_1.value; | ||
_g = false; | ||
const page = _c; | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(page)))); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_g && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
else { | ||
yield yield __await(firstVal.value); | ||
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case | ||
yield __await(yield* __asyncDelegator(__asyncValues(pages))); | ||
} | ||
} | ||
else { | ||
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value))); | ||
try { | ||
for (var _h = true, pages_2 = __asyncValues(pages), pages_2_1; pages_2_1 = yield __await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) { | ||
_f = pages_2_1.value; | ||
_h = false; | ||
const page = _f; | ||
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch, | ||
// it must be the case that `TPage = TElement[]` | ||
yield __await(yield* __asyncDelegator(__asyncValues(page))); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_h && !_d && (_e = pages_2.return)) yield __await(_e.call(pages_2)); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
} | ||
}); | ||
} | ||
function getPageAsyncIterator(pagedResult_1) { | ||
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) { | ||
const { pageLink } = options; | ||
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
while (response.nextPageLink) { | ||
response = yield __await(pagedResult.getPage(response.nextPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
} | ||
}); | ||
} | ||
/** | ||
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension | ||
@@ -7,0 +104,0 @@ * @param client - Client to use for sending the next page requests |
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; | ||
import type { RequestParameters } from "@azure-rest/core-client"; | ||
import type { StringIndexType, DocumentAnalysisFeature, ContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, CopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
import type { StringIndexType, DocumentAnalysisFeature, DocumentContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, ModelCopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
export interface ListOperationsHeaders { | ||
@@ -60,6 +60,7 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
export type GetOperationParameters = GetOperationHeaderParam & RequestParameters; | ||
export type GetResourceInfoParameters = RequestParameters; | ||
export type GetResourceDetailsParameters = RequestParameters; | ||
export type GetAnalyzeResultParameters = RequestParameters; | ||
export type GetAnalyzeResultPdfParameters = RequestParameters; | ||
export type GetAnalyzeResultFigureParameters = RequestParameters; | ||
export type DeleteAnalyzeResultParameters = RequestParameters; | ||
export interface AnalyzeDocumentFromStreamBodyParam { | ||
@@ -73,4 +74,31 @@ /** | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentFromStreamQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -89,5 +117,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFromStreamFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentFromStreamQueryFieldsQueryParam; | ||
/** | ||
@@ -98,5 +126,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentFromStreamOutputQueryParam; | ||
} | ||
@@ -113,6 +141,33 @@ export interface AnalyzeDocumentFromStreamQueryParam { | ||
/** Analyze request parameters. */ | ||
body?: AnalyzeDocumentRequest; | ||
body: AnalyzeDocumentRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -131,5 +186,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentQueryFieldsQueryParam; | ||
/** | ||
@@ -140,5 +195,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentOutputQueryParam; | ||
} | ||
@@ -156,6 +211,33 @@ export interface AnalyzeDocumentQueryParam { | ||
/** Analyze batch request parameters. */ | ||
body?: AnalyzeBatchDocumentsRequest; | ||
body: AnalyzeBatchDocumentsRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeBatchDocumentsQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -174,5 +256,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeBatchDocumentsFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeBatchDocumentsQueryFieldsQueryParam; | ||
/** | ||
@@ -183,5 +265,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeBatchDocumentsOutputQueryParam; | ||
} | ||
@@ -196,2 +278,4 @@ export interface AnalyzeBatchDocumentsQueryParam { | ||
export type AnalyzeBatchDocumentsParameters = AnalyzeBatchDocumentsQueryParam & AnalyzeBatchDocumentsMediaTypesParam & AnalyzeBatchDocumentsBodyParam & RequestParameters; | ||
export type ListAnalyzeBatchResultsParameters = RequestParameters; | ||
export type DeleteAnalyzeBatchResultParameters = RequestParameters; | ||
export interface GetModelHeaders { | ||
@@ -222,3 +306,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
/** Copy to request parameters. */ | ||
body: CopyAuthorization; | ||
body: ModelCopyAuthorization; | ||
} | ||
@@ -292,3 +376,3 @@ export type CopyModelToParameters = CopyModelToBodyParam & RequestParameters; | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -321,3 +405,3 @@ } | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -324,0 +408,0 @@ } |
import type { Client } from "@azure-rest/core-client"; | ||
import type { AbortSignalLike } from "@azure/abort-controller"; | ||
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro"; | ||
import type { OperationState, PollerLike } from "@azure/core-lro"; | ||
import type { AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, AnalyzeBatchDocumentsLogicalResponse, BuildModel202Response, BuildModelDefaultResponse, BuildModelLogicalResponse, ComposeModel202Response, ComposeModelDefaultResponse, ComposeModelLogicalResponse, CopyModelTo202Response, CopyModelToDefaultResponse, CopyModelToLogicalResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, BuildClassifierLogicalResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocumentFromStreamLogicalResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse, CopyClassifierToLogicalResponse } from "./responses.js"; | ||
/** | ||
* A simple poller that can be used to poll a long running operation. | ||
* Options for `getLongRunningPoller`. | ||
*/ | ||
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> { | ||
export interface GetLongRunningPollerOptions { | ||
/** | ||
* Returns true if the poller has finished polling. | ||
* Defines how much time the poller is going to wait before making a new request to the service. | ||
*/ | ||
isDone(): boolean; | ||
intervalInMs?: number; | ||
/** | ||
* Returns the state of the operation. | ||
* A serialized poller which can be used to resume an existing paused Long-Running-Operation. | ||
*/ | ||
getOperationState(): TState; | ||
/** | ||
* Returns the id of the operation. | ||
*/ | ||
getOperationId(): string; | ||
/** | ||
* Returns the result value of the operation, | ||
* regardless of the state of the poller. | ||
* It can return undefined or an incomplete form of the final TResult value | ||
* depending on the implementation. | ||
*/ | ||
getResult(): TResult | undefined; | ||
/** | ||
* Returns a promise that will resolve once a single polling request finishes. | ||
* It does this by calling the update method of the Poller's operation. | ||
*/ | ||
poll(options?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TState>; | ||
/** | ||
* Returns a promise that will resolve once the underlying operation is completed. | ||
*/ | ||
pollUntilDone(pollOptions?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TResult>; | ||
/** | ||
* Invokes the provided callback after each polling is completed, | ||
* sending the current state of the poller's operation. | ||
* | ||
* It returns a method that can be used to stop receiving updates on the given callback function. | ||
*/ | ||
onProgress(callback: (state: TState) => void): CancelOnProgress; | ||
/** | ||
* Returns a promise that could be used for serialized version of the poller's operation | ||
* by invoking the operation's serialize method. | ||
*/ | ||
serialize(): Promise<string>; | ||
/** | ||
* Wait the poller to be submitted. | ||
*/ | ||
submitted(): Promise<void>; | ||
/** | ||
* Returns a string representation of the poller's operation. Similar to serialize but returns a string. | ||
* @deprecated Use serialize() instead. | ||
*/ | ||
toString(): string; | ||
/** | ||
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling | ||
* @deprecated Use abortSignal to stop polling instead. | ||
*/ | ||
stopPolling(): void; | ||
/** | ||
* Returns true if the poller is stopped. | ||
* @deprecated Use abortSignal status to track this instead. | ||
*/ | ||
isStopped(): boolean; | ||
restoreFrom?: string; | ||
} | ||
@@ -80,10 +24,18 @@ /** | ||
*/ | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export declare function parseResultIdFromResponse(initialResponse: { | ||
headers: { | ||
"operation-location": string; | ||
}; | ||
}): string; | ||
//# sourceMappingURL=pollingHelper.d.ts.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { createHttpPoller } from "@azure/core-lro"; | ||
export async function getLongRunningPoller(client, initialResponse, options = {}) { | ||
var _a; | ||
export function getLongRunningPoller(client, initialResponse, options = {}) { | ||
const abortController = new AbortController(); | ||
@@ -46,47 +45,3 @@ const poller = { | ||
}; | ||
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true; | ||
const httpPoller = createHttpPoller(poller, Object.assign(Object.assign({}, options), { updateState: (state, response) => { | ||
const flatResponse = response.flatResponse; | ||
if (!("body" in flatResponse)) | ||
return; | ||
const flatResponseBody = flatResponse.body; | ||
if (!("status" in flatResponseBody && flatResponseBody.status === "completed")) | ||
return; | ||
state.status = "succeeded"; | ||
} })); | ||
const simplePoller = { | ||
isDone() { | ||
return httpPoller.isDone; | ||
}, | ||
isStopped() { | ||
return abortController.signal.aborted; | ||
}, | ||
getOperationState() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return httpPoller.operationState; | ||
}, | ||
getResult() { | ||
return httpPoller.result; | ||
}, | ||
toString() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return JSON.stringify({ | ||
state: httpPoller.operationState, | ||
}); | ||
}, | ||
stopPolling() { | ||
abortController.abort(); | ||
}, | ||
onProgress: httpPoller.onProgress, | ||
poll: httpPoller.poll, | ||
pollUntilDone: httpPoller.pollUntilDone, | ||
serialize: httpPoller.serialize, | ||
submitted: httpPoller.submitted, | ||
getOperationId: () => parseOperationId(initialResponse.headers["operation-location"]), | ||
}; | ||
return simplePoller; | ||
return createHttpPoller(poller, options); | ||
} | ||
@@ -96,3 +51,3 @@ /** | ||
*/ | ||
function parseOperationId(operationLocationHeader) { | ||
function parseResultId(operationLocationHeader) { | ||
// regex to extract the operation id from the operation-location header with the regex "[^:]+://[^/]+/documentintelligence/.+/([^?/]+)" | ||
@@ -102,3 +57,3 @@ const regex = /[^:]+:\/\/[^/]+\/documentintelligence\/.+\/([^?/]+)/; | ||
if (!match) { | ||
throw new Error(`Failed to parse operation id from the operation-location header: ${operationLocationHeader}`); | ||
throw new Error(`Failed to parse result id from the operation-location header: ${operationLocationHeader}`); | ||
} | ||
@@ -108,2 +63,9 @@ return match[1]; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export function parseResultIdFromResponse(initialResponse) { | ||
const operationLocationHeader = initialResponse.headers["operation-location"]; | ||
return parseResultId(operationLocationHeader); | ||
} | ||
/** | ||
* Converts a Rest Client response to a response that the LRO implementation understands | ||
@@ -110,0 +72,0 @@ * @param response - a rest client http response |
import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; | ||
import type { HttpResponse } from "@azure-rest/core-client"; | ||
import type { PagedOperationDetailsOutput, ErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, OperationDetailsOutput, ResourceDetailsOutput, AnalyzeResultOperationOutput, AnalyzeBatchResultOperationOutput, DocumentModelDetailsOutput, CopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
import type { PagedDocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, DocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceResourceDetailsOutput, AnalyzeOperationOutput, AnalyzeBatchOperationOutput, PagedAnalyzeBatchOperationOutput, DocumentModelDetailsOutput, ModelCopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
export interface ListOperations200Headers { | ||
@@ -11,3 +11,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: "200"; | ||
body: PagedOperationDetailsOutput; | ||
body: PagedDocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & ListOperations200Headers; | ||
@@ -17,3 +17,3 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -32,3 +32,3 @@ export interface GetDocumentModelBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -47,3 +47,3 @@ export interface GetDocumentModelComposeOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -62,3 +62,3 @@ export interface GetDocumentModelCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -77,3 +77,3 @@ export interface GetDocumentClassifierCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -92,3 +92,3 @@ export interface GetDocumentClassifierBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -102,3 +102,3 @@ export interface GetOperation200Headers { | ||
status: "200"; | ||
body: OperationDetailsOutput; | ||
body: DocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & GetOperation200Headers; | ||
@@ -108,12 +108,12 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** The request has succeeded. */ | ||
export interface GetResourceInfo200Response extends HttpResponse { | ||
export interface GetResourceDetails200Response extends HttpResponse { | ||
status: "200"; | ||
body: ResourceDetailsOutput; | ||
body: DocumentIntelligenceResourceDetailsOutput; | ||
} | ||
export interface GetResourceInfoDefaultResponse extends HttpResponse { | ||
export interface GetResourceDetailsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -123,7 +123,7 @@ /** The request has succeeded. */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -143,3 +143,3 @@ export interface GetAnalyzeResultPdf200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -159,4 +159,12 @@ export interface GetAnalyzeResultFigure200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface AnalyzeDocumentFromStream202Headers { | ||
@@ -174,3 +182,3 @@ /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -193,3 +201,3 @@ /** The final response for long-running analyzeDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -203,7 +211,7 @@ /** The final response for long-running analyzeDocument operation */ | ||
status: "200"; | ||
body: AnalyzeBatchResultOperationOutput; | ||
body: AnalyzeBatchOperationOutput; | ||
} | ||
export interface GetAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -222,3 +230,3 @@ export interface AnalyzeBatchDocuments202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -229,2 +237,19 @@ /** The final response for long-running analyzeBatchDocuments operation */ | ||
} | ||
/** The request has succeeded. */ | ||
export interface ListAnalyzeBatchResults200Response extends HttpResponse { | ||
status: "200"; | ||
body: PagedAnalyzeBatchOperationOutput; | ||
} | ||
export interface ListAnalyzeBatchResultsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeBatchResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface GetModel200Headers { | ||
@@ -242,3 +267,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -257,3 +282,3 @@ export interface BuildModel202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -276,3 +301,3 @@ /** The final response for long-running buildModel operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -286,7 +311,7 @@ /** The final response for long-running composeModel operation */ | ||
status: "200"; | ||
body: CopyAuthorizationOutput; | ||
body: ModelCopyAuthorizationOutput; | ||
} | ||
export interface AuthorizeModelCopyDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -305,3 +330,3 @@ export interface CopyModelTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -324,3 +349,3 @@ /** The final response for long-running copyModelTo operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -338,3 +363,3 @@ export interface DeleteModel204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -353,3 +378,3 @@ export interface BuildClassifier202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -372,3 +397,3 @@ /** The final response for long-running buildClassifier operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -387,3 +412,3 @@ export interface GetClassifier200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -401,3 +426,3 @@ export interface DeleteClassifier204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -416,3 +441,3 @@ export interface ClassifyDocumentFromStream202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -435,3 +460,3 @@ /** The final response for long-running classifyDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -445,7 +470,7 @@ /** The final response for long-running classifyDocument operation */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetClassifyResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -459,3 +484,3 @@ /** The request has succeeded. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -474,3 +499,3 @@ export interface CopyClassifierTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -477,0 +502,0 @@ /** The final response for long-running copyClassifierTo operation */ |
@@ -1,3 +0,3 @@ | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceInfoParameters, GetAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperationsParameters, GetDocumentModelBuildOperationParameters, GetDocumentModelComposeOperationParameters, GetDocumentModelCopyToOperationParameters, GetDocumentClassifierCopyToOperationParameters, GetDocumentClassifierBuildOperationParameters, GetOperationParameters, GetResourceDetailsParameters, GetAnalyzeResultParameters, DeleteAnalyzeResultParameters, GetAnalyzeResultPdfParameters, GetAnalyzeResultFigureParameters, AnalyzeDocumentFromStreamParameters, AnalyzeDocumentParameters, GetAnalyzeBatchResultParameters, DeleteAnalyzeBatchResultParameters, AnalyzeBatchDocumentsParameters, ListAnalyzeBatchResultsParameters, GetModelParameters, DeleteModelParameters, BuildModelParameters, ComposeModelParameters, AuthorizeModelCopyParameters, CopyModelToParameters, ListModelsParameters, BuildClassifierParameters, ListClassifiersParameters, GetClassifierParameters, DeleteClassifierParameters, ClassifyDocumentFromStreamParameters, ClassifyDocumentParameters, GetClassifyResultParameters, AuthorizeClassifierCopyParameters, CopyClassifierToParameters } from "./parameters.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { Client, StreamableMethod } from "@azure-rest/core-client"; | ||
@@ -22,5 +22,5 @@ export interface ListOperations { | ||
} | ||
export interface GetResourceInfo { | ||
export interface GetResourceDetails { | ||
/** Return information about the current resource. */ | ||
get(options?: GetResourceInfoParameters): StreamableMethod<GetResourceInfo200Response | GetResourceInfoDefaultResponse>; | ||
get(options?: GetResourceDetailsParameters): StreamableMethod<GetResourceDetails200Response | GetResourceDetailsDefaultResponse>; | ||
} | ||
@@ -30,2 +30,4 @@ export interface GetAnalyzeResult { | ||
get(options?: GetAnalyzeResultParameters): StreamableMethod<GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse>; | ||
/** Mark the result of document analysis for deletion. */ | ||
delete(options?: DeleteAnalyzeResultParameters): StreamableMethod<DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse>; | ||
} | ||
@@ -49,2 +51,4 @@ export interface GetAnalyzeResultPdf { | ||
get(options?: GetAnalyzeBatchResultParameters): StreamableMethod<GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse>; | ||
/** Mark the batch document analysis result for deletion. */ | ||
delete(options?: DeleteAnalyzeBatchResultParameters): StreamableMethod<DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse>; | ||
} | ||
@@ -55,2 +59,6 @@ export interface AnalyzeBatchDocuments { | ||
} | ||
export interface ListAnalyzeBatchResults { | ||
/** List batch document analysis results. */ | ||
get(options?: ListAnalyzeBatchResultsParameters): StreamableMethod<ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse>; | ||
} | ||
export interface GetModel { | ||
@@ -126,4 +134,4 @@ /** Gets detailed document model information. */ | ||
/** Resource for '/info' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceInfo; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get */ | ||
(path: "/info"): GetResourceDetails; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeResults/{resultId}", modelId: string, resultId: string): GetAnalyzeResult; | ||
@@ -136,6 +144,8 @@ /** Resource for '/documentModels/\{modelId\}/analyzeResults/\{resultId\}/pdf' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}:analyze", modelId: string): AnalyzeDocumentFromStream; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get */ | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults/\{resultId\}' has methods for the following verbs: get, delete */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults/{resultId}", modelId: string, resultId: string): GetAnalyzeBatchResult; | ||
/** Resource for '/documentModels/\{modelId\}:analyzeBatch' has methods for the following verbs: post */ | ||
(path: "/documentModels/{modelId}:analyzeBatch", modelId: string): AnalyzeBatchDocuments; | ||
/** Resource for '/documentModels/\{modelId\}/analyzeBatchResults' has methods for the following verbs: get */ | ||
(path: "/documentModels/{modelId}/analyzeBatchResults", modelId: string): ListAnalyzeBatchResults; | ||
/** Resource for '/documentModels/\{modelId\}' has methods for the following verbs: get, delete */ | ||
@@ -142,0 +152,0 @@ (path: "/documentModels/{modelId}", modelId: string): GetModel; |
@@ -14,5 +14,5 @@ // Copyright (c) Microsoft Corporation. | ||
var _b, _c, _d, _e, _f, _g, _h, _j; | ||
var { apiVersion = "2024-07-31-preview" } = _a, options = __rest(_a, ["apiVersion"]); | ||
var { apiVersion = "2024-11-30" } = _a, options = __rest(_a, ["apiVersion"]); | ||
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.1`; | ||
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`; | ||
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix | ||
@@ -19,0 +19,0 @@ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` |
@@ -1,2 +0,2 @@ | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceInfo200Response, GetResourceInfoDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
import type { ListOperations200Response, ListOperationsDefaultResponse, GetDocumentModelBuildOperation200Response, GetDocumentModelBuildOperationDefaultResponse, GetDocumentModelComposeOperation200Response, GetDocumentModelComposeOperationDefaultResponse, GetDocumentModelCopyToOperation200Response, GetDocumentModelCopyToOperationDefaultResponse, GetDocumentClassifierCopyToOperation200Response, GetDocumentClassifierCopyToOperationDefaultResponse, GetDocumentClassifierBuildOperation200Response, GetDocumentClassifierBuildOperationDefaultResponse, GetOperation200Response, GetOperationDefaultResponse, GetResourceDetails200Response, GetResourceDetailsDefaultResponse, GetAnalyzeResult200Response, GetAnalyzeResultDefaultResponse, DeleteAnalyzeResult204Response, DeleteAnalyzeResultDefaultResponse, GetAnalyzeResultPdf200Response, GetAnalyzeResultPdfDefaultResponse, GetAnalyzeResultFigure200Response, GetAnalyzeResultFigureDefaultResponse, AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocument202Response, AnalyzeDocumentLogicalResponse, AnalyzeDocumentDefaultResponse, GetAnalyzeBatchResult200Response, GetAnalyzeBatchResultDefaultResponse, DeleteAnalyzeBatchResult204Response, DeleteAnalyzeBatchResultDefaultResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsLogicalResponse, AnalyzeBatchDocumentsDefaultResponse, ListAnalyzeBatchResults200Response, ListAnalyzeBatchResultsDefaultResponse, GetModel200Response, GetModelDefaultResponse, DeleteModel204Response, DeleteModelDefaultResponse, BuildModel202Response, BuildModelLogicalResponse, BuildModelDefaultResponse, ComposeModel202Response, ComposeModelLogicalResponse, ComposeModelDefaultResponse, AuthorizeModelCopy200Response, AuthorizeModelCopyDefaultResponse, CopyModelTo202Response, CopyModelToLogicalResponse, CopyModelToDefaultResponse, ListModels200Response, ListModelsDefaultResponse, BuildClassifier202Response, BuildClassifierLogicalResponse, BuildClassifierDefaultResponse, ListClassifiers200Response, ListClassifiersDefaultResponse, GetClassifier200Response, GetClassifierDefaultResponse, DeleteClassifier204Response, DeleteClassifierDefaultResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamLogicalResponse, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocument202Response, ClassifyDocumentLogicalResponse, ClassifyDocumentDefaultResponse, GetClassifyResult200Response, GetClassifyResultDefaultResponse, AuthorizeClassifierCopy200Response, AuthorizeClassifierCopyDefaultResponse, CopyClassifierTo202Response, CopyClassifierToLogicalResponse, CopyClassifierToDefaultResponse } from "./responses.js"; | ||
export declare function isUnexpected(response: ListOperations200Response | ListOperationsDefaultResponse): response is ListOperationsDefaultResponse; | ||
@@ -9,4 +9,5 @@ export declare function isUnexpected(response: GetDocumentModelBuildOperation200Response | GetDocumentModelBuildOperationDefaultResponse): response is GetDocumentModelBuildOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetOperation200Response | GetOperationDefaultResponse): response is GetOperationDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceInfo200Response | GetResourceInfoDefaultResponse): response is GetResourceInfoDefaultResponse; | ||
export declare function isUnexpected(response: GetResourceDetails200Response | GetResourceDetailsDefaultResponse): response is GetResourceDetailsDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResult200Response | GetAnalyzeResultDefaultResponse): response is GetAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeResult204Response | DeleteAnalyzeResultDefaultResponse): response is DeleteAnalyzeResultDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeResultPdf200Response | GetAnalyzeResultPdfDefaultResponse): response is GetAnalyzeResultPdfDefaultResponse; | ||
@@ -17,3 +18,5 @@ export declare function isUnexpected(response: GetAnalyzeResultFigure200Response | GetAnalyzeResultFigureDefaultResponse): response is GetAnalyzeResultFigureDefaultResponse; | ||
export declare function isUnexpected(response: GetAnalyzeBatchResult200Response | GetAnalyzeBatchResultDefaultResponse): response is GetAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: DeleteAnalyzeBatchResult204Response | DeleteAnalyzeBatchResultDefaultResponse): response is DeleteAnalyzeBatchResultDefaultResponse; | ||
export declare function isUnexpected(response: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse): response is AnalyzeBatchDocumentsDefaultResponse; | ||
export declare function isUnexpected(response: ListAnalyzeBatchResults200Response | ListAnalyzeBatchResultsDefaultResponse): response is ListAnalyzeBatchResultsDefaultResponse; | ||
export declare function isUnexpected(response: GetModel200Response | GetModelDefaultResponse): response is GetModelDefaultResponse; | ||
@@ -20,0 +23,0 @@ export declare function isUnexpected(response: DeleteModel204Response | DeleteModelDefaultResponse): response is DeleteModelDefaultResponse; |
@@ -8,2 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}/analyzeResults/{resultId}/pdf": ["200"], | ||
@@ -14,4 +15,6 @@ "GET /documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}": ["200"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["200"], | ||
"DELETE /documentModels/{modelId}/analyzeBatchResults/{resultId}": ["204"], | ||
"GET /documentModels/{modelId}:analyzeBatch": ["200", "202"], | ||
"POST /documentModels/{modelId}:analyzeBatch": ["202"], | ||
"GET /documentModels/{modelId}/analyzeBatchResults": ["200"], | ||
"GET /documentModels/{modelId}": ["200"], | ||
@@ -18,0 +21,0 @@ "DELETE /documentModels/{modelId}": ["204"], |
@@ -22,3 +22,3 @@ /** Azure Blob Storage content. */ | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -117,3 +117,3 @@ buildMode?: DocumentBuildMode; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -170,3 +170,3 @@ buildMode: DocumentBuildMode; | ||
*/ | ||
export interface CopyAuthorization { | ||
export interface ModelCopyAuthorization { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -253,6 +253,6 @@ targetResourceId: string; | ||
export type StringIndexType = string; | ||
/** Alias for ContentFormat */ | ||
export type ContentFormat = string; | ||
/** Alias for DocumentContentFormat */ | ||
export type DocumentContentFormat = string; | ||
/** Alias for AnalyzeOutputOption */ | ||
export type AnalyzeOutputOption = string; | ||
//# sourceMappingURL=models.d.ts.map |
@@ -1,4 +0,10 @@ | ||
import type { Paged } from "@azure/core-paging"; | ||
/** Paged collection of DocumentIntelligenceOperationDetails items */ | ||
export interface PagedDocumentIntelligenceOperationDetailsOutput { | ||
/** The DocumentIntelligenceOperationDetails items on this page */ | ||
value: Array<DocumentIntelligenceOperationDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Operation info. */ | ||
export interface OperationDetailsOutputParent { | ||
export interface DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation ID */ | ||
@@ -9,5 +15,5 @@ operationId: string; | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Operation progress (0-100). */ | ||
@@ -26,7 +32,7 @@ percentCompleted?: number; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
kind: OperationKindOutput; | ||
} | ||
/** The error object. */ | ||
export interface ErrorModelOutput { | ||
export interface DocumentIntelligenceErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -39,8 +45,8 @@ code: string; | ||
/** An array of details about specific errors that led to this reported error. */ | ||
details?: Array<ErrorModelOutput>; | ||
details?: Array<DocumentIntelligenceErrorOutput>; | ||
/** An object containing more specific information than the current object about the error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** An object containing more specific information about the error. */ | ||
export interface InnerErrorOutput { | ||
export interface DocumentIntelligenceInnerErrorOutput { | ||
/** One of a server-defined set of error codes. */ | ||
@@ -51,6 +57,6 @@ code?: string; | ||
/** Inner error. */ | ||
innererror?: InnerErrorOutput; | ||
innererror?: DocumentIntelligenceInnerErrorOutput; | ||
} | ||
/** Get Operation response object. */ | ||
export interface DocumentModelBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -71,2 +77,4 @@ result?: DocumentModelDetailsOutput; | ||
readonly expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document model. */ | ||
@@ -79,3 +87,3 @@ readonly apiVersion?: string; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -104,3 +112,3 @@ readonly buildMode?: DocumentBuildModeOutput; | ||
/** List of warnings encountered while building the model. */ | ||
readonly warnings?: Array<WarningOutput>; | ||
readonly warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
/** Number of V100-equivalent GPU hours consumed for model training. */ | ||
@@ -130,3 +138,3 @@ readonly trainingHours?: number; | ||
* | ||
* Possible values: "template", "neural", "generative" | ||
* Possible values: "template", "neural" | ||
*/ | ||
@@ -167,3 +175,3 @@ buildMode?: DocumentBuildModeOutput; | ||
/** The error object. */ | ||
export interface WarningOutput { | ||
export interface DocumentIntelligenceWarningOutput { | ||
/** One of a server-defined set of warning codes. */ | ||
@@ -177,3 +185,3 @@ code: string; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelComposeOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelComposeOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -185,3 +193,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentModelCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentModelCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -193,3 +201,3 @@ result?: DocumentModelDetailsOutput; | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierCopyToOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -210,2 +218,4 @@ result?: DocumentClassifierDetailsOutput; | ||
expirationDateTime?: string; | ||
/** Date and time (UTC) when the document model was last modified. */ | ||
readonly modifiedDateTime?: string; | ||
/** API version used to create this document classifier. */ | ||
@@ -218,3 +228,3 @@ apiVersion: string; | ||
/** List of warnings encountered while building the classifier. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -243,3 +253,3 @@ /** Classifier document type info. */ | ||
/** Get Operation response object. */ | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends OperationDetailsOutputParent { | ||
export interface DocumentClassifierBuildOperationDetailsOutput extends DocumentIntelligenceOperationDetailsOutputParent { | ||
/** Operation result upon success. */ | ||
@@ -251,8 +261,8 @@ result?: DocumentClassifierDetailsOutput; | ||
/** Error response object. */ | ||
export interface ErrorResponseOutput { | ||
export interface DocumentIntelligenceErrorResponseOutput { | ||
/** Error info. */ | ||
error: ErrorModelOutput; | ||
error: DocumentIntelligenceErrorOutput; | ||
} | ||
/** General information regarding the current resource. */ | ||
export interface ResourceDetailsOutput { | ||
export interface DocumentIntelligenceResourceDetailsOutput { | ||
/** Details regarding custom document models. */ | ||
@@ -269,9 +279,9 @@ customDocumentModels: CustomDocumentModelsDetailsOutput; | ||
/** Status and result of the analyze operation. */ | ||
export interface AnalyzeResultOperationOutput { | ||
export interface AnalyzeOperationOutput { | ||
/** | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the analyze operation was submitted. */ | ||
@@ -282,3 +292,3 @@ createdDateTime: string; | ||
/** Encountered error during document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Document analysis result. */ | ||
@@ -304,3 +314,3 @@ analyzeResult?: AnalyzeResultOutput; | ||
*/ | ||
contentFormat?: ContentFormatOutput; | ||
contentFormat?: DocumentContentFormatOutput; | ||
/** | ||
@@ -328,5 +338,5 @@ * Concatenate string representation of all textual and visual elements in reading | ||
/** Extracted documents. */ | ||
documents?: Array<DocumentOutput>; | ||
documents?: Array<AnalyzedDocumentOutput>; | ||
/** List of warnings encountered. */ | ||
warnings?: Array<WarningOutput>; | ||
warnings?: Array<DocumentIntelligenceWarningOutput>; | ||
} | ||
@@ -634,3 +644,3 @@ /** Content and layout elements extracted from a page from the input. */ | ||
*/ | ||
fontStyle?: FontStyleOutput; | ||
fontStyle?: DocumentFontStyleOutput; | ||
/** | ||
@@ -641,3 +651,3 @@ * Font weight. | ||
*/ | ||
fontWeight?: FontWeightOutput; | ||
fontWeight?: DocumentFontWeightOutput; | ||
/** Foreground color in #rrggbb hexadecimal format. */ | ||
@@ -668,3 +678,3 @@ color?: string; | ||
/** An object describing the location and semantic content of a document. */ | ||
export interface DocumentOutput { | ||
export interface AnalyzedDocumentOutput { | ||
/** Document type. */ | ||
@@ -780,9 +790,11 @@ docType: string; | ||
/** Status and result of the analyze batch operation. */ | ||
export interface AnalyzeBatchResultOperationOutput { | ||
export interface AnalyzeBatchOperationOutput { | ||
/** Analyze batch operation result ID. */ | ||
resultId?: string; | ||
/** | ||
* Operation status. notStarted, running, completed, or failed | ||
* Operation status. notStarted, running, succeeded, or failed | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** Date and time (UTC) when the operation was submitted. */ | ||
@@ -795,3 +807,3 @@ createdDateTime: string; | ||
/** Encountered error during batch document analysis. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
/** Batch document analysis result. */ | ||
@@ -809,3 +821,3 @@ result?: AnalyzeBatchResultOutput; | ||
/** Operation detail for each document in the batch. */ | ||
details: Array<AnalyzeBatchOperationDetailOutput>; | ||
details?: Array<AnalyzeBatchOperationDetailOutput>; | ||
} | ||
@@ -817,5 +829,5 @@ /** Operation detail for a document in a batch analysis. */ | ||
* | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "completed", "canceled" | ||
* Possible values: "notStarted", "running", "failed", "succeeded", "canceled", "skipped" | ||
*/ | ||
status: OperationStatusOutput; | ||
status: DocumentIntelligenceOperationStatusOutput; | ||
/** URL of the source document. */ | ||
@@ -826,4 +838,11 @@ sourceUrl: string; | ||
/** Encountered error. */ | ||
error?: ErrorModelOutput; | ||
error?: DocumentIntelligenceErrorOutput; | ||
} | ||
/** Paged collection of AnalyzeBatchOperation items */ | ||
export interface PagedAnalyzeBatchOperationOutput { | ||
/** The AnalyzeBatchOperation items on this page */ | ||
value: Array<AnalyzeBatchOperationOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -833,3 +852,3 @@ * Authorization to copy a document model to the specified target resource and | ||
*/ | ||
export interface CopyAuthorizationOutput { | ||
export interface ModelCopyAuthorizationOutput { | ||
/** ID of the target Azure resource where the document model should be copied to. */ | ||
@@ -851,2 +870,16 @@ targetResourceId: string; | ||
} | ||
/** Paged collection of DocumentModelDetails items */ | ||
export interface PagedDocumentModelDetailsOutput { | ||
/** The DocumentModelDetails items on this page */ | ||
value: Array<DocumentModelDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export interface PagedDocumentClassifierDetailsOutput { | ||
/** The DocumentClassifierDetails items on this page */ | ||
value: Array<DocumentClassifierDetailsOutput>; | ||
/** The link to the next page of items */ | ||
nextLink?: string; | ||
} | ||
/** | ||
@@ -874,7 +907,5 @@ * Authorization to copy a document classifier to the specified target resource and | ||
/** Operation info. */ | ||
export type OperationDetailsOutput = OperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Paged collection of OperationDetails items */ | ||
export type PagedOperationDetailsOutput = Paged<OperationDetailsOutput>; | ||
/** Alias for OperationStatusOutput */ | ||
export type OperationStatusOutput = string; | ||
export type DocumentIntelligenceOperationDetailsOutput = DocumentIntelligenceOperationDetailsOutputParent | DocumentModelBuildOperationDetailsOutput | DocumentModelComposeOperationDetailsOutput | DocumentModelCopyToOperationDetailsOutput | DocumentClassifierCopyToOperationDetailsOutput | DocumentClassifierBuildOperationDetailsOutput; | ||
/** Alias for DocumentIntelligenceOperationStatusOutput */ | ||
export type DocumentIntelligenceOperationStatusOutput = string; | ||
/** Alias for OperationKindOutput */ | ||
@@ -894,4 +925,4 @@ export type OperationKindOutput = string; | ||
export type StringIndexTypeOutput = string; | ||
/** Alias for ContentFormatOutput */ | ||
export type ContentFormatOutput = string; | ||
/** Alias for DocumentContentFormatOutput */ | ||
export type DocumentContentFormatOutput = string; | ||
/** Alias for LengthUnitOutput */ | ||
@@ -909,12 +940,8 @@ export type LengthUnitOutput = string; | ||
export type DocumentTableCellKindOutput = string; | ||
/** Alias for FontStyleOutput */ | ||
export type FontStyleOutput = string; | ||
/** Alias for FontWeightOutput */ | ||
export type FontWeightOutput = string; | ||
/** Alias for DocumentFontStyleOutput */ | ||
export type DocumentFontStyleOutput = string; | ||
/** Alias for DocumentFontWeightOutput */ | ||
export type DocumentFontWeightOutput = string; | ||
/** Alias for DocumentSignatureTypeOutput */ | ||
export type DocumentSignatureTypeOutput = string; | ||
/** Paged collection of DocumentModelDetails items */ | ||
export type PagedDocumentModelDetailsOutput = Paged<DocumentModelDetailsOutput>; | ||
/** Paged collection of DocumentClassifierDetails items */ | ||
export type PagedDocumentClassifierDetailsOutput = Paged<DocumentClassifierDetailsOutput>; | ||
//# sourceMappingURL=outputModels.d.ts.map |
@@ -1,4 +0,29 @@ | ||
import type { PagedAsyncIterableIterator } from "@azure/core-paging"; | ||
import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; | ||
/** | ||
* An interface that tracks the settings for paged iteration | ||
*/ | ||
export interface PageSettings { | ||
/** | ||
* The token that keeps track of where to continue the iterator | ||
*/ | ||
continuationToken?: string; | ||
} | ||
/** | ||
* An interface that allows async iterable iteration both to completion and by page. | ||
*/ | ||
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> { | ||
/** | ||
* The next method, part of the iteration protocol | ||
*/ | ||
next(): Promise<IteratorResult<TElement>>; | ||
/** | ||
* The connection to the async iterator, part of the iteration protocol | ||
*/ | ||
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>; | ||
/** | ||
* Return an AsyncIterableIterator that works a page at a time | ||
*/ | ||
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>; | ||
} | ||
/** | ||
* Helper type to extract the type of an array | ||
@@ -10,3 +35,3 @@ */ | ||
*/ | ||
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{ | ||
export type GetPage<TPage> = (pageLink: string) => Promise<{ | ||
page: TPage; | ||
@@ -13,0 +38,0 @@ nextPageLink?: string; |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { getPagedAsyncIterator } from "@azure/core-paging"; | ||
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; | ||
import { createRestError } from "@azure-rest/core-client"; | ||
/** | ||
* returns an async iterator that iterates over results. It also has a `byPage` | ||
* method that returns pages of items at once. | ||
* | ||
* @param pagedResult - an object that specifies how to get pages. | ||
* @returns a paged async iterator that iterates over results. | ||
*/ | ||
function getPagedAsyncIterator(pagedResult) { | ||
var _a; | ||
const iter = getItemAsyncIterator(pagedResult); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { | ||
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {}; | ||
return getPageAsyncIterator(pagedResult, { | ||
pageLink: continuationToken, | ||
}); | ||
}), | ||
}; | ||
} | ||
function getItemAsyncIterator(pagedResult) { | ||
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { | ||
var _a, e_1, _b, _c, _d, e_2, _e, _f; | ||
const pages = getPageAsyncIterator(pagedResult); | ||
const firstVal = yield __await(pages.next()); | ||
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is | ||
if (!Array.isArray(firstVal.value)) { | ||
// can extract elements from this page | ||
const { toElements } = pagedResult; | ||
if (toElements) { | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(firstVal.value)))); | ||
try { | ||
for (var _g = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) { | ||
_c = pages_1_1.value; | ||
_g = false; | ||
const page = _c; | ||
yield __await(yield* __asyncDelegator(__asyncValues(toElements(page)))); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_g && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
else { | ||
yield yield __await(firstVal.value); | ||
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case | ||
yield __await(yield* __asyncDelegator(__asyncValues(pages))); | ||
} | ||
} | ||
else { | ||
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value))); | ||
try { | ||
for (var _h = true, pages_2 = __asyncValues(pages), pages_2_1; pages_2_1 = yield __await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) { | ||
_f = pages_2_1.value; | ||
_h = false; | ||
const page = _f; | ||
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch, | ||
// it must be the case that `TPage = TElement[]` | ||
yield __await(yield* __asyncDelegator(__asyncValues(page))); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_h && !_d && (_e = pages_2.return)) yield __await(_e.call(pages_2)); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
} | ||
}); | ||
} | ||
function getPageAsyncIterator(pagedResult_1) { | ||
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) { | ||
const { pageLink } = options; | ||
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
while (response.nextPageLink) { | ||
response = yield __await(pagedResult.getPage(response.nextPageLink)); | ||
if (!response) { | ||
return yield __await(void 0); | ||
} | ||
yield yield __await(response.page); | ||
} | ||
}); | ||
} | ||
/** | ||
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension | ||
@@ -7,0 +104,0 @@ * @param client - Client to use for sending the next page requests |
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; | ||
import type { RequestParameters } from "@azure-rest/core-client"; | ||
import type { StringIndexType, DocumentAnalysisFeature, ContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, CopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
import type { StringIndexType, DocumentAnalysisFeature, DocumentContentFormat, AnalyzeOutputOption, AnalyzeDocumentRequest, AnalyzeBatchDocumentsRequest, BuildDocumentModelRequest, ComposeDocumentModelRequest, AuthorizeCopyRequest, ModelCopyAuthorization, BuildDocumentClassifierRequest, SplitMode, ClassifyDocumentRequest, AuthorizeClassifierCopyRequest, ClassifierCopyAuthorization } from "./models.js"; | ||
export interface ListOperationsHeaders { | ||
@@ -60,6 +60,7 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
export type GetOperationParameters = GetOperationHeaderParam & RequestParameters; | ||
export type GetResourceInfoParameters = RequestParameters; | ||
export type GetResourceDetailsParameters = RequestParameters; | ||
export type GetAnalyzeResultParameters = RequestParameters; | ||
export type GetAnalyzeResultPdfParameters = RequestParameters; | ||
export type GetAnalyzeResultFigureParameters = RequestParameters; | ||
export type DeleteAnalyzeResultParameters = RequestParameters; | ||
export interface AnalyzeDocumentFromStreamBodyParam { | ||
@@ -73,4 +74,31 @@ /** | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFromStreamOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentFromStreamQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -89,5 +117,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFromStreamFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentFromStreamQueryFieldsQueryParam; | ||
/** | ||
@@ -98,5 +126,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentFromStreamOutputQueryParam; | ||
} | ||
@@ -113,6 +141,33 @@ export interface AnalyzeDocumentFromStreamQueryParam { | ||
/** Analyze request parameters. */ | ||
body?: AnalyzeDocumentRequest; | ||
body: AnalyzeDocumentRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeDocumentOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeDocumentQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -131,5 +186,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeDocumentFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeDocumentQueryFieldsQueryParam; | ||
/** | ||
@@ -140,5 +195,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeDocumentOutputQueryParam; | ||
} | ||
@@ -156,6 +211,33 @@ export interface AnalyzeDocumentQueryParam { | ||
/** Analyze batch request parameters. */ | ||
body?: AnalyzeBatchDocumentsRequest; | ||
body: AnalyzeBatchDocumentsRequest; | ||
} | ||
/** This is the wrapper object for the parameter `features` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsFeaturesQueryParam { | ||
/** Value of the parameter */ | ||
value: DocumentAnalysisFeature[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `queryFields` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsQueryFieldsQueryParam { | ||
/** Value of the parameter */ | ||
value: string[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
/** This is the wrapper object for the parameter `output` with explode set to false and style set to form. */ | ||
export interface AnalyzeBatchDocumentsOutputQueryParam { | ||
/** Value of the parameter */ | ||
value: AnalyzeOutputOption[]; | ||
/** Should we explode the value? */ | ||
explode: false; | ||
/** Style of the value */ | ||
style: "form"; | ||
} | ||
export interface AnalyzeBatchDocumentsQueryParamProperties { | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -174,5 +256,5 @@ /** | ||
/** List of optional analysis features. */ | ||
features?: DocumentAnalysisFeature[]; | ||
features?: DocumentAnalysisFeature[] | AnalyzeBatchDocumentsFeaturesQueryParam; | ||
/** List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber" */ | ||
queryFields?: string[]; | ||
queryFields?: string[] | AnalyzeBatchDocumentsQueryFieldsQueryParam; | ||
/** | ||
@@ -183,5 +265,5 @@ * Format of the analyze result top-level content. | ||
*/ | ||
outputContentFormat?: ContentFormat; | ||
outputContentFormat?: DocumentContentFormat; | ||
/** Additional outputs to generate during analysis. */ | ||
output?: AnalyzeOutputOption[]; | ||
output?: AnalyzeOutputOption[] | AnalyzeBatchDocumentsOutputQueryParam; | ||
} | ||
@@ -196,2 +278,4 @@ export interface AnalyzeBatchDocumentsQueryParam { | ||
export type AnalyzeBatchDocumentsParameters = AnalyzeBatchDocumentsQueryParam & AnalyzeBatchDocumentsMediaTypesParam & AnalyzeBatchDocumentsBodyParam & RequestParameters; | ||
export type ListAnalyzeBatchResultsParameters = RequestParameters; | ||
export type DeleteAnalyzeBatchResultParameters = RequestParameters; | ||
export interface GetModelHeaders { | ||
@@ -222,3 +306,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
/** Copy to request parameters. */ | ||
body: CopyAuthorization; | ||
body: ModelCopyAuthorization; | ||
} | ||
@@ -292,3 +376,3 @@ export type CopyModelToParameters = CopyModelToBodyParam & RequestParameters; | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -321,3 +405,3 @@ } | ||
split?: SplitMode; | ||
/** List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
/** 1-based page numbers to analyze. Ex. "1-3,5,7-9" */ | ||
pages?: string; | ||
@@ -324,0 +408,0 @@ } |
import type { Client } from "@azure-rest/core-client"; | ||
import type { AbortSignalLike } from "@azure/abort-controller"; | ||
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro"; | ||
import type { OperationState, PollerLike } from "@azure/core-lro"; | ||
import type { AnalyzeDocumentFromStream202Response, AnalyzeDocumentFromStreamDefaultResponse, AnalyzeDocumentFromStreamLogicalResponse, AnalyzeBatchDocuments202Response, AnalyzeBatchDocumentsDefaultResponse, AnalyzeBatchDocumentsLogicalResponse, BuildModel202Response, BuildModelDefaultResponse, BuildModelLogicalResponse, ComposeModel202Response, ComposeModelDefaultResponse, ComposeModelLogicalResponse, CopyModelTo202Response, CopyModelToDefaultResponse, CopyModelToLogicalResponse, BuildClassifier202Response, BuildClassifierDefaultResponse, BuildClassifierLogicalResponse, ClassifyDocumentFromStream202Response, ClassifyDocumentFromStreamDefaultResponse, ClassifyDocumentFromStreamLogicalResponse, CopyClassifierTo202Response, CopyClassifierToDefaultResponse, CopyClassifierToLogicalResponse } from "./responses.js"; | ||
/** | ||
* A simple poller that can be used to poll a long running operation. | ||
* Options for `getLongRunningPoller`. | ||
*/ | ||
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> { | ||
export interface GetLongRunningPollerOptions { | ||
/** | ||
* Returns true if the poller has finished polling. | ||
* Defines how much time the poller is going to wait before making a new request to the service. | ||
*/ | ||
isDone(): boolean; | ||
intervalInMs?: number; | ||
/** | ||
* Returns the state of the operation. | ||
* A serialized poller which can be used to resume an existing paused Long-Running-Operation. | ||
*/ | ||
getOperationState(): TState; | ||
/** | ||
* Returns the id of the operation. | ||
*/ | ||
getOperationId(): string; | ||
/** | ||
* Returns the result value of the operation, | ||
* regardless of the state of the poller. | ||
* It can return undefined or an incomplete form of the final TResult value | ||
* depending on the implementation. | ||
*/ | ||
getResult(): TResult | undefined; | ||
/** | ||
* Returns a promise that will resolve once a single polling request finishes. | ||
* It does this by calling the update method of the Poller's operation. | ||
*/ | ||
poll(options?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TState>; | ||
/** | ||
* Returns a promise that will resolve once the underlying operation is completed. | ||
*/ | ||
pollUntilDone(pollOptions?: { | ||
abortSignal?: AbortSignalLike; | ||
}): Promise<TResult>; | ||
/** | ||
* Invokes the provided callback after each polling is completed, | ||
* sending the current state of the poller's operation. | ||
* | ||
* It returns a method that can be used to stop receiving updates on the given callback function. | ||
*/ | ||
onProgress(callback: (state: TState) => void): CancelOnProgress; | ||
/** | ||
* Returns a promise that could be used for serialized version of the poller's operation | ||
* by invoking the operation's serialize method. | ||
*/ | ||
serialize(): Promise<string>; | ||
/** | ||
* Wait the poller to be submitted. | ||
*/ | ||
submitted(): Promise<void>; | ||
/** | ||
* Returns a string representation of the poller's operation. Similar to serialize but returns a string. | ||
* @deprecated Use serialize() instead. | ||
*/ | ||
toString(): string; | ||
/** | ||
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling | ||
* @deprecated Use abortSignal to stop polling instead. | ||
*/ | ||
stopPolling(): void; | ||
/** | ||
* Returns true if the poller is stopped. | ||
* @deprecated Use abortSignal status to track this instead. | ||
*/ | ||
isStopped(): boolean; | ||
restoreFrom?: string; | ||
} | ||
@@ -80,10 +24,18 @@ /** | ||
*/ | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeBatchDocumentsLogicalResponse | AnalyzeBatchDocumentsDefaultResponse>(client: Client, initialResponse: AnalyzeBatchDocuments202Response | AnalyzeBatchDocumentsDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildModelLogicalResponse | BuildModelDefaultResponse>(client: Client, initialResponse: BuildModel202Response | BuildModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ComposeModelLogicalResponse | ComposeModelDefaultResponse>(client: Client, initialResponse: ComposeModel202Response | ComposeModelDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyModelToLogicalResponse | CopyModelToDefaultResponse>(client: Client, initialResponse: CopyModelTo202Response | CopyModelToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends BuildClassifierLogicalResponse | BuildClassifierDefaultResponse>(client: Client, initialResponse: BuildClassifier202Response | BuildClassifierDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends CopyClassifierToLogicalResponse | CopyClassifierToDefaultResponse>(client: Client, initialResponse: CopyClassifierTo202Response | CopyClassifierToDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends AnalyzeDocumentFromStreamLogicalResponse | AnalyzeDocumentFromStreamDefaultResponse>(client: Client, initialResponse: AnalyzeDocumentFromStream202Response | AnalyzeDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
export declare function getLongRunningPoller<TResult extends ClassifyDocumentFromStreamLogicalResponse | ClassifyDocumentFromStreamDefaultResponse>(client: Client, initialResponse: ClassifyDocumentFromStream202Response | ClassifyDocumentFromStreamDefaultResponse, options?: GetLongRunningPollerOptions): PollerLike<OperationState<TResult>, TResult>; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export declare function parseResultIdFromResponse(initialResponse: { | ||
headers: { | ||
"operation-location": string; | ||
}; | ||
}): string; | ||
//# sourceMappingURL=pollingHelper.d.ts.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { createHttpPoller } from "@azure/core-lro"; | ||
export async function getLongRunningPoller(client, initialResponse, options = {}) { | ||
var _a; | ||
export function getLongRunningPoller(client, initialResponse, options = {}) { | ||
const abortController = new AbortController(); | ||
@@ -46,47 +45,3 @@ const poller = { | ||
}; | ||
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true; | ||
const httpPoller = createHttpPoller(poller, Object.assign(Object.assign({}, options), { updateState: (state, response) => { | ||
const flatResponse = response.flatResponse; | ||
if (!("body" in flatResponse)) | ||
return; | ||
const flatResponseBody = flatResponse.body; | ||
if (!("status" in flatResponseBody && flatResponseBody.status === "completed")) | ||
return; | ||
state.status = "succeeded"; | ||
} })); | ||
const simplePoller = { | ||
isDone() { | ||
return httpPoller.isDone; | ||
}, | ||
isStopped() { | ||
return abortController.signal.aborted; | ||
}, | ||
getOperationState() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return httpPoller.operationState; | ||
}, | ||
getResult() { | ||
return httpPoller.result; | ||
}, | ||
toString() { | ||
if (!httpPoller.operationState) { | ||
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."); | ||
} | ||
return JSON.stringify({ | ||
state: httpPoller.operationState, | ||
}); | ||
}, | ||
stopPolling() { | ||
abortController.abort(); | ||
}, | ||
onProgress: httpPoller.onProgress, | ||
poll: httpPoller.poll, | ||
pollUntilDone: httpPoller.pollUntilDone, | ||
serialize: httpPoller.serialize, | ||
submitted: httpPoller.submitted, | ||
getOperationId: () => parseOperationId(initialResponse.headers["operation-location"]), | ||
}; | ||
return simplePoller; | ||
return createHttpPoller(poller, options); | ||
} | ||
@@ -96,3 +51,3 @@ /** | ||
*/ | ||
function parseOperationId(operationLocationHeader) { | ||
function parseResultId(operationLocationHeader) { | ||
// regex to extract the operation id from the operation-location header with the regex "[^:]+://[^/]+/documentintelligence/.+/([^?/]+)" | ||
@@ -102,3 +57,3 @@ const regex = /[^:]+:\/\/[^/]+\/documentintelligence\/.+\/([^?/]+)/; | ||
if (!match) { | ||
throw new Error(`Failed to parse operation id from the operation-location header: ${operationLocationHeader}`); | ||
throw new Error(`Failed to parse result id from the operation-location header: ${operationLocationHeader}`); | ||
} | ||
@@ -108,2 +63,9 @@ return match[1]; | ||
/** | ||
* Returns the operation-id from the initialResponse header | ||
*/ | ||
export function parseResultIdFromResponse(initialResponse) { | ||
const operationLocationHeader = initialResponse.headers["operation-location"]; | ||
return parseResultId(operationLocationHeader); | ||
} | ||
/** | ||
* Converts a Rest Client response to a response that the LRO implementation understands | ||
@@ -110,0 +72,0 @@ * @param response - a rest client http response |
import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; | ||
import type { HttpResponse } from "@azure-rest/core-client"; | ||
import type { PagedOperationDetailsOutput, ErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, OperationDetailsOutput, ResourceDetailsOutput, AnalyzeResultOperationOutput, AnalyzeBatchResultOperationOutput, DocumentModelDetailsOutput, CopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
import type { PagedDocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceErrorResponseOutput, DocumentModelBuildOperationDetailsOutput, DocumentModelComposeOperationDetailsOutput, DocumentModelCopyToOperationDetailsOutput, DocumentClassifierCopyToOperationDetailsOutput, DocumentClassifierBuildOperationDetailsOutput, DocumentIntelligenceOperationDetailsOutput, DocumentIntelligenceResourceDetailsOutput, AnalyzeOperationOutput, AnalyzeBatchOperationOutput, PagedAnalyzeBatchOperationOutput, DocumentModelDetailsOutput, ModelCopyAuthorizationOutput, PagedDocumentModelDetailsOutput, PagedDocumentClassifierDetailsOutput, DocumentClassifierDetailsOutput, ClassifierCopyAuthorizationOutput } from "./outputModels.js"; | ||
export interface ListOperations200Headers { | ||
@@ -11,3 +11,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: "200"; | ||
body: PagedOperationDetailsOutput; | ||
body: PagedDocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & ListOperations200Headers; | ||
@@ -17,3 +17,3 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -32,3 +32,3 @@ export interface GetDocumentModelBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -47,3 +47,3 @@ export interface GetDocumentModelComposeOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -62,3 +62,3 @@ export interface GetDocumentModelCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -77,3 +77,3 @@ export interface GetDocumentClassifierCopyToOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -92,3 +92,3 @@ export interface GetDocumentClassifierBuildOperation200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -102,3 +102,3 @@ export interface GetOperation200Headers { | ||
status: "200"; | ||
body: OperationDetailsOutput; | ||
body: DocumentIntelligenceOperationDetailsOutput; | ||
headers: RawHttpHeaders & GetOperation200Headers; | ||
@@ -108,12 +108,12 @@ } | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** The request has succeeded. */ | ||
export interface GetResourceInfo200Response extends HttpResponse { | ||
export interface GetResourceDetails200Response extends HttpResponse { | ||
status: "200"; | ||
body: ResourceDetailsOutput; | ||
body: DocumentIntelligenceResourceDetailsOutput; | ||
} | ||
export interface GetResourceInfoDefaultResponse extends HttpResponse { | ||
export interface GetResourceDetailsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -123,7 +123,7 @@ /** The request has succeeded. */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -143,3 +143,3 @@ export interface GetAnalyzeResultPdf200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -159,4 +159,12 @@ export interface GetAnalyzeResultFigure200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface AnalyzeDocumentFromStream202Headers { | ||
@@ -174,3 +182,3 @@ /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -193,3 +201,3 @@ /** The final response for long-running analyzeDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -203,7 +211,7 @@ /** The final response for long-running analyzeDocument operation */ | ||
status: "200"; | ||
body: AnalyzeBatchResultOperationOutput; | ||
body: AnalyzeBatchOperationOutput; | ||
} | ||
export interface GetAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -222,3 +230,3 @@ export interface AnalyzeBatchDocuments202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -229,2 +237,19 @@ /** The final response for long-running analyzeBatchDocuments operation */ | ||
} | ||
/** The request has succeeded. */ | ||
export interface ListAnalyzeBatchResults200Response extends HttpResponse { | ||
status: "200"; | ||
body: PagedAnalyzeBatchOperationOutput; | ||
} | ||
export interface ListAnalyzeBatchResultsDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
/** There is no content to send for this request, but the headers may be useful. */ | ||
export interface DeleteAnalyzeBatchResult204Response extends HttpResponse { | ||
status: "204"; | ||
} | ||
export interface DeleteAnalyzeBatchResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
export interface GetModel200Headers { | ||
@@ -242,3 +267,3 @@ /** An opaque, globally-unique, client-generated string identifier for the request. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -257,3 +282,3 @@ export interface BuildModel202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -276,3 +301,3 @@ /** The final response for long-running buildModel operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -286,7 +311,7 @@ /** The final response for long-running composeModel operation */ | ||
status: "200"; | ||
body: CopyAuthorizationOutput; | ||
body: ModelCopyAuthorizationOutput; | ||
} | ||
export interface AuthorizeModelCopyDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -305,3 +330,3 @@ export interface CopyModelTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -324,3 +349,3 @@ /** The final response for long-running copyModelTo operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -338,3 +363,3 @@ export interface DeleteModel204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -353,3 +378,3 @@ export interface BuildClassifier202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -372,3 +397,3 @@ /** The final response for long-running buildClassifier operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -387,3 +412,3 @@ export interface GetClassifier200Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -401,3 +426,3 @@ export interface DeleteClassifier204Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -416,3 +441,3 @@ export interface ClassifyDocumentFromStream202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -435,3 +460,3 @@ /** The final response for long-running classifyDocumentFromStream operation */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -445,7 +470,7 @@ /** The final response for long-running classifyDocument operation */ | ||
status: "200"; | ||
body: AnalyzeResultOperationOutput; | ||
body: AnalyzeOperationOutput; | ||
} | ||
export interface GetClassifyResultDefaultResponse extends HttpResponse { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -459,3 +484,3 @@ /** The request has succeeded. */ | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -474,3 +499,3 @@ export interface CopyClassifierTo202Headers { | ||
status: string; | ||
body: ErrorResponseOutput; | ||
body: DocumentIntelligenceErrorResponseOutput; | ||
} | ||
@@ -477,0 +502,0 @@ /** The final response for long-running copyClassifierTo operation */ |
{ | ||
"name": "@azure-rest/ai-document-intelligence", | ||
"version": "1.0.0-alpha.20241216.1", | ||
"version": "1.0.0-alpha.20241218.1", | ||
"description": "Document Intelligence Rest Client", | ||
@@ -11,2 +11,3 @@ "engines": { | ||
"tshy": { | ||
"project": "tsconfig.src.json", | ||
"exports": { | ||
@@ -24,4 +25,3 @@ "./package.json": "./package.json", | ||
], | ||
"selfLink": false, | ||
"project": "./tsconfig.src.json" | ||
"selfLink": false | ||
}, | ||
@@ -33,5 +33,3 @@ "type": "module", | ||
"cloud", | ||
"typescript", | ||
"browser", | ||
"isomorphic" | ||
"typescript" | ||
], | ||
@@ -52,2 +50,3 @@ "author": "Microsoft Corporation", | ||
}, | ||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/documentintelligence/ai-document-intelligence-rest/README.md", | ||
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", | ||
@@ -63,51 +62,49 @@ "//metadata": { | ||
"dependencies": { | ||
"@azure-rest/core-client": "^2.1.0", | ||
"@azure/abort-controller": "^2.1.2", | ||
"@azure/core-auth": "^1.6.0", | ||
"@azure/core-lro": "^3.0.0", | ||
"@azure/core-paging": "^1.5.0", | ||
"@azure/core-rest-pipeline": "^1.5.0", | ||
"@azure/logger": "^1.0.0", | ||
"tslib": "^2.6.2" | ||
"@azure-rest/core-client": "^2.3.1", | ||
"@azure/core-auth": "^1.9.0", | ||
"@azure/core-rest-pipeline": "^1.18.1", | ||
"@azure/logger": "^1.1.4", | ||
"tslib": "^2.8.1", | ||
"@azure/core-lro": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@azure-tools/test-credential": "^2.0.0", | ||
"@azure-tools/test-recorder": "^4.0.0", | ||
"@azure/core-util": "^1.0.0", | ||
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb", | ||
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb", | ||
"@azure/abort-controller": "^2.1.2", | ||
"dotenv": "^16.0.0", | ||
"@microsoft/api-extractor": "^7.40.3", | ||
"@types/node": "^18.0.0", | ||
"eslint": "^9.9.0", | ||
"typescript": "~5.7.2", | ||
"@azure/identity": "^4.2.1", | ||
"@types/node": "^18.0.0", | ||
"@vitest/browser": "^2.0.5", | ||
"@vitest/coverage-istanbul": "^2.0.5", | ||
"dotenv": "^16.0.0", | ||
"eslint": "^9.9.0", | ||
"playwright": "^1.41.2", | ||
"prettier": "^3.2.5", | ||
"typescript": "~5.6.2", | ||
"vitest": "^2.0.5" | ||
"vitest": "^2.0.5", | ||
"@azure-tools/test-credential": "^2.0.0", | ||
"@azure-tools/test-recorder": "^4.0.0", | ||
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb", | ||
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb" | ||
}, | ||
"scripts": { | ||
"build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", | ||
"build:samples": "dev-tool samples publish --force", | ||
"build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", | ||
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", | ||
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", | ||
"execute:samples": "dev-tool samples run samples-dev", | ||
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz", | ||
"extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", | ||
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", | ||
"generate:client": "echo skipped", | ||
"pack": "npm pack 2>&1", | ||
"lint": "eslint package.json api-extractor.json src test", | ||
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", | ||
"unit-test": "npm run unit-test:node && npm run unit-test:browser", | ||
"unit-test:browser": "echo skipped", | ||
"unit-test:node": "dev-tool run test:vitest --test-proxy-debug", | ||
"integration-test": "npm run integration-test:node && npm run integration-test:browser", | ||
"integration-test:browser": "echo skipped", | ||
"integration-test:node": "echo skipped", | ||
"lint": "eslint package.json api-extractor.json src test", | ||
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", | ||
"integration-test:node": "dev-tool run test:vitest --esm", | ||
"build:samples": "echo skipped", | ||
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", | ||
"execute:samples": "echo skipped", | ||
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", | ||
"generate:client": "echo skipped", | ||
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", | ||
"minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", | ||
"pack": "npm pack 2>&1", | ||
"build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", | ||
"build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", | ||
"test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", | ||
"test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", | ||
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", | ||
"test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", | ||
"unit-test": "npm run unit-test:node && npm run unit-test:browser", | ||
"unit-test:browser": "echo skipped", | ||
"unit-test:node": "dev-tool run test:vitest", | ||
"update-snippets": "echo skipped" | ||
@@ -114,0 +111,0 @@ }, |
144
README.md
@@ -18,3 +18,3 @@ # Azure DocumentIntelligence (formerly FormRecognizer) REST client library for JavaScript | ||
> This version of the client library defaults to the `"2024-07-31-preview"` version of the service. | ||
> This version of the client library defaults to the `"2024-11-30"` version of the service. | ||
@@ -25,5 +25,3 @@ This table shows the relationship between SDK versions and supported API versions of the service: | ||
| ------------ | -------------------------------- | | ||
| 1.0.0-beta.3 | 2024-07-31-preview | | ||
| 1.0.0-beta.2 | 2024-02-29-preview | | ||
| 1.0.0-beta.1 | 2023-10-31-preview | | ||
| 1.0.0 | 2024-11-30 | | ||
@@ -36,5 +34,3 @@ > Please rely on the older `@azure/ai-form-recognizer` library through the older service API versions for retired models, such as `"prebuilt-businessCard"` and `"prebuilt-document"`. For more information, see [Changelog](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/documentintelligence/ai-document-intelligence-rest/CHANGELOG.md). | ||
| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------- | | ||
| 2024-07-31-preview | DocumentIntelligenceClient | `@azure-rest/ai-document-intelligence` version `1.0.0-beta.3` | | ||
| 2024-02-29-preview | DocumentIntelligenceClient | `@azure-rest/ai-document-intelligence` version `1.0.0-beta.2` | | ||
| 2023-10-31-preview | DocumentIntelligenceClient | `@azure-rest/ai-document-intelligence` version `1.0.0-beta.1` | | ||
| 2024-11-30 | DocumentIntelligenceClient | `@azure-rest/ai-document-intelligence` version `1.0.0` | | ||
| 2023-07-31 | DocumentAnalysisClient and DocumentModelAdministrationClient | `@azure/ai-form-recognizer` version `^5.0.0` | | ||
@@ -83,3 +79,3 @@ | 2022-08-01 | DocumentAnalysisClient and DocumentModelAdministrationClient | `@azure/ai-form-recognizer` version `^4.0.0` | | ||
process.env["DOCUMENT_INTELLIGENCE_ENDPOINT"], | ||
new DefaultAzureCredential(), | ||
new DefaultAzureCredential() | ||
); | ||
@@ -146,3 +142,3 @@ ``` | ||
} | ||
const poller = await getLongRunningPoller(client, initialResponse); | ||
const poller = getLongRunningPoller(client, initialResponse); | ||
const result = (await poller.pollUntilDone()).body as AnalyzeResultOperationOutput; | ||
@@ -164,2 +160,38 @@ console.log(result); | ||
## Batch analysis | ||
```ts | ||
import { parseResultIdFromResponse, isUnexpected } from "@azure-rest/ai-document-intelligence"; | ||
// 1. Analyze a batch of documents | ||
const initialResponse = await client | ||
.path("/documentModels/{modelId}:analyzeBatch", "prebuilt-layout") | ||
.post({ | ||
contentType: "application/json", | ||
body: { | ||
azureBlobSource: { | ||
containerUrl: batchTrainingFilesContainerUrl(), | ||
}, | ||
resultContainerUrl: batchTrainingFilesResultContainerUrl(), | ||
resultPrefix: "result", | ||
}, | ||
}); | ||
if (isUnexpected(initialResponse)) { | ||
throw initialResponse.body.error; | ||
} | ||
const resultId = parseResultIdFromResponse(initialResponse); | ||
console.log("resultId: ", resultId); | ||
// (Optional) You can poll for the batch analysis result but be aware that a job may take unexpectedly long time, and polling could incur additional costs. | ||
// const poller = getLongRunningPoller(client, initialResponse); | ||
// await poller.pollUntilDone(); | ||
// 2. At a later time, you can retrieve the operation result using the resultId | ||
const output = await client | ||
.path("/documentModels/{modelId}/analyzeResults/{resultId}", "prebuilt-layout", resultId) | ||
.get(); | ||
console.log(output); | ||
``` | ||
### Markdown content format | ||
@@ -255,3 +287,3 @@ | ||
} | ||
const poller = await getLongRunningPoller(client, initialResponse); | ||
const poller = getLongRunningPoller(client, initialResponse); | ||
const response = (await poller.pollUntilDone()) | ||
@@ -277,2 +309,94 @@ .body as DocumentClassifierBuildOperationDetailsOutput; | ||
## Get the generated PDF output from document analysis | ||
```ts | ||
const filePath = path.join(ASSET_PATH, "layout-pageobject.pdf"); | ||
const base64Source = await fs.readFile(filePath, { encoding: "base64" }); | ||
const initialResponse = await client | ||
.path("/documentModels/{modelId}:analyze", "prebuilt-read") | ||
.post({ | ||
contentType: "application/json", | ||
body: { | ||
base64Source, | ||
}, | ||
queryParameters: { output: ["pdf"] }, | ||
}); | ||
if (isUnexpected(initialResponse)) { | ||
throw initialResponse.body.error; | ||
} | ||
const poller = getLongRunningPoller(client, initialResponse); | ||
await poller.pollUntilDone(); | ||
const output = await client | ||
.path( | ||
"/documentModels/{modelId}/analyzeResults/{resultId}/pdf", | ||
"prebuilt-read", | ||
parseResultIdFromResponse(initialResponse) | ||
) | ||
.get() | ||
.asNodeStream(); // output.body would be NodeJS.ReadableStream | ||
if (output.status !== "200" || !output.body) { | ||
throw new Error("The response was unexpected, expected NodeJS.ReadableStream in the body."); | ||
} | ||
const pdfData = await streamToUint8Array(output.body); | ||
fs.promises.writeFile(`./output.pdf`, pdfData); | ||
// Or you can consume the NodeJS.ReadableStream directly | ||
``` | ||
## Get the generated cropped image of specified figure from document analysis | ||
```ts | ||
const filePath = path.join(ASSET_PATH, "layout-pageobject.pdf"); | ||
const base64Source = fs.readFileSync(filePath, { encoding: "base64" }); | ||
const initialResponse = await client | ||
.path("/documentModels/{modelId}:analyze", "prebuilt-layout") | ||
.post({ | ||
contentType: "application/json", | ||
body: { | ||
base64Source, | ||
}, | ||
queryParameters: { output: ["figures"] }, | ||
}); | ||
if (isUnexpected(initialResponse)) { | ||
throw initialResponse.body.error; | ||
} | ||
const poller = getLongRunningPoller(client, initialResponse, { ...testPollingOptions }); | ||
const result = (await poller.pollUntilDone()).body as AnalyzeResultOperationOutput; | ||
const figures = result.analyzeResult?.figures; | ||
assert.isArray(figures); | ||
assert.isNotEmpty(figures?.[0]); | ||
const figureId = figures?.[0].id || ""; | ||
assert.isDefined(figureId); | ||
const output = await client | ||
.path( | ||
"/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}", | ||
"prebuilt-layout", | ||
parseResultIdFromResponse(initialResponse), | ||
figureId | ||
) | ||
.get() | ||
.asNodeStream(); // output.body would be NodeJS.ReadableStream | ||
if (output.status !== "200" || !output.body) { | ||
throw new Error("The response was unexpected, expected NodeJS.ReadableStream in the body."); | ||
} | ||
const imageData = await streamToUint8Array(output.body); | ||
fs.promises.writeFile(`./figures/${figureId}.png`, imageData); | ||
// Or you can consume the NodeJS.ReadableStream directly | ||
``` | ||
## Get Info | ||
@@ -279,0 +403,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1523101
6
11610
1
433
- Removed@azure/abort-controller@^2.1.2
- Removed@azure/core-paging@^1.5.0
- Removed@azure/core-paging@1.6.2(transitive)
Updated@azure/core-auth@^1.9.0
Updated@azure/core-lro@^3.1.0
Updated@azure/logger@^1.1.4
Updatedtslib@^2.8.1