diff --git a/DigitalData.Core.Client/HttpExtensions.cs b/DigitalData.Core.Client/HttpExtensions.cs index 2501fa3..79910d3 100644 --- a/DigitalData.Core.Client/HttpExtensions.cs +++ b/DigitalData.Core.Client/HttpExtensions.cs @@ -8,22 +8,6 @@ namespace DigitalData.Core.Client /// public static class HttpExtensions { - /// - /// Fetches data from the specified URL using the given HTTP method. - /// - /// The URL to fetch data from. - /// The HTTP method to use for the request. Defaults to GET. - /// A task representing the HTTP response message. - public static async Task Fetch(this string url, Method method = Method.GET) - { - using HttpClient client = new(); - return method switch - { - Method.GET => await client.GetAsync(url), - _ => throw new NotImplementedException(nameof(method)), - }; - } - /// /// Reads the content of the HTTP response message as a string. /// @@ -61,39 +45,6 @@ namespace DigitalData.Core.Client return JsonConvert.DeserializeObject(json) ?? string.Empty; } - /// - /// Fetches data from the specified URL using the given HTTP method and reads the response content as a string. - /// - /// The URL to fetch data from. - /// The HTTP method to use for the request. Defaults to GET. - /// A task representing the response content as a string. - public static async Task FetchText(this string url, Method method = Method.GET) => await url.Fetch(method: method).ThenAsync(Text); - - /// - /// Fetches data from the specified URL using the given HTTP method and deserializes the response content to a specified type. - /// - /// The type to deserialize the response content to. - /// The URL to fetch data from. - /// The HTTP method to use for the request. Defaults to GET. - /// A task representing the deserialized response content. - public static async Task FetchJson(this string url, Method method = Method.GET) => await url.Fetch(method: method).ThenAsync(Json); - - /// - /// Fetches data from the specified URL using the given HTTP method and deserializes the response content to a dynamic object. - /// - /// The URL to fetch data from. - /// The HTTP method to use for the request. Defaults to GET. - /// A task representing the deserialized response content as a dynamic object. - public static async Task FetchJson(this string url, Method method = Method.GET) => await url.Fetch(method: method).ThenAsync(Json); - - /// - /// Fetches data from the specified URL using the given HTTP method and deserializes the response content to a list of dynamic objects. - /// - /// The URL to fetch data from. - /// The HTTP method to use for the request. Defaults to GET. - /// A task representing the deserialized response content as a list of dynamic objects. - public static async Task> FetchJsonList(this string url, Method method = Method.GET) => await url.Fetch(method: method).ThenAsync(JsonList); - /// /// Executes an action when a task is completed. /// diff --git a/DigitalData.Core.Client/Method.cs b/DigitalData.Core.Client/Method.cs deleted file mode 100644 index a4ab8c4..0000000 --- a/DigitalData.Core.Client/Method.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace DigitalData.Core.Client -{ - public enum Method - { - GET - } -} \ No newline at end of file