Add Exceptionhandler, AlertService JSON-Converter AppSettings via DI Reformat Code
24 lines
983 B
C#
24 lines
983 B
C#
using Jugenddienst_Stunden.Interfaces;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Jugenddienst_Stunden.Infrastructure;
|
|
|
|
internal sealed class NullApiClient : IApiClient {
|
|
private readonly string _message;
|
|
public NullApiClient(string message) => _message = message ?? "API nicht konfiguriert.";
|
|
|
|
public Task<T> GetAsync<T>(string path, IDictionary<string, string?>? query = null, CancellationToken ct = default)
|
|
=> Task.FromException<T>(new InvalidOperationException(_message));
|
|
|
|
public Task<T> SendAsync<T>(HttpMethod method, string path, object? body = null,
|
|
IDictionary<string, string?>? query = null, CancellationToken ct = default)
|
|
=> Task.FromException<T>(new InvalidOperationException(_message));
|
|
|
|
public Task DeleteAsync(string path, IDictionary<string, string?>? query = null, CancellationToken ct = default)
|
|
=> Task.FromException(new InvalidOperationException(_message));
|
|
}
|