-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add client configuration for azure API
- Loading branch information
1 parent
9a64a7e
commit 049f0e6
Showing
7 changed files
with
1,375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
autorest --input-file=http://localhost:5009/swagger/v1/swagger.json --csharp --output-folder=src/Streetcred.Cloud.Client --namespace=Streetcred.Cloud.Client --add-credentials --override-client-name=CloudServiceClient | ||
|
||
autorest --input-file=http://localhost:5000/swagger/v1/swagger.json --csharp --output-folder=src/Streetcred.Portal.Client --namespace=Streetcred.Portal.Client --add-credentials --override-client-name=PortalServiceClient | ||
|
||
autorest --input-file=swagger.json --csharp --output-folder=csharp/Generated --namespace=Streetcred.ServiceClients --add-credentials --override-client-name=AgencyServiceClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
public class ServiceClientOptions | ||
{ | ||
public string AccessToken { get; set; } | ||
public string SubscriptionKey { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using Microsoft.Rest; | ||
using Streetcred.ServiceClients; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
public static class ServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddStreetcredClient(this IServiceCollection services, Action<ServiceClientOptions> configure) | ||
{ | ||
services.Configure(configure); | ||
services.AddSingleton<StreetcredClientCredentials>(); | ||
services.AddSingleton<IAgencyServiceClient, AgencyServiceClient>(provider => | ||
new AgencyServiceClient(provider.GetRequiredService<StreetcredClientCredentials>())); | ||
return services; | ||
} | ||
|
||
public static IServiceCollection AddStreetcredClient(this IServiceCollection services) | ||
{ | ||
return AddStreetcredClient(services, options => { }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Version>1.0.0</Version> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.20" /> | ||
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.