Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update to .NET6 and C#10 #589

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
132 changes: 66 additions & 66 deletions src/Twilio/Base/IOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,74 @@
using System.Collections.Generic;

namespace Twilio.Base
{
{
/// <summary>
/// Interface to wrap parameters of a resource
/// </summary>
/// <typeparam name="T">Resource type</typeparam>
public interface IOptions<T> where T : Resource
{
/// <summary>
/// Interface to wrap parameters of a resource
/// Generate the list of parameters for the request
/// </summary>
/// <typeparam name="T">Resource type</typeparam>
public interface IOptions<T> where T : Resource
{
/// <summary>
/// Generate the list of parameters for the request
/// </summary>
///
/// <returns>List of parameters for the request</returns>
List<KeyValuePair<string, string>> GetParams();
}

///
/// <returns>List of parameters for the request</returns>
List<KeyValuePair<string, string>> GetParams();
}

/// <summary>
/// Parameters that are passed when reading resources
/// </summary>
/// <typeparam name="T">Resource type</typeparam>
public abstract class ReadOptions<T> : IOptions<T> where T : Resource
{
private int? _pageSize;

/// <summary>
/// Parameters that are passed when reading resources
/// Page size to read
/// </summary>
/// <typeparam name="T">Resource type</typeparam>
public abstract class ReadOptions<T> : IOptions<T> where T : Resource
{
private int? _pageSize;

/// <summary>
/// Page size to read
/// </summary>
public int? PageSize
{
get { return _pageSize; }
set
{
if (value == null)
{
return;
}

_pageSize = value.Value;
}
}

private long? _limit;

/// <summary>
/// Maximum number of records to read
/// </summary>
public long? Limit
{
get { return _limit; }
set
{
if (value == null)
{
return;
}

_limit = value;
if (_pageSize == null)
{
_pageSize = (int) value.Value;
}
}
}

/// <summary>
/// Generate the list of parameters for the request
/// </summary>
///
/// <returns>List of parameters for the request</returns>
public abstract List<KeyValuePair<string, string>> GetParams();
}
public int? PageSize
{
get { return _pageSize; }
set
{
if (value == null)
{
return;
}

_pageSize = value.Value;
}
}

private long? _limit;

/// <summary>
/// Maximum number of records to read
/// </summary>
public long? Limit
{
get { return _limit; }
set
{
if (value == null)
{
return;
}

_limit = value;
if (_pageSize == null)
{
_pageSize = (int)value.Value;
}
}
}

/// <summary>
/// Generate the list of parameters for the request
/// </summary>
///
/// <returns>List of parameters for the request</returns>
public abstract List<KeyValuePair<string, string>> GetParams();
}
}
Loading