diff --git a/TLSharp.Core/TLSharp.Core.csproj b/TLSharp.Core/TLSharp.Core.csproj
index dd2c33c..5f6d2af 100644
--- a/TLSharp.Core/TLSharp.Core.csproj
+++ b/TLSharp.Core/TLSharp.Core.csproj
@@ -73,7 +73,7 @@
-
+
diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs
index a2ab18d..4ac6947 100644
--- a/TLSharp.Core/TelegramClient.cs
+++ b/TLSharp.Core/TelegramClient.cs
@@ -61,7 +61,7 @@ namespace TLSharp.Core
this.handler = handler;
session = Session.TryLoadOrCreateNew(store, sessionUserId);
- transport = new TcpTransport(session.DataCenter.Address, session.DataCenter.Port, this.handler);
+ transport = new TcpTransport (session.DataCenter.Address, session.DataCenter.Port, this.handler);
}
public async Task ConnectAsync(bool reconnect = false, CancellationToken token = default(CancellationToken))
@@ -110,7 +110,7 @@ namespace TLSharp.Core
}
var dc = dcOptions.First(d => d.Id == dcId);
- var dataCenter = new DataCenter(dcId, dc.IpAddress, dc.Port);
+ var dataCenter = new DataCenter (dcId, dc.IpAddress, dc.Port);
transport = new TcpTransport(dc.IpAddress, dc.Port, handler);
session.DataCenter = dataCenter;
@@ -131,7 +131,7 @@ namespace TLSharp.Core
throw new InvalidOperationException("Not connected!");
var completed = false;
- while (!completed)
+ while(!completed)
{
try
{
@@ -139,7 +139,7 @@ namespace TLSharp.Core
await sender.Receive(request, token).ConfigureAwait(false);
completed = true;
}
- catch (DataCenterMigrationException e)
+ catch(DataCenterMigrationException e)
{
if (session.DataCenter.DataCenterId.HasValue &&
session.DataCenter.DataCenterId.Value == e.DC)
@@ -193,7 +193,7 @@ namespace TLSharp.Core
if (String.IsNullOrWhiteSpace(code))
throw new ArgumentNullException(nameof(code));
-
+
var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code };
await RequestWithDcMigration(request, token).ConfigureAwait(false);
@@ -202,7 +202,7 @@ namespace TLSharp.Core
return ((TLUser)request.Response.User);
}
-
+
public async Task GetPasswordSetting(CancellationToken token = default(CancellationToken))
{
var request = new TLRequestGetPassword();
@@ -234,7 +234,7 @@ namespace TLSharp.Core
public async Task SignUpAsync(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName, CancellationToken token = default(CancellationToken))
{
var request = new TLRequestSignUp() { PhoneNumber = phoneNumber, PhoneCode = code, PhoneCodeHash = phoneCodeHash, FirstName = firstName, LastName = lastName };
-
+
await RequestWithDcMigration(request, token).ConfigureAwait(false);
OnUserAuthenticated((TLUser)request.Response.User);
@@ -251,7 +251,7 @@ namespace TLSharp.Core
return (T)result;
}
- internal async Task SendAuthenticatedRequestAsync(TLMethod methodToExecute, CancellationToken token = default(CancellationToken))
+ internal async Task SendAuthenticatedRequestAsync (TLMethod methodToExecute, CancellationToken token = default(CancellationToken))
{
if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!");
@@ -278,7 +278,7 @@ namespace TLSharp.Core
public async Task ImportContactsAsync(IReadOnlyList contacts, CancellationToken token = default(CancellationToken))
{
- var req = new TLRequestImportContacts { Contacts = new TLVector(contacts) };
+ var req = new TLRequestImportContacts { Contacts = new TLVector(contacts)};
return await SendAuthenticatedRequestAsync(req, token)
.ConfigureAwait(false);
@@ -286,7 +286,7 @@ namespace TLSharp.Core
public async Task DeleteContactsAsync(IReadOnlyList users, CancellationToken token = default(CancellationToken))
{
- var req = new TLRequestDeleteContacts { Id = new TLVector(users) };
+ var req = new TLRequestDeleteContacts {Id = new TLVector(users)};
return await SendAuthenticatedRequestAsync(req, token)
.ConfigureAwait(false);
@@ -294,7 +294,7 @@ namespace TLSharp.Core
public async Task DeleteContactAsync(TLAbsInputUser user, CancellationToken token = default(CancellationToken))
{
- var req = new TLRequestDeleteContact { Id = user };
+ var req = new TLRequestDeleteContact {Id = user};
return await SendAuthenticatedRequestAsync(req, token)
.ConfigureAwait(false);
@@ -337,10 +337,10 @@ namespace TLSharp.Core
offsetPeer = new TLInputPeerSelf();
var req = new TLRequestGetDialogs()
- {
- OffsetDate = offsetDate,
- OffsetId = offsetId,
- OffsetPeer = offsetPeer,
+ {
+ OffsetDate = offsetDate,
+ OffsetId = offsetId,
+ OffsetPeer = offsetPeer,
Limit = limit
};
return await SendAuthenticatedRequestAsync(req, token)
@@ -350,13 +350,13 @@ namespace TLSharp.Core
public async Task SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption, CancellationToken token = default(CancellationToken))
{
return await SendAuthenticatedRequestAsync(new TLRequestSendMedia()
- {
- RandomId = Helpers.GenerateRandomLong(),
- Background = false,
- ClearDraft = false,
- Media = new TLInputMediaUploadedPhoto() { File = file, Caption = caption },
- Peer = peer
- }, token)
+ {
+ RandomId = Helpers.GenerateRandomLong(),
+ Background = false,
+ ClearDraft = false,
+ Media = new TLInputMediaUploadedPhoto() { File = file, Caption = caption },
+ Peer = peer
+ }, token)
.ConfigureAwait(false);
}
@@ -364,30 +364,30 @@ namespace TLSharp.Core
TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector attributes, CancellationToken token = default(CancellationToken))
{
return await SendAuthenticatedRequestAsync(new TLRequestSendMedia()
- {
- RandomId = Helpers.GenerateRandomLong(),
- Background = false,
- ClearDraft = false,
- Media = new TLInputMediaUploadedDocument()
{
- File = file,
- Caption = caption,
- MimeType = mimeType,
- Attributes = attributes
- },
- Peer = peer
- }, token)
+ RandomId = Helpers.GenerateRandomLong(),
+ Background = false,
+ ClearDraft = false,
+ Media = new TLInputMediaUploadedDocument()
+ {
+ File = file,
+ Caption = caption,
+ MimeType = mimeType,
+ Attributes = attributes
+ },
+ Peer = peer
+ }, token)
.ConfigureAwait(false);
}
public async Task GetFile(TLAbsInputFileLocation location, int filePartSize, int offset = 0, CancellationToken token = default(CancellationToken))
{
TLFile result = await SendAuthenticatedRequestAsync(new TLRequestGetFile
- {
- Location = location,
- Limit = filePartSize,
- Offset = offset
- }, token)
+ {
+ Location = location,
+ Limit = filePartSize,
+ Offset = offset
+ }, token)
.ConfigureAwait(false);
return result;
}
@@ -524,7 +524,7 @@ namespace TLSharp.Core
/// The type of the participants to get. Choose Recents not to filter
///
///
- public async Task GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken))
+ public async Task GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
{
if (channel == null) return null;
return await GetParticipants(channel.Id, (long)channel.AccessHash, stIdx, pageSize, partType, token).ConfigureAwait(false);
@@ -541,31 +541,31 @@ namespace TLSharp.Core
/// The type of the participants to get. Choose Recents not to filter
///
///
- public async Task GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken))
+ public async Task GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
{
TLAbsChannelParticipantsFilter filter;
switch (partType)
{
- case ParticipantFilterTypes.Admins:
+ case ParticipantTypes.Admins:
filter = new TLChannelParticipantsAdmins();
break;
- case ParticipantFilterTypes.Kicked:
+ case ParticipantTypes.Kicked:
filter = new TLChannelParticipantsKicked();
break;
- case ParticipantFilterTypes.Bots:
+ case ParticipantTypes.Bots:
filter = new TLChannelParticipantsBots();
break;
- case ParticipantFilterTypes.Recents:
+ case ParticipantTypes.Recents:
filter = new TLChannelParticipantsRecent();
break;
- case ParticipantFilterTypes.Banned:
- case ParticipantFilterTypes.Restricted:
- case ParticipantFilterTypes.Contacts:
- case ParticipantFilterTypes.Search:
+ case ParticipantTypes.Banned:
+ case ParticipantTypes.Restricted:
+ case ParticipantTypes.Contacts:
+ case ParticipantTypes.Search:
default:
throw new NotImplementedException($"{partType} not implemented yet");
}
@@ -588,7 +588,7 @@ namespace TLSharp.Core
ChannelId = channelId,
AccessHash = accessHash
},
- Filter = filter,
+ Filter = new TLChannelParticipantsRecent(),
Offset = found,
Limit = pageSize
};
@@ -607,16 +607,6 @@ namespace TLSharp.Core
///
/// Invites the passed users to the specified channel
///
- /// The descriptor of the channel to invite the users to
- ///
- ///
- public async Task InviteToChannel(TLChannel channel, int[] users, CancellationToken token = default(CancellationToken))
- {
- return await InviteToChannel(channel.Id, (long)channel.AccessHash, users, token);
- }
- ///
- /// Invites the passed users to the specified channel
- ///
/// The id of the channel to invite the users to
/// The access hash of the channel to invite the users to
///
diff --git a/TLSharp.Core/Types/ParticipantFilterTypes.cs b/TLSharp.Core/Types/ParticipantTypes.cs
similarity index 82%
rename from TLSharp.Core/Types/ParticipantFilterTypes.cs
rename to TLSharp.Core/Types/ParticipantTypes.cs
index 99eef19..44be381 100644
--- a/TLSharp.Core/Types/ParticipantFilterTypes.cs
+++ b/TLSharp.Core/Types/ParticipantTypes.cs
@@ -1,6 +1,6 @@
namespace TLSharp.Core.Types
{
- public enum ParticipantFilterTypes
+ public enum ParticipantTypes
{
Recents,
Restricted,