@azure-rest/health-deidentification 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.
- package/LICENSE +4 -4
- package/README.md +153 -35
- package/dist/browser/clientDefinitions.d.ts +7 -7
- package/dist/browser/clientDefinitions.d.ts.map +1 -1
- package/dist/browser/clientDefinitions.js +1 -1
- package/dist/browser/clientDefinitions.js.map +1 -1
- package/dist/browser/deidentificationClient.d.ts +3 -3
- package/dist/browser/deidentificationClient.d.ts.map +1 -1
- package/dist/browser/deidentificationClient.js +3 -3
- package/dist/browser/deidentificationClient.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/isUnexpected.d.ts +3 -3
- package/dist/browser/isUnexpected.d.ts.map +1 -1
- package/dist/browser/isUnexpected.js +1 -1
- package/dist/browser/isUnexpected.js.map +1 -1
- package/dist/browser/logger.js +1 -1
- package/dist/browser/logger.js.map +1 -1
- package/dist/browser/models.d.ts +45 -28
- package/dist/browser/models.d.ts.map +1 -1
- package/dist/browser/models.js +1 -1
- package/dist/browser/models.js.map +1 -1
- package/dist/browser/outputModels.d.ts +56 -40
- package/dist/browser/outputModels.d.ts.map +1 -1
- package/dist/browser/outputModels.js +1 -1
- package/dist/browser/outputModels.js.map +1 -1
- package/dist/browser/paginateHelper.d.ts +28 -3
- package/dist/browser/paginateHelper.d.ts.map +1 -1
- package/dist/browser/paginateHelper.js +99 -2
- package/dist/browser/paginateHelper.js.map +1 -1
- package/dist/browser/parameters.d.ts +17 -10
- package/dist/browser/parameters.d.ts.map +1 -1
- package/dist/browser/parameters.js +1 -1
- package/dist/browser/parameters.js.map +1 -1
- package/dist/browser/pollingHelper.d.ts +5 -5
- package/dist/browser/pollingHelper.d.ts.map +1 -1
- package/dist/browser/pollingHelper.js +2 -2
- package/dist/browser/pollingHelper.js.map +1 -1
- package/dist/browser/responses.d.ts +24 -19
- package/dist/browser/responses.d.ts.map +1 -1
- package/dist/browser/responses.js +1 -1
- package/dist/browser/responses.js.map +1 -1
- package/dist/commonjs/clientDefinitions.d.ts +7 -7
- package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
- package/dist/commonjs/clientDefinitions.js +1 -1
- package/dist/commonjs/clientDefinitions.js.map +1 -1
- package/dist/commonjs/deidentificationClient.d.ts +3 -3
- package/dist/commonjs/deidentificationClient.d.ts.map +1 -1
- package/dist/commonjs/deidentificationClient.js +3 -3
- package/dist/commonjs/deidentificationClient.js.map +1 -1
- package/dist/commonjs/index.js +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/isUnexpected.d.ts +3 -3
- package/dist/commonjs/isUnexpected.d.ts.map +1 -1
- package/dist/commonjs/isUnexpected.js +1 -1
- package/dist/commonjs/isUnexpected.js.map +1 -1
- package/dist/commonjs/logger.js +1 -1
- package/dist/commonjs/logger.js.map +1 -1
- package/dist/commonjs/models.d.ts +45 -28
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js +1 -1
- package/dist/commonjs/models.js.map +1 -1
- package/dist/commonjs/outputModels.d.ts +56 -40
- package/dist/commonjs/outputModels.d.ts.map +1 -1
- package/dist/commonjs/outputModels.js +1 -1
- package/dist/commonjs/outputModels.js.map +1 -1
- package/dist/commonjs/paginateHelper.d.ts +28 -3
- package/dist/commonjs/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/paginateHelper.js +100 -3
- package/dist/commonjs/paginateHelper.js.map +1 -1
- package/dist/commonjs/parameters.d.ts +17 -10
- package/dist/commonjs/parameters.d.ts.map +1 -1
- package/dist/commonjs/parameters.js +1 -1
- package/dist/commonjs/parameters.js.map +1 -1
- package/dist/commonjs/pollingHelper.d.ts +5 -5
- package/dist/commonjs/pollingHelper.d.ts.map +1 -1
- package/dist/commonjs/pollingHelper.js +1 -1
- package/dist/commonjs/pollingHelper.js.map +1 -1
- package/dist/commonjs/responses.d.ts +24 -19
- package/dist/commonjs/responses.d.ts.map +1 -1
- package/dist/commonjs/responses.js +1 -1
- package/dist/commonjs/responses.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/clientDefinitions.d.ts +7 -7
- package/dist/esm/clientDefinitions.d.ts.map +1 -1
- package/dist/esm/clientDefinitions.js +1 -1
- package/dist/esm/clientDefinitions.js.map +1 -1
- package/dist/esm/deidentificationClient.d.ts +3 -3
- package/dist/esm/deidentificationClient.d.ts.map +1 -1
- package/dist/esm/deidentificationClient.js +3 -3
- package/dist/esm/deidentificationClient.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isUnexpected.d.ts +3 -3
- package/dist/esm/isUnexpected.d.ts.map +1 -1
- package/dist/esm/isUnexpected.js +1 -1
- package/dist/esm/isUnexpected.js.map +1 -1
- package/dist/esm/logger.js +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/models.d.ts +45 -28
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/outputModels.d.ts +56 -40
- package/dist/esm/outputModels.d.ts.map +1 -1
- package/dist/esm/outputModels.js +1 -1
- package/dist/esm/outputModels.js.map +1 -1
- package/dist/esm/paginateHelper.d.ts +28 -3
- package/dist/esm/paginateHelper.d.ts.map +1 -1
- package/dist/esm/paginateHelper.js +99 -2
- package/dist/esm/paginateHelper.js.map +1 -1
- package/dist/esm/parameters.d.ts +17 -10
- package/dist/esm/parameters.d.ts.map +1 -1
- package/dist/esm/parameters.js +1 -1
- package/dist/esm/parameters.js.map +1 -1
- package/dist/esm/pollingHelper.d.ts +5 -5
- package/dist/esm/pollingHelper.d.ts.map +1 -1
- package/dist/esm/pollingHelper.js +2 -2
- package/dist/esm/pollingHelper.js.map +1 -1
- package/dist/esm/responses.d.ts +24 -19
- package/dist/esm/responses.d.ts.map +1 -1
- package/dist/esm/responses.js +1 -1
- package/dist/esm/responses.js.map +1 -1
- package/dist/react-native/clientDefinitions.d.ts +7 -7
- package/dist/react-native/clientDefinitions.d.ts.map +1 -1
- package/dist/react-native/clientDefinitions.js +1 -1
- package/dist/react-native/clientDefinitions.js.map +1 -1
- package/dist/react-native/deidentificationClient.d.ts +3 -3
- package/dist/react-native/deidentificationClient.d.ts.map +1 -1
- package/dist/react-native/deidentificationClient.js +3 -3
- package/dist/react-native/deidentificationClient.js.map +1 -1
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/isUnexpected.d.ts +3 -3
- package/dist/react-native/isUnexpected.d.ts.map +1 -1
- package/dist/react-native/isUnexpected.js +1 -1
- package/dist/react-native/isUnexpected.js.map +1 -1
- package/dist/react-native/logger.js +1 -1
- package/dist/react-native/logger.js.map +1 -1
- package/dist/react-native/models.d.ts +45 -28
- package/dist/react-native/models.d.ts.map +1 -1
- package/dist/react-native/models.js +1 -1
- package/dist/react-native/models.js.map +1 -1
- package/dist/react-native/outputModels.d.ts +56 -40
- package/dist/react-native/outputModels.d.ts.map +1 -1
- package/dist/react-native/outputModels.js +1 -1
- package/dist/react-native/outputModels.js.map +1 -1
- package/dist/react-native/paginateHelper.d.ts +28 -3
- package/dist/react-native/paginateHelper.d.ts.map +1 -1
- package/dist/react-native/paginateHelper.js +99 -2
- package/dist/react-native/paginateHelper.js.map +1 -1
- package/dist/react-native/parameters.d.ts +17 -10
- package/dist/react-native/parameters.d.ts.map +1 -1
- package/dist/react-native/parameters.js +1 -1
- package/dist/react-native/parameters.js.map +1 -1
- package/dist/react-native/pollingHelper.d.ts +5 -5
- package/dist/react-native/pollingHelper.d.ts.map +1 -1
- package/dist/react-native/pollingHelper.js +2 -2
- package/dist/react-native/pollingHelper.js.map +1 -1
- package/dist/react-native/responses.d.ts +24 -19
- package/dist/react-native/responses.d.ts.map +1 -1
- package/dist/react-native/responses.js +1 -1
- package/dist/react-native/responses.js.map +1 -1
- package/package.json +45 -51
- package/review/health-deidentification.api.md +0 -645
package/dist/browser/models.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
/** A job containing a batch of documents to de-identify. */
|
|
2
2
|
export interface DeidentificationJob {
|
|
3
|
-
/** Storage location to perform the operation on. */
|
|
4
|
-
sourceLocation: SourceStorageLocation;
|
|
5
|
-
/** Target location to store output of operation. */
|
|
6
|
-
targetLocation: TargetStorageLocation;
|
|
7
3
|
/**
|
|
8
4
|
* Operation to perform on the input documents.
|
|
9
5
|
*
|
|
10
6
|
* Possible values: "Redact", "Surrogate", "Tag"
|
|
11
7
|
*/
|
|
12
|
-
operation?:
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Format of the redacted output. Only valid when Operation is Redact. */
|
|
20
|
-
redactionFormat?: string;
|
|
8
|
+
operation?: DeidentificationOperationType;
|
|
9
|
+
/** Storage location to perform the operation on. */
|
|
10
|
+
sourceLocation: SourceStorageLocation;
|
|
11
|
+
/** Target location to store output of operation. */
|
|
12
|
+
targetLocation: TargetStorageLocation;
|
|
13
|
+
/** Customization parameters to override default service behaviors. */
|
|
14
|
+
customizations?: DeidentificationJobCustomizationOptions;
|
|
21
15
|
}
|
|
22
16
|
/** Storage location. */
|
|
23
17
|
export interface SourceStorageLocation {
|
|
@@ -32,11 +26,32 @@ export interface SourceStorageLocation {
|
|
|
32
26
|
export interface TargetStorageLocation {
|
|
33
27
|
/** URL to storage location. */
|
|
34
28
|
location: string;
|
|
35
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.
|
|
31
|
+
*
|
|
32
|
+
* Example:
|
|
33
|
+
* File full path: documents/user/note.txt
|
|
34
|
+
* Input Prefix: "documents/user/"
|
|
35
|
+
* Output Prefix: "output_docs/"
|
|
36
|
+
*
|
|
37
|
+
* Output file: "output_docs/note.txt"
|
|
38
|
+
*/
|
|
36
39
|
prefix: string;
|
|
40
|
+
/** When set to true during a job, the service will overwrite the output location if it already exists. */
|
|
41
|
+
overwrite?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Customizations options to override default service behaviors for job usage. */
|
|
44
|
+
export interface DeidentificationJobCustomizationOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Format of the redacted output. Only valid when Operation is Redact.
|
|
47
|
+
* Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
|
|
48
|
+
*/
|
|
49
|
+
redactionFormat?: string;
|
|
50
|
+
/** Locale in which the output surrogates are written. */
|
|
51
|
+
surrogateLocale?: string;
|
|
37
52
|
}
|
|
38
53
|
/** Summary metrics of a job. */
|
|
39
|
-
export interface
|
|
54
|
+
export interface DeidentificationJobSummary {
|
|
40
55
|
/** Number of documents that have completed. */
|
|
41
56
|
successful: number;
|
|
42
57
|
/** Number of documents that have failed. */
|
|
@@ -53,24 +68,26 @@ export interface DeidentificationContent {
|
|
|
53
68
|
/** Input text to de-identify. */
|
|
54
69
|
inputText: string;
|
|
55
70
|
/**
|
|
56
|
-
* Operation to perform on the input.
|
|
71
|
+
* Operation to perform on the input documents.
|
|
57
72
|
*
|
|
58
73
|
* Possible values: "Redact", "Surrogate", "Tag"
|
|
59
74
|
*/
|
|
60
|
-
operation?:
|
|
75
|
+
operation?: DeidentificationOperationType;
|
|
76
|
+
/** Customization parameters to override default service behaviors. */
|
|
77
|
+
customizations?: DeidentificationCustomizationOptions;
|
|
78
|
+
}
|
|
79
|
+
/** Customizations options to override default service behaviors for synchronous usage. */
|
|
80
|
+
export interface DeidentificationCustomizationOptions {
|
|
61
81
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* Possible values: "Plaintext"
|
|
82
|
+
* Format of the redacted output. Only valid when Operation is Redact.
|
|
83
|
+
* Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
|
|
65
84
|
*/
|
|
66
|
-
dataType?: DocumentDataType;
|
|
67
|
-
/** Format of the redacted output. Only valid when OperationType is "Redact". */
|
|
68
85
|
redactionFormat?: string;
|
|
86
|
+
/** Locale in which the output surrogates are written. */
|
|
87
|
+
surrogateLocale?: string;
|
|
69
88
|
}
|
|
70
|
-
/** Alias for
|
|
71
|
-
export type
|
|
72
|
-
/** Alias for
|
|
73
|
-
export type
|
|
74
|
-
/** Alias for JobStatus */
|
|
75
|
-
export type JobStatus = string;
|
|
89
|
+
/** Alias for DeidentificationOperationType */
|
|
90
|
+
export type DeidentificationOperationType = string;
|
|
91
|
+
/** Alias for OperationState */
|
|
92
|
+
export type OperationState = string;
|
|
76
93
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,6BAA6B,CAAC;IAC1C,oDAAoD;IACpD,cAAc,EAAE,qBAAqB,CAAC;IACtC,oDAAoD;IACpD,cAAc,EAAE,qBAAqB,CAAC;IACtC,sEAAsE;IACtE,cAAc,CAAC,EAAE,uCAAuC,CAAC;CAC1D;AAED,wBAAwB;AACxB,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAwB;AACxB,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,0GAA0G;IAC1G,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,kFAAkF;AAClF,MAAM,WAAW,uCAAuC;IACtD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gCAAgC;AAChC,MAAM,WAAW,0BAA0B;IACzC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,6BAA6B,CAAC;IAC1C,sEAAsE;IACtE,cAAc,CAAC,EAAE,oCAAoC,CAAC;CACvD;AAED,0FAA0F;AAC1F,MAAM,WAAW,oCAAoC;IACnD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,+BAA+B;AAC/B,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC"}
|
package/dist/browser/models.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJob {\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationType;\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocation;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocation;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationJobCustomizationOptions;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocation {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocation {\n /** URL to storage location. */\n location: string;\n /**\n * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.\n *\n * Example:\n * File full path: documents/user/note.txt\n * Input Prefix: \"documents/user/\"\n * Output Prefix: \"output_docs/\"\n *\n * Output file: \"output_docs/note.txt\"\n */\n prefix: string;\n /** When set to true during a job, the service will overwrite the output location if it already exists. */\n overwrite?: boolean;\n}\n\n/** Customizations options to override default service behaviors for job usage. */\nexport interface DeidentificationJobCustomizationOptions {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Summary metrics of a job. */\nexport interface DeidentificationJobSummary {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Request body for de-identification operation. */\nexport interface DeidentificationContent {\n /** Input text to de-identify. */\n inputText: string;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationType;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationCustomizationOptions;\n}\n\n/** Customizations options to override default service behaviors for synchronous usage. */\nexport interface DeidentificationCustomizationOptions {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Alias for DeidentificationOperationType */\nexport type DeidentificationOperationType = string;\n/** Alias for OperationState */\nexport type OperationState = string;\n"]}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorModel } from "@azure-rest/core-client";
|
|
1
|
+
import type { ErrorModel } from "@azure-rest/core-client";
|
|
3
2
|
/** A job containing a batch of documents to de-identify. */
|
|
4
3
|
export interface DeidentificationJobOutput {
|
|
5
4
|
/** The name of a job. */
|
|
6
5
|
readonly name: string;
|
|
7
|
-
/** Storage location to perform the operation on. */
|
|
8
|
-
sourceLocation: SourceStorageLocationOutput;
|
|
9
|
-
/** Target location to store output of operation. */
|
|
10
|
-
targetLocation: TargetStorageLocationOutput;
|
|
11
6
|
/**
|
|
12
7
|
* Operation to perform on the input documents.
|
|
13
8
|
*
|
|
14
9
|
* Possible values: "Redact", "Surrogate", "Tag"
|
|
15
10
|
*/
|
|
16
|
-
operation?:
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** Format of the redacted output. Only valid when Operation is Redact. */
|
|
24
|
-
redactionFormat?: string;
|
|
11
|
+
operation?: DeidentificationOperationTypeOutput;
|
|
12
|
+
/** Storage location to perform the operation on. */
|
|
13
|
+
sourceLocation: SourceStorageLocationOutput;
|
|
14
|
+
/** Target location to store output of operation. */
|
|
15
|
+
targetLocation: TargetStorageLocationOutput;
|
|
16
|
+
/** Customization parameters to override default service behaviors. */
|
|
17
|
+
customizations?: DeidentificationJobCustomizationOptionsOutput;
|
|
25
18
|
/**
|
|
26
19
|
* Current status of a job.
|
|
27
20
|
*
|
|
28
|
-
* Possible values: "NotStarted", "Running", "Succeeded", "
|
|
21
|
+
* Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled"
|
|
29
22
|
*/
|
|
30
|
-
readonly status:
|
|
23
|
+
readonly status: OperationStateOutput;
|
|
31
24
|
/** Error when job fails in it's entirety. */
|
|
32
25
|
readonly error?: ErrorModel;
|
|
33
26
|
/**
|
|
@@ -43,7 +36,7 @@ export interface DeidentificationJobOutput {
|
|
|
43
36
|
/** Date and time when the job was started. */
|
|
44
37
|
readonly startedAt?: string;
|
|
45
38
|
/** Summary of a job. Exists only when the job is completed. */
|
|
46
|
-
readonly summary?:
|
|
39
|
+
readonly summary?: DeidentificationJobSummaryOutput;
|
|
47
40
|
}
|
|
48
41
|
/** Storage location. */
|
|
49
42
|
export interface SourceStorageLocationOutput {
|
|
@@ -58,11 +51,32 @@ export interface SourceStorageLocationOutput {
|
|
|
58
51
|
export interface TargetStorageLocationOutput {
|
|
59
52
|
/** URL to storage location. */
|
|
60
53
|
location: string;
|
|
61
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.
|
|
56
|
+
*
|
|
57
|
+
* Example:
|
|
58
|
+
* File full path: documents/user/note.txt
|
|
59
|
+
* Input Prefix: "documents/user/"
|
|
60
|
+
* Output Prefix: "output_docs/"
|
|
61
|
+
*
|
|
62
|
+
* Output file: "output_docs/note.txt"
|
|
63
|
+
*/
|
|
62
64
|
prefix: string;
|
|
65
|
+
/** When set to true during a job, the service will overwrite the output location if it already exists. */
|
|
66
|
+
overwrite?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Customizations options to override default service behaviors for job usage. */
|
|
69
|
+
export interface DeidentificationJobCustomizationOptionsOutput {
|
|
70
|
+
/**
|
|
71
|
+
* Format of the redacted output. Only valid when Operation is Redact.
|
|
72
|
+
* Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
|
|
73
|
+
*/
|
|
74
|
+
redactionFormat?: string;
|
|
75
|
+
/** Locale in which the output surrogates are written. */
|
|
76
|
+
surrogateLocale?: string;
|
|
63
77
|
}
|
|
64
78
|
/** Summary metrics of a job. */
|
|
65
|
-
export interface
|
|
79
|
+
export interface DeidentificationJobSummaryOutput {
|
|
66
80
|
/** Number of documents that have completed. */
|
|
67
81
|
successful: number;
|
|
68
82
|
/** Number of documents that have failed. */
|
|
@@ -74,14 +88,28 @@ export interface JobSummaryOutput {
|
|
|
74
88
|
/** Number of bytes processed. */
|
|
75
89
|
bytesProcessed: number;
|
|
76
90
|
}
|
|
91
|
+
/** Paged collection of DeidentificationJob items */
|
|
92
|
+
export interface PagedDeidentificationJobOutput {
|
|
93
|
+
/** The DeidentificationJob items on this page */
|
|
94
|
+
value: Array<DeidentificationJobOutput>;
|
|
95
|
+
/** The link to the next page of items */
|
|
96
|
+
nextLink?: string;
|
|
97
|
+
}
|
|
98
|
+
/** Paged collection of DeidentificationDocumentDetails items */
|
|
99
|
+
export interface PagedDeidentificationDocumentDetailsOutput {
|
|
100
|
+
/** The DeidentificationDocumentDetails items on this page */
|
|
101
|
+
value: Array<DeidentificationDocumentDetailsOutput>;
|
|
102
|
+
/** The link to the next page of items */
|
|
103
|
+
nextLink?: string;
|
|
104
|
+
}
|
|
77
105
|
/** Details of a single document in a job. */
|
|
78
|
-
export interface
|
|
106
|
+
export interface DeidentificationDocumentDetailsOutput {
|
|
79
107
|
/** Id of the document details. */
|
|
80
108
|
readonly id: string;
|
|
81
109
|
/** Location for the input. */
|
|
82
|
-
input:
|
|
110
|
+
input: DeidentificationDocumentLocationOutput;
|
|
83
111
|
/** Location for the output. */
|
|
84
|
-
output?:
|
|
112
|
+
output?: DeidentificationDocumentLocationOutput;
|
|
85
113
|
/**
|
|
86
114
|
* Status of the document.
|
|
87
115
|
*
|
|
@@ -92,9 +120,9 @@ export interface DocumentDetailsOutput {
|
|
|
92
120
|
error?: ErrorModel;
|
|
93
121
|
}
|
|
94
122
|
/** Location of a document. */
|
|
95
|
-
export interface
|
|
96
|
-
/**
|
|
97
|
-
|
|
123
|
+
export interface DeidentificationDocumentLocationOutput {
|
|
124
|
+
/** Location of document in storage. */
|
|
125
|
+
location: string;
|
|
98
126
|
/** The entity tag for this resource. */
|
|
99
127
|
readonly etag: string;
|
|
100
128
|
}
|
|
@@ -109,10 +137,6 @@ export interface DeidentificationResultOutput {
|
|
|
109
137
|
export interface PhiTaggerResultOutput {
|
|
110
138
|
/** List of entities detected in the input. */
|
|
111
139
|
entities: Array<PhiEntityOutput>;
|
|
112
|
-
/** Path to the document in storage. */
|
|
113
|
-
path?: string;
|
|
114
|
-
/** The entity tag for this resource. */
|
|
115
|
-
etag?: string;
|
|
116
140
|
}
|
|
117
141
|
/** PHI Entity tag in the input. */
|
|
118
142
|
export interface PhiEntityOutput {
|
|
@@ -148,16 +172,8 @@ export interface StringIndexOutput {
|
|
|
148
172
|
*/
|
|
149
173
|
codePoint: number;
|
|
150
174
|
}
|
|
151
|
-
/** Alias for
|
|
152
|
-
export type
|
|
153
|
-
/** Alias for DocumentDataTypeOutput */
|
|
154
|
-
export type DocumentDataTypeOutput = string;
|
|
155
|
-
/** Alias for JobStatusOutput */
|
|
156
|
-
export type JobStatusOutput = string;
|
|
157
|
-
/** Paged collection of DeidentificationJob items */
|
|
158
|
-
export type PagedDeidentificationJobOutput = Paged<DeidentificationJobOutput>;
|
|
159
|
-
/** Paged collection of DocumentDetails items */
|
|
160
|
-
export type PagedDocumentDetailsOutput = Paged<DocumentDetailsOutput>;
|
|
175
|
+
/** Alias for DeidentificationOperationTypeOutput */
|
|
176
|
+
export type DeidentificationOperationTypeOutput = string;
|
|
161
177
|
/** Alias for OperationStateOutput */
|
|
162
178
|
export type OperationStateOutput = string;
|
|
163
179
|
/** Alias for PhiCategoryOutput */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,mCAAmC,CAAC;IAChD,oDAAoD;IACpD,cAAc,EAAE,2BAA2B,CAAC;IAC5C,oDAAoD;IACpD,cAAc,EAAE,2BAA2B,CAAC;IAC5C,sEAAsE;IACtE,cAAc,CAAC,EAAE,6CAA6C,CAAC;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,gCAAgC,CAAC;CACrD;AAED,wBAAwB;AACxB,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAwB;AACxB,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;OASG;IACH,MAAM,EAAE,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Q,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,qDAAqD;AACrD,MAAM,WAAW,4BAA4B;IAC3C,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAED,qCAAqC;AACrC,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAClC;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,iEAAiE;IACjE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oDAAoD;AACpD,MAAM,MAAM,mCAAmC,GAAG,MAAM,CAAC;AACzD,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,kCAAkC;AAClC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ErrorModel } from \"@azure-rest/core-client\";\n\n/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJobOutput {\n /** The name of a job. */\n readonly name: string;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationTypeOutput;\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocationOutput;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocationOutput;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationJobCustomizationOptionsOutput;\n /**\n * Current status of a job.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Canceled\"\n */\n readonly status: OperationStateOutput;\n /** Error when job fails in it's entirety. */\n readonly error?: ErrorModel;\n /**\n * Date and time when the job was completed.\n *\n * If the job is canceled, this is the time when the job was canceled.\n *\n * If the job failed, this is the time when the job failed.\n */\n readonly lastUpdatedAt: string;\n /** Date and time when the job was created. */\n readonly createdAt: string;\n /** Date and time when the job was started. */\n readonly startedAt?: string;\n /** Summary of a job. Exists only when the job is completed. */\n readonly summary?: DeidentificationJobSummaryOutput;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /**\n * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.\n *\n * Example:\n * File full path: documents/user/note.txt\n * Input Prefix: \"documents/user/\"\n * Output Prefix: \"output_docs/\"\n *\n * Output file: \"output_docs/note.txt\"\n */\n prefix: string;\n /** When set to true during a job, the service will overwrite the output location if it already exists. */\n overwrite?: boolean;\n}\n\n/** Customizations options to override default service behaviors for job usage. */\nexport interface DeidentificationJobCustomizationOptionsOutput {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Summary metrics of a job. */\nexport interface DeidentificationJobSummaryOutput {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Paged collection of DeidentificationJob items */\nexport interface PagedDeidentificationJobOutput {\n /** The DeidentificationJob items on this page */\n value: Array<DeidentificationJobOutput>;\n /** The link to the next page of items */\n nextLink?: string;\n}\n\n/** Paged collection of DeidentificationDocumentDetails items */\nexport interface PagedDeidentificationDocumentDetailsOutput {\n /** The DeidentificationDocumentDetails items on this page */\n value: Array<DeidentificationDocumentDetailsOutput>;\n /** The link to the next page of items */\n nextLink?: string;\n}\n\n/** Details of a single document in a job. */\nexport interface DeidentificationDocumentDetailsOutput {\n /** Id of the document details. */\n readonly id: string;\n /** Location for the input. */\n input: DeidentificationDocumentLocationOutput;\n /** Location for the output. */\n output?: DeidentificationDocumentLocationOutput;\n /**\n * Status of the document.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Canceled\"\n */\n status: OperationStateOutput;\n /** Error when document fails. */\n error?: ErrorModel;\n}\n\n/** Location of a document. */\nexport interface DeidentificationDocumentLocationOutput {\n /** Location of document in storage. */\n location: string;\n /** The entity tag for this resource. */\n readonly etag: string;\n}\n\n/** Response body for de-identification operation. */\nexport interface DeidentificationResultOutput {\n /** Output text after de-identification. Not available for \"Tag\" operation. */\n outputText?: string;\n /** Result of the \"Tag\" operation. Only available for \"Tag\" Operation. */\n taggerResult?: PhiTaggerResultOutput;\n}\n\n/** Result of the \"Tag\" operation. */\nexport interface PhiTaggerResultOutput {\n /** List of entities detected in the input. */\n entities: Array<PhiEntityOutput>;\n}\n\n/** PHI Entity tag in the input. */\nexport interface PhiEntityOutput {\n /**\n * PHI Category of the entity.\n *\n * Possible values: \"Unknown\", \"Account\", \"Age\", \"BioID\", \"City\", \"CountryOrRegion\", \"Date\", \"Device\", \"Doctor\", \"Email\", \"Fax\", \"HealthPlan\", \"Hospital\", \"IDNum\", \"IPAddress\", \"License\", \"LocationOther\", \"MedicalRecord\", \"Organization\", \"Patient\", \"Phone\", \"Profession\", \"SocialSecurity\", \"State\", \"Street\", \"Url\", \"Username\", \"Vehicle\", \"Zip\"\n */\n category: PhiCategoryOutput;\n /** Starting index of the location from within the input text. */\n offset: StringIndexOutput;\n /** Length of the input text. */\n length: StringIndexOutput;\n /** Text of the entity. */\n text?: string;\n /** Confidence score of the category match. */\n confidenceScore?: number;\n}\n\n/** String index encoding model. */\nexport interface StringIndexOutput {\n /** The offset or length of the substring in UTF-8 encoding */\n utf8: number;\n /**\n * The offset or length of the substring in UTF-16 encoding.\n *\n * Primary encoding used by .NET, Java, and JavaScript.\n */\n utf16: number;\n /**\n * The offset or length of the substring in CodePoint encoding.\n *\n * Primary encoding used by Python.\n */\n codePoint: number;\n}\n\n/** Alias for DeidentificationOperationTypeOutput */\nexport type DeidentificationOperationTypeOutput = string;\n/** Alias for OperationStateOutput */\nexport type OperationStateOutput = string;\n/** Alias for PhiCategoryOutput */\nexport type PhiCategoryOutput = string;\n"]}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Client, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
2
|
+
/**
|
|
3
|
+
* An interface that tracks the settings for paged iteration
|
|
4
|
+
*/
|
|
5
|
+
export interface PageSettings {
|
|
6
|
+
/**
|
|
7
|
+
* The token that keeps track of where to continue the iterator
|
|
8
|
+
*/
|
|
9
|
+
continuationToken?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An interface that allows async iterable iteration both to completion and by page.
|
|
13
|
+
*/
|
|
14
|
+
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
|
|
15
|
+
/**
|
|
16
|
+
* The next method, part of the iteration protocol
|
|
17
|
+
*/
|
|
18
|
+
next(): Promise<IteratorResult<TElement>>;
|
|
19
|
+
/**
|
|
20
|
+
* The connection to the async iterator, part of the iteration protocol
|
|
21
|
+
*/
|
|
22
|
+
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
|
|
23
|
+
/**
|
|
24
|
+
* Return an AsyncIterableIterator that works a page at a time
|
|
25
|
+
*/
|
|
26
|
+
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
|
|
27
|
+
}
|
|
3
28
|
/**
|
|
4
29
|
* Helper type to extract the type of an array
|
|
5
30
|
*/
|
|
@@ -7,7 +32,7 @@ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|
|
7
32
|
/**
|
|
8
33
|
* The type of a custom function that defines how to get a page and a link to the next one if any.
|
|
9
34
|
*/
|
|
10
|
-
export type GetPage<TPage> = (pageLink: string
|
|
35
|
+
export type GetPage<TPage> = (pageLink: string) => Promise<{
|
|
11
36
|
page: TPage;
|
|
12
37
|
nextPageLink?: string;
|
|
13
38
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAuF7E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B,CACzC,QAAQ,EACR,KAAK,GA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
@@ -1,7 +1,104 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
import {
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
4
|
import { createRestError } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* returns an async iterator that iterates over results. It also has a `byPage`
|
|
7
|
+
* method that returns pages of items at once.
|
|
8
|
+
*
|
|
9
|
+
* @param pagedResult - an object that specifies how to get pages.
|
|
10
|
+
* @returns a paged async iterator that iterates over results.
|
|
11
|
+
*/
|
|
12
|
+
function getPagedAsyncIterator(pagedResult) {
|
|
13
|
+
var _a;
|
|
14
|
+
const iter = getItemAsyncIterator(pagedResult);
|
|
15
|
+
return {
|
|
16
|
+
next() {
|
|
17
|
+
return iter.next();
|
|
18
|
+
},
|
|
19
|
+
[Symbol.asyncIterator]() {
|
|
20
|
+
return this;
|
|
21
|
+
},
|
|
22
|
+
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => {
|
|
23
|
+
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {};
|
|
24
|
+
return getPageAsyncIterator(pagedResult, {
|
|
25
|
+
pageLink: continuationToken,
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getItemAsyncIterator(pagedResult) {
|
|
31
|
+
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
|
|
32
|
+
var _a, e_1, _b, _c, _d, e_2, _e, _f;
|
|
33
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
34
|
+
const firstVal = yield __await(pages.next());
|
|
35
|
+
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
|
|
36
|
+
if (!Array.isArray(firstVal.value)) {
|
|
37
|
+
// can extract elements from this page
|
|
38
|
+
const { toElements } = pagedResult;
|
|
39
|
+
if (toElements) {
|
|
40
|
+
yield __await(yield* __asyncDelegator(__asyncValues(toElements(firstVal.value))));
|
|
41
|
+
try {
|
|
42
|
+
for (var _g = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) {
|
|
43
|
+
_c = pages_1_1.value;
|
|
44
|
+
_g = false;
|
|
45
|
+
const page = _c;
|
|
46
|
+
yield __await(yield* __asyncDelegator(__asyncValues(toElements(page))));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
|
+
finally {
|
|
51
|
+
try {
|
|
52
|
+
if (!_g && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
|
|
53
|
+
}
|
|
54
|
+
finally { if (e_1) throw e_1.error; }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
yield yield __await(firstVal.value);
|
|
59
|
+
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
|
|
60
|
+
yield __await(yield* __asyncDelegator(__asyncValues(pages)));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value)));
|
|
65
|
+
try {
|
|
66
|
+
for (var _h = true, pages_2 = __asyncValues(pages), pages_2_1; pages_2_1 = yield __await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) {
|
|
67
|
+
_f = pages_2_1.value;
|
|
68
|
+
_h = false;
|
|
69
|
+
const page = _f;
|
|
70
|
+
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
|
|
71
|
+
// it must be the case that `TPage = TElement[]`
|
|
72
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
76
|
+
finally {
|
|
77
|
+
try {
|
|
78
|
+
if (!_h && !_d && (_e = pages_2.return)) yield __await(_e.call(pages_2));
|
|
79
|
+
}
|
|
80
|
+
finally { if (e_2) throw e_2.error; }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function getPageAsyncIterator(pagedResult_1) {
|
|
86
|
+
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) {
|
|
87
|
+
const { pageLink } = options;
|
|
88
|
+
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink));
|
|
89
|
+
if (!response) {
|
|
90
|
+
return yield __await(void 0);
|
|
91
|
+
}
|
|
92
|
+
yield yield __await(response.page);
|
|
93
|
+
while (response.nextPageLink) {
|
|
94
|
+
response = yield __await(pagedResult.getPage(response.nextPageLink));
|
|
95
|
+
if (!response) {
|
|
96
|
+
return yield __await(void 0);
|
|
97
|
+
}
|
|
98
|
+
yield yield __await(response.page);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
5
102
|
/**
|
|
6
103
|
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
7
104
|
* @param client - Client to use for sending the next page requests
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAA2C,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AAyCzF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,CAAC;IAChC,MAA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jE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// 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"]}
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,SAAS,qBAAqB,CAM5B,WAAqD;;IAErD,MAAM,IAAI,GAAG,oBAAoB,CAAwC,WAAW,CAAC,CAAC;IACtF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EACJ,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,mCAClB,CAAC,CAAC,QAAuB,EAAE,EAAE;YAC5B,MAAM,EAAE,iBAAiB,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC;YAC7C,OAAO,oBAAoB,CAAC,WAAW,EAAE;gBACvC,QAAQ,EAAE,iBAAiD;aAC5D,CAAC,CAAC;QACL,CAAC,CAA2E;KAC/E,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAClC,WAAqD;;;QAErD,MAAM,KAAK,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,cAA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,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string,\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n (((settings?: PageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken as unknown as TLink | undefined,\n });\n }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator<TPage>),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n // can extract elements from this page\n const { toElements } = pagedResult;\n if (toElements) {\n yield* toElements(firstVal.value) as TElement[];\n for await (const page of pages) {\n yield* toElements(page) as TElement[];\n }\n } else {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n }\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n pageLink?: TLink;\n } = {},\n): AsyncIterableIterator<TPage> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n }\n}\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\ninterface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => unknown[];\n}\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> = (pageLink: string) => 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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
|
|
2
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
3
|
-
import { DeidentificationJob, DeidentificationContent } from "./models.js";
|
|
1
|
+
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
|
|
2
|
+
import type { RequestParameters } from "@azure-rest/core-client";
|
|
3
|
+
import type { DeidentificationJob, DeidentificationContent } from "./models.js";
|
|
4
4
|
export interface GetJobHeaders {
|
|
5
5
|
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
6
6
|
"x-ms-client-request-id"?: string;
|
|
@@ -9,18 +9,18 @@ export interface GetJobHeaderParam {
|
|
|
9
9
|
headers?: RawHttpHeadersInput & GetJobHeaders;
|
|
10
10
|
}
|
|
11
11
|
export type GetJobParameters = GetJobHeaderParam & RequestParameters;
|
|
12
|
-
export interface
|
|
12
|
+
export interface DeidentifyDocumentsHeaders {
|
|
13
13
|
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
14
14
|
"x-ms-client-request-id"?: string;
|
|
15
15
|
}
|
|
16
|
-
export interface
|
|
16
|
+
export interface DeidentifyDocumentsBodyParam {
|
|
17
17
|
/** The resource instance. */
|
|
18
18
|
body: DeidentificationJob;
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
21
|
-
headers?: RawHttpHeadersInput &
|
|
20
|
+
export interface DeidentifyDocumentsHeaderParam {
|
|
21
|
+
headers?: RawHttpHeadersInput & DeidentifyDocumentsHeaders;
|
|
22
22
|
}
|
|
23
|
-
export type
|
|
23
|
+
export type DeidentifyDocumentsParameters = DeidentifyDocumentsHeaderParam & DeidentifyDocumentsBodyParam & RequestParameters;
|
|
24
24
|
export interface ListJobsHeaders {
|
|
25
25
|
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
26
26
|
"x-ms-client-request-id"?: string;
|
|
@@ -71,9 +71,16 @@ export interface DeleteJobHeaderParam {
|
|
|
71
71
|
headers?: RawHttpHeadersInput & DeleteJobHeaders;
|
|
72
72
|
}
|
|
73
73
|
export type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters;
|
|
74
|
-
export interface
|
|
74
|
+
export interface DeidentifyTextHeaders {
|
|
75
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
76
|
+
"x-ms-client-request-id"?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface DeidentifyTextBodyParam {
|
|
75
79
|
/** Request body for de-identification operation. */
|
|
76
80
|
body: DeidentificationContent;
|
|
77
81
|
}
|
|
78
|
-
export
|
|
82
|
+
export interface DeidentifyTextHeaderParam {
|
|
83
|
+
headers?: RawHttpHeadersInput & DeidentifyTextHeaders;
|
|
84
|
+
}
|
|
85
|
+
export type DeidentifyTextParameters = DeidentifyTextHeaderParam & DeidentifyTextBodyParam & RequestParameters;
|
|
79
86
|
//# sourceMappingURL=parameters.d.ts.map
|