Skip to content

Commit

Permalink
Merge pull request #6457 from microsoft/feat/bundles
Browse files Browse the repository at this point in the history
feat: upgrades samples to bundle
  • Loading branch information
baywet authored Sep 16, 2024
2 parents 2976247 + 93ce6b2 commit b96798a
Show file tree
Hide file tree
Showing 25 changed files with 118 additions and 150 deletions.
9 changes: 2 additions & 7 deletions get-started/azure-auth/cli/src/GetUserClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Cli.Commons" Version="1.1.2" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.12.4" />
</ItemGroup>

</Project>
</Project>
8 changes: 4 additions & 4 deletions get-started/azure-auth/cli/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using GetUserClient.ApiClient;
using Microsoft.Kiota.Authentication.Azure;
using Microsoft.Kiota.Cli.Commons.Extensions;
using Microsoft.Kiota.Http.HttpClientLibrary;
using Microsoft.Kiota.Bundle;

var rootCommand = new GetUserApiClient().BuildRootCommand();
rootCommand.Description = "CLI description";
Expand All @@ -20,8 +20,8 @@
{
// The auth provider will only authorize requests to
// the allowed hosts, in this case Microsoft Graph
var allowedHosts = new [] { "graph.microsoft.com" };
var graphScopes = new [] { "User.Read" };
var allowedHosts = new[] { "graph.microsoft.com" };
var graphScopes = new[] { "User.Read" };
var options = new DeviceCodeCredentialOptions
{
ClientId = "YOUR_CLIENT_ID",
Expand All @@ -34,7 +34,7 @@
var credential = new DeviceCodeCredential(options);
var authProvider = new AzureIdentityAuthenticationProvider(credential, allowedHosts, scopes: graphScopes);
var adapter = new HttpClientRequestAdapter(authProvider);
var adapter = new DefaultRequestAdapter(authProvider);
adapter.BaseUrl = "https://graph.microsoft.com/v1.0";
return adapter;
}).RegisterCommonServices();
Expand Down
10 changes: 3 additions & 7 deletions get-started/azure-auth/dotnet/src/GetUserClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.12.4" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers"
Version="0.4.421302">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions get-started/azure-auth/dotnet/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
using Azure.Identity;
using GetUserClient.ApiClient;
using Microsoft.Kiota.Authentication.Azure;
using Microsoft.Kiota.Http.HttpClientLibrary;
using Microsoft.Kiota.Bundle;

// The auth provider will only authorize requests to
// the allowed hosts, in this case Microsoft Graph
var allowedHosts = new [] { "graph.microsoft.com" };
var graphScopes = new [] { "User.Read" };
var allowedHosts = new[] { "graph.microsoft.com" };
var graphScopes = new[] { "User.Read" };

var options = new DeviceCodeCredentialOptions
{
Expand All @@ -25,7 +25,7 @@
var credential = new DeviceCodeCredential(options);

var authProvider = new AzureIdentityAuthenticationProvider(credential, allowedHosts, scopes: graphScopes);
var requestAdapter = new HttpClientRequestAdapter(authProvider);
var requestAdapter = new DefaultRequestAdapter(authProvider);
var client = new GetUserApiClient(requestAdapter);

var me = await client.Me.GetAsync();
Expand Down
4 changes: 2 additions & 2 deletions get-started/azure-auth/go/getuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
azure "github.com/microsoft/kiota-authentication-azure-go"
http "github.com/microsoft/kiota-http-go"
bundle "github.com/microsoft/kiota-bundle-go"
)

