From bbe81bf82e2b46b97c318e4024158b9add540c85 Mon Sep 17 00:00:00 2001 From: deagrawa Date: Mon, 11 Feb 2019 11:07:16 +0530 Subject: [PATCH 1/2] Update readme and add license file. --- LICENSE | 21 +++++++++ readme.md | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..11938c882 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Microsoft Graph + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/readme.md b/readme.md index cea3bfaf2..558235580 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,123 @@ -# Microsoft Graph Core SDK for Java \ No newline at end of file +# Microsoft Graph Core SDK for Java + +[ ![Download](https://api.bintray.com/packages/microsoftgraph/Maven/microsoft-graph/images/download.svg) ](https://bintray.com/microsoftgraph/Maven/microsoft-graph/_latestVersion) + + +Get started with the Microsoft Graph Core SDK for Java by integrating the [Microsoft Graph API](https://graph.microsoft.io/en-us/getting-started) into your Java application! + +## 1. Installation + +### 1.1 Install via Gradle + +Add the repository and a compile dependency for `microsoft-graph` to your project's `build.gradle`: + +```gradle +repository { + jcenter() +} + +dependency { + // Include the sdk as a dependency + compile('com.microsoft.graph:microsoft-graph-core:0.1.0-SNAPSHOT') +} +``` + +### 1.2 Install via Maven +Add the dependency in `dependencies` in pom.xml +```dependency + + com.microsoft.graph + microsoft-graph-core + 0.1.0-SNAPSHOT + +``` + +Add `profiles` in `project` to download Snapshot release binary: +``` + + + allow-snapshots + + true + + + + snapshots-repo + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + +``` + +### 1.3 Enable ProGuard (Android) +The nature of the Graph API is such that the SDK needs quite a large set of classes to describe its functionality. You need to ensure that [ProGuard](https://developer.android.com/studio/build/shrink-code.html) is enabled on your project. Otherwise, you will incur long build times for functionality that is not necessarily relevant to your particular application. If you are still hitting the 64K method limit, you can also enable [multidexing](https://developer.android.com/studio/build/multidex.html). + +## 2. Getting started + +### 2.1 Register your application + +Register your application by following the steps at [Register your app with the Azure AD v2.0 endpoint](https://developer.microsoft.com/en-us/graph/docs/concepts/auth_register_app_v2). + +### 2.2 Create an IAuthenticationProvider object + +An instance of the **GraphServiceClient** class handles building requests, sending them to the Microsoft Graph API, and processing the responses. To create a new instance of this class, you need to provide an instance of `IAuthenticationProvider`, which can authenticate requests to Microsoft Graph. + +For an example of authentication in a client application, see the [MSGraph SDK Android MSA Auth for Android Adapter](https://github.com/microsoftgraph/msgraph-sdk-android-msa-auth-for-android-adapter). + +### 2.3 Get a HttpClient object +You must get a **HttpClient** object to make requests against the service. + +```java +CloseableHttpClient httpClient = HttpClients.createDefault(authenticationProvider); +``` + +## 3. Make requests against the service + +After you have a HttpClient that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://developer.microsoft.com/en-us/graph/docs/concepts/overview). + +### 3.1 Get the user's drive + +To retrieve the user's drive: + +```java +HttpGet httpget = new HttpGet("https://graph.microsoft.com/v1.0/me/"); +try{ + HttpResponse response = httpclient.execute(httpget); + //... +}catch(IOException e){ +//Handle exception +} +``` + +## 4. Issues + +For known issues, see [issues](https://github.com/MicrosoftGraph/msgraph-sdk-java-core/issues). + +## 5. Contributions + +The Microsoft Graph SDK is open for contribution. To contribute to this project, see [Contributing](https://github.com/microsoftgraph/msgraph-sdk-java/blob/master/CONTRIBUTING.md). + + + +[
Deepak Agrawal](https://github.com/deepak2016)
[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=deepak2016 "Code") + + +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome! + +## 6. Supported Java versions +The Microsoft Graph SDK for Java library is supported at runtime for Java 7+ and [Android API revision 15](http://source.android.com/source/build-numbers.html) and greater. + +## 7. License + +Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the [MIT license](LICENSE). + +## 8. Third-party notices + +[Third-party notices](THIRD%20PARTY%20NOTICES) From fbbb08ef8d1a59d42a18c618da0902b8c0a2c6c3 Mon Sep 17 00:00:00 2001 From: deagrawa Date: Mon, 11 Feb 2019 11:47:37 +0530 Subject: [PATCH 2/2] Add jcenter url in readme --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index 558235580..22e38fc0a 100644 --- a/readme.md +++ b/readme.md @@ -14,6 +14,9 @@ Add the repository and a compile dependency for `microsoft-graph` to your projec ```gradle repository { jcenter() + jcenter{ + url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' + } } dependency {