Fixed OffSet paramets for GetUserDialogsAsync & GetHistoryAsync

This commit is contained in:
Marc R Kellerman 2019-01-03 11:44:34 -08:00
parent 47e973823a
commit a2e7b0cf33

View file

@ -258,11 +258,19 @@ namespace TLSharp.Core
return await SendRequestAsync<Boolean>(req);
}
public async Task<TLAbsDialogs> GetUserDialogsAsync()
public async Task<TLAbsDialogs> GetUserDialogsAsync(int offset_date = 0, int offset_id = 0, TLAbsInputPeer offset_peer = null, int limit = 100)
{
var peer = new TLInputPeerSelf();
return await SendRequestAsync<TLAbsDialogs>(
new TLRequestGetDialogs() { OffsetDate = 0, OffsetPeer = peer, Limit = 100 });
if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!");
var req = new TLRequestGetDialogs()
{
OffsetDate = offset_date,
OffsetId = offset_id,
OffsetPeer = offset_peer,
Limit = limit
};
return await SendRequestAsync<TLAbsDialogs>(req);
}
public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption)
@ -313,7 +321,10 @@ namespace TLSharp.Core
await _sender.SendPingAsync();
}
public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit)
/// <summary>
/// messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:date add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages
/// </summary>
public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset_id = 0, int offset_date = 0, int add_offset = 0, int limit = 100, int max_id = 0, int min_id = 0)
{
if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!");
@ -321,9 +332,12 @@ namespace TLSharp.Core
var req = new TLRequestGetHistory()
{
Peer = peer,
AddOffset = offset,
OffsetId = offset_id,
OffsetDate = offset_date,
AddOffset = add_offset,
Limit = limit,
MaxId = max_id,
Limit = limit
MinId = min_id
};
return await SendRequestAsync<TLAbsMessages>(req);
}