Skip to content

Conversation

@Ndiritu
Copy link
Contributor

@Ndiritu Ndiritu commented Jul 8, 2021

This PR:

  • Changes GraphRequest and GraphCollectionRequest constructors to accept the Graph client as an encapsulation of api version, sdk version, access token and custom hosts/middleware etc in future
  • Removes Guzzle-specific config and supports PSR-18 clients and PHP-HTTP async clients
  • Passes a configured PSR-7 HTTP request object to the client
  • Makes Graph client an Abstract class to allow service library clients to provide API version and SDK versions.

Closes https://github.com/microsoftgraph/msgraph-sdk-php/issues/438
Closes microsoftgraph/msgraph-sdk-php#531

if (stripos($this->endpoint, "http") === 0) {
return $this->endpoint;
$coreSdkVersion = "graph-php-core/".GraphConstants::SDK_VERSION;
$serviceLibSdkVersion = "Graph-php-".$this->graphClient->getSdkVersion();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change the service library SDK version header to match https://github.com/microsoftgraph/msgraph-sdk-design/blob/master/middleware/TelemetryHandler.md#requirements?

Might need some changes to our PowerBI usage charts

* of class $returnType
*/
public function execute($client = null)
public function execute(?ClientInterface $client = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MIchaelMainer please clarify whether we should always return a GraphResponse object or return the serialised response body payload if a $returnType is not set?

* @return string
* @param ClientInterface|null $client (optional) When null, uses $graphClient's http client
* @return array|GraphResponse|StreamInterface|object Graph Response object or response body cast to $returnType
* @throws ClientExceptionInterface
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made no sense to me to throw a GraphClientException here since we were only wrapping an existing standard exception interface and providing no further info.

@Ndiritu Ndiritu merged commit 7606355 into philip/feat/http-client-factory Aug 18, 2021
@Ndiritu Ndiritu deleted the philip/feat/graph-request-changes branch October 28, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants