mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 14:04:32 +08:00
feat(wxapi): 新增草稿箱相关接口
This commit is contained in:
parent
c935b72e17
commit
6b693ea2b8
@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
{
|
||||
public static class WechatApiClientExecuteCgibinDraftExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/add 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftAddResponse> ExecuteCgibinDraftAddAsync(this WechatApiClient client, Models.CgibinDraftAddRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "add")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftAddResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/get 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftGetResponse> ExecuteCgibinDraftGetAsync(this WechatApiClient client, Models.CgibinDraftGetRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/delete 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Delete_draft.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftDeleteResponse> ExecuteCgibinDraftDeleteAsync(this WechatApiClient client, Models.CgibinDraftDeleteRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "delete")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/update 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Update_draft.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftUpdateResponse> ExecuteCgibinDraftUpdateAsync(this WechatApiClient client, Models.CgibinDraftUpdateRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "update")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftUpdateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /cgi-bin/draft/count 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Count_drafts.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftCountResponse> ExecuteCgibinDraftCountAsync(this WechatApiClient client, Models.CgibinDraftCountRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Get, "cgi-bin", "draft", "count")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftCountResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/batchget 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Get_draft_list.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftBatchGetResponse> ExecuteCgibinDraftBatchGetAsync(this WechatApiClient client, Models.CgibinDraftBatchGetRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "batchget")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftBatchGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/draft/switch 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Temporary_MP_Switch.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinDraftSwitchResponse> ExecuteCgibinDraftSwitchAsync(this WechatApiClient client, Models.CgibinDraftSwitchRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "draft", "switch")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (request.OnlyCheck != null)
|
||||
flurlReq.SetQueryParam("checkonly", request.OnlyCheck.Value ? 1 : 0);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinDraftSwitchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/add 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftAddRequest : WechatApiRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Article
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息缩略图媒体文件标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("thumb_media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("thumb_media_id")]
|
||||
public string ThumbnailMediaId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息作者。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("author")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("author")]
|
||||
public string? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息摘要。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("digest")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("digest")]
|
||||
public string? Digest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息阅读原文 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content_source_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content_source_url")]
|
||||
public string? ContentSourceUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息页面的内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否显示封面。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("show_cover_pic")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("show_cover_pic")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsShowCover { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否打开评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("need_open_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("need_open_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOpenComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否粉丝才可评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("only_fans_can_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("only_fans_can_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOnlyFansCanComment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("articles")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("articles")]
|
||||
public IList<Types.Article> ArticleList { get; set; } = new List<Types.Article>();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/add 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftAddResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置草稿的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string MediaId { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/batchget 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftBatchGetRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("offset")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("offset")]
|
||||
public int Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("count")]
|
||||
public int Limit { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否不返回内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("no_content")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("no_content")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? RequireNoContent { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/batchget 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftBatchGetResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Draft
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Content
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Article : CgibinDraftGetResponse.Types.Article
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿图文消息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("news_item")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("news_item")]
|
||||
public Types.Article[] ArticleList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string MediaId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public Types.Content? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置修改时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("update_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
|
||||
public long UpdateTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置创建时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("item")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("item")]
|
||||
public Types.Draft[] DraftList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置本次草稿数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("item_count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("item_count")]
|
||||
public int DraftCount { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿总数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total_count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
|
||||
public int TotalCount { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/draft/count 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftCountRequest : WechatApiRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/draft/count 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftCountResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置草稿总数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total_count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/delete 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftDeleteRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置草稿的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string Media { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/delete 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftDeleteResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftGetRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string Media { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftGetResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Article
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息缩略图的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("thumb_media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("thumb_media_id")]
|
||||
public string ThumbnailMediaId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息作者。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("author")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("author")]
|
||||
public string Author { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息摘要。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("digest")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("digest")]
|
||||
public string Digest { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息阅读原文 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content_source_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content_source_url")]
|
||||
public string ContentSourceUrl { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息页面的内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息页面的 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string Url { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否显示封面。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("show_cover_pic")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("show_cover_pic")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
|
||||
public bool IsShowCover { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否打开评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("need_open_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("need_open_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOpenComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否粉丝才可评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("only_fans_can_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("only_fans_can_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOnlyFansCanComment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("news_item")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("news_item")]
|
||||
public Types.Article[] ArticleList { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/switch 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftSwitchRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否只检查状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool? OnlyCheck { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/switch 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftSwitchResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启草稿箱功能。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_open")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_open")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
|
||||
public bool IsOpen { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/update 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftUpdateRequest : WechatApiRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Article
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息缩略图的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("thumb_media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("thumb_media_id")]
|
||||
public string ThumbnailMediaId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息作者。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("author")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("author")]
|
||||
public string? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息摘要。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("digest")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("digest")]
|
||||
public string? Digest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息阅读原文 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content_source_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content_source_url")]
|
||||
public string? ContentSourceUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息页面的内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否显示封面。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("show_cover_pic")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("show_cover_pic")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsShowCover { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否打开评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("need_open_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("need_open_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOpenComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否粉丝才可评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("only_fans_can_comment")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("only_fans_can_comment")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
|
||||
public bool? IsOnlyFansCanComment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置草稿的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string Media { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要更新的文章在草稿中的位置(从 0 开始)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("index")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("index")]
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要更新的图文消息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("articles")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("articles")]
|
||||
public Types.Article Article { get; set; } = new Types.Article();
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/draft/update 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinDraftUpdateResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"articles": [
|
||||
{
|
||||
"title": "TITLE",
|
||||
"author": "AUTHOR",
|
||||
"digest": "DIGEST",
|
||||
"content": "CONTENT",
|
||||
"content_source_url": "CONTENT_SOURCE_URL",
|
||||
"thumb_media_id": "THUMB_MEDIA_ID",
|
||||
"show_cover_pic": 1,
|
||||
"need_open_comment": 0,
|
||||
"only_fans_can_comment": 0
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"media_id": "MEDIA_ID"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"offset": 0,
|
||||
"count": 0,
|
||||
"no_content": 0
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
"total_count": 0,
|
||||
"item_count": 0,
|
||||
"item": [
|
||||
{
|
||||
"media_id": "MEDIA_ID",
|
||||
"content": {
|
||||
"news_item": [
|
||||
{
|
||||
"title": "TITLE",
|
||||
"author": "AUTHOR",
|
||||
"digest": "DIGEST",
|
||||
"content": "CONTENT",
|
||||
"content_source_url": "CONTENT_SOURCE_URL",
|
||||
"thumb_media_id": "THUMB_MEDIA_ID",
|
||||
"show_cover_pic": 1,
|
||||
"need_open_comment": 0,
|
||||
"only_fans_can_comment": 0,
|
||||
"url": "URL"
|
||||
}
|
||||
]
|
||||
},
|
||||
"update_time": 0
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"total_count": 0
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"media_id": "MEDIA_ID"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ERRMSG"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"media_id": "MEDIA_ID"
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"news_item": [
|
||||
{
|
||||
"title": "TITLE",
|
||||
"author": "AUTHOR",
|
||||
"digest": "DIGEST",
|
||||
"content": "CONTENT",
|
||||
"content_source_url": "CONTENT_SOURCE_URL",
|
||||
"thumb_media_id": "THUMB_MEDIA_ID",
|
||||
"show_cover_pic": 1,
|
||||
"need_open_comment": 0,
|
||||
"only_fans_can_comment": 0,
|
||||
"url": "URL"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ERRMSG",
|
||||
"is_open": 0
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"media_id": "MEDIA_ID",
|
||||
"index": 0,
|
||||
"articles": {
|
||||
"title": "TITLE",
|
||||
"author": "AUTHOR",
|
||||
"digest": "DIGEST",
|
||||
"content": "CONTENT",
|
||||
"content_source_url": "CONTENT_SOURCE_URL",
|
||||
"thumb_media_id": "THUMB_MEDIA_ID",
|
||||
"show_cover_pic": 1,
|
||||
"need_open_comment": 0,
|
||||
"only_fans_can_comment": 0
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ERRMSG"
|
||||
}
|
Loading…
Reference in New Issue
Block a user