-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fields for method "market.get" (#1580)
## List of changes - added support for new fields of method *[market.get](https://dev.vk.com/ru/method/market.get)* - date_from, date_to, need_variants, with_disabled - added model *MarketGetParams* for wrap arguments for method *market.get* - added unit test and test data for thid method [Source of args](https://dev.vk.com/ru/method/market.get) Bound with issue #1222 --------- Co-authored-by: inyutin-maxim <[email protected]>
- Loading branch information
1 parent
cde6328
commit 2796c74
Showing
7 changed files
with
271 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using FluentAssertions; | ||
using System.Reflection; | ||
using VkNet.Tests.Infrastructure; | ||
using Xunit; | ||
|
||
namespace VkNet.Tests.Categories.Market | ||
{ | ||
public class MarketGetTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "Market"; | ||
|
||
[Fact] | ||
public void MarketGet() | ||
{ | ||
Url = "https://api.vk.com/method/market.get"; | ||
|
||
ReadCategoryJsonPath(nameof(Api.Markets.Get)); | ||
|
||
var result = Api.Markets.Get(new() | ||
{ | ||
OwnerId = -85689507, | ||
Count = 2, | ||
Offset = 0, | ||
DateFrom = "10.08.2022", | ||
DateTo = "10.06.2023" | ||
}); | ||
|
||
result.Should(). | ||
NotBeNull(); | ||
|
||
result.Count. | ||
Should(). | ||
Be(2); | ||
|
||
result[0].Title. | ||
Should(). | ||
Be("Жетон Bronze"); | ||
|
||
result[0].Price. | ||
Amount. | ||
Should(). | ||
Be(89000); | ||
|
||
result[0].Category. | ||
Name. | ||
Should(). | ||
Be("Кошельки, ключницы и брелки"); | ||
|
||
result[0].Category. | ||
Section. | ||
Name. | ||
Should(). | ||
Be("Гардероб"); | ||
|
||
result[1].Title. | ||
Should(). | ||
Be("Жетон Black"); | ||
|
||
result[1].Price. | ||
Amount. | ||
Should(). | ||
Be(89000); | ||
|
||
result[1].Description. | ||
Should(). | ||
Be("Брендированный жетон в расцветке Black"); | ||
|
||
result[1].OwnerId. | ||
Should(). | ||
Be(-85689507); | ||
} | ||
} | ||
} |
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,73 @@ | ||
{ | ||
"response": { | ||
"count": 18, | ||
"items": [ | ||
{ | ||
"availability": 0, | ||
"category": { | ||
"id": 40105, | ||
"name": "Кошельки, ключницы и брелки", | ||
"section": { | ||
"id": 10000, | ||
"name": "Гардероб" | ||
} | ||
}, | ||
"description": "Брендированный жетон в расцветке Bronze", | ||
"id": 6148970, | ||
"owner_id": -85689507, | ||
"price": { | ||
"amount": "89000", | ||
"currency": { | ||
"id": 643, | ||
"name": "RUB", | ||
"title": "₽" | ||
}, | ||
"text": "890 ₽" | ||
}, | ||
"title": "Жетон Bronze", | ||
"is_owner": false, | ||
"is_adult": false, | ||
"thumb_photo": "https://sun6-23.userapi.com/impg/ylLImplvcmF0omQmzaenCERHGvW4DKGPb26kEw/45ids_vcpKY.jpg?crop=0,0.125,1,0.75&size=400x0&quality=95&sign=63cdf689f65863d29bd1b59d22a28d8a&c_uniq_tag=2b7ctR3uLfKgLuyMMK2DLEpDeUzLLnavkx6vHEvV3BM", | ||
"cart_quantity": 0, | ||
"item_rating": { | ||
"rating": 0, | ||
"reviews_count": 0, | ||
"reviews_count_text": "Нет отзывов" | ||
} | ||
}, | ||
{ | ||
"availability": 0, | ||
"category": { | ||
"id": 40105, | ||
"name": "Кошельки, ключницы и брелки", | ||
"section": { | ||
"id": 10000, | ||
"name": "Гардероб" | ||
} | ||
}, | ||
"description": "Брендированный жетон в расцветке Black", | ||
"id": 6148964, | ||
"owner_id": -85689507, | ||
"price": { | ||
"amount": "89000", | ||
"currency": { | ||
"id": 643, | ||
"name": "RUB", | ||
"title": "₽" | ||
}, | ||
"text": "890 ₽" | ||
}, | ||
"title": "Жетон Black", | ||
"is_owner": false, | ||
"is_adult": false, | ||
"thumb_photo": "https://sun6-22.userapi.com/impg/Io4mIHuLZ0C_fdUcDk8YKOBz0yXu2ZjwmldSoQ/qPnb13rLpr4.jpg?crop=0,0.125,1,0.75&size=400x0&quality=95&sign=2a92edc192a4cc5d36648741934d6656&c_uniq_tag=XDmXPyLGFJFhdhuEz1CqYHRRsJlHFVBxYaCxl8n9icU", | ||
"cart_quantity": 0, | ||
"item_rating": { | ||
"rating": 0, | ||
"reviews_count": 0, | ||
"reviews_count_text": "Нет отзывов" | ||
} | ||
} | ||
] | ||
} | ||
} |
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
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,62 @@ | ||
using HtmlAgilityPack; | ||
using System; | ||
|
||
namespace VkNet.Model | ||
{ | ||
/// <summary> | ||
/// Параметры для запроса market.get | ||
/// </summary> | ||
[Serializable] | ||
public class MarketGetParams | ||
{ | ||
/// <summary> | ||
/// Идентификатор сообщества, которому принадлежат товары. | ||
/// </summary> | ||
public long? OwnerId { get; set; } | ||
|
||
/// <summary> | ||
/// Идентификатор подборки, товары из которой нужно вернуть. | ||
/// </summary> | ||
public long? AlbumId { get; set; } | ||
|
||
/// <summary> | ||
/// Количество возвращаемых товаров. | ||
/// </summary> | ||
public long? Count { get; set; } | ||
|
||
/// <summary> | ||
/// Смещение относительно первого найденного товара для выборки определенного | ||
/// подмножества. | ||
/// </summary> | ||
public long? Offset { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// 1 - чтобы вернуть доп.поля likes, can_comment, can_repost, photos, views_count. | ||
/// По умолчанию 0 | ||
/// </summary> | ||
public bool? Extended { get; set; } | ||
|
||
/// <summary> | ||
/// Параметр для сортировки выгрузки товаров, загруженных с определенной даты | ||
/// DateFrom - строка вида dd.MM.yyyy или dd.MM(год текущий по умолчанию) | ||
/// </summary> | ||
public string DateFrom { get; set; } | ||
|
||
/// <summary> | ||
/// Параметр для сортировки выгрузки товаров, загруженных до определенной даты | ||
/// DateTo - строка вида dd.MM.yyyy или dd.MM(год текущий по умолчанию) | ||
/// </summary> | ||
public string DateTo { get; set; } | ||
|
||
/// <summary> | ||
/// Флаг для получения вариантов одного товара,если они существуют | ||
/// </summary> | ||
public bool? NeedVariants { get; set; } | ||
|
||
/// <summary> | ||
/// Флаг для получения выведденых товаров с продажи | ||
/// </summary> | ||
public bool? WithDisabled { get; set; } | ||
}; | ||
} |