! fixed conflicts

+ eol
This commit is contained in:
solarin 2020-04-06 10:49:19 +04:00
parent 9623f9d5ac
commit ce93c766c4
3 changed files with 33 additions and 13 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\ParticipantTypes.cs" /> <Compile Include="Types\ParticipantFilterTypes.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

@ -435,6 +435,7 @@ namespace TLSharp.Core
return ((TLUser)request.Response.User); return ((TLUser)request.Response.User);
} }
/// <summary> /// <summary>
/// Gets the full information of a specified chat /// Gets the full information of a specified chat
/// </summary> /// </summary>
@ -448,6 +449,7 @@ namespace TLSharp.Core
return fchat; return fchat;
} }
/// <summary> /// <summary>
/// Gets the list of chats and channels opened by the authenticated user. /// Gets the list of chats and channels opened by the authenticated user.
/// Throws an exception if the authenticated user is a bot. /// Throws an exception if the authenticated user is a bot.
@ -458,6 +460,7 @@ namespace TLSharp.Core
{ {
return await GetAllChats(null, token); return await GetAllChats(null, token);
} }
/// <summary> /// <summary>
/// Gets the list of chats and channels opened by the authenticated user except the passed ones. /// Gets the list of chats and channels opened by the authenticated user except the passed ones.
/// Throws an exception if the authenticated user is a bot. /// Throws an exception if the authenticated user is a bot.
@ -473,6 +476,7 @@ namespace TLSharp.Core
var chats = await SendRequestAsync<TLChats>(new TLRequestGetAllChats() { ExceptIds = ichats }, token).ConfigureAwait(false); var chats = await SendRequestAsync<TLChats>(new TLRequestGetAllChats() { ExceptIds = ichats }, token).ConfigureAwait(false);
return chats; return chats;
} }
/// <summary> /// <summary>
/// Gets the information about a channel /// Gets the information about a channel
/// </summary> /// </summary>
@ -484,6 +488,7 @@ namespace TLSharp.Core
if (channel == null) return null; if (channel == null) return null;
return await GetFullChannel(channel.Id, (long)channel.AccessHash, token).ConfigureAwait(false); return await GetFullChannel(channel.Id, (long)channel.AccessHash, token).ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// Gets the information about a channel /// Gets the information about a channel
/// </summary> /// </summary>
@ -497,6 +502,7 @@ namespace TLSharp.Core
return fchat; return fchat;
} }
/// <summary> /// <summary>
/// Gets the channels having the supplied IDs /// Gets the channels having the supplied IDs
/// </summary> /// </summary>
@ -513,6 +519,7 @@ namespace TLSharp.Core
return fchat; return fchat;
} }
/// <summary> /// <summary>
/// Gets the participants of the channel having the supplied type. /// Gets the participants of the channel having the supplied type.
/// The method will auto-paginate results and return all the participants /// The method will auto-paginate results and return all the participants
@ -524,11 +531,12 @@ 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, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken)) public async Task<TLChannelParticipants> GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.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);
} }
/// <summary> /// <summary>
/// Gets the participants of the channel having the supplied type. /// Gets the participants of the channel having the supplied type.
/// The method will auto-paginate results and return all the participants /// The method will auto-paginate results and return all the participants
@ -541,31 +549,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, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken)) public async Task<TLChannelParticipants> GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken))
{ {
TLAbsChannelParticipantsFilter filter; TLAbsChannelParticipantsFilter filter;
switch (partType) switch (partType)
{ {
case ParticipantTypes.Admins: case ParticipantFilterTypes.Admins:
filter = new TLChannelParticipantsAdmins(); filter = new TLChannelParticipantsAdmins();
break; break;
case ParticipantTypes.Kicked: case ParticipantFilterTypes.Kicked:
filter = new TLChannelParticipantsKicked(); filter = new TLChannelParticipantsKicked();
break; break;
case ParticipantTypes.Bots: case ParticipantFilterTypes.Bots:
filter = new TLChannelParticipantsBots(); filter = new TLChannelParticipantsBots();
break; break;
case ParticipantTypes.Recents: case ParticipantFilterTypes.Recents:
filter = new TLChannelParticipantsRecent(); filter = new TLChannelParticipantsRecent();
break; break;
case ParticipantTypes.Banned: case ParticipantFilterTypes.Banned:
case ParticipantTypes.Restricted: case ParticipantFilterTypes.Restricted:
case ParticipantTypes.Contacts: case ParticipantFilterTypes.Contacts:
case ParticipantTypes.Search: case ParticipantFilterTypes.Search:
default: default:
throw new NotImplementedException($"{partType} not implemented yet"); throw new NotImplementedException($"{partType} not implemented yet");
} }
@ -588,7 +596,7 @@ namespace TLSharp.Core
ChannelId = channelId, ChannelId = channelId,
AccessHash = accessHash AccessHash = accessHash
}, },
Filter = new TLChannelParticipantsRecent(), Filter = filter,
Offset = found, Offset = found,
Limit = pageSize Limit = pageSize
}; };
@ -604,6 +612,18 @@ namespace TLSharp.Core
ret.Count = ret.Participants.Count; ret.Count = ret.Participants.Count;
return ret; return ret;
} }
/// <summary>
/// Invites the passed users to the specified channel
/// </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> /// <summary>
/// Invites the passed users to the specified channel /// Invites the passed users to the specified channel
/// </summary> /// </summary>

View file

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