Skip to content

Commit

Permalink
Updated .editorconfig and updated all .cs files to use file-scoped na…
Browse files Browse the repository at this point in the history
…mespace declarations
  • Loading branch information
abjerner committed Jan 27, 2024
1 parent 397f6bd commit 0e08e6f
Show file tree
Hide file tree
Showing 50 changed files with 8,556 additions and 8,634 deletions.
27 changes: 23 additions & 4 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Version 1.0.6

# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

Expand All @@ -10,6 +12,7 @@ root = true
indent_size = 4
indent_style = space
tab_width = 4
trim_trailing_whitespace = true

# New line preferences
end_of_line = crlf
Expand All @@ -19,7 +22,7 @@ insert_final_newline = false

# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
dotnet_sort_system_directives_first = true

# this. and Me. preferences
dotnet_style_qualification_for_event = false:silent
Expand All @@ -28,8 +31,8 @@ dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
Expand Down Expand Up @@ -194,4 +197,20 @@ dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# Define what we will treat as private fields
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

# Define rule that something must begin with an underscore and be in camel case
dotnet_naming_style.require_underscore_prefix_and_camel_case.required_prefix = _
dotnet_naming_style.require_underscore_prefix_and_camel_case.capitalization = camel_case

# Apply our rule to private fields
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.style = require_underscore_prefix_and_camel_case
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.severity = warning

# Prefer file-scoped namespace declarations
csharp_style_namespace_declarations = file_scoped:warning
98 changes: 48 additions & 50 deletions src/Skybrud.Essentials.Http/Client/HttpClient.Delete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,58 @@
using Skybrud.Essentials.Http.Collections;
using Skybrud.Essentials.Http.Options;

namespace Skybrud.Essentials.Http.Client {

public partial class HttpClient {

/// <summary>
/// Makes a HTTP DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Delete(url));
}

/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
[Obsolete("Use 'GetResponse' method and 'IHttpRequestOptions' class as parameter instead.")]
public virtual IHttpResponse Delete(string url, IHttpGetOptions options) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
if (options == null) throw new ArgumentNullException(nameof(options));
return GetResponse(HttpRequest.Delete(url, options.GetQueryString()));
}

/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url, IHttpQueryString queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Delete(url, queryString));
}
namespace Skybrud.Essentials.Http.Client;

public partial class HttpClient {

/// <summary>
/// Makes a HTTP DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Delete(url));
}

#if NAME_VALUE_COLLECTION
/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
[Obsolete("Use 'GetResponse' method and 'IHttpRequestOptions' class as parameter instead.")]
public virtual IHttpResponse Delete(string url, IHttpGetOptions options) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
if (options == null) throw new ArgumentNullException(nameof(options));
return GetResponse(HttpRequest.Delete(url, options.GetQueryString()));
}

/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url, NameValueCollection? queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
IHttpQueryString? query = queryString == null ? null : new HttpQueryString(queryString);
return GetResponse(HttpRequest.Delete(url, query));
}
/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url, IHttpQueryString queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Delete(url, queryString));
}

#endif
#if NAME_VALUE_COLLECTION

/// <summary>
/// Makes a DELETE request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Delete(string url, NameValueCollection? queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
IHttpQueryString? query = queryString == null ? null : new HttpQueryString(queryString);
return GetResponse(HttpRequest.Delete(url, query));
}

#endif

}
98 changes: 48 additions & 50 deletions src/Skybrud.Essentials.Http/Client/HttpClient.Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,58 @@
using Skybrud.Essentials.Http.Collections;
using Skybrud.Essentials.Http.Options;

namespace Skybrud.Essentials.Http.Client {

public partial class HttpClient {

/// <summary>
/// Makes a HTTP GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Get(url));
}

/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
[Obsolete("Use 'GetResponse' method and 'IHttpRequestOptions' class as parameter instead.")]
public virtual IHttpResponse Get(string url, IHttpGetOptions options) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
if (options == null) throw new ArgumentNullException(nameof(options));
return GetResponse(HttpRequest.Get(url, options.GetQueryString()));
}

/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url, IHttpQueryString queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Get(url, queryString));
}
namespace Skybrud.Essentials.Http.Client;

public partial class HttpClient {

/// <summary>
/// Makes a HTTP GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Get(url));
}

#if NAME_VALUE_COLLECTION
/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
[Obsolete("Use 'GetResponse' method and 'IHttpRequestOptions' class as parameter instead.")]
public virtual IHttpResponse Get(string url, IHttpGetOptions options) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
if (options == null) throw new ArgumentNullException(nameof(options));
return GetResponse(HttpRequest.Get(url, options.GetQueryString()));
}

/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url, NameValueCollection? queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
IHttpQueryString? query = queryString == null ? null : new HttpQueryString(queryString);
return GetResponse(HttpRequest.Get(url, query));
}
/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url, IHttpQueryString queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
return GetResponse(HttpRequest.Get(url, queryString));
}

#endif
#if NAME_VALUE_COLLECTION

/// <summary>
/// Makes a GET request to the specified <paramref name="url"/>.
/// </summary>
/// <param name="url">The URL of the request.</param>
/// <param name="queryString">The query string of the request.</param>
/// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
public virtual IHttpResponse Get(string url, NameValueCollection? queryString) {
if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));
IHttpQueryString? query = queryString == null ? null : new HttpQueryString(queryString);
return GetResponse(HttpRequest.Get(url, query));
}

#endif

}
Loading

0 comments on commit 0e08e6f

Please sign in to comment.