Skip to content

Commit

Permalink
* Rename RestClientOptions to RestRequestOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bytecode77 committed Nov 19, 2023
1 parent e17d381 commit 8d80976
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions BytecodeApi.Rest/RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public abstract class RestClient : IDisposable
/// </summary>
public string BaseUrl { get; private init; }
/// <summary>
/// A <see cref="RestClientOptions" /> object with formatting options for this <see cref="RestClient" /> instance.
/// A <see cref="RestRequestOptions" /> object with options for REST requests.
/// </summary>
protected internal RestClientOptions Options { get; set; }
protected internal RestRequestOptions RequestOptions { get; set; }
/// <summary>
/// Gets the <see cref="System.Net.Http.HttpClient" /> that is used to process requests.
/// </summary>
Expand All @@ -28,7 +28,7 @@ protected RestClient(string baseUrl)
Check.ArgumentNull(baseUrl);

BaseUrl = baseUrl.TrimEnd('/');
Options = new();
RequestOptions = new();
HttpClient = new();
}
/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions BytecodeApi.Rest/RestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public RestRequest QueryParameter(string name, object? value)
{
Check.ObjectDisposed<RestClient>(RestClient.Disposed);
Check.ArgumentNull(name);
Check.ArgumentNull(RestClient.Options);
Check.ArgumentNull(RestClient.RequestOptions);

if (value == null)
{
Expand All @@ -56,9 +56,9 @@ public RestRequest QueryParameter(string name, object? value)
{
string str => str,
Enum enumValue => Convert.ToInt32(enumValue).ToString(),
DateTime dateTimeParameter => dateTimeParameter.ToStringInvariant(RestClient.Options.QueryParameterDateTimeFormat),
DateOnly dateOnlyParameter => dateOnlyParameter.ToStringInvariant(RestClient.Options.QueryParameterDateOnlyFormat),
TimeOnly timeOnlyParameter => timeOnlyParameter.ToStringInvariant(RestClient.Options.QueryParameterTimeOnlyFormat),
DateTime dateTimeParameter => dateTimeParameter.ToStringInvariant(RestClient.RequestOptions.QueryParameterDateTimeFormat),
DateOnly dateOnlyParameter => dateOnlyParameter.ToStringInvariant(RestClient.RequestOptions.QueryParameterDateOnlyFormat),
TimeOnly timeOnlyParameter => timeOnlyParameter.ToStringInvariant(RestClient.RequestOptions.QueryParameterTimeOnlyFormat),
_ => value?.ToString() ?? ""
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace BytecodeApi.Rest;

/// <summary>
/// Represents a set of formatting options for a <see cref="RestClient" /> instance.
/// Represents a set of options for REST requests.
/// </summary>
public sealed class RestClientOptions
public sealed class RestRequestOptions
{
/// <summary>
/// Gets or sets a value specifying the format that is used to convert <see cref="DateTime" /> values.
Expand All @@ -22,9 +22,9 @@ public sealed class RestClientOptions
public string QueryParameterTimeOnlyFormat { get; set; }

/// <summary>
/// Initializes a new instance of the <see cref="RestClientOptions" /> class with default formatting options.
/// Initializes a new instance of the <see cref="RestRequestOptions" /> class with default options.
/// </summary>
public RestClientOptions()
public RestRequestOptions()
{
QueryParameterDateTimeFormat = "yyyy-MM-ddTHH:mm:sszzz";
QueryParameterDateOnlyFormat = "yyyy-MM-dd";
Expand Down

0 comments on commit 8d80976

Please sign in to comment.