func main() {
Expand Down Expand Up @@ -42,7 +42,7 @@ func main() {
fmt.Printf("Error creating auth provider: %v\n", err)
}

adapter, err := http.NewNetHttpRequestAdapter(authProvider)
adapter, err := bundle.NewDefaultRequestAdapter(authProvider)

if err != nil {
fmt.Printf("Error creating request adapter: %v\n", err)
Expand Down
3 changes: 2 additions & 1 deletion get-started/azure-auth/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/microsoft/kiota-abstractions-go v1.7.0
github.com/microsoft/kiota-authentication-azure-go v1.1.0
github.com/microsoft/kiota-http-go v1.4.5
github.com/microsoft/kiota-bundle-go v1.0.0
github.com/microsoft/kiota-serialization-form-go v1.0.0
github.com/microsoft/kiota-serialization-json-go v1.0.8
github.com/microsoft/kiota-serialization-multipart-go v1.0.0
Expand All @@ -24,6 +24,7 @@ require (
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/microsoft/kiota-http-go v1.4.5 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/std-uritemplate/std-uritemplate/go v0.0.57 // indirect
Expand Down
2 changes: 2 additions & 0 deletions get-started/azure-auth/go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ github.com/microsoft/kiota-abstractions-go v1.7.0 h1:/0OKSSEe94Z1qgpcGE7ZFI9P+4i
github.com/microsoft/kiota-abstractions-go v1.7.0/go.mod h1:FI1I2OHg0E7bK5t8DPnw+9C/CHVyLP6XeqDBT+95pTE=
github.com/microsoft/kiota-authentication-azure-go v1.1.0 h1:HudH57Enel9zFQ4TEaJw6lMiyZ5RbBdrRHwdU0NP2RY=
github.com/microsoft/kiota-authentication-azure-go v1.1.0/go.mod h1:zfPFOiLdEqM77Hua5B/2vpcXrVaGqSWjHSRzlvAWEgc=
github.com/microsoft/kiota-bundle-go v1.0.0 h1:jPfaGP6aBcaHfi09/NJtgXxqi/hqeWFBm4HCPhAr64s=
github.com/microsoft/kiota-bundle-go v1.0.0/go.mod h1:2aquyp0HHKGaIg6Nf8K1mCjgFFNWn+xXZvSk9A8Gi6c=
github.com/microsoft/kiota-http-go v1.4.5 h1:BrI9TZ0cWiU1ucP5oSWR6UmP2vR3PaKbQ61TQ/qM5cM=
github.com/microsoft/kiota-http-go v1.4.5/go.mod h1:Kup5nMDD3a9sjdgRKHCqZWqtrv3FbprjcPaGjLR6FzM=
github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI=
Expand Down
7 changes: 1 addition & 6 deletions get-started/azure-auth/java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ dependencies {

// <DependenciesSnippet>
implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0'
implementation 'com.microsoft.kiota:microsoft-kiota-abstractions:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-bundle:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.4.0'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.4.0'
implementation 'com.azure:azure-identity:1.13.2'
// </DependenciesSnippet>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.azure.identity.DeviceCodeCredential;
import com.azure.identity.DeviceCodeCredentialBuilder;
import com.microsoft.kiota.authentication.AzureIdentityAuthenticationProvider;
import com.microsoft.kiota.http.OkHttpRequestAdapter;
import com.microsoft.kiota.bundle.DefaultRequestAdapter;

import getuserclient.apiclient.GetUserApiClient;
import getuserclient.apiclient.models.User;
Expand All @@ -31,7 +31,7 @@ public static void main(String[] args) {

final AzureIdentityAuthenticationProvider authProvider =
new AzureIdentityAuthenticationProvider(credential, allowedHosts, graphScopes);
final OkHttpRequestAdapter adapter = new OkHttpRequestAdapter(authProvider);
final DefaultRequestAdapter adapter = new DefaultRequestAdapter(authProvider);

final GetUserApiClient client = new GetUserApiClient(adapter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
import com.microsoft.kiota.ApiClientBuilder;
import com.microsoft.kiota.BaseRequestBuilder;
import com.microsoft.kiota.RequestAdapter;
import com.microsoft.kiota.serialization.FormParseNodeFactory;
import com.microsoft.kiota.serialization.FormSerializationWriterFactory;
import com.microsoft.kiota.serialization.JsonParseNodeFactory;
import com.microsoft.kiota.serialization.JsonSerializationWriterFactory;
import com.microsoft.kiota.serialization.MultipartSerializationWriterFactory;
import com.microsoft.kiota.serialization.ParseNodeFactoryRegistry;
import com.microsoft.kiota.serialization.SerializationWriterFactoryRegistry;
import com.microsoft.kiota.serialization.TextParseNodeFactory;
import com.microsoft.kiota.serialization.TextSerializationWriterFactory;
import getuserclient.apiclient.me.MeRequestBuilder;
import java.util.HashMap;
import java.util.Objects;
Expand All @@ -35,13 +26,6 @@ public MeRequestBuilder me() {
public GetUserApiClient(@jakarta.annotation.Nonnull final RequestAdapter requestAdapter) {
super(requestAdapter, "{+baseurl}");
this.pathParameters = new HashMap<>();
ApiClientBuilder.registerDefaultSerializer(() -> new JsonSerializationWriterFactory());
ApiClientBuilder.registerDefaultSerializer(() -> new TextSerializationWriterFactory());
ApiClientBuilder.registerDefaultSerializer(() -> new FormSerializationWriterFactory());
ApiClientBuilder.registerDefaultSerializer(() -> new MultipartSerializationWriterFactory());
ApiClientBuilder.registerDefaultDeserializer(() -> new JsonParseNodeFactory());
ApiClientBuilder.registerDefaultDeserializer(() -> new FormParseNodeFactory());
ApiClientBuilder.registerDefaultDeserializer(() -> new TextParseNodeFactory());
if (requestAdapter.getBaseUrl() == null || requestAdapter.getBaseUrl().isEmpty()) {
requestAdapter.setBaseUrl("https://graph.microsoft.com/v1.0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
"includeAdditionalData": true,
"disableSSLValidation": false,
"serializers": [
"Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory",
"Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory",
"Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory",
"Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory"
"none"
],
"deserializers": [
"Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory",
"Microsoft.Kiota.Serialization.Text.TextParseNodeFactory",
"Microsoft.Kiota.Serialization.Form.FormParseNodeFactory"
"none"
],
"structuredMimeTypes": [
"application/json",
Expand Down
39 changes: 33 additions & 6 deletions get-started/azure-auth/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions get-started/azure-auth/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@
},
"dependencies": {
"@azure/identity": "^4.4.1",
"@microsoft/kiota-abstractions": "^1.0.0-preview.66",
"@microsoft/kiota-authentication-azure": "^1.0.0-preview.61",
"@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.65",
"@microsoft/kiota-serialization-form": "^1.0.0-preview.54",
"@microsoft/kiota-serialization-json": "^1.0.0-preview.66",
"@microsoft/kiota-serialization-multipart": "^1.0.0-preview.44",
"@microsoft/kiota-serialization-text": "^1.0.0-preview.63",
"@microsoft/kiota-bundle": "^1.0.0-preview.9",
"node-fetch": "^3.3.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.12.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions get-started/quickstart/cli/src/KiotaPostsCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Cli.Commons" Version="1.1.2" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.12.4" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions get-started/quickstart/dotnet/src/KiotaPosts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.12.4" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.12.4" />
</ItemGroup>

</Project>
</Project>
3 changes: 2 additions & 1 deletion get-started/quickstart/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/microsoft/kiota-abstractions-go v1.7.0
github.com/microsoft/kiota-http-go v1.4.5
github.com/microsoft/kiota-bundle-go v1.0.0
github.com/microsoft/kiota-serialization-form-go v1.0.0
github.com/microsoft/kiota-serialization-json-go v1.0.8
github.com/microsoft/kiota-serialization-multipart-go v1.0.0
Expand All @@ -17,6 +17,7 @@ require (
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/microsoft/kiota-http-go v1.4.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/std-uritemplate/std-uritemplate/go v0.0.57 // indirect
github.com/stretchr/testify v1.9.0 // indirect
Expand Down
Loading

0 comments on commit b96798a

Please sign in to comment.