Skip to content

Commit 0abd896

Browse files
Merge branch 'dev' into Multiple-Output-JS
2 parents 3e38229 + 2983bd5 commit 0abd896

File tree

14 files changed

+82
-25
lines changed

14 files changed

+82
-25
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,19 @@ You can pass in additional request headers, either individually or in a dictiona
248248
````
249249

250250
### .responseType()
251-
To set a custom response type, use the `.responseType(string)` method. To see an example, check the [browser sample](samples/browser/index.html) that downloads an image and displays it in an `<img>` element.
251+
To set a custom response type, use the `.responseType(<ResponseType>)` method. Refer [ResponseType.ts](./src/ResponseType.ts) for available options.
252+
````js
253+
client
254+
.api(`/me/drive/root/children/${fileName}/content`)
255+
.responseType(MicrosoftGraph.ResponseType.BLOB)
256+
.get()
257+
.then((res) => {
258+
console.log("Downloaded..!!");
259+
})
260+
.catch((err) => {
261+
throw err;
262+
});
263+
````
252264

253265
## Running node samples
254266
You can run and debug the node samples found under [./samples/node/node-sample.js](./samples/node/node-sample.js) by running the *Run node samples* configuration from the **Debug** (Ctrl + Shift + D) menu in Visual Studio Code. Alternately, you can run the node samples from the CLI by entering `node ./samples/node/node-sample.js` (assuming you are at the root of this repo). You'll need to rename the *secrets.example.json* file to *secrets.json* and add a valid access token to it. You can get an access token by doing the following:

lib/src/GraphRequest.js

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/ResponseHandler.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/ResponseType.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export declare enum ResponseType {
2+
ARRAYBUFFER = "arraybuffer",
3+
BLOB = "blob",
4+
DOCUMENT = "document",
5+
JSON = "json",
6+
STREAM = "stream",
7+
TEXT = "text"
8+
}

lib/src/ResponseType.js

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/ResponseType.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export declare class Client {
88
export * from "./GraphRequest";
99
export * from "./common";
1010
export * from "./ResponseHandler";
11+
export * from "./ResponseType";

lib/src/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/browser/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// Example of downloading the user's profile photo and displaying it in an img tag
2727
client
2828
.api('/me/photo/$value')
29-
.responseType('blob')
29+
.responseType(MicrosoftGraph.ResponseType.BLOB)
3030
.get((err, res, rawResponse) => {
3131
if (err) throw err;
3232

0 commit comments

Comments
 (0)