Skip to content

Commit

Permalink
API Layer 172: Premium last-seen, read-dates, contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jan 18, 2024
1 parent a0841fe commit 6f3c873
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pr: none
trigger: [ master ]

name: 3.6.4-dev.$(Rev:r)
name: 3.6.5-dev.$(Rev:r)

pool:
vmImage: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Olivier Marcoux
Copyright (c) 2021-2024 Olivier Marcoux

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![API Layer](https://img.shields.io/badge/API_Layer-170-blueviolet)](https://corefork.telegram.org/methods)
[![API Layer](https://img.shields.io/badge/API_Layer-172-blueviolet)](https://corefork.telegram.org/methods)
[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/)
[![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest)
[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou)
Expand Down
169 changes: 139 additions & 30 deletions src/TL.Schema.cs

Large diffs are not rendered by default.

59 changes: 49 additions & 10 deletions src/TL.SchemaFuncs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ public static Task<bool> Account_DeclinePasswordReset(this Client client)
{
});

/// <summary>Get all available chat themes <para>See <a href="https://corefork.telegram.org/method/account.getChatThemes"/></para></summary>
/// <summary>Get all available chat <a href="https://corefork.telegram.org/api/themes">themes »</a>. <para>See <a href="https://corefork.telegram.org/method/account.getChatThemes"/></para></summary>
/// <param name="hash"><a href="https://corefork.telegram.org/api/offsets#hash-generation">Hash for pagination, for more info click here</a></param>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/account.themesNotModified">account.themesNotModified</a></returns>
public static Task<Account_Themes> Account_GetChatThemes(this Client client, long hash = default)
Expand Down Expand Up @@ -1175,7 +1175,7 @@ public static Task<EmojiList> Account_GetDefaultBackgroundEmojis(this Client cli
hash = hash,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/account.getChannelDefaultEmojiStatuses"/> [bots: ✓]</para></summary>
/// <summary>Get a list of default suggested <a href="https://corefork.telegram.org/api/emoji-status">channel emoji statuses</a>. <para>See <a href="https://corefork.telegram.org/method/account.getChannelDefaultEmojiStatuses"/> [bots: ✓]</para></summary>
/// <param name="hash"><a href="https://corefork.telegram.org/api/offsets#hash-generation">Hash for pagination, for more info click here</a></param>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/account.emojiStatusesNotModified">account.emojiStatusesNotModified</a></returns>
public static Task<Account_EmojiStatuses> Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default)
Expand All @@ -1184,7 +1184,7 @@ public static Task<Account_EmojiStatuses> Account_GetChannelDefaultEmojiStatuses
hash = hash,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/account.getChannelRestrictedStatusEmojis"/> [bots: ✓]</para></summary>
/// <summary>Returns fetch the full list of <a href="https://corefork.telegram.org/api/custom-emoji">custom emoji IDs »</a> that cannot be used in <a href="https://corefork.telegram.org/api/emoji-status">channel emoji statuses »</a>. <para>See <a href="https://corefork.telegram.org/method/account.getChannelRestrictedStatusEmojis"/> [bots: ✓]</para></summary>
/// <param name="hash"><a href="https://corefork.telegram.org/api/offsets#hash-generation">Hash for pagination, for more info click here</a></param>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/emojiListNotModified">emojiListNotModified</a></returns>
public static Task<EmojiList> Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default)
Expand Down Expand Up @@ -1219,6 +1219,13 @@ public static Task<bool> Users_SetSecureValueErrors(this Client client, InputUse
errors = errors,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/users.getIsPremiumRequiredToContact"/></para></summary>
public static Task<bool[]> Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id)
=> client.Invoke(new Users_GetIsPremiumRequiredToContact
{
id = id,
});

/// <summary>Get the telegram IDs of all contacts.<br/>Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). <para>See <a href="https://corefork.telegram.org/method/contacts.getContactIDs"/></para></summary>
/// <param name="hash"><a href="https://corefork.telegram.org/api/offsets#hash-generation">Hash for pagination, for more info click here</a></param>
public static Task<int[]> Contacts_GetContactIDs(this Client client, long hash = default)
Expand Down Expand Up @@ -1348,7 +1355,7 @@ public static Task<bool> Contacts_ResetTopPeerRating(this Client client, TopPeer
peer = peer,
});

/// <summary>Delete saved contacts <para>See <a href="https://corefork.telegram.org/method/contacts.resetSaved"/></para></summary>
/// <summary>Removes all contacts without an associated Telegram account. <para>See <a href="https://corefork.telegram.org/method/contacts.resetSaved"/></para></summary>
public static Task<bool> Contacts_ResetSaved(this Client client)
=> client.Invoke(new Contacts_ResetSaved
{
Expand Down Expand Up @@ -3299,8 +3306,8 @@ public static Task<UpdatesBase> Messages_GetMessagesReactions(this Client client
/// <summary>Get <a href="https://corefork.telegram.org/api/reactions">message reaction</a> list, along with the sender of each reaction. <para>See <a href="https://corefork.telegram.org/method/messages.getMessageReactionsList"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/messages.getMessageReactionsList#possible-errors">details</a>)</para></summary>
/// <param name="peer">Peer</param>
/// <param name="id">Message ID</param>
/// <param name="reaction">Get only reactions of this type (UTF8 emoji)</param>
/// <param name="offset">Offset (typically taken from the <c>next_offset</c> field of the returned <see cref="Messages_MessageReactionsList"/>)</param>
/// <param name="reaction">Get only reactions of this type</param>
/// <param name="offset">Offset for pagination (taken from the <c>next_offset</c> field of the returned <see cref="Messages_MessageReactionsList"/>); empty in the first request.</param>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
public static Task<Messages_MessageReactionsList> Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null)
=> client.Invoke(new Messages_GetMessageReactionsList
Expand Down Expand Up @@ -3627,10 +3634,11 @@ public static Task<DefaultHistoryTTL> Messages_GetDefaultHistoryTTL(this Client
{
});

/// <summary>Send a chosen peer, as requested by a <see cref="KeyboardButtonRequestPeer"/> button. <para>See <a href="https://corefork.telegram.org/method/messages.sendBotRequestedPeer"/> [bots: ✓]</para></summary>
/// <summary>Send one or more chosen peers, as requested by a <see cref="KeyboardButtonRequestPeer"/> button. <para>See <a href="https://corefork.telegram.org/method/messages.sendBotRequestedPeer"/> [bots: ✓]</para></summary>
/// <param name="peer">The bot that sent the <see cref="KeyboardButtonRequestPeer"/> button.</param>
/// <param name="msg_id">ID of the message that contained the reply keyboard with the <see cref="KeyboardButtonRequestPeer"/> button.</param>
/// <param name="button_id">The <c>button_id</c> field from the <see cref="KeyboardButtonRequestPeer"/>.</param>
/// <param name="requested_peers">The chosen peers.</param>
public static Task<UpdatesBase> Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, params InputPeer[] requested_peers)
=> client.Invoke(new Messages_SendBotRequestedPeer
{
Expand Down Expand Up @@ -3839,6 +3847,14 @@ public static Task<Messages_Reactions> Messages_GetDefaultTagReactions(this Clie
hash = hash,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.getOutboxReadDate"/></para></summary>
public static Task<OutboxReadDate> Messages_GetOutboxReadDate(this Client client, InputPeer peer, int msg_id)
=> client.Invoke(new Messages_GetOutboxReadDate
{
peer = peer,
msg_id = msg_id,
});

/// <summary>Returns a current state of updates. <para>See <a href="https://corefork.telegram.org/method/updates.getState"/> [bots: ✓]</para></summary>
public static Task<Updates_State> Updates_GetState(this Client client)
=> client.Invoke(new Updates_GetState
Expand Down Expand Up @@ -4851,6 +4867,7 @@ public static Task<bool> Channels_ClickSponsoredMessage(this Client client, Inpu
});

/// <summary>Update the <a href="https://corefork.telegram.org/api/colors">accent color and background custom emoji »</a> of a channel. <para>See <a href="https://corefork.telegram.org/method/channels.updateColor"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/channels.updateColor#possible-errors">details</a>)</para></summary>
/// <param name="for_profile">Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed.</param>
/// <param name="channel">Channel whose accent color should be changed.</param>
/// <param name="color"><a href="https://corefork.telegram.org/api/colors">ID of the accent color palette »</a> to use (not RGB24, see <a href="https://corefork.telegram.org/api/colors">here »</a> for more info).</param>
/// <param name="background_emoji_id">Custom emoji ID used in the accent color pattern.</param>
Expand Down Expand Up @@ -4881,7 +4898,9 @@ public static Task<Messages_Chats> Channels_GetChannelRecommendations(this Clien
channel = channel,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.updateEmojiStatus"/> [bots: ✓]</para></summary>
/// <summary>Set an <a href="https://corefork.telegram.org/api/emoji-status">emoji status</a> for a channel. <para>See <a href="https://corefork.telegram.org/method/channels.updateEmojiStatus"/> [bots: ✓]</para></summary>
/// <param name="channel">The channel, must have at least <a href="https://corefork.telegram.org/api/config#channel-emoji-status-level-min"><c>channel_emoji_status_level_min</c> boosts</a>.</param>
/// <param name="emoji_status"><a href="https://corefork.telegram.org/api/emoji-status">Emoji status</a> to set</param>
public static Task<UpdatesBase> Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status)
=> client.Invoke(new Channels_UpdateEmojiStatus
{
Expand Down Expand Up @@ -5782,6 +5801,7 @@ public static Task<Stats_MegagroupStats> Stats_GetMegagroupStats(this Client cli
/// <summary>Obtains a list of messages, indicating to which other public channels was a channel message forwarded.<br/>Will return a list of <see cref="Message">messages</see> with <c>peer_id</c> equal to the public channel to which this message was forwarded. <para>See <a href="https://corefork.telegram.org/method/stats.getMessagePublicForwards"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/stats.getMessagePublicForwards#possible-errors">details</a>)</para></summary>
/// <param name="channel">Source channel</param>
/// <param name="msg_id">Source message ID</param>
/// <param name="offset">Offset for <a href="https://corefork.telegram.org/api/offsets">pagination</a>, empty string on first call, then use the <c>next_offset</c> field of the returned constructor (if present, otherwise no more results are available).</param>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
public static Task<Stats_PublicForwards> Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, string offset, int limit = int.MaxValue)
=> client.Invoke(new Stats_GetMessagePublicForwards
Expand Down Expand Up @@ -6093,7 +6113,8 @@ public static Task<bool> Stories_IncrementStoryViews(this Client client, InputPe

/// <summary>Obtain the list of users that have viewed a specific <a href="https://corefork.telegram.org/api/stories">story we posted</a> <para>See <a href="https://corefork.telegram.org/method/stories.getStoryViewsList"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/stories.getStoryViewsList#possible-errors">details</a>)</para></summary>
/// <param name="just_contacts">Whether to only fetch view reaction/views made by our <a href="https://corefork.telegram.org/api/contacts">contacts</a></param>
/// <param name="reactions_first">Whether to return <see cref="StoryView"/> info about users that reacted to the story (i.e. if set, the server will first sort results by view date as usual, and then also additionally sort the list by putting <see cref="StoryView"/>s with an associated reaction first in the list).</param>
/// <param name="reactions_first">Whether to return <see cref="StoryView"/> info about users that reacted to the story (i.e. if set, the server will first sort results by view date as usual, and then also additionally sort the list by putting <see cref="StoryView"/>s with an associated reaction first in the list). Ignored if <c>forwards_first</c> is set.</param>
/// <param name="forwards_first">If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date.</param>
/// <param name="peer">Peer where the story was posted</param>
/// <param name="q">Search for specific peers</param>
/// <param name="id">Story ID</param>
Expand Down Expand Up @@ -6205,7 +6226,12 @@ public static Task<bool> Stories_TogglePeerStoriesHidden(this Client client, Inp
hidden = hidden,
});

/// <summary><para>See <a href="https://corefork.telegram.org/method/stories.getStoryReactionsList"/> [bots: ✓]</para></summary>
/// <summary>Get the <a href="https://corefork.telegram.org/api/reactions">reaction</a> and interaction list of a <a href="https://corefork.telegram.org/api/stories">story</a> posted to a channel, along with the sender of each reaction. <para>See <a href="https://corefork.telegram.org/method/stories.getStoryReactionsList"/> [bots: ✓]</para></summary>
/// <param name="forwards_first">If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date.</param>
/// <param name="peer">Channel</param>
/// <param name="id"><a href="https://corefork.telegram.org/api/stories">Story</a> ID</param>
/// <param name="reaction">Get only reactions of this type</param>
/// <param name="offset">Offset for pagination (taken from the <c>next_offset</c> field of the returned <see cref="Stories_StoryReactionsList"/>); empty in the first request.</param>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
public static Task<Stories_StoryReactionsList> Stories_GetStoryReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null, bool forwards_first = false)
=> client.Invoke(new Stories_GetStoryReactionsList
Expand Down Expand Up @@ -7201,6 +7227,12 @@ public class Users_SetSecureValueErrors : IMethod<bool>
public SecureValueErrorBase[] errors;
}

[TLDef(0xA622AA10)]
public class Users_GetIsPremiumRequiredToContact : IMethod<bool[]>
{
public InputUserBase[] id;
}

[TLDef(0x7ADC669D)]
public class Contacts_GetContactIDs : IMethod<int[]>
{
Expand Down Expand Up @@ -9455,6 +9487,13 @@ public class Messages_GetDefaultTagReactions : IMethod<Messages_Reactions>
public long hash;
}

[TLDef(0x8C4BFE5D)]
public class Messages_GetOutboxReadDate : IMethod<OutboxReadDate>
{
public InputPeer peer;
public int msg_id;
}

[TLDef(0xEDD4882A)]
public class Updates_GetState : IMethod<Updates_State> { }

Expand Down
9 changes: 5 additions & 4 deletions src/TL.Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
public const int Version = 171; // fetched 16/01/2024 17:09:52
public const int Version = 172; // fetched 18/01/2024 14:49:18
internal const int SecretChats = 144;
internal const int MTProto2 = 73;
internal const uint VectorCtor = 0x1CB5C415;
Expand Down Expand Up @@ -127,9 +127,9 @@ public static class Layer
[0x09D05049] = null,//UserStatusEmpty
[0xEDB93949] = typeof(UserStatusOnline),
[0x008C703F] = typeof(UserStatusOffline),
[0xE26F42F1] = typeof(UserStatusRecently),
[0x07BF09FC] = typeof(UserStatusLastWeek),
[0x77EBC742] = typeof(UserStatusLastMonth),
[0x7B197DC8] = typeof(UserStatusRecently),
[0x541A1D1A] = typeof(UserStatusLastWeek),
[0x65899777] = typeof(UserStatusLastMonth),
[0x29562865] = typeof(ChatEmpty),
[0x41CBF256] = typeof(Chat),
[0x6592A1A7] = typeof(ChatForbidden),
Expand Down Expand Up @@ -1188,6 +1188,7 @@ public static class Layer
[0xCB6FF828] = typeof(SavedReactionTag),
[0x889B59EF] = null,//Messages_SavedReactionTagsNotModified
[0x3259950A] = typeof(Messages_SavedReactionTags),
[0x3BB842AC] = typeof(OutboxReadDate),
// from TL.Secret:
[0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument),
[0x91CC4674] = typeof(Layer73.DecryptedMessage),
Expand Down
4 changes: 2 additions & 2 deletions src/WTelegramClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<PackageId>WTelegramClient</PackageId>
<Version>0.0.0</Version>
<Authors>Wizou</Authors>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 171&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Copyright>Copyright © Olivier Marcoux 2021-2023</Copyright>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 172&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Copyright>Copyright © Olivier Marcoux 2021-2024</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/wiz0u/WTelegramClient</PackageProjectUrl>
<PackageIcon>logo.png</PackageIcon>
Expand Down

0 comments on commit 6f3c873

Please sign in to comment.