@azure-rest/ai-translation-document 1.0.0-alpha.20240701.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# Release History
|
|
2
|
+
## 1.0.0-beta.2 (2024-07-01)
|
|
3
|
+
|
|
4
|
+
### Other Changes
|
|
5
|
+
- Re-release of 1.0.0-beta.1 as the SDK package was released without types
|
|
6
|
+
|
|
2
7
|
## 1.0.0-beta.1 (2024-06-27)
|
|
3
8
|
- Initial release. Please see the README and wiki for information on the new design.
|
|
4
9
|
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function createClient(endpointParam, credentials, options = {}) {
|
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
25
25
|
const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : `${endpointParam}/translator`;
|
|
26
26
|
options.apiVersion = (_c = options.apiVersion) !== null && _c !== void 0 ? _c : "2024-05-01";
|
|
27
|
-
const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.
|
|
27
|
+
const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.2`;
|
|
28
28
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
29
29
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
30
30
|
: `${userAgentInfo}`;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/logger.ts","../src/documentTranslationClient.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/pollingHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"ai-translation-document\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { DocumentTranslationClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `DocumentTranslationClient`\n * @param endpointParam - Supported document Translation endpoint, protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): DocumentTranslationClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/translator`;\n options.apiVersion = options.apiVersion ?? \"2024-05-01\";\n const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const client = getClient(endpointUrl, credentials, options) as DocumentTranslationClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DocumentTranslate200Response,\n DocumentTranslateDefaultResponse,\n StartTranslation202Response,\n StartTranslationLogicalResponse,\n StartTranslationDefaultResponse,\n GetTranslationsStatus200Response,\n GetTranslationsStatusDefaultResponse,\n GetDocumentStatus200Response,\n GetDocumentStatusDefaultResponse,\n GetTranslationStatus200Response,\n GetTranslationStatusDefaultResponse,\n CancelTranslation200Response,\n CancelTranslationDefaultResponse,\n GetDocumentsStatus200Response,\n GetDocumentsStatusDefaultResponse,\n GetSupportedFormats200Response,\n GetSupportedFormatsDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /document:translate\": [\"200\"],\n \"GET /document/batches\": [\"200\"],\n \"POST /document/batches\": [\"202\"],\n \"GET /document/batches/{id}/documents/{documentId}\": [\"200\"],\n \"GET /document/batches/{id}\": [\"200\"],\n \"DELETE /document/batches/{id}\": [\"200\"],\n \"GET /document/batches/{id}/documents\": [\"200\"],\n \"GET /document/formats\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DocumentTranslate200Response | DocumentTranslateDefaultResponse,\n): response is DocumentTranslateDefaultResponse;\nexport function isUnexpected(\n response:\n | StartTranslation202Response\n | StartTranslationLogicalResponse\n | StartTranslationDefaultResponse,\n): response is StartTranslationDefaultResponse;\nexport function isUnexpected(\n response: GetTranslationsStatus200Response | GetTranslationsStatusDefaultResponse,\n): response is GetTranslationsStatusDefaultResponse;\nexport function isUnexpected(\n response: GetDocumentStatus200Response | GetDocumentStatusDefaultResponse,\n): response is GetDocumentStatusDefaultResponse;\nexport function isUnexpected(\n response: GetTranslationStatus200Response | GetTranslationStatusDefaultResponse,\n): response is GetTranslationStatusDefaultResponse;\nexport function isUnexpected(\n response: CancelTranslation200Response | CancelTranslationDefaultResponse,\n): response is CancelTranslationDefaultResponse;\nexport function isUnexpected(\n response: GetDocumentsStatus200Response | GetDocumentsStatusDefaultResponse,\n): response is GetDocumentsStatusDefaultResponse;\nexport function isUnexpected(\n response: GetSupportedFormats200Response | GetSupportedFormatsDefaultResponse,\n): response is GetSupportedFormatsDefaultResponse;\nexport function isUnexpected(\n response:\n | DocumentTranslate200Response\n | DocumentTranslateDefaultResponse\n | StartTranslation202Response\n | StartTranslationLogicalResponse\n | StartTranslationDefaultResponse\n | GetTranslationsStatus200Response\n | GetTranslationsStatusDefaultResponse\n | GetDocumentStatus200Response\n | GetDocumentStatusDefaultResponse\n | GetTranslationStatus200Response\n | GetTranslationStatusDefaultResponse\n | CancelTranslation200Response\n | CancelTranslationDefaultResponse\n | GetDocumentsStatus200Response\n | GetDocumentsStatusDefaultResponse\n | GetSupportedFormats200Response\n | GetSupportedFormatsDefaultResponse,\n): response is\n | DocumentTranslateDefaultResponse\n | StartTranslationDefaultResponse\n | GetTranslationsStatusDefaultResponse\n | GetDocumentStatusDefaultResponse\n | GetTranslationStatusDefaultResponse\n | CancelTranslationDefaultResponse\n | GetDocumentsStatusDefaultResponse\n | GetSupportedFormatsDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n CancelOnProgress,\n CreateHttpPollerOptions,\n LongRunningOperation,\n OperationResponse,\n OperationState,\n createHttpPoller,\n} from \"@azure/core-lro\";\nimport {\n StartTranslation202Response,\n StartTranslationDefaultResponse,\n StartTranslationLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns true if the poller is stopped.\n */\n isStopped(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends StartTranslationLogicalResponse | StartTranslationDefaultResponse,\n>(\n client: Client,\n initialResponse: StartTranslation202Response | StartTranslationDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: LongRunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path, sendPollRequestOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = sendPollRequestOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return httpPoller.isStopped;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport DocumentTranslationClient from \"./documentTranslationClient\";\n\nexport * from \"./documentTranslationClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\nexport * from \"./pollingHelper\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"@azure/core-rest-pipeline\";\n\nexport default DocumentTranslationClient;\n"],"names":["createClientLogger","getClient","getPagedAsyncIterator","createRestError","createHttpPoller"],"mappings":";;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,yBAAyB,CAAC;;ACJnE;AACA;AAOA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,OAAA,GAAyB,EAAE,EAAA;;AAE3B,IAAA,MAAM,WAAW,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,QAAQ,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAG,EAAA,aAAa,aAAa,CAAC;IACzF,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY,CAAC;IACxD,MAAM,aAAa,GAAG,CAAA,kDAAA,CAAoD,CAAC;IAC3E,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;UAChE,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAI,CAAA,EAAA,aAAa,CAAE,CAAA;AAChE,UAAE,CAAA,EAAG,aAAa,CAAA,CAAE,CAAC;AACzB,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,gBAAgB,EAAE;YAChB,eAAe;AAChB,SAAA,EACD,cAAc,EAAE;YACd,MAAM,EAAE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,MAA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EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;KAChC,CAAC;AACF,IAAA,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;AAIG;AACH,SAAS,cAAc,CACrB,QAAiB,EAAA;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,CAAA,oDAAA,EAAuD,QAAQ,CAAC,MAAM,CAAE,CAAA,CAAC,CAAC;KAC/F;IAED,OAAO;AACL,QAAA,YAAY,EAAE,QAAQ;AACtB,QAAA,WAAW,kCACN,QAAQ,CAAA,EAAA,EACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,EACpB,CAAA;KACF,CAAC;AACJ;;AC3MA;AACA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/logger.ts","../src/documentTranslationClient.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/pollingHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"ai-translation-document\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { DocumentTranslationClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `DocumentTranslationClient`\n * @param endpointParam - Supported document Translation endpoint, protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): DocumentTranslationClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/translator`;\n options.apiVersion = options.apiVersion ?? \"2024-05-01\";\n const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const client = getClient(endpointUrl, credentials, options) as DocumentTranslationClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DocumentTranslate200Response,\n DocumentTranslateDefaultResponse,\n StartTranslation202Response,\n StartTranslationLogicalResponse,\n StartTranslationDefaultResponse,\n GetTranslationsStatus200Response,\n GetTranslationsStatusDefaultResponse,\n GetDocumentStatus200Response,\n GetDocumentStatusDefaultResponse,\n GetTranslationStatus200Response,\n GetTranslationStatusDefaultResponse,\n CancelTranslation200Response,\n CancelTranslationDefaultResponse,\n GetDocumentsStatus200Response,\n GetDocumentsStatusDefaultResponse,\n GetSupportedFormats200Response,\n GetSupportedFormatsDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /document:translate\": [\"200\"],\n \"GET /document/batches\": [\"200\"],\n \"POST /document/batches\": [\"202\"],\n \"GET /document/batches/{id}/documents/{documentId}\": [\"200\"],\n \"GET /document/batches/{id}\": [\"200\"],\n \"DELETE /document/batches/{id}\": [\"200\"],\n \"GET /document/batches/{id}/documents\": [\"200\"],\n \"GET /document/formats\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DocumentTranslate200Response | DocumentTranslateDefaultResponse,\n): response is DocumentTranslateDefaultResponse;\nexport function isUnexpected(\n response:\n | StartTranslation202Response\n | StartTranslationLogicalResponse\n | StartTranslationDefaultResponse,\n): response is StartTranslationDefaultResponse;\nexport function isUnexpected(\n response: GetTranslationsStatus200Response | GetTranslationsStatusDefaultResponse,\n): response is GetTranslationsStatusDefaultResponse;\nexport function isUnexpected(\n response: GetDocumentStatus200Response | GetDocumentStatusDefaultResponse,\n): response is GetDocumentStatusDefaultResponse;\nexport function isUnexpected(\n response: GetTranslationStatus200Response | GetTranslationStatusDefaultResponse,\n): response is GetTranslationStatusDefaultResponse;\nexport function isUnexpected(\n response: CancelTranslation200Response | CancelTranslationDefaultResponse,\n): response is CancelTranslationDefaultResponse;\nexport function isUnexpected(\n response: GetDocumentsStatus200Response | GetDocumentsStatusDefaultResponse,\n): response is GetDocumentsStatusDefaultResponse;\nexport function isUnexpected(\n response: GetSupportedFormats200Response | GetSupportedFormatsDefaultResponse,\n): response is GetSupportedFormatsDefaultResponse;\nexport function isUnexpected(\n response:\n | DocumentTranslate200Response\n | DocumentTranslateDefaultResponse\n | StartTranslation202Response\n | StartTranslationLogicalResponse\n | StartTranslationDefaultResponse\n | GetTranslationsStatus200Response\n | GetTranslationsStatusDefaultResponse\n | GetDocumentStatus200Response\n | GetDocumentStatusDefaultResponse\n | GetTranslationStatus200Response\n | GetTranslationStatusDefaultResponse\n | CancelTranslation200Response\n | CancelTranslationDefaultResponse\n | GetDocumentsStatus200Response\n | GetDocumentsStatusDefaultResponse\n | GetSupportedFormats200Response\n | GetSupportedFormatsDefaultResponse,\n): response is\n | DocumentTranslateDefaultResponse\n | StartTranslationDefaultResponse\n | GetTranslationsStatusDefaultResponse\n | GetDocumentStatusDefaultResponse\n | GetTranslationStatusDefaultResponse\n | CancelTranslationDefaultResponse\n | GetDocumentsStatusDefaultResponse\n | GetSupportedFormatsDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n CancelOnProgress,\n CreateHttpPollerOptions,\n LongRunningOperation,\n OperationResponse,\n OperationState,\n createHttpPoller,\n} from \"@azure/core-lro\";\nimport {\n StartTranslation202Response,\n StartTranslationDefaultResponse,\n StartTranslationLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns true if the poller is stopped.\n */\n isStopped(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends StartTranslationLogicalResponse | StartTranslationDefaultResponse,\n>(\n client: Client,\n initialResponse: StartTranslation202Response | StartTranslationDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: LongRunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path, sendPollRequestOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = sendPollRequestOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return httpPoller.isStopped;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport DocumentTranslationClient from \"./documentTranslationClient\";\n\nexport * from \"./documentTranslationClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\nexport * from \"./pollingHelper\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"@azure/core-rest-pipeline\";\n\nexport default DocumentTranslationClient;\n"],"names":["createClientLogger","getClient","getPagedAsyncIterator","createRestError","createHttpPoller"],"mappings":";;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,yBAAyB,CAAC;;ACJnE;AACA;AAOA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,OAAA,GAAyB,EAAE,EAAA;;AAE3B,IAAA,MAAM,WAAW,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,QAAQ,MAAI,I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,QAAQ,CAAC,MAAM,CAAE,CAAA,CAAC,CAAC;KAC/F;IAED,OAAO;AACL,QAAA,YAAY,EAAE,QAAQ;AACtB,QAAA,WAAW,kCACN,QAAQ,CAAA,EAAA,EACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,EACpB,CAAA;KACF,CAAC;AACJ;;AC3MA;AACA;;;;;;;;;;;;;;;"}
|
|
@@ -12,7 +12,7 @@ export default function createClient(endpointParam, credentials, options = {}) {
|
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
13
13
|
const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : `${endpointParam}/translator`;
|
|
14
14
|
options.apiVersion = (_c = options.apiVersion) !== null && _c !== void 0 ? _c : "2024-05-01";
|
|
15
|
-
const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.
|
|
15
|
+
const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.2`;
|
|
16
16
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
17
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
18
|
: `${userAgentInfo}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentTranslationClient.js","sourceRoot":"","sources":["../../src/documentTranslationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,UAAyB,EAAE;;IAE3B,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,aAAa,CAAC;IACzF,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,YAAY,CAAC;IACxD,MAAM,aAAa,GAAG,oDAAoD,CAAC;IAC3E,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,8CAA8C,CAAC;YACvF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;IAEzF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { DocumentTranslationClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `DocumentTranslationClient`\n * @param endpointParam - Supported document Translation endpoint, protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): DocumentTranslationClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/translator`;\n options.apiVersion = options.apiVersion ?? \"2024-05-01\";\n const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.
|
|
1
|
+
{"version":3,"file":"documentTranslationClient.js","sourceRoot":"","sources":["../../src/documentTranslationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,UAAyB,EAAE;;IAE3B,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,aAAa,CAAC;IACzF,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,YAAY,CAAC;IACxD,MAAM,aAAa,GAAG,oDAAoD,CAAC;IAC3E,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,8CAA8C,CAAC;YACvF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;IAEzF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { DocumentTranslationClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `DocumentTranslationClient`\n * @param endpointParam - Supported document Translation endpoint, protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): DocumentTranslationClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/translator`;\n options.apiVersion = options.apiVersion ?? \"2024-05-01\";\n const userAgentInfo = `azsdk-js-ai-translation-document-rest/1.0.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const client = getClient(endpointUrl, credentials, options) as DocumentTranslationClient;\n\n return client;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "A generated SDK for DocumentTranslationClient.",
|
|
6
|
-
"version": "1.0.0-
|
|
6
|
+
"version": "1.0.0-beta.2",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
9
9
|
"azure",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"main": "dist/index.js",
|
|
19
19
|
"module": "./dist-esm/src/index.js",
|
|
20
|
-
"types": "./types/ai-translation-document
|
|
20
|
+
"types": "./types/ai-translation-document.d.ts",
|
|
21
21
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/translation/ai-translation-document-rest/README.md",
|
|
22
22
|
"repository": "github:Azure/azure-sdk-for-js",
|
|
23
23
|
"bugs": {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"mkdirp": "^3.0.1",
|
|
67
67
|
"source-map-support": "^0.5.9",
|
|
68
68
|
"typescript": "~5.4.5",
|
|
69
|
-
"@azure/dev-tool": "
|
|
70
|
-
"@azure/eslint-plugin-azure-sdk": "
|
|
69
|
+
"@azure/dev-tool": "^1.0.0",
|
|
70
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
71
71
|
"@azure-tools/test-credential": "^1.0.0",
|
|
72
72
|
"@azure/identity": "^4.0.1",
|
|
73
73
|
"@azure-tools/test-recorder": "^3.5.2",
|
|
@@ -0,0 +1,989 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { AbortSignalLike } from '@azure/abort-controller';
|
|
4
|
+
import { CancelOnProgress } from '@azure/core-lro';
|
|
5
|
+
import { Client } from '@azure-rest/core-client';
|
|
6
|
+
import { ClientOptions } from '@azure-rest/core-client';
|
|
7
|
+
import { createFile } from '@azure/core-rest-pipeline';
|
|
8
|
+
import { createFileFromStream } from '@azure/core-rest-pipeline';
|
|
9
|
+
import { CreateFileFromStreamOptions } from '@azure/core-rest-pipeline';
|
|
10
|
+
import { CreateFileOptions } from '@azure/core-rest-pipeline';
|
|
11
|
+
import { CreateHttpPollerOptions } from '@azure/core-lro';
|
|
12
|
+
import { ErrorResponse } from '@azure-rest/core-client';
|
|
13
|
+
import { HttpResponse } from '@azure-rest/core-client';
|
|
14
|
+
import { KeyCredential } from '@azure/core-auth';
|
|
15
|
+
import { OperationState } from '@azure/core-lro';
|
|
16
|
+
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
17
|
+
import { PathUncheckedResponse } from '@azure-rest/core-client';
|
|
18
|
+
import { RawHttpHeaders } from '@azure/core-rest-pipeline';
|
|
19
|
+
import { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
|
|
20
|
+
import { RequestParameters } from '@azure-rest/core-client';
|
|
21
|
+
import { StreamableMethod } from '@azure-rest/core-client';
|
|
22
|
+
import { TokenCredential } from '@azure/core-auth';
|
|
23
|
+
|
|
24
|
+
/** Definition for the input batch translation request */
|
|
25
|
+
export declare interface BatchRequest {
|
|
26
|
+
/** Source of the input documents */
|
|
27
|
+
source: SourceInput;
|
|
28
|
+
/** Location of the destination for the output */
|
|
29
|
+
targets: Array<TargetInput>;
|
|
30
|
+
/** Storage type of the input documents source string */
|
|
31
|
+
storageType?: StorageInputType;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The request has succeeded. */
|
|
35
|
+
export declare interface CancelTranslation200Response extends HttpResponse {
|
|
36
|
+
status: "200";
|
|
37
|
+
body: TranslationStatusOutput;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare interface CancelTranslationDefaultHeaders {
|
|
41
|
+
/** String error code indicating what went wrong. */
|
|
42
|
+
"x-ms-error-code"?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare interface CancelTranslationDefaultResponse extends HttpResponse {
|
|
46
|
+
status: string;
|
|
47
|
+
body: ErrorResponse;
|
|
48
|
+
headers: RawHttpHeaders & CancelTranslationDefaultHeaders;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare type CancelTranslationParameters = RequestParameters;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Initialize a new instance of `DocumentTranslationClient`
|
|
55
|
+
* @param endpointParam - Supported document Translation endpoint, protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator.
|
|
56
|
+
* @param credentials - uniquely identify client credential
|
|
57
|
+
* @param options - the parameter for all optional parameters
|
|
58
|
+
*/
|
|
59
|
+
declare function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, options?: ClientOptions): DocumentTranslationClient;
|
|
60
|
+
export default createClient;
|
|
61
|
+
|
|
62
|
+
export { createFile }
|
|
63
|
+
|
|
64
|
+
export { createFileFromStream }
|
|
65
|
+
|
|
66
|
+
export { CreateFileFromStreamOptions }
|
|
67
|
+
|
|
68
|
+
export { CreateFileOptions }
|
|
69
|
+
|
|
70
|
+
/** Document filter */
|
|
71
|
+
export declare interface DocumentFilter {
|
|
72
|
+
/**
|
|
73
|
+
* A case-sensitive prefix string to filter documents in the source path for
|
|
74
|
+
* translation.
|
|
75
|
+
* For example, when using a Azure storage blob Uri, use the prefix
|
|
76
|
+
* to restrict sub folders for translation.
|
|
77
|
+
*/
|
|
78
|
+
prefix?: string;
|
|
79
|
+
/**
|
|
80
|
+
* A case-sensitive suffix string to filter documents in the source path for
|
|
81
|
+
* translation.
|
|
82
|
+
* This is most often use for file extensions
|
|
83
|
+
*/
|
|
84
|
+
suffix?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Documents Status Response */
|
|
88
|
+
export declare interface DocumentsStatusOutput {
|
|
89
|
+
/** The detail status of individual documents */
|
|
90
|
+
value: Array<DocumentStatusOutput>;
|
|
91
|
+
/** Url for the next page. Null if no more pages available */
|
|
92
|
+
nextLink?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Document Status Response */
|
|
96
|
+
export declare interface DocumentStatusOutput {
|
|
97
|
+
/** Location of the document or folder */
|
|
98
|
+
path?: string;
|
|
99
|
+
/** Location of the source document */
|
|
100
|
+
sourcePath: string;
|
|
101
|
+
/** Operation created date time */
|
|
102
|
+
createdDateTimeUtc: string;
|
|
103
|
+
/** Date time in which the operation's status has been updated */
|
|
104
|
+
lastActionDateTimeUtc: string;
|
|
105
|
+
/** List of possible statuses for job or document */
|
|
106
|
+
status: StatusOutput;
|
|
107
|
+
/** To language */
|
|
108
|
+
to: string;
|
|
109
|
+
/**
|
|
110
|
+
* This contains an outer error with error code, message, details, target and an
|
|
111
|
+
* inner error with more descriptive details.
|
|
112
|
+
*/
|
|
113
|
+
error?: TranslationErrorOutput;
|
|
114
|
+
/** Progress of the translation if available */
|
|
115
|
+
progress: number;
|
|
116
|
+
/** Document Id */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Character charged by the API */
|
|
119
|
+
characterCharged?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare interface DocumentTranslate {
|
|
123
|
+
/** Use this API to submit a single translation request to the Document Translation Service. */
|
|
124
|
+
post(options: DocumentTranslateParameters): StreamableMethod<DocumentTranslate200Response | DocumentTranslateDefaultResponse>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export declare interface DocumentTranslate200Headers {
|
|
128
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
129
|
+
"x-ms-client-request-id"?: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The request has succeeded. */
|
|
133
|
+
export declare interface DocumentTranslate200Response extends HttpResponse {
|
|
134
|
+
status: "200";
|
|
135
|
+
/** Value may contain any sequence of octets */
|
|
136
|
+
body: Uint8Array;
|
|
137
|
+
headers: RawHttpHeaders & DocumentTranslate200Headers;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare interface DocumentTranslateBodyParam {
|
|
141
|
+
body?: DocumentTranslateContent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Document Translate Request Content */
|
|
145
|
+
export declare type DocumentTranslateContent = FormData | Array<DocumentTranslateContentDocumentPartDescriptor | DocumentTranslateContentGlossaryPartDescriptor>;
|
|
146
|
+
|
|
147
|
+
export declare interface DocumentTranslateContentDocumentPartDescriptor {
|
|
148
|
+
name: "document";
|
|
149
|
+
body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream | File;
|
|
150
|
+
filename?: string;
|
|
151
|
+
contentType?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export declare interface DocumentTranslateContentGlossaryPartDescriptor {
|
|
155
|
+
name: "glossary";
|
|
156
|
+
body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream | File;
|
|
157
|
+
filename?: string;
|
|
158
|
+
contentType?: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare interface DocumentTranslateDefaultHeaders {
|
|
162
|
+
/** String error code indicating what went wrong. */
|
|
163
|
+
"x-ms-error-code"?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export declare interface DocumentTranslateDefaultResponse extends HttpResponse {
|
|
167
|
+
status: string;
|
|
168
|
+
body: ErrorResponse;
|
|
169
|
+
headers: RawHttpHeaders & DocumentTranslateDefaultHeaders;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export declare interface DocumentTranslateHeaderParam {
|
|
173
|
+
headers?: RawHttpHeadersInput & DocumentTranslateHeaders;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export declare interface DocumentTranslateHeaders {
|
|
177
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
178
|
+
"x-ms-client-request-id"?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare interface DocumentTranslateMediaTypesParam {
|
|
182
|
+
/** Content Type as multipart/form-data */
|
|
183
|
+
contentType: "multipart/form-data";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export declare type DocumentTranslateParameters = DocumentTranslateQueryParam & DocumentTranslateHeaderParam & DocumentTranslateMediaTypesParam & DocumentTranslateBodyParam & RequestParameters;
|
|
187
|
+
|
|
188
|
+
export declare interface DocumentTranslateQueryParam {
|
|
189
|
+
queryParameters: DocumentTranslateQueryParamProperties;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export declare interface DocumentTranslateQueryParamProperties {
|
|
193
|
+
/**
|
|
194
|
+
* Specifies source language of the input document.
|
|
195
|
+
* If this parameter isn't specified, automatic language detection is applied to determine the source language.
|
|
196
|
+
* For example if the source document is written in English, then use sourceLanguage=en
|
|
197
|
+
*/
|
|
198
|
+
sourceLanguage?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Specifies the language of the output document.
|
|
201
|
+
* The target language must be one of the supported languages included in the translation scope.
|
|
202
|
+
* For example if you want to translate the document in German language, then use targetLanguage=de
|
|
203
|
+
*/
|
|
204
|
+
targetLanguage: string;
|
|
205
|
+
/**
|
|
206
|
+
* A string specifying the category (domain) of the translation. This parameter is used to get translations
|
|
207
|
+
* from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
|
|
208
|
+
* project details to this parameter to use your deployed customized system. Default value is: general.
|
|
209
|
+
*/
|
|
210
|
+
category?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
|
|
213
|
+
* Possible values are: true (default) or false.
|
|
214
|
+
*/
|
|
215
|
+
allowFallback?: boolean;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export declare type DocumentTranslationClient = Client & {
|
|
219
|
+
path: Routes;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** File Format */
|
|
223
|
+
export declare interface FileFormatOutput {
|
|
224
|
+
/** Name of the format */
|
|
225
|
+
format: string;
|
|
226
|
+
/** Supported file extension for this format */
|
|
227
|
+
fileExtensions: string[];
|
|
228
|
+
/** Supported Content-Types for this format */
|
|
229
|
+
contentTypes: string[];
|
|
230
|
+
/** Default version if none is specified */
|
|
231
|
+
defaultVersion?: string;
|
|
232
|
+
/** Supported Version */
|
|
233
|
+
versions?: string[];
|
|
234
|
+
/** Supported Type for this format */
|
|
235
|
+
type?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Alias for FileFormatType */
|
|
239
|
+
export declare type FileFormatType = "document" | "glossary" | string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Helper type to extract the type of an array
|
|
243
|
+
*/
|
|
244
|
+
export declare type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|
245
|
+
|
|
246
|
+
export declare interface GetDocumentsStatus {
|
|
247
|
+
/**
|
|
248
|
+
* Returns the status for all documents in a batch document translation request.
|
|
249
|
+
*
|
|
250
|
+
*
|
|
251
|
+
* If the number of documents in the response exceeds our paging limit,
|
|
252
|
+
* server-side paging is used.
|
|
253
|
+
* Paginated responses indicate a partial result and
|
|
254
|
+
* include a continuation token in the response. The absence of a continuation
|
|
255
|
+
* token means that no additional pages are available.
|
|
256
|
+
*
|
|
257
|
+
* top, skip
|
|
258
|
+
* and maxpagesize query parameters can be used to specify a number of results to
|
|
259
|
+
* return and an offset for the collection.
|
|
260
|
+
*
|
|
261
|
+
* top indicates the total
|
|
262
|
+
* number of records the user wants to be returned across all pages.
|
|
263
|
+
* skip
|
|
264
|
+
* indicates the number of records to skip from the list of document status held
|
|
265
|
+
* by the server based on the sorting method specified. By default, we sort by
|
|
266
|
+
* descending start time.
|
|
267
|
+
* maxpagesize is the maximum items returned in a page.
|
|
268
|
+
* If more items are requested via top (or top is not specified and there are
|
|
269
|
+
* more items to be returned), @nextLink will contain the link to the next page.
|
|
270
|
+
*
|
|
271
|
+
*
|
|
272
|
+
* orderby query parameter can be used to sort the returned list (ex
|
|
273
|
+
* "orderby=createdDateTimeUtc asc" or "orderby=createdDateTimeUtc
|
|
274
|
+
* desc").
|
|
275
|
+
* The default sorting is descending by createdDateTimeUtc.
|
|
276
|
+
* Some query
|
|
277
|
+
* parameters can be used to filter the returned list (ex:
|
|
278
|
+
* "status=Succeeded,Cancelled") will only return succeeded and cancelled
|
|
279
|
+
* documents.
|
|
280
|
+
* createdDateTimeUtcStart and createdDateTimeUtcEnd can be used
|
|
281
|
+
* combined or separately to specify a range of datetime to filter the returned
|
|
282
|
+
* list by.
|
|
283
|
+
* The supported filtering query parameters are (status, ids,
|
|
284
|
+
* createdDateTimeUtcStart, createdDateTimeUtcEnd).
|
|
285
|
+
*
|
|
286
|
+
* When both top
|
|
287
|
+
* and skip are included, the server should first apply skip and then top on
|
|
288
|
+
* the collection.
|
|
289
|
+
* Note: If the server can't honor top and/or skip, the server
|
|
290
|
+
* must return an error to the client informing about it instead of just ignoring
|
|
291
|
+
* the query options.
|
|
292
|
+
* This reduces the risk of the client making assumptions about
|
|
293
|
+
* the data returned.
|
|
294
|
+
*/
|
|
295
|
+
get(options?: GetDocumentsStatusParameters): StreamableMethod<GetDocumentsStatus200Response | GetDocumentsStatusDefaultResponse>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** The request has succeeded. */
|
|
299
|
+
export declare interface GetDocumentsStatus200Response extends HttpResponse {
|
|
300
|
+
status: "200";
|
|
301
|
+
body: DocumentsStatusOutput;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export declare interface GetDocumentsStatusDefaultHeaders {
|
|
305
|
+
/** String error code indicating what went wrong. */
|
|
306
|
+
"x-ms-error-code"?: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export declare interface GetDocumentsStatusDefaultResponse extends HttpResponse {
|
|
310
|
+
status: string;
|
|
311
|
+
body: ErrorResponse;
|
|
312
|
+
headers: RawHttpHeaders & GetDocumentsStatusDefaultHeaders;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export declare type GetDocumentsStatusParameters = GetDocumentsStatusQueryParam & RequestParameters;
|
|
316
|
+
|
|
317
|
+
export declare interface GetDocumentsStatusQueryParam {
|
|
318
|
+
queryParameters?: GetDocumentsStatusQueryParamProperties;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export declare interface GetDocumentsStatusQueryParamProperties {
|
|
322
|
+
/**
|
|
323
|
+
* top indicates the total number of records the user wants to be returned across
|
|
324
|
+
* all pages.
|
|
325
|
+
*
|
|
326
|
+
* Clients MAY use top and skip query parameters to
|
|
327
|
+
* specify a number of results to return and an offset into the collection.
|
|
328
|
+
* When
|
|
329
|
+
* both top and skip are given by a client, the server SHOULD first apply skip
|
|
330
|
+
* and then top on the collection.
|
|
331
|
+
*
|
|
332
|
+
* Note: If the server can't honor
|
|
333
|
+
* top and/or skip, the server MUST return an error to the client informing
|
|
334
|
+
* about it instead of just ignoring the query options.
|
|
335
|
+
*/
|
|
336
|
+
top?: number;
|
|
337
|
+
/**
|
|
338
|
+
* skip indicates the number of records to skip from the list of records held by
|
|
339
|
+
* the server based on the sorting method specified. By default, we sort by
|
|
340
|
+
* descending start time.
|
|
341
|
+
*
|
|
342
|
+
* Clients MAY use top and skip query
|
|
343
|
+
* parameters to specify a number of results to return and an offset into the
|
|
344
|
+
* collection.
|
|
345
|
+
* When both top and skip are given by a client, the server SHOULD
|
|
346
|
+
* first apply skip and then top on the collection.
|
|
347
|
+
*
|
|
348
|
+
* Note: If the
|
|
349
|
+
* server can't honor top and/or skip, the server MUST return an error to the
|
|
350
|
+
* client informing about it instead of just ignoring the query options.
|
|
351
|
+
*/
|
|
352
|
+
skip?: number;
|
|
353
|
+
/**
|
|
354
|
+
* maxpagesize is the maximum items returned in a page. If more items are
|
|
355
|
+
* requested via top (or top is not specified and there are more items to be
|
|
356
|
+
* returned), @nextLink will contain the link to the next page.
|
|
357
|
+
*
|
|
358
|
+
*
|
|
359
|
+
* Clients MAY request server-driven paging with a specific page size by
|
|
360
|
+
* specifying a maxpagesize preference. The server SHOULD honor this preference
|
|
361
|
+
* if the specified page size is smaller than the server's default page size.
|
|
362
|
+
*/
|
|
363
|
+
maxpagesize?: number;
|
|
364
|
+
/** Ids to use in filtering */
|
|
365
|
+
ids?: string[];
|
|
366
|
+
/** Statuses to use in filtering */
|
|
367
|
+
statuses?: string[];
|
|
368
|
+
/** the start datetime to get items after */
|
|
369
|
+
createdDateTimeUtcStart?: Date | string;
|
|
370
|
+
/** the end datetime to get items before */
|
|
371
|
+
createdDateTimeUtcEnd?: Date | string;
|
|
372
|
+
/** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */
|
|
373
|
+
orderby?: string[];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export declare interface GetDocumentStatus {
|
|
377
|
+
/**
|
|
378
|
+
* Returns the translation status for a specific document based on the request Id
|
|
379
|
+
* and document Id.
|
|
380
|
+
*/
|
|
381
|
+
get(options?: GetDocumentStatusParameters): StreamableMethod<GetDocumentStatus200Response | GetDocumentStatusDefaultResponse>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** The request has succeeded. */
|
|
385
|
+
export declare interface GetDocumentStatus200Response extends HttpResponse {
|
|
386
|
+
status: "200";
|
|
387
|
+
body: DocumentStatusOutput;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export declare interface GetDocumentStatusDefaultHeaders {
|
|
391
|
+
/** String error code indicating what went wrong. */
|
|
392
|
+
"x-ms-error-code"?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export declare interface GetDocumentStatusDefaultResponse extends HttpResponse {
|
|
396
|
+
status: string;
|
|
397
|
+
body: ErrorResponse;
|
|
398
|
+
headers: RawHttpHeaders & GetDocumentStatusDefaultHeaders;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export declare type GetDocumentStatusParameters = RequestParameters;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Helper function that builds a Poller object to help polling a long running operation.
|
|
405
|
+
* @param client - Client to use for sending the request to get additional pages.
|
|
406
|
+
* @param initialResponse - The initial response.
|
|
407
|
+
* @param options - Options to set a resume state or custom polling interval.
|
|
408
|
+
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
409
|
+
*/
|
|
410
|
+
export declare function getLongRunningPoller<TResult extends StartTranslationLogicalResponse | StartTranslationDefaultResponse>(client: Client, initialResponse: StartTranslation202Response | StartTranslationDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* The type of a custom function that defines how to get a page and a link to the next one if any.
|
|
414
|
+
*/
|
|
415
|
+
export declare type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
|
|
416
|
+
page: TPage;
|
|
417
|
+
nextPageLink?: string;
|
|
418
|
+
}>;
|
|
419
|
+
|
|
420
|
+
export declare interface GetSupportedFormats {
|
|
421
|
+
/**
|
|
422
|
+
* The list of supported formats supported by the Document Translation
|
|
423
|
+
* service.
|
|
424
|
+
* The list includes the common file extension, as well as the
|
|
425
|
+
* content-type if using the upload API.
|
|
426
|
+
*/
|
|
427
|
+
get(options?: GetSupportedFormatsParameters): StreamableMethod<GetSupportedFormats200Response | GetSupportedFormatsDefaultResponse>;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** The request has succeeded. */
|
|
431
|
+
export declare interface GetSupportedFormats200Response extends HttpResponse {
|
|
432
|
+
status: "200";
|
|
433
|
+
body: SupportedFileFormatsOutput;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export declare interface GetSupportedFormatsDefaultHeaders {
|
|
437
|
+
/** String error code indicating what went wrong. */
|
|
438
|
+
"x-ms-error-code"?: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export declare interface GetSupportedFormatsDefaultResponse extends HttpResponse {
|
|
442
|
+
status: string;
|
|
443
|
+
body: ErrorResponse;
|
|
444
|
+
headers: RawHttpHeaders & GetSupportedFormatsDefaultHeaders;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export declare type GetSupportedFormatsParameters = GetSupportedFormatsQueryParam & RequestParameters;
|
|
448
|
+
|
|
449
|
+
export declare interface GetSupportedFormatsQueryParam {
|
|
450
|
+
queryParameters?: GetSupportedFormatsQueryParamProperties;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export declare interface GetSupportedFormatsQueryParamProperties {
|
|
454
|
+
/** the type of format like document or glossary */
|
|
455
|
+
type?: FileFormatType;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** The request has succeeded. */
|
|
459
|
+
export declare interface GetTranslationsStatus200Response extends HttpResponse {
|
|
460
|
+
status: "200";
|
|
461
|
+
body: TranslationsStatusOutput;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export declare interface GetTranslationsStatusDefaultHeaders {
|
|
465
|
+
/** String error code indicating what went wrong. */
|
|
466
|
+
"x-ms-error-code"?: string;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export declare interface GetTranslationsStatusDefaultResponse extends HttpResponse {
|
|
470
|
+
status: string;
|
|
471
|
+
body: ErrorResponse;
|
|
472
|
+
headers: RawHttpHeaders & GetTranslationsStatusDefaultHeaders;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export declare type GetTranslationsStatusParameters = GetTranslationsStatusQueryParam & RequestParameters;
|
|
476
|
+
|
|
477
|
+
export declare interface GetTranslationsStatusQueryParam {
|
|
478
|
+
queryParameters?: GetTranslationsStatusQueryParamProperties;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export declare interface GetTranslationsStatusQueryParamProperties {
|
|
482
|
+
/**
|
|
483
|
+
* top indicates the total number of records the user wants to be returned across
|
|
484
|
+
* all pages.
|
|
485
|
+
*
|
|
486
|
+
* Clients MAY use top and skip query parameters to
|
|
487
|
+
* specify a number of results to return and an offset into the collection.
|
|
488
|
+
* When
|
|
489
|
+
* both top and skip are given by a client, the server SHOULD first apply skip
|
|
490
|
+
* and then top on the collection.
|
|
491
|
+
*
|
|
492
|
+
* Note: If the server can't honor
|
|
493
|
+
* top and/or skip, the server MUST return an error to the client informing
|
|
494
|
+
* about it instead of just ignoring the query options.
|
|
495
|
+
*/
|
|
496
|
+
top?: number;
|
|
497
|
+
/**
|
|
498
|
+
* skip indicates the number of records to skip from the list of records held by
|
|
499
|
+
* the server based on the sorting method specified. By default, we sort by
|
|
500
|
+
* descending start time.
|
|
501
|
+
*
|
|
502
|
+
* Clients MAY use top and skip query
|
|
503
|
+
* parameters to specify a number of results to return and an offset into the
|
|
504
|
+
* collection.
|
|
505
|
+
* When both top and skip are given by a client, the server SHOULD
|
|
506
|
+
* first apply skip and then top on the collection.
|
|
507
|
+
*
|
|
508
|
+
* Note: If the
|
|
509
|
+
* server can't honor top and/or skip, the server MUST return an error to the
|
|
510
|
+
* client informing about it instead of just ignoring the query options.
|
|
511
|
+
*/
|
|
512
|
+
skip?: number;
|
|
513
|
+
/**
|
|
514
|
+
* maxpagesize is the maximum items returned in a page. If more items are
|
|
515
|
+
* requested via top (or top is not specified and there are more items to be
|
|
516
|
+
* returned), @nextLink will contain the link to the next page.
|
|
517
|
+
*
|
|
518
|
+
*
|
|
519
|
+
* Clients MAY request server-driven paging with a specific page size by
|
|
520
|
+
* specifying a maxpagesize preference. The server SHOULD honor this preference
|
|
521
|
+
* if the specified page size is smaller than the server's default page size.
|
|
522
|
+
*/
|
|
523
|
+
maxpagesize?: number;
|
|
524
|
+
/** Ids to use in filtering */
|
|
525
|
+
ids?: string[];
|
|
526
|
+
/** Statuses to use in filtering */
|
|
527
|
+
statuses?: string[];
|
|
528
|
+
/** the start datetime to get items after */
|
|
529
|
+
createdDateTimeUtcStart?: Date | string;
|
|
530
|
+
/** the end datetime to get items before */
|
|
531
|
+
createdDateTimeUtcEnd?: Date | string;
|
|
532
|
+
/** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */
|
|
533
|
+
orderby?: string[];
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export declare interface GetTranslationStatus {
|
|
537
|
+
/**
|
|
538
|
+
* Returns the status for a document translation request.
|
|
539
|
+
* The status includes the
|
|
540
|
+
* overall request status, as well as the status for documents that are being
|
|
541
|
+
* translated as part of that request.
|
|
542
|
+
*/
|
|
543
|
+
get(options?: GetTranslationStatusParameters): StreamableMethod<GetTranslationStatus200Response | GetTranslationStatusDefaultResponse>;
|
|
544
|
+
/**
|
|
545
|
+
* Cancel a currently processing or queued translation.
|
|
546
|
+
* A translation will not be
|
|
547
|
+
* cancelled if it is already completed or failed or cancelling. A bad request
|
|
548
|
+
* will be returned.
|
|
549
|
+
* All documents that have completed translation will not be
|
|
550
|
+
* cancelled and will be charged.
|
|
551
|
+
* All pending documents will be cancelled if
|
|
552
|
+
* possible.
|
|
553
|
+
*/
|
|
554
|
+
delete(options?: CancelTranslationParameters): StreamableMethod<CancelTranslation200Response | CancelTranslationDefaultResponse>;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** The request has succeeded. */
|
|
558
|
+
export declare interface GetTranslationStatus200Response extends HttpResponse {
|
|
559
|
+
status: "200";
|
|
560
|
+
body: TranslationStatusOutput;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export declare interface GetTranslationStatusDefaultHeaders {
|
|
564
|
+
/** String error code indicating what went wrong. */
|
|
565
|
+
"x-ms-error-code"?: string;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export declare interface GetTranslationStatusDefaultResponse extends HttpResponse {
|
|
569
|
+
status: string;
|
|
570
|
+
body: ErrorResponse;
|
|
571
|
+
headers: RawHttpHeaders & GetTranslationStatusDefaultHeaders;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export declare type GetTranslationStatusParameters = RequestParameters;
|
|
575
|
+
|
|
576
|
+
/** Glossary / translation memory for the request */
|
|
577
|
+
export declare interface Glossary {
|
|
578
|
+
/**
|
|
579
|
+
* Location of the glossary.
|
|
580
|
+
* We will use the file extension to extract the
|
|
581
|
+
* formatting if the format parameter is not supplied.
|
|
582
|
+
*
|
|
583
|
+
* If the translation
|
|
584
|
+
* language pair is not present in the glossary, it will not be applied
|
|
585
|
+
*/
|
|
586
|
+
glossaryUrl: string;
|
|
587
|
+
/** Format */
|
|
588
|
+
format: string;
|
|
589
|
+
/** Optional Version. If not specified, default is used. */
|
|
590
|
+
version?: string;
|
|
591
|
+
/** Storage Source */
|
|
592
|
+
storageSource?: StorageSource;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* New Inner Error format which conforms to Cognitive Services API Guidelines
|
|
597
|
+
* which is available at
|
|
598
|
+
* https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.
|
|
599
|
+
* This
|
|
600
|
+
* contains required properties ErrorCode, message and optional properties target,
|
|
601
|
+
* details(key value pair), inner error(this can be nested).
|
|
602
|
+
*/
|
|
603
|
+
export declare interface InnerTranslationErrorOutput {
|
|
604
|
+
/** Gets code error string. */
|
|
605
|
+
code: string;
|
|
606
|
+
/** Gets high level error message. */
|
|
607
|
+
message: string;
|
|
608
|
+
/**
|
|
609
|
+
* Gets the source of the error.
|
|
610
|
+
* For example it would be "documents" or
|
|
611
|
+
* "document id" in case of invalid document.
|
|
612
|
+
*/
|
|
613
|
+
readonly target?: string;
|
|
614
|
+
/**
|
|
615
|
+
* New Inner Error format which conforms to Cognitive Services API Guidelines
|
|
616
|
+
* which is available at
|
|
617
|
+
* https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.
|
|
618
|
+
* This
|
|
619
|
+
* contains required properties ErrorCode, message and optional properties target,
|
|
620
|
+
* details(key value pair), inner error(this can be nested).
|
|
621
|
+
*/
|
|
622
|
+
innerError?: InnerTranslationErrorOutput;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export declare function isUnexpected(response: DocumentTranslate200Response | DocumentTranslateDefaultResponse): response is DocumentTranslateDefaultResponse;
|
|
626
|
+
|
|
627
|
+
export declare function isUnexpected(response: StartTranslation202Response | StartTranslationLogicalResponse | StartTranslationDefaultResponse): response is StartTranslationDefaultResponse;
|
|
628
|
+
|
|
629
|
+
export declare function isUnexpected(response: GetTranslationsStatus200Response | GetTranslationsStatusDefaultResponse): response is GetTranslationsStatusDefaultResponse;
|
|
630
|
+
|
|
631
|
+
export declare function isUnexpected(response: GetDocumentStatus200Response | GetDocumentStatusDefaultResponse): response is GetDocumentStatusDefaultResponse;
|
|
632
|
+
|
|
633
|
+
export declare function isUnexpected(response: GetTranslationStatus200Response | GetTranslationStatusDefaultResponse): response is GetTranslationStatusDefaultResponse;
|
|
634
|
+
|
|
635
|
+
export declare function isUnexpected(response: CancelTranslation200Response | CancelTranslationDefaultResponse): response is CancelTranslationDefaultResponse;
|
|
636
|
+
|
|
637
|
+
export declare function isUnexpected(response: GetDocumentsStatus200Response | GetDocumentsStatusDefaultResponse): response is GetDocumentsStatusDefaultResponse;
|
|
638
|
+
|
|
639
|
+
export declare function isUnexpected(response: GetSupportedFormats200Response | GetSupportedFormatsDefaultResponse): response is GetSupportedFormatsDefaultResponse;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
643
|
+
* @param client - Client to use for sending the next page requests
|
|
644
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
645
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
646
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
647
|
+
*/
|
|
648
|
+
export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Helper type to infer the Type of the paged elements from the response type
|
|
652
|
+
* This type is generated based on the swagger information for x-ms-pageable
|
|
653
|
+
* specifically on the itemName property which indicates the property of the response
|
|
654
|
+
* where the page items are found. The default value is `value`.
|
|
655
|
+
* This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
|
|
656
|
+
*/
|
|
657
|
+
export declare type PaginateReturn<TResult> = TResult extends {
|
|
658
|
+
body: {
|
|
659
|
+
value?: infer TPage;
|
|
660
|
+
};
|
|
661
|
+
} ? GetArrayType<TPage> : Array<unknown>;
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Options for the paging helper
|
|
665
|
+
*/
|
|
666
|
+
export declare interface PagingOptions<TResponse> {
|
|
667
|
+
/**
|
|
668
|
+
* Custom function to extract pagination details for crating the PagedAsyncIterableIterator
|
|
669
|
+
*/
|
|
670
|
+
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export declare interface Routes {
|
|
674
|
+
/** Resource for '/document:translate' has methods for the following verbs: post */
|
|
675
|
+
(path: "/document:translate"): DocumentTranslate;
|
|
676
|
+
/** Resource for '/document/batches' has methods for the following verbs: post, get */
|
|
677
|
+
(path: "/document/batches"): StartTranslation;
|
|
678
|
+
/** Resource for '/document/batches/\{id\}/documents/\{documentId\}' has methods for the following verbs: get */
|
|
679
|
+
(path: "/document/batches/{id}/documents/{documentId}", id: string, documentId: string): GetDocumentStatus;
|
|
680
|
+
/** Resource for '/document/batches/\{id\}' has methods for the following verbs: get, delete */
|
|
681
|
+
(path: "/document/batches/{id}", id: string): GetTranslationStatus;
|
|
682
|
+
/** Resource for '/document/batches/\{id\}/documents' has methods for the following verbs: get */
|
|
683
|
+
(path: "/document/batches/{id}/documents", id: string): GetDocumentsStatus;
|
|
684
|
+
/** Resource for '/document/formats' has methods for the following verbs: get */
|
|
685
|
+
(path: "/document/formats"): GetSupportedFormats;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* A simple poller that can be used to poll a long running operation.
|
|
690
|
+
*/
|
|
691
|
+
export declare interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
|
|
692
|
+
/**
|
|
693
|
+
* Returns true if the poller has finished polling.
|
|
694
|
+
*/
|
|
695
|
+
isDone(): boolean;
|
|
696
|
+
/**
|
|
697
|
+
* Returns true if the poller is stopped.
|
|
698
|
+
*/
|
|
699
|
+
isStopped(): boolean;
|
|
700
|
+
/**
|
|
701
|
+
* Returns the state of the operation.
|
|
702
|
+
*/
|
|
703
|
+
getOperationState(): TState;
|
|
704
|
+
/**
|
|
705
|
+
* Returns the result value of the operation,
|
|
706
|
+
* regardless of the state of the poller.
|
|
707
|
+
* It can return undefined or an incomplete form of the final TResult value
|
|
708
|
+
* depending on the implementation.
|
|
709
|
+
*/
|
|
710
|
+
getResult(): TResult | undefined;
|
|
711
|
+
/**
|
|
712
|
+
* Returns a promise that will resolve once a single polling request finishes.
|
|
713
|
+
* It does this by calling the update method of the Poller's operation.
|
|
714
|
+
*/
|
|
715
|
+
poll(options?: {
|
|
716
|
+
abortSignal?: AbortSignalLike;
|
|
717
|
+
}): Promise<TState>;
|
|
718
|
+
/**
|
|
719
|
+
* Returns a promise that will resolve once the underlying operation is completed.
|
|
720
|
+
*/
|
|
721
|
+
pollUntilDone(pollOptions?: {
|
|
722
|
+
abortSignal?: AbortSignalLike;
|
|
723
|
+
}): Promise<TResult>;
|
|
724
|
+
/**
|
|
725
|
+
* Invokes the provided callback after each polling is completed,
|
|
726
|
+
* sending the current state of the poller's operation.
|
|
727
|
+
*
|
|
728
|
+
* It returns a method that can be used to stop receiving updates on the given callback function.
|
|
729
|
+
*/
|
|
730
|
+
onProgress(callback: (state: TState) => void): CancelOnProgress;
|
|
731
|
+
/**
|
|
732
|
+
* Returns a promise that could be used for serialized version of the poller's operation
|
|
733
|
+
* by invoking the operation's serialize method.
|
|
734
|
+
*/
|
|
735
|
+
serialize(): Promise<string>;
|
|
736
|
+
/**
|
|
737
|
+
* Wait the poller to be submitted.
|
|
738
|
+
*/
|
|
739
|
+
submitted(): Promise<void>;
|
|
740
|
+
/**
|
|
741
|
+
* Returns a string representation of the poller's operation. Similar to serialize but returns a string.
|
|
742
|
+
* @deprecated Use serialize() instead.
|
|
743
|
+
*/
|
|
744
|
+
toString(): string;
|
|
745
|
+
/**
|
|
746
|
+
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling
|
|
747
|
+
* @deprecated Use abortSignal to stop polling instead.
|
|
748
|
+
*/
|
|
749
|
+
stopPolling(): void;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/** Source of the input documents */
|
|
753
|
+
export declare interface SourceInput {
|
|
754
|
+
/** Location of the folder / container or single file with your documents */
|
|
755
|
+
sourceUrl: string;
|
|
756
|
+
/** Document filter */
|
|
757
|
+
filter?: DocumentFilter;
|
|
758
|
+
/**
|
|
759
|
+
* Language code
|
|
760
|
+
* If none is specified, we will perform auto detect on the document
|
|
761
|
+
*/
|
|
762
|
+
language?: string;
|
|
763
|
+
/** Storage Source */
|
|
764
|
+
storageSource?: StorageSource;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export declare interface StartTranslation {
|
|
768
|
+
/**
|
|
769
|
+
* Use this API to submit a bulk (batch) translation request to the Document
|
|
770
|
+
* Translation service.
|
|
771
|
+
* Each request can contain multiple documents and must
|
|
772
|
+
* contain a source and destination container for each document.
|
|
773
|
+
*
|
|
774
|
+
* The
|
|
775
|
+
* prefix and suffix filter (if supplied) are used to filter folders. The prefix
|
|
776
|
+
* is applied to the subpath after the container name.
|
|
777
|
+
*
|
|
778
|
+
* Glossaries /
|
|
779
|
+
* Translation memory can be included in the request and are applied by the
|
|
780
|
+
* service when the document is translated.
|
|
781
|
+
*
|
|
782
|
+
* If the glossary is
|
|
783
|
+
* invalid or unreachable during translation, an error is indicated in the
|
|
784
|
+
* document status.
|
|
785
|
+
* If a file with the same name already exists at the
|
|
786
|
+
* destination, it will be overwritten. The targetUrl for each target language
|
|
787
|
+
* must be unique.
|
|
788
|
+
*/
|
|
789
|
+
post(options?: StartTranslationParameters): StreamableMethod<StartTranslation202Response | StartTranslationDefaultResponse>;
|
|
790
|
+
/**
|
|
791
|
+
* Returns a list of batch requests submitted and the status for each
|
|
792
|
+
* request.
|
|
793
|
+
* This list only contains batch requests submitted by the user (based on
|
|
794
|
+
* the resource).
|
|
795
|
+
*
|
|
796
|
+
* If the number of requests exceeds our paging limit,
|
|
797
|
+
* server-side paging is used. Paginated responses indicate a partial result and
|
|
798
|
+
* include a continuation token in the response.
|
|
799
|
+
* The absence of a continuation
|
|
800
|
+
* token means that no additional pages are available.
|
|
801
|
+
*
|
|
802
|
+
* top, skip
|
|
803
|
+
* and maxpagesize query parameters can be used to specify a number of results to
|
|
804
|
+
* return and an offset for the collection.
|
|
805
|
+
*
|
|
806
|
+
* top indicates the total
|
|
807
|
+
* number of records the user wants to be returned across all pages.
|
|
808
|
+
* skip
|
|
809
|
+
* indicates the number of records to skip from the list of batches based on the
|
|
810
|
+
* sorting method specified. By default, we sort by descending start
|
|
811
|
+
* time.
|
|
812
|
+
* maxpagesize is the maximum items returned in a page. If more items are
|
|
813
|
+
* requested via top (or top is not specified and there are more items to be
|
|
814
|
+
* returned), @nextLink will contain the link to the next page.
|
|
815
|
+
*
|
|
816
|
+
*
|
|
817
|
+
* orderby query parameter can be used to sort the returned list (ex
|
|
818
|
+
* "orderby=createdDateTimeUtc asc" or "orderby=createdDateTimeUtc
|
|
819
|
+
* desc").
|
|
820
|
+
* The default sorting is descending by createdDateTimeUtc.
|
|
821
|
+
* Some query
|
|
822
|
+
* parameters can be used to filter the returned list (ex:
|
|
823
|
+
* "status=Succeeded,Cancelled") will only return succeeded and cancelled
|
|
824
|
+
* operations.
|
|
825
|
+
* createdDateTimeUtcStart and createdDateTimeUtcEnd can be used
|
|
826
|
+
* combined or separately to specify a range of datetime to filter the returned
|
|
827
|
+
* list by.
|
|
828
|
+
* The supported filtering query parameters are (status, ids,
|
|
829
|
+
* createdDateTimeUtcStart, createdDateTimeUtcEnd).
|
|
830
|
+
*
|
|
831
|
+
* The server honors
|
|
832
|
+
* the values specified by the client. However, clients must be prepared to handle
|
|
833
|
+
* responses that contain a different page size or contain a continuation token.
|
|
834
|
+
*
|
|
835
|
+
*
|
|
836
|
+
* When both top and skip are included, the server should first apply
|
|
837
|
+
* skip and then top on the collection.
|
|
838
|
+
* Note: If the server can't honor top
|
|
839
|
+
* and/or skip, the server must return an error to the client informing about it
|
|
840
|
+
* instead of just ignoring the query options.
|
|
841
|
+
* This reduces the risk of the client
|
|
842
|
+
* making assumptions about the data returned.
|
|
843
|
+
*/
|
|
844
|
+
get(options?: GetTranslationsStatusParameters): StreamableMethod<GetTranslationsStatus200Response | GetTranslationsStatusDefaultResponse>;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export declare interface StartTranslation202Headers {
|
|
848
|
+
/** Link to the translation operation status */
|
|
849
|
+
"operation-location": string;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/** The request has been accepted for processing, but processing has not yet completed. */
|
|
853
|
+
export declare interface StartTranslation202Response extends HttpResponse {
|
|
854
|
+
status: "202";
|
|
855
|
+
headers: RawHttpHeaders & StartTranslation202Headers;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export declare interface StartTranslationBodyParam {
|
|
859
|
+
body?: StartTranslationDetails;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export declare interface StartTranslationDefaultHeaders {
|
|
863
|
+
/** String error code indicating what went wrong. */
|
|
864
|
+
"x-ms-error-code"?: string;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export declare interface StartTranslationDefaultResponse extends HttpResponse {
|
|
868
|
+
status: string;
|
|
869
|
+
body: ErrorResponse;
|
|
870
|
+
headers: RawHttpHeaders & StartTranslationDefaultHeaders;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** Translation job submission batch request */
|
|
874
|
+
export declare interface StartTranslationDetails {
|
|
875
|
+
/** The input list of documents or folders containing documents */
|
|
876
|
+
inputs: Array<BatchRequest>;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/** The final response for long-running startTranslation operation */
|
|
880
|
+
export declare interface StartTranslationLogicalResponse extends HttpResponse {
|
|
881
|
+
status: "200";
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export declare type StartTranslationParameters = StartTranslationBodyParam & RequestParameters;
|
|
885
|
+
|
|
886
|
+
/** Alias for StatusOutput */
|
|
887
|
+
export declare type StatusOutput = "NotStarted" | "Running" | "Succeeded" | "Failed" | "Cancelled" | "Cancelling" | "ValidationFailed" | string;
|
|
888
|
+
|
|
889
|
+
/** Status Summary */
|
|
890
|
+
export declare interface StatusSummaryOutput {
|
|
891
|
+
/** Total count */
|
|
892
|
+
total: number;
|
|
893
|
+
/** Failed count */
|
|
894
|
+
failed: number;
|
|
895
|
+
/** Number of Success */
|
|
896
|
+
success: number;
|
|
897
|
+
/** Number of in progress */
|
|
898
|
+
inProgress: number;
|
|
899
|
+
/** Count of not yet started */
|
|
900
|
+
notYetStarted: number;
|
|
901
|
+
/** Number of cancelled */
|
|
902
|
+
cancelled: number;
|
|
903
|
+
/** Total characters charged by the API */
|
|
904
|
+
totalCharacterCharged: number;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/** Alias for StorageInputType */
|
|
908
|
+
export declare type StorageInputType = "Folder" | "File" | string;
|
|
909
|
+
|
|
910
|
+
/** Alias for StorageSource */
|
|
911
|
+
export declare type StorageSource = "AzureBlob" | string;
|
|
912
|
+
|
|
913
|
+
/** List of supported file formats */
|
|
914
|
+
export declare interface SupportedFileFormatsOutput {
|
|
915
|
+
/** list of objects */
|
|
916
|
+
value: Array<FileFormatOutput>;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/** Destination for the finished translated documents */
|
|
920
|
+
export declare interface TargetInput {
|
|
921
|
+
/** Location of the folder / container with your documents */
|
|
922
|
+
targetUrl: string;
|
|
923
|
+
/** Category / custom system for translation request */
|
|
924
|
+
category?: string;
|
|
925
|
+
/** Target Language */
|
|
926
|
+
language: string;
|
|
927
|
+
/** List of Glossary */
|
|
928
|
+
glossaries?: Array<Glossary>;
|
|
929
|
+
/** Storage Source */
|
|
930
|
+
storageSource?: StorageSource;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/** Alias for TranslationErrorCodeOutput */
|
|
934
|
+
export declare type TranslationErrorCodeOutput = "InvalidRequest" | "InvalidArgument" | "InternalServerError" | "ServiceUnavailable" | "ResourceNotFound" | "Unauthorized" | "RequestRateTooHigh" | string;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* This contains an outer error with error code, message, details, target and an
|
|
938
|
+
* inner error with more descriptive details.
|
|
939
|
+
*/
|
|
940
|
+
export declare interface TranslationErrorOutput {
|
|
941
|
+
/** Enums containing high level error codes. */
|
|
942
|
+
code: TranslationErrorCodeOutput;
|
|
943
|
+
/** Gets high level error message. */
|
|
944
|
+
message: string;
|
|
945
|
+
/**
|
|
946
|
+
* Gets the source of the error.
|
|
947
|
+
* For example it would be "documents" or
|
|
948
|
+
* "document id" in case of invalid document.
|
|
949
|
+
*/
|
|
950
|
+
readonly target?: string;
|
|
951
|
+
/**
|
|
952
|
+
* New Inner Error format which conforms to Cognitive Services API Guidelines
|
|
953
|
+
* which is available at
|
|
954
|
+
* https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.
|
|
955
|
+
* This
|
|
956
|
+
* contains required properties ErrorCode, message and optional properties target,
|
|
957
|
+
* details(key value pair), inner error(this can be nested).
|
|
958
|
+
*/
|
|
959
|
+
innerError?: InnerTranslationErrorOutput;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Translation job Status Response */
|
|
963
|
+
export declare interface TranslationsStatusOutput {
|
|
964
|
+
/** The summary status of individual operation */
|
|
965
|
+
value: Array<TranslationStatusOutput>;
|
|
966
|
+
/** Url for the next page. Null if no more pages available */
|
|
967
|
+
nextLink?: string;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/** Translation job status response */
|
|
971
|
+
export declare interface TranslationStatusOutput {
|
|
972
|
+
/** Id of the operation. */
|
|
973
|
+
id: string;
|
|
974
|
+
/** Operation created date time */
|
|
975
|
+
createdDateTimeUtc: string;
|
|
976
|
+
/** Date time in which the operation's status has been updated */
|
|
977
|
+
lastActionDateTimeUtc: string;
|
|
978
|
+
/** List of possible statuses for job or document */
|
|
979
|
+
status: StatusOutput;
|
|
980
|
+
/**
|
|
981
|
+
* This contains an outer error with error code, message, details, target and an
|
|
982
|
+
* inner error with more descriptive details.
|
|
983
|
+
*/
|
|
984
|
+
error?: TranslationErrorOutput;
|
|
985
|
+
/** Status Summary */
|
|
986
|
+
summary: StatusSummaryOutput;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export { }
|