Revert "+ overload for method InviteToChannel"

This reverts commit 45be5f51d3.
This commit is contained in:
solarin 2020-04-06 10:45:40 +04:00
parent 45be5f51d3
commit 9623f9d5ac
3 changed files with 52 additions and 62 deletions

View file

@ -73,7 +73,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Network\Requests\AckRequest.cs" /> <Compile Include="Network\Requests\AckRequest.cs" />
<Compile Include="Network\Requests\PingRequest.cs" /> <Compile Include="Network\Requests\PingRequest.cs" />
<Compile Include="Types\ParticipantFilterTypes.cs" /> <Compile Include="Types\ParticipantTypes.cs" />
<Compile Include="Utils\UploadHelper.cs" /> <Compile Include="Utils\UploadHelper.cs" />
<Compile Include="Session.cs" /> <Compile Include="Session.cs" />
<Compile Include="TelegramClient.cs" /> <Compile Include="TelegramClient.cs" />

View file

@ -524,7 +524,7 @@ namespace TLSharp.Core
/// <param name="partType">The type of the participants to get. Choose Recents not to filter</param> /// <param name="partType">The type of the participants to get. Choose Recents not to filter</param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
public async Task<TLChannelParticipants> GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken)) public async Task<TLChannelParticipants> GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
{ {
if (channel == null) return null; if (channel == null) return null;
return await GetParticipants(channel.Id, (long)channel.AccessHash, stIdx, pageSize, partType, token).ConfigureAwait(false); return await GetParticipants(channel.Id, (long)channel.AccessHash, stIdx, pageSize, partType, token).ConfigureAwait(false);
@ -541,31 +541,31 @@ namespace TLSharp.Core
/// <param name="partType">The type of the participants to get. Choose Recents not to filter</param> /// <param name="partType">The type of the participants to get. Choose Recents not to filter</param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
public async Task<TLChannelParticipants> GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken)) public async Task<TLChannelParticipants> GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
{ {
TLAbsChannelParticipantsFilter filter; TLAbsChannelParticipantsFilter filter;
switch (partType) switch (partType)
{ {
case ParticipantFilterTypes.Admins: case ParticipantTypes.Admins:
filter = new TLChannelParticipantsAdmins(); filter = new TLChannelParticipantsAdmins();
break; break;
case ParticipantFilterTypes.Kicked: case ParticipantTypes.Kicked:
filter = new TLChannelParticipantsKicked(); filter = new TLChannelParticipantsKicked();
break; break;
case ParticipantFilterTypes.Bots: case ParticipantTypes.Bots:
filter = new TLChannelParticipantsBots(); filter = new TLChannelParticipantsBots();
break; break;
case ParticipantFilterTypes.Recents: case ParticipantTypes.Recents:
filter = new TLChannelParticipantsRecent(); filter = new TLChannelParticipantsRecent();
break; break;
case ParticipantFilterTypes.Banned: case ParticipantTypes.Banned:
case ParticipantFilterTypes.Restricted: case ParticipantTypes.Restricted:
case ParticipantFilterTypes.Contacts: case ParticipantTypes.Contacts:
case ParticipantFilterTypes.Search: case ParticipantTypes.Search:
default: default:
throw new NotImplementedException($"{partType} not implemented yet"); throw new NotImplementedException($"{partType} not implemented yet");
} }
@ -588,7 +588,7 @@ namespace TLSharp.Core
ChannelId = channelId, ChannelId = channelId,
AccessHash = accessHash AccessHash = accessHash
}, },
Filter = filter, Filter = new TLChannelParticipantsRecent(),
Offset = found, Offset = found,
Limit = pageSize Limit = pageSize
}; };
@ -607,16 +607,6 @@ namespace TLSharp.Core
/// <summary> /// <summary>
/// Invites the passed users to the specified channel /// Invites the passed users to the specified channel
/// </summary> /// </summary>
/// <param name="channel">The descriptor of the channel to invite the users to</param>
/// <param name="users"></param>
/// <returns></returns>
public async Task<TLUpdates> InviteToChannel(TLChannel channel, int[] users, CancellationToken token = default(CancellationToken))
{
return await InviteToChannel(channel.Id, (long)channel.AccessHash, users, token);
}
/// <summary>
/// Invites the passed users to the specified channel
/// </summary>
/// <param name="channelId">The id of the channel to invite the users to</param> /// <param name="channelId">The id of the channel to invite the users to</param>
/// <param name="accessHash">The access hash of the channel to invite the users to</param> /// <param name="accessHash">The access hash of the channel to invite the users to</param>
/// <param name="users"></param> /// <param name="users"></param>

View file

@ -1,6 +1,6 @@
namespace TLSharp.Core.Types namespace TLSharp.Core.Types
{ {
public enum ParticipantFilterTypes public enum ParticipantTypes
{ {
Recents, Recents,
Restricted, Restricted,