Class PendingInstallmentsServiceClient
Concrete class that implement HTTP calls on Pending Installments Microservice.
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StoneCo.IC.Service.Visa.Host.Client
Assembly: cs.temp.dll.dll
Syntax
public class PendingInstallmentsServiceClient : InterchangeServiceVisaServiceClientBase, IPendingInstallmentsServiceClient
Constructors
PendingInstallmentsServiceClient(IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions>, IHttpRestServiceClient)
Default constructor to set options and HttpRestServiceClient.
Declaration
public PendingInstallmentsServiceClient(IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions> options, IHttpRestServiceClient httpRestServiceClient)
Parameters
Type | Name | Description |
---|---|---|
IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions> | options | The options design pattern used in InterchangeServiceVisaServiceClient. |
IHttpRestServiceClient | httpRestServiceClient | Interface with the default methods and properties to be used for all HTTP Rest calls. |
Examples
Create a options configuration on class with name AppSettingsOptionsConfigurations on folder Configurations.
public static class AppSettingsOptionsConfigurations
{
private static string AppSettingsInterchangeServiceVisaServiceClient => "Clients:InterchangeServiceVisaServiceClient";
public static void ConfigureAppSettingsOptions(this IServiceCollection services, IConfiguration configuration)
{
services.AddOptions();
services.Configure<InterchangeServiceVisaServiceClientOptions>(options =>
configuration.GetSection(AppSettingsInterchangeServiceVisaServiceClient).Bind(options));
}
}
Representation on appsettings.json file.
{
"Clients": {
"InterchangeServiceVisaServiceClient": {
"Name": "InterchangeServiceVisaServiceClient",
"AuthorizationToken": "50953e76f47d4be8b0c0072b1b876ab7",
"BaseAddress": "https://domain-of-api.com/"
}
}
}
Dependency injection on application.
public class DIFactory
{
public static void ConfigureDI(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<IPendingInstallmentsServiceClient, PendingInstallmentsServiceClient>(configuration.GetValue<string>("Clients:InterchangeServiceVisaServiceClient:Name"), configuration.GetValue<string>("Clients:InterchangeServiceVisaServiceClient:BaseAddress"));
}
}
Finally, follow the example of how to use the client.
public class Bar
{
private IPendingInstallmentsServiceClient PendingInstallmentsServiceClient { get; }
public Bar(IPendingInstallmentsServiceClient pendingInstallmentsServiceClient) => PendingInstallmentsServiceClient = pendingInstallmentsServiceClient;
public async Task GetPendingVisaInstallmentsAsync(...)
{
var request = new PendingVisaInstallmentsRequestMessage();
//(...)
ResultResponseMessage<PendingVisaInstallmentsResponseMessage> result = await PendingInstallmentsServiceClient.GetPendingVisaInstallmentsAsync(request);
//(...)
}
}
Methods
GetPendingVisaInstallmentsAsync(PendingVisaInstallmentsRequestMessage)
Asynchronous call to get pending installments data.
Declaration
public Task<ResultResponseMessage<PendingVisaInstallmentsResponseMessage>> GetPendingVisaInstallmentsAsync(PendingVisaInstallmentsRequestMessage request)
Parameters
Type | Name | Description |
---|---|---|
PendingVisaInstallmentsRequestMessage | request | Request whit values to get pending installments data. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ResultResponseMessage<PendingVisaInstallmentsResponseMessage>> | Result of operations. |