@azure-rest/purview-sharing 1.0.0-alpha.20250221.1 → 1.0.0-alpha.20250224.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -2
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -44,14 +44,85 @@ can be used to authenticate the client.
|
|
|
44
44
|
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
|
|
45
45
|
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
|
|
46
46
|
|
|
47
|
+
Use the returned token credential to authenticate the client:
|
|
48
|
+
|
|
49
|
+
```ts snippet:ReadmeSampleCreateClient_Node
|
|
50
|
+
import PurviewSharingClient from "@azure-rest/purview-sharing";
|
|
51
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
52
|
+
|
|
53
|
+
const client = PurviewSharingClient(
|
|
54
|
+
"https://<my-account-name>.purview.azure.com",
|
|
55
|
+
new DefaultAzureCredential(),
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Examples
|
|
60
|
+
|
|
61
|
+
The following sections provide several code snippets covering some of the most common Purview Sharing scenarios, including:
|
|
62
|
+
|
|
63
|
+
- Get Recipient for a Given Sent Share
|
|
64
|
+
|
|
65
|
+
```ts snippet:ReadmeSampleGetRecipientForAGivenSentShare
|
|
66
|
+
import PurviewSharingClient, { isUnexpected, paginate } from "@azure-rest/purview-sharing";
|
|
67
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
68
|
+
|
|
69
|
+
const client = PurviewSharingClient(
|
|
70
|
+
"https://<my-account-name>.purview.azure.com",
|
|
71
|
+
new DefaultAzureCredential(),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const storageAccountResourceId = "<storage-account-resource-id>";
|
|
75
|
+
const options = {
|
|
76
|
+
queryParameters: {
|
|
77
|
+
referenceName: storageAccountResourceId,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const initialResponse = await client.path("/sentShares").get(options);
|
|
81
|
+
if (isUnexpected(initialResponse)) {
|
|
82
|
+
throw initialResponse.body.error;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const pageData = paginate(client, initialResponse);
|
|
86
|
+
for await (const sharedInvitationOutput of pageData) {
|
|
87
|
+
const sharedInvitationId = sharedInvitationOutput.id;
|
|
88
|
+
if (sharedInvitationId) {
|
|
89
|
+
const sentShareResponse = await client
|
|
90
|
+
.path("/sentShares/{sentShareId}", sharedInvitationId)
|
|
91
|
+
.get();
|
|
92
|
+
|
|
93
|
+
if (isUnexpected(sentShareResponse)) {
|
|
94
|
+
throw sentShareResponse.body.error;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const sentShareId = sentShareResponse.body.id;
|
|
98
|
+
if (sentShareId) {
|
|
99
|
+
const sentShareRecipientResponse = await client
|
|
100
|
+
.path(
|
|
101
|
+
"/sentShares/{sentShareId}/sentShareInvitations/{sentShareInvitationId}",
|
|
102
|
+
sentShareId,
|
|
103
|
+
sharedInvitationId,
|
|
104
|
+
)
|
|
105
|
+
.get();
|
|
106
|
+
|
|
107
|
+
if (isUnexpected(sentShareRecipientResponse)) {
|
|
108
|
+
throw sentShareRecipientResponse.body.error;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const sentShareRecipientId = sentShareRecipientResponse.body.id;
|
|
112
|
+
console.log(`Sent Share Recipient Id: ${sentShareRecipientId}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
47
118
|
## Troubleshooting
|
|
48
119
|
|
|
49
120
|
### Logging
|
|
50
121
|
|
|
51
122
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
52
123
|
|
|
53
|
-
```ts
|
|
54
|
-
|
|
124
|
+
```ts snippet:SetLogLevel
|
|
125
|
+
import { setLogLevel } from "@azure/logger";
|
|
55
126
|
|
|
56
127
|
setLogLevel("info");
|
|
57
128
|
```
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/purview-sharing",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.20250224.2",
|
|
6
6
|
"description": "A generated SDK for PurviewSharing.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
54
54
|
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
55
55
|
"unit-test:node": "dev-tool run test:vitest",
|
|
56
|
-
"update-snippets": "
|
|
56
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
57
57
|
},
|
|
58
58
|
"sideEffects": false,
|
|
59
59
|
"autoPublish": false,
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@azure/abort-controller": "^2.1.2",
|
|
63
63
|
"@azure/core-auth": "^1.9.0",
|
|
64
64
|
"@azure/core-lro": "^3.0.0",
|
|
65
|
-
"@azure/core-rest-pipeline": "^1.
|
|
65
|
+
"@azure/core-rest-pipeline": "^1.19.0",
|
|
66
66
|
"@azure/logger": "^1.1.4",
|
|
67
67
|
"tslib": "^2.8.1"
|
|
68
68
|
},
|
|
@@ -72,16 +72,16 @@
|
|
|
72
72
|
"@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
|
|
73
73
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
74
74
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
75
|
-
"@azure/identity": "^4.
|
|
75
|
+
"@azure/identity": "^4.7.0",
|
|
76
76
|
"@types/node": "^18.0.0",
|
|
77
|
-
"@vitest/browser": "^3.0.
|
|
78
|
-
"@vitest/coverage-istanbul": "^3.0.
|
|
77
|
+
"@vitest/browser": "^3.0.6",
|
|
78
|
+
"@vitest/coverage-istanbul": "^3.0.6",
|
|
79
79
|
"autorest": "latest",
|
|
80
80
|
"dotenv": "^16.0.3",
|
|
81
81
|
"eslint": "^9.9.0",
|
|
82
|
-
"playwright": "^1.
|
|
82
|
+
"playwright": "^1.50.1",
|
|
83
83
|
"typescript": "~5.7.2",
|
|
84
|
-
"vitest": "^3.0.
|
|
84
|
+
"vitest": "^3.0.6"
|
|
85
85
|
},
|
|
86
86
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-sharing-rest/README.md",
|
|
87
87
|
"//metadata": {
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"type": "module",
|
|
108
108
|
"tshy": {
|
|
109
|
+
"project": "./tsconfig.src.json",
|
|
109
110
|
"exports": {
|
|
110
111
|
"./package.json": "./package.json",
|
|
111
112
|
".": "./src/index.ts"
|
|
@@ -118,8 +119,7 @@
|
|
|
118
119
|
"browser",
|
|
119
120
|
"react-native"
|
|
120
121
|
],
|
|
121
|
-
"selfLink": false
|
|
122
|
-
"project": "./tsconfig.src.json"
|
|
122
|
+
"selfLink": false
|
|
123
123
|
},
|
|
124
124
|
"exports": {
|
|
125
125
|
"./package.json": "./package.json",
|
|
@@ -141,5 +141,6 @@
|
|
|
141
141
|
"default": "./dist/commonjs/index.js"
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
}
|
|
144
|
+
},
|
|
145
|
+
"react-native": "./dist/react-native/index.js"
|
|
145
146
|
}
|