Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync method market.edit with actual api version #1584

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}

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

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