Skip to content

Commit e6a811e

Browse files
authored
Merge pull request #16 from Cabazure/avoid-type-conflicts
Move embedded source to Cabazure.Client.Runtime to avoid type conflicts
2 parents c5d4ce7 + b2dada2 commit e6a811e

File tree

67 files changed

+100
-1236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+100
-1236
lines changed

samples/AzureRest/AzureRest.Contracts/AzureRest.Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="System.Text.Json" Version="8.0.4" />
8+
<PackageReference Include="System.Text.Json" Version="8.0.5" />
99
</ItemGroup>
1010

1111
</Project>

src/Cabazure.Client/EmbeddedSource/Authentication/AzureAuthenticationHandler.g.cs renamed to src/Cabazure.Client.Runtime/Authentication/AzureAuthenticationHandler.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System.Net.Http;
4-
using System.Threading;
5-
using System.Threading.Tasks;
6-
7-
namespace Cabazure.Client.Authentication
1+
namespace Cabazure.Client.Authentication
82
{
9-
internal class AzureAuthenticationHandler
3+
public class AzureAuthenticationHandler
104
: DelegatingHandler
115
{
126
private readonly IBearerTokenProvider tokenProvider;
@@ -27,4 +21,3 @@ protected async override Task<HttpResponseMessage> SendAsync(
2721
}
2822
}
2923
}
30-
#nullable disable

src/Cabazure.Client/EmbeddedSource/Authentication/BearerTokenProvider.g.cs renamed to src/Cabazure.Client.Runtime/Authentication/BearerTokenProvider.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System.Net.Http.Headers;
4-
using System.Threading;
5-
using System.Threading.Tasks;
1+
using System.Net.Http.Headers;
62
using Azure.Core;
73

84
namespace Cabazure.Client.Authentication
95
{
10-
internal class BearerTokenProvider : IBearerTokenProvider
6+
public class BearerTokenProvider : IBearerTokenProvider
117
{
128
private readonly TokenRequestContext context;
139
private readonly TokenCredential credential;
@@ -41,4 +37,3 @@ private bool TokenIsExpired()
4137
=> dateTimeProvider.GetDateTime().AddMinutes(1) > accessToken.ExpiresOn;
4238
}
4339
}
44-
#nullable disable
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Cabazure.Client.Authentication
2+
{
3+
public class DateTimeProvider
4+
: IDateTimeProvider
5+
{
6+
public DateTimeOffset GetDateTime()
7+
=> DateTimeOffset.UtcNow;
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Net.Http.Headers;
2+
3+
namespace Cabazure.Client.Authentication
4+
{
5+
public interface IBearerTokenProvider
6+
{
7+
Task<AuthenticationHeaderValue> GetTokenAsync(
8+
CancellationToken cancellationToken);
9+
}
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Cabazure.Client.Authentication
2+
{
3+
public interface IDateTimeProvider
4+
{
5+
DateTimeOffset GetDateTime();
6+
}
7+
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System;
4-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
52

63
namespace Cabazure.Client
74
{
@@ -13,8 +10,7 @@ namespace Cabazure.Client
1310
AttributeTargets.Parameter | AttributeTargets.Property,
1411
Inherited = false,
1512
AllowMultiple = false)]
16-
internal sealed class BodyAttribute : Attribute
13+
public sealed class BodyAttribute : Attribute
1714
{
1815
}
1916
}
20-
#nullable disable

src/Cabazure.Client/EmbeddedSource/Builder/ClientSerializer.g.cs renamed to src/Cabazure.Client.Runtime/Builder/ClientSerializer.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System.Text.Json;
1+
using System.Text.Json;
42
using Microsoft.Extensions.Options;
53

64
namespace Cabazure.Client.Builder
75
{
8-
internal class ClientSerializer : IClientSerializer
6+
public class ClientSerializer : IClientSerializer
97
{
108
private readonly IOptionsMonitor<JsonSerializerOptions> options;
119

@@ -22,4 +20,3 @@ public string Serialize(string clientName, object value)
2220
=> JsonSerializer.Deserialize<T>(json, options.Get(clientName));
2321
}
2422
}
25-
#nullable disable

src/Cabazure.Client/EmbeddedSource/Builder/HttpClientBuilderExtensions.g.cs renamed to src/Cabazure.Client.Runtime/Builder/HttpClientBuilderExtensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System;
4-
using Azure.Core;
1+
using Azure.Core;
52
using Cabazure.Client.Authentication;
63

74
namespace Microsoft.Extensions.DependencyInjection
@@ -38,4 +35,3 @@ public static IHttpClientBuilder AddAuthentication(
3835
}
3936
}
4037
}
41-
#nullable disable

src/Cabazure.Client/EmbeddedSource/Builder/HttpClientExtensions.g.cs renamed to src/Cabazure.Client.Runtime/Builder/HttpClientExtensions.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
// <auto-generated/>
2-
#nullable enable
3-
using System.Net.Http;
4-
5-
namespace Cabazure.Client.Builder
1+
namespace Cabazure.Client.Builder
62
{
7-
internal static class HttpClientExtensions
3+
public static class HttpClientExtensions
84
{
95
public static HttpClient WithRequestOptions(
106
this HttpClient httpClient,
@@ -19,4 +15,3 @@ public static HttpClient WithRequestOptions(
1915
}
2016
}
2117
}
22-
#nullable disable

0 commit comments

Comments
 (0)