Skip to content
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

Add Graph API version to base URI #195

Open
Ndiritu opened this issue Oct 2, 2024 · 2 comments
Open

Add Graph API version to base URI #195

Ndiritu opened this issue Oct 2, 2024 · 2 comments
Labels
type:feature New experience request

Comments

@Ndiritu
Copy link
Contributor

Ndiritu commented Oct 2, 2024

Is your feature request related to a problem? Please describe the problem.

Currently, the base URI only contains the national cloud host, meaning each request needs a Graph API version prefix:

$httpClient = GraphClientFactory::createWithConfig($config);
$response = $httpClient->get("/v1.0/me");

Current workaround is to override the base_uri via config:

$httpClient = GraphClientFactory::createWithConfig(['base_uri' => NationalCloud::Global + "/v1.0"]);
$response = $httpClient->get("/me");

This would be a breaking change.

Describe the solution you'd like.

Support setting the Graph API version via the factory & default to v1.0
(With default v1.0)

$httpClient = GraphClientFactory::create();
$response = $httpClient->get("/me");

Or to change to beta

$httpClient = GraphClientFactory::setApiVersion('beta')::create();
$response = $httpClient->get("/me");

Additional context?

No response

@Ndiritu Ndiritu added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request type:breaking-change An issue that will result in dependent client projects failing. and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 2, 2024
@andrueastman
Copy link
Member

This does not necessarily have to be a breaking change.
We could always add an overload that takes in version parameter or add a property to the config object.

https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/9ed307008545e19b516e35e57ff35df061eaf05d/src/Microsoft.Graph.Core/Requests/GraphClientFactory.cs#L57

@Ndiritu Ndiritu removed the type:breaking-change An issue that will result in dependent client projects failing. label Oct 3, 2024
@Ndiritu
Copy link
Contributor Author

Ndiritu commented Oct 3, 2024

Good catch, yes we can add a version parameter that defaults to an empty string.
The config object ideally maps to a Guzzle request options object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New experience request
Projects
None yet
Development

No branches or pull requests

2 participants