Skip to content

Commit 7a17e7f

Browse files
Updates
1 parent 15fc99f commit 7a17e7f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

design/kiota-e2e.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Before we jump into the end-to-end walk-through, it's important to set some cons
1515
## NodeJS e2e using the Service library
1616

1717
```bash
18-
npm install @microsoft/msgraph-sdk-typescript --save
18+
## Depending on the needs, you could also install the @microsoft/msgraph-sdk-javascript-beta side-by-side with the v1.0 one. Not covered in this walkthrough.
19+
npm install @microsoft/msgraph-sdk-javascript --save ## Installing the Javascript service library should also install the core SDK and the types (based on the version of the service library).
1920
npm install @microsoft/kiota-authentication-azure --save
2021
```
2122

@@ -34,23 +35,33 @@ const deviceCodeCredentials = new DeviceCodeCredential({
3435
const scopes = ["User.Read", "Mail.Send"];
3536

3637
const graphClient = Client.init({
38+
// Note that this is not an authentication provider, but an access token provider.
3739
accessTokenProvider: new AzureIdentityAccessTokenProvider(deviceCodeCredentials, scopes),
3840
});
3941

42+
// Calling the API via the fluent API
4043
const me = await getMe();
44+
45+
// Allowing raw calls (using the .api() method instead of the full fluent API) is important for migration purposes and cases we don't know the resource beforehands (thinking Graph Explorer, mgt-get, etc.)
4146
const meRaw = await getMeRaw();
47+
48+
// Sending an email via the fluent API
4249
await sendMail();
50+
51+
// Sending the email via the .api() method
4352
await sendMailRaw();
4453

54+
// The types returned by the fluent API should be the same as the .api() area. It should also be the same (or at least very similar) as the current @microsoft/microsoft-graph-types to offer seamless migration.
4555
async function getMe(): Promise<User | undefined> {
4656
return await graphClient.me.get();
4757
}
4858

49-
async function getMe(): Promise<User | undefined> {
59+
async function getMeRaw(): Promise<User | undefined> {
5060
return await graphClient.api("/me").get();
5161
}
5262

5363
async function sendMail(): Promise<void> {
64+
// Noting that we are using Interfaces and not Classes. There is an open discussion about this topic here https://github.com/microsoft/kiota/issues/1013
5465
const message: Message = {
5566
subject: "Hello Graph TypeScript SDK!",
5667
body: {
@@ -96,6 +107,7 @@ async function sendMailRaw(): Promise<void> {
96107
```bash
97108
npm install @microsoft/msgraph-sdk-javascript-core --save
98109
npm install @microsoft/msgraph-sdk-javascript-types --save
110+
## npm install @microsoft/msgraph-sdk-javascript-types-beta --save
99111
npm install @microsoft/kiota-authentication-azure --save
100112
```
101113

0 commit comments

Comments
 (0)