-
Notifications
You must be signed in to change notification settings - Fork 233
ReadMe - Adding table of contents #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0ea910b
creating table of contents
nikithauc cfd8ae0
CreateClient md changes, more links in toc
nikithauc 385b058
Adding additional resources
nikithauc 7da8998
Removing travis badge
nikithauc 80159dc
Apply suggestions from code review
nikithauc 311d14f
replace - with :
nikithauc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,40 @@ | ||
| # Microsoft Graph JavaScript Client Library | ||
|
|
||
| [](https://www.npmjs.com/package/@microsoft/microsoft-graph-client) [](https://travis-ci.org/microsoftgraph/msgraph-sdk-javascript) [](https://snyk.io/test/github/microsoftgraph/msgraph-sdk-javascript) [](https://github.com/microsoftgraph/msgraph-sdk-javascript) [](https://github.com/microsoftgraph/msgraph-sdk-javascript) [](https://www.npmjs.com/package/@microsoft/microsoft-graph-client) | ||
| [](https://www.npmjs.com/package/@microsoft/microsoft-graph-client) [](https://snyk.io/test/github/microsoftgraph/msgraph-sdk-javascript) [](https://github.com/microsoftgraph/msgraph-sdk-javascript) [](https://github.com/microsoftgraph/msgraph-sdk-javascript) [](https://www.npmjs.com/package/@microsoft/microsoft-graph-client) | ||
|
|
||
| The Microsoft Graph JavaScript client library is a lightweight wrapper around the Microsoft Graph API that can be used server-side and in the browser. | ||
|
|
||
| **Looking for IntelliSense on models (Users, Groups, etc.)? Check out the [Microsoft Graph Types](https://github.com/microsoftgraph/msgraph-typescript-typings) repository!** | ||
| - [Microsoft Graph JavaScript Client Library](#microsoft-graph-javascript-client-library) | ||
| - [Installation](#installation) | ||
| - [Via npm](#via-npm) | ||
| - [Via Script Tag](#via-script-tag) | ||
| - [Getting started](#getting-started) | ||
| - [1. Register your application](#1-register-your-application) | ||
| - [2. Create a Client Instance](#2-create-a-client-instance) | ||
| - [3. Make requests to the graph](#3-make-requests-to-the-graph) | ||
| - Documentation | ||
| - [HTTP Actions](docs/Actions.md) | ||
| - [Chained APIs to call Microsoft Graph](docs/CallingPattern.md) | ||
| - [OData system query options - Query Parameters](docs/QueryParameters.md) | ||
| - [Batch multiple requests into single HTTP request](docs/content/Batching.md) | ||
| - [Configurations to your request](docs/OtherAPIs.md) | ||
| - [Query](docs/OtherAPIs.md#QUERY) | ||
| - [Version](docs/OtherAPIs.md#VERSION) | ||
| - [Headers](docs/OtherAPIs.md#HEADER-AND-HEADERS) | ||
| - [Options](docs/OtherAPIs.md#OPTION-AND-OPTIONS) | ||
| - [MiddlewareOptions](docs/OtherAPIs.md#MIDDLEWAREOPTIONS) | ||
| - [ResponseType](docs/OtherAPIs.md#RESPONSETYPE) | ||
| - [Upload large files to OneDrive, Outlook, Print API](docs/tasks/LargeFileUploadTask.md) | ||
| - [Page Iteration](docs/tasks/PageIterator.md) | ||
| - [Getting Raw Response](docs/GettingRawResponse.md) | ||
| - [Creating an instance of TokenCredentialAuthenticationProvider](docs/TokenCredentialAuthenticationProvider.md) | ||
| - [Questions and comments](#questions-and-comments) | ||
| - [Contributing](#contributing) | ||
| - [Additional resources](#additional-resources) | ||
| - [Third Party Notices](#third-party-notices) | ||
| - [Security Reporting](#security-reporting) | ||
| - [License](#license) | ||
| - [We Value and Adhere to the Microsoft Open Source Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct) | ||
|
|
||
| [](https://github.com/microsoftgraph/msgraph-typescript-typings) | ||
|
|
||
|
|
@@ -16,10 +46,16 @@ The Microsoft Graph JavaScript client library is a lightweight wrapper around th | |
| npm install @microsoft/microsoft-graph-client | ||
| ``` | ||
|
|
||
| import `@microsoft/microsoft-graph-client` into your module and also you will need polyfills for fetch like [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch). | ||
| import `@microsoft/microsoft-graph-client` into your module. | ||
|
|
||
| Also, you will need to import any fetch polyfill which suits your requirements. | ||
| Following are some fetch polyfills - | ||
| * [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch). | ||
| * [cross-fetch](https://www.npmjs.com/package/cross-fetch) | ||
| * [whatwg-fetch](https://www.npmjs.com/package/whatwg-fetch) | ||
|
|
||
| ```typescript | ||
| import "isomorphic-fetch"; | ||
| import "isomorphic-fetch"; // or import the fetch polyfill you installed | ||
| import { Client } from "@microsoft/microsoft-graph-client"; | ||
| ``` | ||
|
|
||
|
|
@@ -45,60 +81,25 @@ In case your browser doesn't have support for [Fetch](https://developer.mozilla. | |
| ``` | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### 1. Register your application | ||
|
|
||
| Register your application to use Microsoft Graph API using one of the following supported authentication portals: | ||
|
|
||
| - [Microsoft Application Registration Portal](https://apps.dev.microsoft.com): Register a new application that works with Microsoft Accounts and/or organizational accounts using the unified V2 Authentication Endpoint. | ||
| - [Microsoft Azure Active Directory](https://manage.windowsazure.com): Register a new application in your tenant's Active Directory to support work or school users for your tenant or multiple tenants. | ||
|
|
||
| ### 2. Authenticate for the Microsoft Graph service | ||
|
|
||
| The Microsoft Graph JavaScript Client Library has an adapter implementation for the following - | ||
|
|
||
| - ([TokenCredentialAuthenticationProvider](src/authentication/TokenCredentialAuthenticationProvider.ts)) to support [Azure Identity TokenCredential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md) (Azure Identity client library for JavaScript) which takes care of getting the `accessToken`. @azure/identity library does not ship with this library, user has to include it externally (For including @azure/identity, refer [this](https://www.npmjs.com/package/@azure/identity)). | ||
|
|
||
| > Learn how to [create an instance of TokenCredentialAuthenticationProvider](./docs/TokenCredentialAuthenticationProvider.md). | ||
|
|
||
| - ([ImplicitMSALAuthenticationProvider](src/ImplicitMSALAuthenticationProvider.ts)) for [MSAL](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core) (Microsoft Authentication Library) which takes care of getting the `accessToken`. MSAL library does not ship with this library, user has to include it externally (For including MSAL, refer [this](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core#installation)). | ||
|
|
||
| > Learn how to [create an instance of ImplicitMSALAuthenticationProvider](./docs/ImplicitMSALAuthenticationProvider.md). | ||
|
|
||
| User can integrate own preferred authentication library by implementing `IAuthenticationProvider` interface. Refer implementing [Custom Authentication Provider](./docs/CustomAuthenticationProvider.md). | ||
|
|
||
| ### 3. Initialize a Microsoft Graph Client object with an authentication provider | ||
|
|
||
| An instance of the **Client** class handles requests to Microsoft Graph API and processing the responses. To create a new instance of this class, you need to provide an instance of [`IAuthenticationProvider`](src/IAuthenticationProvider.ts) which needs to be passed as a value for `authProvider` key in [`ClientOptions`](src/IClientOptions.ts) to a static initializer method `Client.initWithMiddleware`. | ||
| To call Microsoft Graph, your app must acquire an access token from the Microsoft identity platform. | ||
| Learn more about this - | ||
| - [Authentication and authorization basics for Microsoft Graph](https://docs.microsoft.com/en-us/graph/auth/auth-concepts) | ||
| - [Register your app with the Microsoft identity platform](https://docs.microsoft.com/en-us/graph/auth/auth-concepts) | ||
|
|
||
| #### For browser environment | ||
| ### 2. Create a Client Instance | ||
|
|
||
| ```typescript | ||
| const options = { | ||
| authProvider, // An instance created from previous step | ||
| }; | ||
| const Client = MicrosoftGraph.Client; | ||
| const client = Client.initWithMiddleware(options); | ||
| ``` | ||
|
|
||
| #### For node environment | ||
|
|
||
| ```typescript | ||
| import { Client } from "@microsoft/microsoft-graph-client"; | ||
| The Microsoft Graph client is designed to make it simple to make calls to Microsoft Graph. You can use a single client instance for the lifetime of the application. | ||
|
|
||
| const options = { | ||
| authProvider, // An instance created from previous step | ||
| }; | ||
| const client = Client.initWithMiddleware(options); | ||
| ``` | ||
| For information on how to create a client instance, see [Creating Client Instance](./docs/CreatingClientInstance.md) | ||
|
|
||
| For more information on initializing client, refer [this document](./docs/CreatingClientInstance.md). | ||
|
|
||
| ### 4. Make requests to the graph | ||
| ### 3. Make requests to the graph | ||
|
|
||
| Once you have authentication setup and an instance of Client, you can begin to make calls to the service. All requests should be start with `client.api(path)` and end with an [action](./docs/Actions.md). | ||
| Once you have authentication setup and an instance of Client, you can begin to make calls to the service. All requests should start with `client.api(path)` and end with an [action](./docs/Actions.md). | ||
|
|
||
| Getting user details | ||
| Getting user details - | ||
|
|
||
| ```typescript | ||
| try { | ||
|
|
@@ -109,7 +110,7 @@ try { | |
| } | ||
| ``` | ||
|
|
||
| Sending an email to the recipients | ||
| Sending an email to the recipients - | ||
|
||
|
|
||
| ```typescript | ||
| // Construct email object | ||
|
|
@@ -137,16 +138,6 @@ try { | |
|
|
||
| For more information, refer: [Calling Pattern](docs/CallingPattern.md), [Actions](docs/Actions.md), [Query Params](docs/QueryParameters.md), [API Methods](docs/OtherAPIs.md) and [more](docs/). | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [Batching](docs/content/Batching.md) | ||
| - [Large File Upload Task](docs/tasks/LargeFileUploadTask.md) | ||
| - [Page Iterator](docs/tasks/PageIterator.md) | ||
| - [Actions](docs/Actions.md) | ||
| - [Query Parameters](docs/QueryParameters.md) | ||
| - [Other APIs](docs/OtherAPIs.md) | ||
| - [Getting Raw Response](docs/GettingRawResponse.md) | ||
|
|
||
| ## Questions and comments | ||
|
|
||
| We'd love to get your feedback about the Microsoft Graph JavaScript client library. You can send your questions and suggestions to us in the [Issues](https://github.com/microsoftgraph/msgraph-sdk-javascript/issues) section of this repository. | ||
|
|
@@ -157,11 +148,16 @@ Please see the [contributing guidelines](CONTRIBUTING.md). | |
|
|
||
| ## Additional resources | ||
|
|
||
| - [Microsoft Graph website](https://graph.microsoft.io) | ||
| - [Microsoft Graph TypeScript types](https://github.com/microsoftgraph/msgraph-typescript-typings/) | ||
| - [Build Angular single-page apps with Microsoft Graph](https://github.com/microsoftgraph/msgraph-training-angularspa) | ||
| - [Build Node.js Express apps with Microsoft Graph](https://github.com/microsoftgraph/msgraph-training-nodeexpressapp) | ||
| - [Office Dev Center](http://dev.office.com/) | ||
| - [Microsoft Graph website](https://graph.microsoft.io) | ||
|
|
||
| - The Microsoft Graph TypeScript definitions enable editors to provide intellisense on Microsoft Graph objects including users, messages, and groups. | ||
| - [@microsoft/microsoft-graph-types](https://www.npmjs.com/package/@microsoft/microsoft-graph-types) or [@types/microsoft-graph](https://www.npmjs.com/package/@types/microsoft-graph) | ||
| - [@microsoft/microsoft-graph-types-beta](https://www.npmjs.com/package/@microsoft/microsoft-graph-types-beta) | ||
| - [Build React Native apps with Microsoft Graph](https://docs.microsoft.com/en-us/graph/tutorials/react-native) | ||
| - [Build Angular single-page apps with Microsoft Graph](https://github.com/microsoftgraph/msgraph-training-angularspa) | ||
| - [Build Node.js Express apps with Microsoft Graph](https://github.com/microsoftgraph/msgraph-training-nodeexpressapp) | ||
| - [Microsoft Graph Toolkit: UI Components and Authentication Providers for Microsoft Graph](https://docs.microsoft.com/en-us/graph/toolkit/overview) | ||
| - [Office Dev Center](http://dev.office.com/) | ||
|
|
||
| ## Third Party Notices | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: what is the trailing
-sign for?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicating the the following sample is for Getting user details