diff --git a/VkNet.Tests/Categories/Podcasts/SearchPodcastTest.cs b/VkNet.Tests/Categories/Podcasts/SearchPodcastTest.cs new file mode 100644 index 000000000..cf58f1756 --- /dev/null +++ b/VkNet.Tests/Categories/Podcasts/SearchPodcastTest.cs @@ -0,0 +1,80 @@ +using FluentAssertions; +using VkNet.Tests.Infrastructure; +using Xunit; + +namespace VkNet.Tests.Categories.Podcasts; + +public class SearchPodcastTest : CategoryBaseTest +{ + protected override string Folder => "Podcasts"; + + [Fact] + public void SearchPodcast() + { + Url = "https://api.vk.com/method/podcasts.searchPodcast"; + + ReadCategoryJsonPath(nameof(Api.Podcasts.SearchPodcast)); + + var result = Api.Podcasts.SearchPodcast(new() + { + SearchString = "наука", + Offset = 0, + Count = 100 + }); + + result.Should(). + NotBeNull(); + + result.ResultsTotal. + Should(). + Be(32); + + result.Podcasts[0]. + OwnerUrl. + Should(). + Be("https://vk.com/science_in_palm"); + + result.Podcasts[0]. + Title. + Should(). + Be("Наука в Ладошке"); + + result.Podcasts[0]. + Covers. + Sizes[0]. + Width. + Should(). + Be(640); + + result.Podcasts[0]. + Covers. + Sizes[0]. + Type. + Should(). + Be("a"); + + result.Podcasts[4]. + Title. + Should(). + Be("Noosphere Studio | Наука"); + + result.Podcasts[4]. + OwnerUrl. + Should() + .Be("https://vk.com/noosphere_studio"); + + result.Podcasts[4]. + Covers. + Sizes[1]. + Type. + Should() + .Be("c"); + + result.Podcasts[4]. + Covers. + Sizes[2]. + Height. + Should(). + Be(160); + } +} \ No newline at end of file diff --git a/VkNet.Tests/Categories/Podcasts/SearchTest.cs b/VkNet.Tests/Categories/Podcasts/SearchTest.cs deleted file mode 100644 index 3598d9992..000000000 --- a/VkNet.Tests/Categories/Podcasts/SearchTest.cs +++ /dev/null @@ -1,40 +0,0 @@ -using FluentAssertions; -using VkNet.Tests.Infrastructure; -using Xunit; - -namespace VkNet.Tests.Categories.Podcasts; - -public class SearchTest : CategoryBaseTest -{ - protected override string Folder => "Podcasts"; - - [Fact] - public void Search() - { - Url = "https://api.vk.com/method/podcasts.search"; - - ReadCategoryJsonPath(nameof(Api.Podcasts.Search)); - - var result = Api.Podcasts.Search(new() - { - SearchString = "дудь", - Offset = 0, - Count = 100 - }); - - result.Should() - .NotBeNull(); - - result.Podcasts[0] - .OwnerId.Should() - .Be(-189167851); - - result.Episodes[0] - .Id.Should() - .Be(456239643); - - result.Groups[0] - .Id.Should() - .Be(189167851); - } -} \ No newline at end of file diff --git a/VkNet.Tests/TestData/Categories/Podcasts/Search.json b/VkNet.Tests/TestData/Categories/Podcasts/Search.json deleted file mode 100644 index f3138d6e2..000000000 --- a/VkNet.Tests/TestData/Categories/Podcasts/Search.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "response": { - "podcasts": [{ - "owner_id": -189167851, - "podcast_title": "Дудки)" - }, { - "owner_id": -66891523, - "podcast_title": "Ораторское мастерство для деловых людей" - }], - "episodes": [{ - "artist": "Дудки)", - "id": 456239643, - "owner_id": -189167851, - "title": "Дудки ФМ. Эфир из карантина. 18 марта. В студии: Карина, Артем и Кирилл", - "duration": 5109, - "is_explicit": true, - "track_code": "720a366ctv7p1TcWJeYot3FCylVodgw", - "url": "https://vk.com/rLA.jpg", - "date": 1585094676, - "lyrics_id": 446382744, - "no_search": 1, - "podcast_info": { - "cover": { - "sizes": [{ - "height": 640, - "url": "https://vk.com/rLA.jpg", - "type": "a", - "width": 640 - }, { - "height": 320, - "url": "https://vk.com/rLA.jpg", - "type": "c", - "width": 320 - }, { - "height": 160, - "url": "https://vk.com/rLA.jpg", - "type": "e", - "width": 160 - }, { - "height": 240, - "url": "https://vk.com/rLA.jpg", - "type": "b", - "width": 240 - }, { - "height": 120, - "url": "https://vk.com/rLA.jpg", - "type": "d", - "width": 120 - }, { - "height": 100, - "url": "https://vk.com/rLA.jpg", - "type": "f", - "width": 100 - }, { - "height": 50, - "url": "https://vk.com/rLA.jpg", - "type": "h", - "width": 50 - }, { - "height": 1400, - "url": "https://vk.com/rLA.jpg", - "type": "x", - "width": 1400 - }] - }, - "description": "Обсуждение вселенских тайн, новостей и каверзных вопросов. Интервью с экспертами и не только. А также, самая приятная музыка", - "plays": 4, - "position": 0 - } - }, { - "artist": "Дудки)", - "id": 456239749, - "owner_id": -189167851, - "title": "Дудки ФМ. Пасхальный выпуск", - "duration": 5795, - "is_explicit": true, - "track_code": "bf0311d1W4eqbNM3vU2wtzYhFBJ1q1E", - "url": "https://vk.com/rLA.jpg", - "date": 1587905611, - "lyrics_id": 447166129, - "no_search": 1, - "podcast_info": { - "cover": { - "sizes": [{ - "height": 640, - "url": "https://vk.com/rLA.jpg", - "type": "a", - "width": 640 - }, { - "height": 320, - "url": "https://vk.com/rLA.jpg", - "type": "c", - "width": 320 - }, { - "height": 160, - "url": "https://vk.com/rLA.jpg", - "type": "e", - "width": 160 - }, { - "height": 240, - "url": "https://vk.com/rLA.jpg", - "type": "b", - "width": 240 - }, { - "height": 120, - "url": "https://vk.com/rLA.jpg", - "type": "d", - "width": 120 - }, { - "height": 100, - "url": "https://vk.com/rLA.jpg", - "type": "f", - "width": 100 - }, { - "height": 50, - "url": "https://vk.com/rLA.jpg", - "type": "h", - "width": 50 - }, { - "height": 1400, - "url": "https://vk.com/rLA.jpg", - "type": "x", - "width": 1400 - }] - }, - "description": "Свежие, новые и в том числе пасхальные дудки, а также прямое включение Артема и Кирилла с гостями.", - "plays": 1, - "position": 0 - } - }], - "profiles": [], - "groups": [{ - "id": 189167851, - "name": "Дудки)", - "screen_name": "dudki_fm", - "is_closed": 0, - "type": "page", - "is_admin": 0, - "is_member": 0, - "is_advertiser": 0, - "members_count": 16, - "photo_50": "https://vk.com/rLA.jpg", - "photo_100": "https://vk.com/rLA.jpg", - "photo_200": "https://vk.com/rLA.jpg" - }, { - "id": 66891523, - "name": "Публичные выступления | Переговоры | Продажи", - "screen_name": "win_win_vrn", - "is_closed": 0, - "type": "group", - "is_admin": 0, - "is_member": 0, - "is_advertiser": 0, - "members_count": 2092, - "photo_50": "https://vk.com/rLA.jpg", - "photo_100": "https://vk.com/rLA.jpg", - "photo_200": "https://vk.com/rLA.jpg" - }] - } -} \ No newline at end of file diff --git a/VkNet.Tests/TestData/Categories/Podcasts/SearchPodcast.json b/VkNet.Tests/TestData/Categories/Podcasts/SearchPodcast.json new file mode 100644 index 000000000..e81353780 --- /dev/null +++ b/VkNet.Tests/TestData/Categories/Podcasts/SearchPodcast.json @@ -0,0 +1,225 @@ +{ + "response": { + "results_total": 32, + "podcasts": [ + { + "url": "https://vk.com/podcasts-163324735", + "owner_url": "https://vk.com/science_in_palm", + "title": "Наука в Ладошке", + "owner_name": "Наука в Ладошке", + "cover": { + "sizes": [ + { + "height": 640, + "type": "a", + "width": 640, + "url": "https://sun1-90.userapi.com/s/v1/ig2/yLH6gRpwFl4Nf7TI_5r2-mEqZRM__TaBPO1Y4osaqBgfavoCvcSGpF4sPAYaNr6-jC8riO7ZeOwDFaYop0wIgEKE.jpg?size=200x200&quality=95&crop=256,256,2048,2048&ava=1" + }, + { + "height": 320, + "type": "c", + "width": 320, + "url": "https://sun1-90.userapi.com/s/v1/ig2/5eZXDKf8A26Yl50PJYxoh7Y8oZIMtUh_G3FliS4O-DcO1qliZKf3Q1N8W-JEcnAru2J3Va0ao9vNKYkgEbNwsit-.jpg?size=200x200&quality=95&crop=460,460,1636,1636&ava=1" + }, + { + "height": 160, + "type": "e", + "width": 160, + "url": "https://sun1-90.userapi.com/s/v1/ig2/nOQe-82UabYSxn2eN-tGywqvG_vgQ3YOQ-ICDw9Zz3JDEjGIJg-4lYHWSx0W0mEi2D0VYo9cd5pa2DR7MiBhBqqB.jpg?size=50x50&quality=95&crop=460,460,1636,1636&ava=1" + }, + { + "height": 240, + "type": "b", + "width": 240, + "url": "https://sun1-90.userapi.com/s/v1/ig2/QakNfV2P5_dCVRyYSkz_RLg7owneRe5hyyvwYNLVIPrGs1LRbrUfQ36PSmsE9t0JEkKqi3GsCT4F_wqH537Dt-Gt.jpg?size=400x400&quality=95&crop=256,256,2048,2048&ava=1" + }, + { + "height": 120, + "type": "d", + "width": 120, + "url": "https://sun1-90.userapi.com/s/v1/ig2/ASgzRscoZr0OA4KmY1CGt9oR2_u0lkPnkcREsF1E03Ivwgk6_sPCfXA0y_zszb_JE_TNlC6gdKmpAoSAj7nHlWN8.jpg?size=100x100&quality=95&crop=460,460,1636,1636&ava=1" + } + ] + } + }, + { + "url": "https://vk.com/podcasts-190320587", + "owner_url": "https://vk.com/nauka_pro_rnd", + "title": "НаукаPRO", + "owner_name": "НаукаPRO", + "cover": { + "sizes": [ + { + "height": 640, + "type": "a", + "width": 640, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=640x640&quality=96&sign=fb3bbd8d0398f255a7b3d1ca23127898&c_uniq_tag=Urd4KlMeJ2X4IB9uw4qVyiUqMYHQ_-MoMuN6t7V4KBE&type=none" + }, + { + "height": 320, + "type": "c", + "width": 320, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=320x320&quality=96&sign=230702cbd398e3db31ddfabe3b7d4fac&c_uniq_tag=_cTkYMeXY1cy1Dwbb7jMefA1cunXa0L4TfEoY0DOdYg&type=none" + }, + { + "height": 160, + "type": "e", + "width": 160, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=160x160&quality=96&sign=4e01861a6c7fd46587fd9549ceedb5bd&c_uniq_tag=hGx0UdU9CboZJZrxJJT7YKG7SHRKOCObic4FbNm-6A8&type=none" + }, + { + "height": 240, + "type": "b", + "width": 240, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=240x240&quality=96&sign=68bf3f06a2415fefe3960be87bf0d65c&c_uniq_tag=0RH_IBzdg7wUHOh_Xy5-pK0PPCvA4ZdoMVFdHh7PtCU&type=none" + }, + { + "height": 120, + "type": "d", + "width": 120, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=120x120&quality=96&sign=45d0c0e5765c7aa1794bfdaa57c01d17&c_uniq_tag=9RHfeqki17xCq6CJexkNOabrFFWtvVkcgRPxa0172Mk&type=none" + }, + { + "height": 100, + "type": "f", + "width": 100, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=100x100&quality=96&sign=900089201afa47daeca5189e0f6459f0&c_uniq_tag=kDTAK6qYQcLKK-jqPSzbn2jgnfp4sgSH--P6JC-vRtI&type=none" + }, + { + "height": 50, + "type": "h", + "width": 50, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=50x50&quality=96&sign=13674bc85b86d2fa66209551cf1b0856&c_uniq_tag=H9KvfOUiipSgOG8jSuSGteyEHHFIkifySClcH8QNEsI&type=none" + }, + { + "height": 1400, + "type": "x", + "width": 1400, + "url": "https://sun1-14.userapi.com/impf/cpdVUwl65nVpDC85vqpPMUNDLZX6E5Y_98mnnw/bYCtNYB59ks.jpg?size=1400x1400&quality=96&sign=1f629fd6b22686ce6062a9b76337138d&c_uniq_tag=RZWe2CfZVbUH90coWYQdHmGjkjNyjrxmjMlZ23-N3IU&type=none" + } + ] + } + }, + { + "url": "https://vk.com/podcasts-75841096", + "owner_url": "https://vk.com/beardycast", + "title": "BeardyCast: проект об IT, науке и спорте", + "owner_name": "BeardyCast: проект об IT, науке и спорте", + "cover": { + "sizes": [ + { + "height": 640, + "type": "a", + "width": 640, + "url": "https://sun1-27.userapi.com/s/v1/if1/UfxhFR30CviQrMPe9vtOPZL3ElSf8TVwSPk6Trdx4xCCdlMBNM_sPuvOFshAPm5LNoY8xOFw.jpg?size=200x200&quality=96&crop=432,0,512,512&ava=1" + }, + { + "height": 320, + "type": "c", + "width": 320, + "url": "https://sun1-27.userapi.com/s/v1/if1/BmMnVvtVvuzjYgeJxUr697R-DCRKxwOExq4AsbvATjnIH6YL3jxIWhHANBS-zzF9Lk7f18Tr.jpg?size=200x200&quality=96&crop=432,0,511,511&ava=1" + }, + { + "height": 160, + "type": "e", + "width": 160, + "url": "https://sun1-27.userapi.com/s/v1/if1/EiZAkOd4T60prnprl4PHiRTfyBRgCohDFIja_tm-0ZkUf_CmUXMOFU37v5w-mZGRdmQ0eds2.jpg?size=50x50&quality=96&crop=432,0,511,511&ava=1" + }, + { + "height": 240, + "type": "b", + "width": 240, + "url": "https://sun1-27.userapi.com/s/v1/if1/o0FXy9v0UNbpEqQL3hF8vRZ-sWaUDU-aZ3Oo2CHIz6s8USWAjxBdy6RkzAtjqM8PgFDdXlUK.jpg?size=400x400&quality=96&crop=432,0,512,512&ava=1" + }, + { + "height": 120, + "type": "d", + "width": 120, + "url": "https://sun1-27.userapi.com/s/v1/if1/OJ8UwhvOSgQ4BFqlD0TQwWGWZDeWiAxOCGYuQzEVXkK3iPkRZKFEN0wbMz0N6VXv_etoC_zG.jpg?size=100x100&quality=96&crop=432,0,511,511&ava=1" + } + ] + } + }, + { + "url": "https://vk.com/podcasts-27737784", + "owner_url": "https://vk.com/tv_nauka", + "title": "Телеканал Наука", + "owner_name": "Телеканал Наука", + "cover": { + "sizes": [ + { + "height": 640, + "type": "a", + "width": 640, + "url": "https://sun1-83.userapi.com/s/v1/ig2/CtonWjIgj6Cmg9zU1_L105qCh-jbnDfG3RFAly_EeX0m3OTst23fUuhwLujgJcwooBZ1Esa98CkpBbqSFqo1jIa5.jpg?size=200x200&quality=95&crop=0,0,1080,1080&ava=1" + }, + { + "height": 320, + "type": "c", + "width": 320, + "url": "https://sun1-83.userapi.com/s/v1/ig2/CtonWjIgj6Cmg9zU1_L105qCh-jbnDfG3RFAly_EeX0m3OTst23fUuhwLujgJcwooBZ1Esa98CkpBbqSFqo1jIa5.jpg?size=200x200&quality=95&crop=0,0,1080,1080&ava=1" + }, + { + "height": 160, + "type": "e", + "width": 160, + "url": "https://sun1-83.userapi.com/s/v1/ig2/mSODeldtIMmRiy_PLtLX5PRLzbqIz7dr5tlZmf-zxcX1LcTf6sFNn2m1slaeEJnKNNBoRPdxpKqq51MQP_awj0jk.jpg?size=50x50&quality=95&crop=0,0,1080,1080&ava=1" + }, + { + "height": 240, + "type": "b", + "width": 240, + "url": "https://sun1-83.userapi.com/s/v1/ig2/-mxjbILts96RKsrvuu6NYosiH5dqBK9gO8sLJx-Ro7lwi_sso129HvmbT4UeF2rBZ8Okrmr5viYn_nupyv-GdxDc.jpg?size=400x400&quality=95&crop=0,0,1080,1080&ava=1" + }, + { + "height": 120, + "type": "d", + "width": 120, + "url": "https://sun1-83.userapi.com/s/v1/ig2/-v10RAQ8ikmeBJhxX4g_h22qWzymG5rG65FJOCGKo3j9ToCtbZe8qfC2OwxceaBT21gybjNr6AYuYORhKUfNLWic.jpg?size=100x100&quality=95&crop=0,0,1080,1080&ava=1" + } + ] + } + }, + { + "url": "https://vk.com/podcasts-164600772", + "owner_url": "https://vk.com/noosphere_studio", + "title": "Noosphere Studio | Наука", + "owner_name": "Noosphere Studio | Наука", + "cover": { + "sizes": [ + { + "height": 640, + "type": "a", + "width": 640, + "url": "https://sun1-57.userapi.com/s/v1/ig2/tOG20S7CzRIGKub_i3bD-Mz3a1bGioAHozxK6gmO_axb8ApIYN7bWX2qs_O__a1QOcLJkmhmQSM1PkS7emV2o9PG.jpg?size=200x200&quality=96&crop=0,0,1625,1626&ava=1" + }, + { + "height": 320, + "type": "c", + "width": 320, + "url": "https://sun1-57.userapi.com/s/v1/ig2/_Pb5za4wdvZ25Kd7i17qhIRlALuv5UJaOmjOLXbQ_85V8uUotCuoeNzwpZ-7irVQ9ObctolYIN6Q5KFq9djuFZU1.jpg?size=200x200&quality=96&crop=16,16,1585,1585&ava=1" + }, + { + "height": 160, + "type": "e", + "width": 160, + "url": "https://sun1-57.userapi.com/s/v1/ig2/64JBcIkqViN8rAarcpIK9OAsRXT-PBqD15bPTScLo0jwfbJLrwQwABgOdFRcVOyg1LFoUQeOHnVKvqP1pfslOr4H.jpg?size=50x50&quality=96&crop=16,16,1585,1585&ava=1" + }, + { + "height": 240, + "type": "b", + "width": 240, + "url": "https://sun1-57.userapi.com/s/v1/ig2/dTcVymjQ9334WiAf0GkkgCEy_WNJxxieTCiR9E0mZbR3R3SzLbFXGPtP6bsCUHxuRVcfz2iCypTnIN_vTixzGp3h.jpg?size=400x400&quality=96&crop=0,0,1625,1626&ava=1" + }, + { + "height": 120, + "type": "d", + "width": 120, + "url": "https://sun1-57.userapi.com/s/v1/ig2/_tUKCkuveK4M1bYOPYrKCGgvIsOaXyPrjMs9J2qfa2GZCd9EfJ6x04quDYneidQREsNINqBCm7Li-0tWa8FFf3x3.jpg?size=100x100&quality=96&crop=16,16,1585,1585&ava=1" + } + ] + } + } + ] + } +} \ No newline at end of file diff --git a/VkNet/Abstractions/Category/Async/IPodcastsCategoryAsync.cs b/VkNet/Abstractions/Category/Async/IPodcastsCategoryAsync.cs index 7d3c8302f..652cfd48e 100644 --- a/VkNet/Abstractions/Category/Async/IPodcastsCategoryAsync.cs +++ b/VkNet/Abstractions/Category/Async/IPodcastsCategoryAsync.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; using VkNet.Model; @@ -20,6 +21,7 @@ public interface IPodcastsCategoryAsync /// /// Страница документации ВКонтакте https://vk.com/dev/podcasts.clearRecentSearches /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] Task ClearRecentSearchesAsync(CancellationToken token = default); /// @@ -32,6 +34,7 @@ public interface IPodcastsCategoryAsync /// /// Страница документации ВКонтакте https://vk.com/dev/podcasts.getPopular /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] Task> GetPopularAsync(CancellationToken token = default); /// @@ -44,6 +47,7 @@ public interface IPodcastsCategoryAsync /// /// Страница документации ВКонтакте https://vk.com/dev/podcasts.getRecentSearchRequests /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] Task> GetRecentSearchRequestsAsync(CancellationToken token = default); /// @@ -55,8 +59,8 @@ public interface IPodcastsCategoryAsync /// Результат поиска /// /// - /// Страница документации ВКонтакте https://vk.com/dev/podcasts.search + /// Страница документации ВКонтакте https://vk.com/dev/podcasts.searchPodcast /// - Task SearchAsync(PodcastsSearchParams @params, + Task SearchPodcastAsync(PodcastsSearchParams @params, CancellationToken token = default); } \ No newline at end of file diff --git a/VkNet/Abstractions/Category/IPodcastsCategory.cs b/VkNet/Abstractions/Category/IPodcastsCategory.cs index 01c01c923..102a8bc98 100644 --- a/VkNet/Abstractions/Category/IPodcastsCategory.cs +++ b/VkNet/Abstractions/Category/IPodcastsCategory.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using VkNet.Model; namespace VkNet.Abstractions; @@ -7,14 +8,17 @@ namespace VkNet.Abstractions; public interface IPodcastsCategory : IPodcastsCategoryAsync { /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] bool ClearRecentSearches(); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] ReadOnlyCollection GetPopular(); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] ReadOnlyCollection GetRecentSearchRequests(); - /// - PodcastsSearchResult Search(PodcastsSearchParams @params); + /// + PodcastsSearchResult SearchPodcast(PodcastsSearchParams @params); } \ No newline at end of file diff --git a/VkNet/Categories/Async/PodcastsCategoryAsync.cs b/VkNet/Categories/Async/PodcastsCategoryAsync.cs index f30f69e84..9fd57e10d 100644 --- a/VkNet/Categories/Async/PodcastsCategoryAsync.cs +++ b/VkNet/Categories/Async/PodcastsCategoryAsync.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; using VkNet.Model; @@ -10,20 +11,23 @@ namespace VkNet.Categories; public partial class PodcastsCategory { /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public Task ClearRecentSearchesAsync(CancellationToken token = default) => TypeHelper.TryInvokeMethodAsync(ClearRecentSearches, token); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public Task> GetPopularAsync(CancellationToken token = default) => TypeHelper.TryInvokeMethodAsync(GetPopular, token); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public Task> GetRecentSearchRequestsAsync(CancellationToken token = default) => TypeHelper.TryInvokeMethodAsync(GetRecentSearchRequests, token); /// - public Task SearchAsync(PodcastsSearchParams @params, + public Task SearchPodcastAsync(PodcastsSearchParams @params, CancellationToken token = default) => TypeHelper.TryInvokeMethodAsync(() => - Search(@params), token); + SearchPodcast(@params), token); } \ No newline at end of file diff --git a/VkNet/Categories/PodcastsCategory.cs b/VkNet/Categories/PodcastsCategory.cs index ea7b1e469..2478ccf80 100644 --- a/VkNet/Categories/PodcastsCategory.cs +++ b/VkNet/Categories/PodcastsCategory.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using VkNet.Abstractions; using VkNet.Model; using VkNet.Utils; @@ -20,18 +21,21 @@ public partial class PodcastsCategory : IPodcastsCategory public PodcastsCategory(IVkApiInvoke vk) => _vk = vk; /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public bool ClearRecentSearches() => _vk.Call("podcasts.clearRecentSearches", VkParameters.Empty); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public ReadOnlyCollection GetPopular() => _vk.Call>("podcasts.getPopular", VkParameters.Empty); /// + [Obsolete("This method is deprecated. Use SearchPodcast method for work with podcast")] public ReadOnlyCollection GetRecentSearchRequests() => _vk.Call>("podcasts.getRecentSearchRequests", VkParameters.Empty); /// - public PodcastsSearchResult Search(PodcastsSearchParams @params) => _vk.Call("podcasts.search", new() + public PodcastsSearchResult SearchPodcast(PodcastsSearchParams @params) => _vk.Call("podcasts.searchPodcast", new() { { "search_string", @params.SearchString diff --git a/VkNet/Model/Results/Podcasts/PodcastSearchInfo.cs b/VkNet/Model/Results/Podcasts/PodcastSearchInfo.cs new file mode 100644 index 000000000..e03c29c92 --- /dev/null +++ b/VkNet/Model/Results/Podcasts/PodcastSearchInfo.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace VkNet.Model +{ + /// + /// Базовая информация о подкасте выданная поисковиком + /// + [Serializable] + public class PodcastSearchInfo + { + /// + /// URL адрес подкаста + /// + [JsonProperty("url")] + public string Url { get; set; } + + /// + /// URL владельца подкаста + /// + [JsonProperty("owner_url")] + public string OwnerUrl { get; set; } + + /// + /// Название подкаста + /// + [JsonProperty("title")] + public string Title { get; set; } + + /// + /// Имя владельца подкаста + /// + [JsonProperty("owner_name")] + public string OwnerName { get; set; } + + /// + /// Коллекция логотипов подкаста + /// + [JsonProperty("cover")] + public Cover Covers { get; set; } + } +} diff --git a/VkNet/Model/Results/Podcasts/PodcastsSearchResult.cs b/VkNet/Model/Results/Podcasts/PodcastsSearchResult.cs index c1ba8d530..a6c43485f 100644 --- a/VkNet/Model/Results/Podcasts/PodcastsSearchResult.cs +++ b/VkNet/Model/Results/Podcasts/PodcastsSearchResult.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.ObjectModel; using Newtonsoft.Json; @@ -11,26 +11,13 @@ namespace VkNet.Model; public class PodcastsSearchResult { /// - /// Подкасты. + /// Количество найденных подкастов /// - [JsonProperty("podcasts")] - public ReadOnlyCollection Podcasts { get; set; } - - /// - /// Эпизоды. - /// - [JsonProperty("episodes")] - public ReadOnlyCollection Episodes { get; set; } - + [JsonProperty("results_total")] + public ulong ResultsTotal { get; set; } /// - /// Профили. + /// Информация о подкасте, выданная поиском /// - [JsonProperty("profiles")] - public ReadOnlyCollection Profiles { get; set; } - - /// - /// Группы. - /// - [JsonProperty("groups")] - public ReadOnlyCollection Groups { get; set; } + [JsonProperty("podcasts")] + public ReadOnlyCollection Podcasts { get; set; } } \ No newline at end of file