chore: re-adding 'Paymo' prefix in front of all classes
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Novaloop.PaymoApi.Extensions
|
||||
{
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new ApiException((int) response.StatusCode, await response.Content.ReadAsStringAsync());
|
||||
throw new PaymoApiException((int) response.StatusCode, await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,27 +13,27 @@ namespace Novaloop.PaymoApi.Extensions
|
||||
{
|
||||
public static class PaymoApiExtensions
|
||||
{
|
||||
public static IServiceCollection AddPaymoApi(this IServiceCollection services, Action<ApiOptions> options)
|
||||
public static IServiceCollection AddPaymoApi(this IServiceCollection services, Action<PaymoApiOptions> options)
|
||||
{
|
||||
services.Configure(options);
|
||||
var resolvedOptions = (IOptions<ApiOptions>) services.BuildServiceProvider().GetService(typeof(IOptions<ApiOptions>));
|
||||
services.AddHttpClient<ApiClient>(client => { client.BaseAddress = new Uri(resolvedOptions.Value.BaseUrl); })
|
||||
.AddHttpMessageHandler(s => s.GetService<LoggingHandler>());
|
||||
var resolvedOptions = (IOptions<PaymoApiOptions>) services.BuildServiceProvider().GetService(typeof(IOptions<PaymoApiOptions>));
|
||||
services.AddHttpClient<PaymoPaymoIApiClient>(client => { client.BaseAddress = new Uri(resolvedOptions.Value.BaseUrl); })
|
||||
.AddHttpMessageHandler(s => s.GetService<PaymoLoggingHandler>());
|
||||
|
||||
// ClientContacts
|
||||
services.AddTransient<IBaseApi<ClientContactsResponse, ClientContact>, BaseApi<ClientContactsResponse, ClientContact>>();
|
||||
services.AddTransient<IClientsApi, ClientsApi>();
|
||||
services.AddTransient<IPaymoBaseApi<PaymoClientContactsResponse, PaymoClientContact>, PaymoBaseApi<PaymoClientContactsResponse, PaymoClientContact>>();
|
||||
services.AddTransient<IPaymoClientsApi, PaymoPaymoClientsApi>();
|
||||
|
||||
// Tasks
|
||||
services.AddTransient<IBaseApi<TasksResponse, Task>, BaseApi<TasksResponse, Task>>();
|
||||
services.AddTransient<ITasksApi, TasksApi>();
|
||||
services.AddTransient<IPaymoBaseApi<PaymoTasksResponse, PaymoTask>, PaymoBaseApi<PaymoTasksResponse, PaymoTask>>();
|
||||
services.AddTransient<IPaymoTasksApi, PaymoTasksApi>();
|
||||
|
||||
// Contacts
|
||||
services.AddTransient<IBaseApi<ClientsResponse, Client>, BaseApi<ClientsResponse, Client>>();
|
||||
services.AddTransient<IClientContactsApi, ClientContactsApi>();
|
||||
services.AddTransient<IPaymoBaseApi<PaymoClientsResponse, PaymoClient>, PaymoBaseApi<PaymoClientsResponse, PaymoClient>>();
|
||||
services.AddTransient<IPaymoClientContactsApi, PaymoClientContactsApi>();
|
||||
|
||||
// Shared
|
||||
services.AddTransient<LoggingHandler>();
|
||||
services.AddTransient<PaymoLoggingHandler>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Novaloop.PaymoApi.Extensions
|
||||
{
|
||||
public class ApiOptions
|
||||
public class PaymoApiOptions
|
||||
{
|
||||
public string BaseUrl { get; set; } = "https://app.paymoapp.com/";
|
||||
public string ApiToken { get; set; }
|
||||
Reference in New Issue
Block a user