-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
VkNet/Abstractions/Category/Async/IShortVideoCategoryAsync.cs
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,31 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using VkNet.Model; | ||
|
||
namespace VkNet.Abstractions; | ||
|
||
/// <summary> | ||
/// ShortVideo В этой секции представлены методы, | ||
/// предназначенные для работы с Клипами | ||
/// </summary> | ||
public interface IShortVideoCategoryAsync | ||
{ | ||
/// <summary> | ||
/// Получает ссылку для загрузки Клипа | ||
/// </summary> | ||
/// <param name="description">Описание клипа</param> | ||
/// <param name="token">Токен отмены</param> | ||
/// <param name="fileSize">Размер файла в КБ, если файл меньше 16384 кб, то указывать не обязательно</param> | ||
/// <param name="groupId">ID группы, если нужно выкладывать от имени группы</param> | ||
/// <param name="wallPost">Нужно ли выкладывать клип на стену</param> | ||
/// <returns> | ||
/// </returns> | ||
/// <remarks> | ||
/// Страница документации ВКонтакте http://vk.com/dev/shortVideo.create | ||
/// </remarks> | ||
Task<ShortVideoUploadServer> CreateAsync(string description, | ||
ulong fileSize = 16384, | ||
long? groupId = null, | ||
bool? wallPost = null, | ||
CancellationToken token = default); | ||
} |
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,13 @@ | ||
using VkNet.Model; | ||
|
||
namespace VkNet.Abstractions; | ||
|
||
/// <inheritdoc cref="IShortVideoCategoryAsync"/> | ||
public interface IShortVideoCategory : IShortVideoCategoryAsync | ||
{ | ||
/// <inheritdoc cref="IShortVideoCategoryAsync.CreateAsync"/> | ||
ShortVideoUploadServer Create(string description, | ||
ulong fileSize = 16384, | ||
long? groupId = null, | ||
bool? wallPost = null); | ||
} |
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,19 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using VkNet.Model; | ||
using VkNet.Utils; | ||
|
||
namespace VkNet.Categories; | ||
|
||
/// <inheritdoc /> | ||
public partial class ShortVideoCategory | ||
{ | ||
/// <inheritdoc/> | ||
public Task<ShortVideoUploadServer> CreateAsync(string description, | ||
ulong fileSize = 16384, | ||
long? groupId = null, | ||
bool? wallPost = null, | ||
CancellationToken token = default) => | ||
TypeHelper.TryInvokeMethodAsync(() => | ||
Create(description, fileSize, groupId, wallPost), token); | ||
} |
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,40 @@ | ||
using VkNet.Abstractions; | ||
using VkNet.Model; | ||
|
||
namespace VkNet.Categories; | ||
|
||
/// <inheritdoc /> | ||
public partial class ShortVideoCategory : IShortVideoCategory | ||
{ | ||
/// <summary> | ||
/// API. | ||
/// </summary> | ||
private readonly IVkApiInvoke _vk; | ||
|
||
/// <summary> | ||
/// api vk.com | ||
/// </summary> | ||
/// <param name="vk"> API. </param> | ||
public ShortVideoCategory(IVkApiInvoke vk) => _vk = vk; | ||
|
||
/// <inheritdoc/> | ||
public ShortVideoUploadServer Create(string description, | ||
ulong fileSize = 16384, | ||
long? groupId = null, | ||
bool? wallPost = null) => _vk.Call<ShortVideoUploadServer>("shortVideo.create", | ||
new() | ||
{ | ||
{ | ||
"group_id", groupId | ||
}, | ||
{ | ||
"description", description | ||
}, | ||
{ | ||
"wall_post", wallPost | ||
}, | ||
{ | ||
"file_size", fileSize | ||
} | ||
}); | ||
} |
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,29 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
|
||
namespace VkNet.Model; | ||
|
||
/// <summary> | ||
/// Результат метода ShortVideo.Create | ||
/// </summary> | ||
[Serializable] | ||
public class ShortVideoUploadServer | ||
{ | ||
/// <summary> | ||
/// Адрес для загрузки Клипа | ||
/// </summary> | ||
[JsonProperty("upload_url")] | ||
public Uri UploadUrl { get; set; } | ||
|
||
/// <summary> | ||
/// Идентификатор владельца Клипа | ||
/// </summary> | ||
[JsonProperty("owner_id")] | ||
public long? OwnerId { get; set; } | ||
|
||
/// <summary> | ||
/// Идентификатор Клипа | ||
/// </summary> | ||
[JsonProperty("video_id")] | ||
public long? VideoId { get; set; } | ||
} |
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