Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 3b36d2c

Browse files
Fix query parameters (#58)
* Fix query parameters * Update pipeline * Set graph target version * Update src/Program.cs Co-authored-by: Eastman <[email protected]> Co-authored-by: Eastman <[email protected]>
1 parent e7471b9 commit 3b36d2c

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

.github/workflows/build-cli.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
env:
7-
NUGET_URL: https://nuget.pkg.github.com/microsoft/index.json
7+
MS_NUGET_URL: https://nuget.pkg.github.com/microsoft/index.json
8+
MSGRAPH_NUGET_URL: https://nuget.pkg.github.com/microsoftgraph/index.json
89
steps:
910
- name: Checkout
1011
uses: actions/checkout@v3
@@ -17,7 +18,8 @@ jobs:
1718
- name: Add NuGet kiota source
1819
# NOTE: Password encryption is not supported for the linux platform (Encryption is only supported on Windows platforms.)
1920
run: |
20-
dotnet nuget add source ${{env.NUGET_URL}} -n github -u ${{secrets.NUGET_USER}} -p ${{secrets.NUGET_PASSWORD}} --store-password-in-clear-text
21+
dotnet nuget add source ${{env.MS_NUGET_URL}} -n ms-gh -u ${{secrets.NUGET_USER}} -p ${{secrets.NUGET_PASSWORD}} --store-password-in-clear-text
22+
dotnet nuget add source ${{env.MSGRAPH_NUGET_URL}} -n msgraph-gh -u ${{secrets.NUGET_USER}} -p ${{secrets.NUGET_PASSWORD}} --store-password-in-clear-text
2123
- uses: actions/cache@v2
2224
with:
2325
path: ~/.nuget/packages

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Fixed stream output being passed to output formatter when no file path is provided #38
1919
- Format JSON output by default. The formatting can be disabled per command through the CLI argument `--json-no-indent` #55
2020
- Use async OutputFormatter & OutputFilter APIs #55
21+
- Fix failing requests when adding options like `--select`, `--expand`, `--top` etc

src/Program.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,14 @@ static async Task<int> Main(string[] args)
4848

4949
var credential = await authServiceFactory.GetTokenCredentialAsync(authStrategy, authSettings?.TenantId, authSettings?.ClientId);
5050
var authProvider = new AzureIdentityAuthenticationProvider(credential, new string[] {"graph.microsoft.com"});
51-
var defaultHandlers = KiotaClientFactory.CreateDefaultHandlers();
5251

5352
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
54-
var sdkVersionHeaderValue = string.Format(
55-
SdkVersionHeaderValueFormatString,
56-
"graph",
57-
assemblyVersion.Major,
58-
assemblyVersion.Minor,
59-
assemblyVersion.Build);
60-
61-
var telemetryHandlerOption = new TelemetryHandlerOption {
62-
TelemetryConfigurator = (request) => {
63-
request.Headers.Add("SdkVersion", sdkVersionHeaderValue);
64-
return request;
65-
}
53+
var options = new GraphClientOptions {
54+
GraphProductPrefix = "graph-cli",
55+
GraphServiceLibraryClientVersion = $"{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Build}",
56+
GraphServiceTargetVersion = "1.0"
6657
};
67-
var telemetryHandler = new TelemetryHandler(telemetryHandlerOption);
68-
defaultHandlers.Add(telemetryHandler);
69-
var finalHandler = KiotaClientFactory.ChainHandlersCollectionAndGetFirstLink(KiotaClientFactory.GetDefaultHttpMessageHandler(), defaultHandlers.ToArray());
70-
71-
using var httpClient = KiotaClientFactory.Create(finalHandler);
58+
using var httpClient = GraphCliClientFactory.GetDefaultClient(options);
7259
var core = new HttpClientRequestAdapter(authProvider, httpClient: httpClient);
7360
var client = new GraphClient(core);
7461

0 commit comments

Comments
 (0)