Skip to content

Commit 08cbbdc

Browse files
authored
Fix samples and typos. (#508)
1 parent 6cbb558 commit 08cbbdc

15 files changed

+40
-38
lines changed

design/publishing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
##### Current set up -
2222

23-
1. TypeScript Source Code
23+
1. TypeScript Source Code
2424
/ \
2525
Transpiles into JavaScript
2626
'lib' folder
@@ -40,7 +40,7 @@
4040
1. `src/browser/index.js` does not export `RedirectHandler` and `RedirectHandlerOptions`. Redirection is handled by the browser.
4141
2. `src/browser/index.js` exports `src/browser/ImplicitMsalProvider`.
4242
3. `src/browser/ImplicitMsalProvider` does not import or require 'msal' dependency. While, `src/ImplicitMsalProvider` imports or requires 'msal' in the implementation.
43-
4. My assumtion is that `src/browser/ImplicitMsalProvider` is implemented specifically for the rollup process and to skip the rollup external dependency while using `graph-js-sdk.js` in the browser.
43+
4. My assumption is that `src/browser/ImplicitMsalProvider` is implemented specifically for the rollup process and to skip the rollup external dependency while using `graph-js-sdk.js` in the browser.
4444

4545
Note - Browser applications using the ES modules from the npm package of the JS SDK refer to the `module` entry point - `lib/es/src/index.js`(not the browser entry point). Example - Graph Explorer.
4646

docs/ChaosHandlerSamples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
**A request Passes through to the Graph, if there is no entry for the request**
1313

14-
**Note - Always add ChaosHandler before HttpMessageHandler in the midllewareChain**
14+
**Note - Always add ChaosHandler before HttpMessageHandler in the middlewareChain**
1515

1616
### Samples
1717

docs/CustomMiddlewareChain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class MyHttpMessageHandler implements Middleware {
6464

6565
### Create Middleware Chain
6666

67-
Can use own middlewares and the ones shipped with the library [[Here](../src/middleware) are the set of Middlwares shipped with the library] to create the middleware chain. Create a chain out of these one has to link them in sequentially manner in own preferred order using `.setNext()` method.
67+
Can use own middlewares and the ones shipped with the library [[Here](../src/middleware) are the set of Middlewares shipped with the library] to create the middleware chain. Create a chain out of these one has to link them in sequentially manner in own preferred order using `.setNext()` method.
6868

6969
Using AuthenticationHandler [one shipped with the library] and MyLoggingHandler, and MyHttpMessageHandler [custom ones] to create a middleware chain here.
7070

docs/tasks/LargeFileUploadTask.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface FileObject<T> {
6161
}
6262
```
6363

64-
The Microsoft Graph JavaScript Client SDK provides two implementions -
64+
The Microsoft Graph JavaScript Client SDK provides two implementations -
6565

6666
1. StreamUpload - Supports Node.js stream upload
6767

samples/javascript/tasks/LargeFileUploadTask.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function upload() {
2121
const file = fs.createReadStream(`./${fileName}`);
2222

2323
const stats = fs.statSync(`./${fileName}`);
24-
const totalsize = stats.size;
24+
const totalSize = stats.size;
2525

2626
const progress = (range, extraCallbackParam) => {
2727
// Implement the progress callback here
@@ -31,7 +31,7 @@ async function upload() {
3131

3232
const uploadEventHandlers = {
3333
progress,
34-
extraCallbackParam: "Any paramater needed by the callback implementation",
34+
extraCallbackParam: "Any parameter needed by the callback implementation",
3535
};
3636

3737
const options = {
@@ -55,18 +55,18 @@ async function upload() {
5555
// AttachmentItem: {
5656
// attachmentType: 'file',
5757
// name: "FILE_NAME",
58-
// size: totalsize,
58+
// size: totalSize,
5959
// }
6060
// }
6161

62-
const fileObject = new StreamUpload(file, fileName, totalsize);
62+
const fileObject = new StreamUpload(file, fileName, totalSize);
6363

64-
//OR
64+
// OR
6565
// You can also use a FileUpload instance
66-
//const file = fs.readFileSync();
67-
//const fileObject = new FileUpload(file, fileName, totalsize);
66+
// const file = fs.readFileSync();
67+
// const fileObject = new FileUpload(file, fileName, totalSize);
6868

69-
//OR
69+
// OR
7070
// You can also create an object from a custom implementation of the FileObject interface
7171
const task = new MicrosoftGraph.LargeFileUploadTask(client, fileObject, uploadSession, options);
7272
const uploadResult = await task.upload();

samples/javascript/tasks/OneDriveLargeFileUploadTask.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function upload() {
3333

3434
const uploadEventHandlers = {
3535
progress,
36-
extraCallbackParam: "any paramater needed by the callback implementation",
36+
extraCallbackParam: "any parameter needed by the callback implementation",
3737
};
3838

3939
const options = {

samples/typescript/tasks/LargeFileUploadTask.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99

1010
// First, create an instance of the Microsoft Graph JS SDK Client class
1111

12+
import { LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client";
13+
import * as fs from "fs";
1214
import { client } from "../clientInitialization/ClientWithOptions";
1315
/**
1416
* OR
1517
* import { client } from ("../clientInitialization/TokenCredentialAuthenticationProvider");
1618
* OR
1719
* require or import client created using an custom authentication provider
1820
*/
19-
import * as fs from "fs";
20-
import { LargeFileUploadTaskOptions, LargeFileUploadSession, LargeFileUploadTask, StreamUpload, UploadEventHandlers, UploadResult, Range, FileUpload } from "@microsoft/microsoft-graph-client";
2121

2222
async function upload(): Promise<UploadResult> {
2323
const file = fs.createReadStream("./test.pdf");
2424

2525
const stats = fs.statSync(`./test.pdf`);
26-
const totalsize = stats.size;
26+
const totalSize = stats.size;
2727

2828
const progress = (range?: Range, extraCallbackParam?: unknown) => {
2929
// Implement the progress callback here
@@ -34,7 +34,7 @@ async function upload(): Promise<UploadResult> {
3434

3535
const uploadEventHandlers: UploadEventHandlers = {
3636
progress,
37-
extraCallbackParam: "any paramater needed by the callback implementation",
37+
extraCallbackParam: "any parameter needed by the callback implementation",
3838
};
3939

4040
const options: LargeFileUploadTaskOptions = {
@@ -58,18 +58,18 @@ async function upload(): Promise<UploadResult> {
5858
// AttachmentItem: {
5959
// attachmentType: 'file',
6060
// name: "FILE_NAME",
61-
// size: totalsize,
61+
// size: totalSize,
6262
// }
6363
// }
6464

65-
const fileObject = new StreamUpload(file, "test.pdf", totalsize);
65+
const fileObject = new StreamUpload(file, "test.pdf", totalSize);
6666

67-
//OR
67+
// OR
6868
// You can also use a FileUpload instance
69-
//const file = fs.readFileSync();
70-
//const fileObject = new FileUpload(file, 'test.pdf', totalsize);
69+
// const file = fs.readFileSync();
70+
// const fileObject = new FileUpload(file, 'test.pdf', totalSize);
7171

72-
//OR
72+
// OR
7373
// You can also create an object from a custom implementation of FileObject
7474
const task = new LargeFileUploadTask(client, fileObject, uploadSession, options);
7575
const uploadResult = await task.upload();

samples/typescript/tasks/OneDriveLargeFileUploadTask.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
// First, create an instance of the Microsoft Graph JS SDK Client class
99
/* eslint-disable simple-import-sort/imports*/
1010

11+
import { OneDriveLargeFileUploadOptions, OneDriveLargeFileUploadTask, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client";
12+
import * as fs from "fs";
13+
import { Readable } from "stream";
1114
import { client } from "../clientInitialization/ClientWithOptions";
1215
/**
1316
* OR
1417
* import { client } from ("../clientInitialization/TokenCredentialAuthenticationProvider");
1518
* OR
1619
* require or import client created using an custom authentication provider
1720
*/
18-
import { OneDriveLargeFileUploadOptions, OneDriveLargeFileUploadTask, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client";
19-
import * as fs from "fs";
20-
import { Readable } from "stream";
2121

2222
async function upload() {
2323
const file = fs.createReadStream("./test.pdf");
2424
const fileName = "FILENAME";
2525
const stats = fs.statSync(`./test.pdf`);
26-
const totalsize = stats.size;
26+
const totalSize = stats.size;
2727

2828
const progress = (range?: Range, extraCallBackParam?: unknown) => {
2929
console.log("uploading range: ", range);
@@ -33,7 +33,7 @@ async function upload() {
3333

3434
const uploadEventHandlers: UploadEventHandlers = {
3535
progress,
36-
extraCallbackParam: "any paramater needed by the callback implementation",
36+
extraCallbackParam: "any parameter needed by the callback implementation",
3737
};
3838

3939
const options: OneDriveLargeFileUploadOptions = {
@@ -43,7 +43,7 @@ async function upload() {
4343
uploadEventHandlers,
4444
};
4545

46-
const stream = new StreamUpload(file, "test.pdf", totalsize);
46+
const stream = new StreamUpload(file, "test.pdf", totalSize);
4747
const task = await OneDriveLargeFileUploadTask.createTaskWithFileObject<Readable>(client, stream, options);
4848
const uploadResult: UploadResult = await task.upload();
4949
return uploadResult;

src/GraphClientError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class GraphClientError extends Error {
3333
* @static
3434
* @async
3535
* To set the GraphClientError object
36-
* @param {any} - The error returned encountered by the Graph JavaScript Client SDK while processing request
36+
* @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request
3737
* @returns GraphClientError object set to the error passed
3838
*/
3939
public static setGraphClientError(error: any): GraphClientError {

src/GraphError.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export class GraphError extends Error {
5353
* @constructor
5454
* Creates an instance of GraphError
5555
* @param {number} [statusCode = -1] - The status code of the error
56+
* @param {string} [message] - The message of the error
57+
* @param {Error} [baseError] - The base error
5658
* @returns An instance of GraphError
5759
*/
5860
public constructor(statusCode = -1, message?: string, baseError?: Error) {

0 commit comments

Comments
 (0)