using System;
using System.Collections.Generic;
using System.Linq;
namespace RestEase
{
///
/// Encapsulates information provided to
///
public class QueryStringBuilderInfo
{
///
/// Gets the initial query string, present from the URI the user specified in the Get/etc parameter
///
public string InitialQueryString { get; }
///
/// Gets the raw query parameter, if any
///
public IEnumerable RawQueryParameters { get; }
///
/// Obsolete. Use
///
[Obsolete("Use RawQueryParameters")]
public string RawQueryParameter => this.RawQueryParameters.FirstOrDefault() ?? string.Empty;
///
/// Gets the query parameters (or an empty collection)
///
public IEnumerable> QueryParams { get; }
///
/// Gets the query properties (or an empty collection)
///
public IEnumerable> QueryProperties { get; }
///
/// Gets the RequestInfo representing the request
///
public IRequestInfo RequestInfo { get; }
///
/// Gets the format provider, if any
///
public IFormatProvider? FormatProvider { get; }
///
/// Initialises a new instance of the class
///
/// Initial query string, present from the URI the user specified in the Get/etc parameter
/// The raw query parameters, if any
/// The query parameters (or an empty collection)
/// The query propeorties (or an empty collection)
/// RequestInfo representing the request
/// Format provider to use to format things
public QueryStringBuilderInfo(
string initialQueryString,
IEnumerable rawQueryParameters,
IEnumerable> queryParams,
IEnumerable> queryProperties,
IRequestInfo requestInfo,
IFormatProvider? formatProvider)
{
this.InitialQueryString = initialQueryString;
this.RawQueryParameters = rawQueryParameters;
this.QueryParams = queryParams;
this.QueryProperties = queryProperties;
this.RequestInfo = requestInfo;
this.FormatProvider = formatProvider;
}
///
/// Obsolete. Use the other constructor.
///
[Obsolete("Use the other constructor")]
public QueryStringBuilderInfo(
string initialQueryString,
string rawQueryParameter,
IEnumerable> queryParams,
IEnumerable> queryProperties,
IRequestInfo requestInfo,
IFormatProvider? formatProvider)
: this(initialQueryString, new[] { rawQueryParameter }, queryParams, queryProperties, requestInfo, formatProvider)
{
}
}
}