-
Couldn't load subscription status.
- Fork 3
Add HttpClientFactory and update Graph client to use it #2
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
Changes from 10 commits
b23cc04
4c3fa35
0293b63
7231294
b6cdb1a
3665dd2
8762088
719d50c
4dc0e87
b95fc51
2f161e0
b044859
bca9780
acd2855
17bb389
f11850d
20186f0
607d4e8
13112b4
bdd2ed5
efb8bc8
bed36da
35ce3ff
8a92a86
8583d17
f1bb80f
bfb37ca
7606355
018c427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,27 @@ | ||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| # All PHP files MUST use the Unix LF (linefeed) line ending. | ||
| # Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. | ||
| # All PHP files MUST end with a single blank line. | ||
| # There MUST NOT be trailing whitespace at the end of non-blank lines. | ||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = crlf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| # PHP-Files, Composer.json, MD-Files | ||
| [{*.php,composer.json,*.md}] | ||
| indent_style = space | ||
| indent_size = 4 | ||
|
|
||
| # HTML-Files LESS-Files SASS-Files CSS-Files JS-Files JSON-Files | ||
| [{*.html,*.less,*.sass,*.css,*.js,*.json}] | ||
| indent_style = tab | ||
| indent_size = 4 | ||
|
|
||
| # Gitlab-CI, Travis-CI | ||
| [*.yml] | ||
| indent_style = space | ||
| indent_size = 2 | ||
| # top-most EditorConfig file | ||
| root = true | ||
| # All PHP files MUST use the Unix LF (linefeed) line ending. | ||
| # Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. | ||
| # All PHP files MUST end with a single blank line. | ||
| # There MUST NOT be trailing whitespace at the end of non-blank lines. | ||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| # PHP-Files, Composer.json, MD-Files | ||
| [{*.php,composer.json,*.md}] | ||
| indent_style = space | ||
| indent_size = 4 | ||
| # HTML-Files LESS-Files SASS-Files CSS-Files JS-Files JSON-Files | ||
| [{*.html,*.less,*.sass,*.css,*.js,*.json}] | ||
| indent_style = tab | ||
| indent_size = 4 | ||
| # Gitlab-CI, Travis-CI | ||
| [*.yml] | ||
| indent_style = space | ||
| indent_size = 2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,38 @@ | ||
| { | ||
| "name": "microsoft/microsoft-graph-core", | ||
| "type": "library", | ||
| "description": "The Microsoft Graph SDK for PHP", | ||
| "homepage": "https://developer.microsoft.com/en-us/graph", | ||
| "license": "MIT", | ||
| "authors": [ | ||
| { | ||
| "name": "Microsoft Graph Client Tooling", | ||
| "email": "graphtooling@service.microsoft.com", | ||
| "role": "Developer" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": "^8.0 || ^7.3", | ||
| "guzzlehttp/guzzle": "^6.0 || ^7.0", | ||
| "ext-json": "*" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^8.0 || ^9.0", | ||
| "mikey179/vfsstream": "^1.2", | ||
| "vimeo/psalm": "^4.8", | ||
| "microsoft/microsoft-graph": "^1.34" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Microsoft\\Graph\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "Microsoft\\Graph\\Test\\": "tests/Functional/", | ||
| "Microsoft\\Graph\\Http\\Test\\": "tests/Http/" | ||
| } | ||
| } | ||
| } | ||
| { | ||
| "name": "microsoft/microsoft-graph-core", | ||
| "type": "library", | ||
| "description": "The Microsoft Graph SDK for PHP", | ||
| "homepage": "https://developer.microsoft.com/en-us/graph", | ||
| "license": "MIT", | ||
| "authors": [ | ||
| { | ||
| "name": "Microsoft Graph Client Tooling", | ||
| "email": "graphtooling@service.microsoft.com", | ||
| "role": "Developer" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": "^8.0 || ^7.3", | ||
| "guzzlehttp/guzzle": "^7.0", | ||
| "php-http/httplug": "^2.2.0", | ||
| "php-http/guzzle7-adapter": "^1.0.0", | ||
| "ext-json": "*" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^8.0 || ^9.0", | ||
| "mikey179/vfsstream": "^1.2", | ||
| "vimeo/psalm": "^4.8", | ||
| "microsoft/microsoft-graph": "^1.34" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Microsoft\\Graph\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "Microsoft\\Graph\\Test\\": "tests/Functional/", | ||
| "Microsoft\\Graph\\Http\\Test\\": "tests/Http/" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,4 +101,4 @@ public function value() | |
| { | ||
| return $this->_value; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (c) Microsoft Corporation. All Rights Reserved. | ||
| * Licensed under the MIT License. See License in the project root | ||
| * for license information. | ||
| */ | ||
|
|
||
| namespace Microsoft\Graph\Core; | ||
|
|
||
| /** | ||
| * Class NationalCloud | ||
| * | ||
| * Defines Graph hosts for the various national clouds | ||
| * | ||
| * @package Microsoft\Graph\Core | ||
| * @copyright 2021 Microsoft Corporation | ||
| * @license https://opensource.org/licenses/MIT MIT License | ||
| * @link https://developer.microsoft.com/graph | ||
| */ | ||
| final class NationalCloud | ||
| { | ||
| const GLOBAL = "https://graph.microsoft.com"; | ||
| const US_GOV = "https://graph.microsoft.us"; | ||
| const US_DOD = "https://dod-graph.microsoft.us"; | ||
| const GERMANY = "https://graph.microsoft.de"; | ||
| const CHINA = "https://microsoftgraph.chinacloudapi.cn"; | ||
|
|
||
| /** | ||
| * Stores all enum values as list | ||
| * Prevents having to do reflection for each call to getValues() | ||
| * | ||
| * @var array | ||
| */ | ||
| private static $values = []; | ||
|
|
||
| /** | ||
| * Returns a list of the constant values | ||
| * | ||
| * @return array | ||
| */ | ||
| public static function getValues(): array { | ||
nikithauc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (!self::$values) { | ||
| $reflectedClass = new \ReflectionClass(__CLASS__); | ||
| self::$values = array_values($reflectedClass->getConstants()); | ||
| } | ||
| return self::$values; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (c) Microsoft Corporation. All Rights Reserved. | ||
| * Licensed under the MIT License. See License in the project root | ||
| * for license information. | ||
| */ | ||
|
|
||
| namespace Microsoft\Graph\Exception; | ||
|
|
||
| /** | ||
| * Class ClientInitialisationException | ||
| * | ||
| * @package Microsoft\Graph\Exception | ||
| * @copyright 2021 Microsoft Corporation | ||
| * @license https://opensource.org/licenses/MIT MIT License | ||
| * @link https://developer.microsoft.com/graph | ||
| */ | ||
| class ClientInitialisationException extends GraphException | ||
| { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this empty? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It extends all functionality of the GraphException with nothing custom to add. Thanks for pointing out a bug though, I need to change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of GraphException class? For the JS SDK, @MIchaelMainer had suggested creating a GraphCientError class which handles the errors such as ClientInitialisationException and a GraphError class which handles errors from the API. I would suggest using something similar because:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for catching this! We still need to better define our error classification. At a high-level, we have two primary exceptions: ServiceException that represents errors returned in an API response and ClientException for issues raised in the client. Both of these can extend GraphException. I just created a quick PR to help us be more consistent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated ClientInitialisationException to GraphClientException There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Ndiritu Graph Exception that is the parent class is it the service exception class? If GraphException is the service error response class then I recommend you to keep them separate as mentioned by @MIchaelMainer in the PR microsoftgraph/msgraph-sdk-design#47 I suppose you can address this in a separate PR focusing on the error classes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikithauc Yes, i'll need to make these changes in a separate PR. |
||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.