@azure-rest/ai-translation-document 1.0.0-beta.1 → 1.0.0

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