mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-04-13 00:22:22 +00:00
wip
This commit is contained in:
parent
9fab8faa45
commit
63d6701a8d
@ -7,6 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public interface INextPageToken
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -26,6 +27,8 @@ namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
LastTime = timestamp;
|
||||
}
|
||||
|
||||
public DateTimeToken GetNextToken(DateTime nextTime) => this with { LastTime = nextTime };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -50,6 +53,8 @@ namespace CryptoExchange.Net.SharedApis
|
||||
Page = page;
|
||||
PageSize = pageSize;
|
||||
}
|
||||
|
||||
public PageToken GetNextToken() => this with { Page = Page + 1 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,6 +74,17 @@ namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
FromToken = fromToken;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public FromIdToken(int fromToken)
|
||||
{
|
||||
FromToken = fromToken.ToString();
|
||||
}
|
||||
|
||||
public FromIdToken GetNextToken(string nextToken) => this with { FromToken = nextToken };
|
||||
public FromIdToken GetNextToken(long nextToken) => this with { FromToken = nextToken.ToString() };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,6 +104,8 @@ namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
Cursor = cursor;
|
||||
}
|
||||
|
||||
public CursorToken GetNextToken(string nextCursor) => this with { Cursor = nextCursor };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -107,5 +125,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
public OffsetToken GetNextToken() => this with { Offset = Offset + Offset };
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for paginated endpoints
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
#if NET5_0_OR_GREATER
|
||||
public class PageEndpointOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : EndpointOptions<T> where T : SharedRequest
|
||||
#else
|
||||
public class PageEndpointOptions<T> : EndpointOptions<T> where T : SharedRequest
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PageEndpointOptions(bool needsAuthentication) : base(needsAuthentication)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString(string exchange)
|
||||
{
|
||||
var sb = new StringBuilder(base.ToString(exchange));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
CryptoExchange.Net/SharedApis/Models/Pagination.cs
Normal file
23
CryptoExchange.Net/SharedApis/Models/Pagination.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis.Models
|
||||
{
|
||||
public interface PageRequest
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public record PageParameters
|
||||
{
|
||||
public string? Cursor { get; set; }
|
||||
public string? FromId { get; set; }
|
||||
public int? Page { get; set; }
|
||||
public int? Offset { get; set; }
|
||||
public DateTime? StartTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
public SharedPaginationSupport? Direction { get; set; }
|
||||
}
|
||||
}
|
||||
@ -10,15 +10,15 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Filter by start time
|
||||
/// </summary>
|
||||
public DateTime StartTime { get; }
|
||||
public DateTime StartTime { get; set; }
|
||||
/// <summary>
|
||||
/// Filter by end time
|
||||
/// </summary>
|
||||
public DateTime EndTime { get; }
|
||||
public DateTime EndTime { get; set; }
|
||||
/// <summary>
|
||||
/// Max number of results
|
||||
/// </summary>
|
||||
public int? Limit { get; }
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user