Skip to content

Commit

Permalink
Sync method market.edit with actual api version (#1584)
Browse files Browse the repository at this point in the history
## List of changes
- added fields *video_ids*, *variant_ids*, *is_main_variant* to
*MarketProductParams* model
- Rebuild order of argumets in method *edit* according api documentation

### Warning
Cannot add test data for this method, cause need to have market with
admin rights

### Sources

[Source of method](https://dev.vk.com/ru/method/market.edit)

Bound with issue #1222

Co-authored-by: inyutin-maxim <inyutin_maxim@mail.ru>
  • Loading branch information
Rahovski and inyutin-maxim authored Sep 11, 2023
1 parent e00262b commit c0d25a6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 18 deletions.
37 changes: 20 additions & 17 deletions VkNet/Categories/MarketsCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,56 +385,59 @@ public long Add(MarketProductParams @params) => _vk.Call("market.add",
})[key: "market_item_id"];

/// <inheritdoc />
public bool Edit(MarketProductParams editParams) => _vk.Call<bool>("market.edit",
public bool Edit(MarketProductParams @params) => _vk.Call<bool>("market.edit",
new()
{
{
"owner_id", editParams.OwnerId
"owner_id", @params.OwnerId
},
{
"item_id", editParams.ItemId
"item_id", @params.ItemId
},
{
"name", editParams.Name
"name", @params.Name
},
{
"description", editParams.Description
"description", @params.Description
},
{
"url", editParams.Url
"category_id", @params.CategoryId
},
{
"sku", editParams.Sku
"price", @params.Price
},
{
"old_price", @params.OldPrice
},
{
"category_id", editParams.CategoryId
"deleted", @params.Deleted
},
{
"price", editParams.Price
"main_photo_id", @params.MainPhotoId
},
{
"old_price", editParams.OldPrice
"photo_ids", @params.PhotoIds
},
{
"deleted", editParams.Deleted
"video_ids", @params.VideoIds
},
{
"main_photo_id", editParams.MainPhotoId
"url", @params.Url
},
{
"photo_ids", editParams.PhotoIds
"sku", @params.Sku
},
{
"dimension_width", editParams.DimensionWidth
"dimension_width", @params.DimensionWidth
},
{
"dimension_height", editParams.DimensionHeight
"dimension_height", @params.DimensionHeight
},
{
"dimension_length", editParams.DimensionLength
"dimension_length", @params.DimensionLength
},
{
"weight", editParams.Weight
"weight", @params.Weight
}
});

Expand Down
25 changes: 24 additions & 1 deletion VkNet/Model/RequestParams/Market/MarketProductParams.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using VkNet.Abstractions;
Expand Down Expand Up @@ -96,6 +96,14 @@ public class MarketProductParams
[JsonProperty("photo_ids")]
public IEnumerable<long> PhotoIds { get; set; }

/// <summary>
/// Идентификаторы видео товара.
/// Видео должно быть загружено в сообщество и быть доступным для просмотра, в UI отображается только один элемент.
/// <see xlink="https://dev.vk.com/ru/api/upload/photo-in-market#%D0%9E%D1%82%D0%B2%D0%B5%D1%82"/>
/// </summary>
[JsonProperty("video_ids")]
public IEnumerable<long> VideoIds { get; set; }

/// <summary>
/// Ссылка на сайт товара.
/// </summary>
Expand All @@ -105,6 +113,21 @@ public class MarketProductParams
[JsonProperty("url")]
public Uri Url { get; set; }

/// <summary>
/// Список id вариантов свойств товаров.
/// Не более 2 значений разных свойств.
/// Если товар уже в группе, порядок свойств всех товаров группы должен совпадать,
/// а набор свойств должен быть уникален для каждого товара.
/// </summary>
[JsonProperty("variant_ids")]
public IEnumerable<long> VariantIds { get; set}

Check failure on line 123 in VkNet/Model/RequestParams/Market/MarketProductParams.cs

View workflow job for this annotation

GitHub Actions / build

{ or ; or => expected

/// <summary>
/// Признак, является ли товар главным в своей группе.
/// </summary>
[JsonProperty("is_main_variant")]
public bool IsMainVariant { get; set; }

/// <summary>
/// Ширина в миллиметрах.
/// </summary>
Expand Down

0 comments on commit c0d25a6

Please sign in to comment.