-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for method messages.changeConversationMemberRestrictions (#…
…1610) (#1612) #1610 ## Список изменений - Добавлена поддержка метода messages.changeConversationMemberRestrictions ##### Обязательно выполните следующие пункты: - [x] Проверьте что ваш код не содержит конфликтов, и исправьте их по необходимости - [x] Напишите тесты, и обязательно проверьте что не падают другие. ##### Внимание! Pull Request'ы с непройденными тестами не принимаются
- Loading branch information
Showing
9 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
VkNet.Tests/TestData/Categories/Messages/ChangeConversationMemberRestrictions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"response": { | ||
"failed_member_ids": [ | ||
814412 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
VkNet/Enums/StringEnums/ConversationMemberRestrictionsActionType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
using VkNet.Utils.JsonConverter; | ||
|
||
namespace VkNet.Enums.StringEnums; | ||
|
||
/// <summary> | ||
/// Ограничения участников разговора | ||
/// </summary> | ||
[StringEnum] | ||
[JsonConverter(typeof(TolerantStringEnumConverter))] | ||
public enum ConversationMemberRestrictionsActionType | ||
{ | ||
/// <summary> | ||
/// Read/write, пользователь может читать и отправлять сообщения в чат | ||
/// </summary> | ||
Rw, | ||
|
||
/// <summary> | ||
/// Read only, пользователь не может отправлять сообщения в чат | ||
/// </summary> | ||
Ro | ||
} |
18 changes: 18 additions & 0 deletions
18
VkNet/Model/MessagesChangeConversationMemberRestrictionsObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using Newtonsoft.Json; | ||
|
||
namespace VkNet.Model; | ||
|
||
/// <summary> | ||
/// Результат выполнения запроса установки ограничений участнику чата | ||
/// </summary> | ||
[Serializable] | ||
public class MessagesChangeConversationMemberRestrictionsObject | ||
{ | ||
/// <summary> | ||
/// Список идентификаторов, к которым не удалось применить ограничения | ||
/// </summary> | ||
[JsonProperty("failed_member_ids")] | ||
public ReadOnlyCollection<long> FailedMemberIds { get; set; } | ||
} |
37 changes: 37 additions & 0 deletions
37
VkNet/Model/RequestParams/Messages/MessagesChangeConversationMemberRestrictionsParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using VkNet.Enums.StringEnums; | ||
|
||
namespace VkNet.Model; | ||
|
||
/// <summary> | ||
/// Список параметров для метода messages.changeConversationMemberRestrictions | ||
/// </summary> | ||
[Serializable] | ||
public class MessagesChangeConversationMemberRestrictionsParams | ||
{ | ||
/// <summary> | ||
/// Идентификатор назначения. | ||
/// </summary> | ||
[JsonProperty("peer_id")] | ||
public long PeerId { get; set; } | ||
|
||
/// <summary> | ||
/// Идентификаторы пользователей. | ||
/// </summary> | ||
[JsonProperty("member_ids")] | ||
public IEnumerable<long> MemberIds { get; set; } | ||
|
||
/// <summary> | ||
/// Время в секундах. Если нужно замутить навсегда, то указывать не нужно. | ||
/// </summary> | ||
[JsonProperty("for", NullValueHandling = NullValueHandling.Ignore)] | ||
public long For { get; set; } | ||
|
||
/// <summary> | ||
/// Разрешенные действия. | ||
/// </summary> | ||
[JsonProperty("action")] | ||
public ConversationMemberRestrictionsActionType Action { get; set; } | ||
} |