Skip to content

Commit

Permalink
Исправить часть warning, обновить некоторые методы из #1222 (#1600)
Browse files Browse the repository at this point in the history
## Список изменений
Исправлены warning
- Local constant 'expectedUserId' is never 
- Redundant 'Attribute' suffix
- Dictionary lookup can be simplified with 'TryGetValue'
- S6608: Indexing at 0 should be used instead of the "Enumerable"
extenion method "First"
- The keyword 'new' is required on 'AccessKey' because it hides property
'string VkNet.Model.MediaAttachment.AccessKey'
- Using directive is not required by the code and can be safely removed
- The keyword 'new' is required on 'PhotoId' because it hides property
'long? VkNet.Model.Comment.PhotoId'
- Conditional access qualifier expression is known to be not null
- Cannot resolve symbol BotsLongPollUpdatesHandler
- Code is unreachable

Обновил методы из #1222
- ads.getAds
- ads.getAdsLayout
- apps.get
- wall.postAdsStealth
- wall.editAdsStealth
- video.addToAlbum
- friends.areFriends
- friends.getMutual

##### Обязательно выполните следующие пункты:
- [x] Проверьте что ваш код не содержит конфликтов, и исправьте их по
необходимости
- [x] Напишите тесты, и обязательно проверьте что не падают другие.

##### Внимание! Pull Request'ы с непройденными тестами не принимаются
  • Loading branch information
1dNDN authored Nov 11, 2023
1 parent d4d748a commit 7fa349d
Show file tree
Hide file tree
Showing 69 changed files with 148 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public void GetBotsLongPollHistory_BoardPostRestoreTest()

var expectedGroupId = new GroupId(1234);
const int unExpectedGroupId = -1234;
const int expectedUserId = 123;
const string expectedText = "test";

var botsLongPollHistory = Api.Groups.GetBotsLongPollHistory(new()
Expand Down
1 change: 0 additions & 1 deletion VkNet.Tests/Categories/Market/MarketGetTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FluentAssertions;
using System.Reflection;
using VkNet.Tests.Infrastructure;
using Xunit;

Expand Down
7 changes: 7 additions & 0 deletions VkNet/Abstractions/Category/Async/IFriendsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ Task<ReadOnlyCollection<MutualFriend>> GetMutualAsync(FriendsGetMutualParams @pa
/// 0 – поле sign возвращать не нужно. флаг, может принимать значения 1 или 0
/// (Флаг, может принимать значения 1 или 0).
/// </param>
/// <param name="extended">
/// Информация о том, вернуть ли в ответе поле is_request_unread.
/// 1 – необходимо вернуть поле is_request_unread,
/// если есть непросмотренная заявка в друзья.
/// 0 — поле is_request_unread возвращать не нужно.
/// </param>
/// <param name="token">Токен отмены операции</param>
/// <returns>
/// После успешного выполнения возвращает массив объектов status, каждый из которых
Expand All @@ -128,6 +134,7 @@ Task<ReadOnlyCollection<MutualFriend>> GetMutualAsync(FriendsGetMutualParams @pa
/// </remarks>
Task<ReadOnlyCollection<AreFriendsResult>> AreFriendsAsync([NotNull] IEnumerable<long> userIds,
bool? needSign = null,
bool? extended = null,
CancellationToken token = default);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion VkNet/Abstractions/Category/IFriendsCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface IFriendsCategory : IFriendsCategoryAsync
ReadOnlyCollection<MutualFriend> GetMutual(FriendsGetMutualParams @params);

/// <inheritdoc cref="IFriendsCategoryAsync.AreFriendsAsync" />
ReadOnlyCollection<AreFriendsResult> AreFriends([NotNull] IEnumerable<long> userIds, bool? needSign = null);
ReadOnlyCollection<AreFriendsResult> AreFriends([NotNull] IEnumerable<long> userIds, bool? needSign = null, bool? extended = null);

/// <inheritdoc cref="IFriendsCategoryAsync.AddListAsync" />
long AddList(string name, IEnumerable<long> userIds);
Expand Down
6 changes: 6 additions & 0 deletions VkNet/Categories/AdsCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public ReadOnlyCollection<Ad> GetAds(GetAdsParams getAdsParams) => _vk.Call<Read
{
"include_deleted", getAdsParams.IncludeDeleted
},
{
"only_deleted", getAdsParams.OnlyDeleted
},
{
"limit", getAdsParams.Limit
},
Expand Down Expand Up @@ -297,6 +300,9 @@ public ReadOnlyCollection<Layout> GetAdsLayout(GetAdsLayoutParams getAdsLayoutPa
{
"include_deleted", getAdsLayoutParams.IncludeDeleted
},
{
"only_deleted", getAdsLayoutParams.OnlyDeleted
},
{
"limit", getAdsLayoutParams.Limit
},
Expand Down
3 changes: 3 additions & 0 deletions VkNet/Categories/AppsCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public AppGetObject Get(AppGetParams @params, bool skipAuthorization = false)
{
return _vk.Call<AppGetObject>("apps.get", new()
{
{
"app_id", @params.AppId
},
{
"app_ids", @params.AppIds
},
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AccountCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AdsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AppWidgetsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.SafetyEnums;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AppsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AsrCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.StringEnums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AudioCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.Filters;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/AuthCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/BoardCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/DatabaseCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/DocsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/FaveCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.StringEnums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/FaveCategoryAsyncObsolete.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
4 changes: 3 additions & 1 deletion VkNet/Categories/Async/FriendsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
Expand Down Expand Up @@ -39,9 +40,10 @@ public Task<ReadOnlyCollection<MutualFriend>> GetMutualAsync(FriendsGetMutualPar
/// <inheritdoc />
public Task<ReadOnlyCollection<AreFriendsResult>> AreFriendsAsync(IEnumerable<long> userIds,
bool? needSign = null,
bool? extended = null,
CancellationToken token = default) =>
TypeHelper.TryInvokeMethodAsync(() =>
AreFriends(userIds, needSign), token);
AreFriends(userIds, needSign, extended), token);

/// <inheritdoc />
public Task<long> AddListAsync(string name,
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/GiftsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/GroupsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/LeadFormsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions.Category;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/LeadsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/LikesCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.StringEnums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 0 additions & 1 deletion VkNet/Categories/Async/MarketsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/NewsFeedCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/NotesCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/NotificationsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/OrdersCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.StringEnums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PagesCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PhotoCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PlacesCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PodcastsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PollsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/PrettyCardsCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/SearchCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/SecureCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/StatusCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/StorageCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/StoriesCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/StreamingCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.StringEnums;
using VkNet.Model;
using VkNet.Utils;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/UsersCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums.Filters;
using VkNet.Enums.StringEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/UtilsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/VideoCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.SafetyEnums;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/WallCategoryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.Filters;
using VkNet.Model;
Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/Async/WidgetsCategoryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
1 change: 1 addition & 0 deletions VkNet/Categories/FaveCategoryObsolete.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using VkNet.Abstractions;
using VkNet.Model;
using VkNet.Utils;

Expand Down
Loading

0 comments on commit 7fa349d

Please sign in to comment.