mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(wxapi): 新增小程序短剧媒资剧目授权相关接口
This commit is contained in:
parent
3a3097a36a
commit
bf4153e0c9
@ -570,6 +570,86 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSecVodReplaceDramaMediaResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/sec/vod/authorizedrama 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/mini-drama/mini_drama.html#_5-1-%E5%A2%9E%E5%8A%A0%E5%89%A7%E7%9B%AE%E6%8E%88%E6%9D%83 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaSecVodAuthorizeDramaResponse> ExecuteWxaSecVodAuthorizeDramaAsync(this WechatApiClient client, Models.WxaSecVodAuthorizeDramaRequest 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, "wxa", "sec", "vod", "authorizedrama")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSecVodAuthorizeDramaResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/sec/vod/deauthorizedrama 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/mini-drama/mini_drama.html#_5-2-%E8%A7%A3%E9%99%A4%E5%89%A7%E7%9B%AE%E6%8E%88%E6%9D%83 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaSecVodDeauthorizeDramaResponse> ExecuteWxaSecVodDeauthorizeDramaAsync(this WechatApiClient client, Models.WxaSecVodDeauthorizeDramaRequest 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, "wxa", "sec", "vod", "deauthorizedrama")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSecVodDeauthorizeDramaResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/sec/vod/getauthorizeobjects 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/mini-drama/mini_drama.html#_5-3-%E6%9F%A5%E8%AF%A2%E6%8E%88%E6%9D%83%E4%BF%A1%E6%81%AF </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaSecVodGetAuthorizeObjectsResponse> ExecuteWxaSecVodGetAuthorizeObjectsAsync(this WechatApiClient client, Models.WxaSecVodGetAuthorizeObjectsRequest 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, "wxa", "sec", "vod", "getauthorizeobjects")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSecVodGetAuthorizeObjectsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/sec/vod/getauthorizedobjects 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/mini-drama/mini_drama.html#_5-4-%E6%9F%A5%E8%AF%A2%E8%A2%AB%E6%8E%88%E6%9D%83%E4%BF%A1%E6%81%AF </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaSecVodGetAuthorizedObjectsResponse> ExecuteWxaSecVodGetAuthorizedObjectsAsync(this WechatApiClient client, Models.WxaSecVodGetAuthorizedObjectsRequest 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, "wxa", "sec", "vod", "getauthorizedobjects")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSecVodGetAuthorizedObjectsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/authorizedrama 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodAuthorizeDramaRequest : WechatApiRequest, IInferable<WxaSecVodAuthorizeDramaRequest, WxaSecVodAuthorizeDramaResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置授权的剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
public IList<long> DramaIdList { get; set; } = new List<long>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置被授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_appid")]
|
||||
public string AuthorizedAppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权到期时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authz_expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authz_expire_time")]
|
||||
public long? ExpireTimestamp { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/authorizedrama 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodAuthorizeDramaResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long DramaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errcode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errcode")]
|
||||
public int ErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误原因。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errmsg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errmsg")]
|
||||
public string ErrorMessage { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/deauthorizedrama 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodDeauthorizeDramaRequest : WechatApiRequest, IInferable<WxaSecVodDeauthorizeDramaRequest, WxaSecVodDeauthorizeDramaResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置解除授权的剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
public IList<long> DramaIdList { get; set; } = new List<long>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置被授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_appid")]
|
||||
public string AuthorizedAppId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/deauthorizedrama 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodDeauthorizeDramaResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result : WxaSecVodAuthorizeDramaResponse.Types.Result
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/getauthorizeobjects 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodGetAuthorizeObjectsRequest : WechatApiRequest, IInferable<WxaSecVodGetAuthorizeObjectsRequest, WxaSecVodGetAuthorizeObjectsResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
public long? DramaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置被授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_appid")]
|
||||
public string? AuthorizedAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("offset")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("offset")]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("limit")]
|
||||
public int? Limit { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/getauthorizeobjects 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodGetAuthorizeObjectsResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Object
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long DramaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置被授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_appid")]
|
||||
public string AuthorizedAppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_time")]
|
||||
public long AuthorizeTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权到期时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authz_expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authz_expire_time")]
|
||||
public long? ExpireTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("objects")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("objects")]
|
||||
public Types.Object[] ObjectList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置记录总数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total_count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/getauthorizedobjects 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodGetAuthorizedObjectsRequest : WechatApiRequest, IInferable<WxaSecVodGetAuthorizedObjectsRequest, WxaSecVodGetAuthorizedObjectsResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorizer_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorizer_appid")]
|
||||
public string? AuthorizerAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("offset")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("offset")]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("limit")]
|
||||
public int? Limit { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/sec/vod/getauthorizedobjects 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaSecVodGetAuthorizedObjectsResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Object
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置剧目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("drama_id")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long DramaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权方小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorizer_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorizer_appid")]
|
||||
public string AuthorizerAppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authorized_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authorized_time")]
|
||||
public long AuthorizeTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权到期时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("authz_expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("authz_expire_time")]
|
||||
public long? ExpireTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("objects")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("objects")]
|
||||
public Types.Object[] ObjectList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置记录总数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total_count")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"authorized_appid": "wx*************",
|
||||
"drama_id": [ 100200, 100205 ],
|
||||
"authz_expire_time": 0
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"result": [
|
||||
{
|
||||
"drama_id": 100200,
|
||||
"errcode": 0
|
||||
},
|
||||
{
|
||||
"drama_id": 100205,
|
||||
"errcode": 1,
|
||||
"errmsg": "获取剧目100205失败!"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"authorized_appid": "wx*************",
|
||||
"drama_id": [ 100200, 100205 ]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"result": [
|
||||
{
|
||||
"drama_id": 100200,
|
||||
"errcode": 0
|
||||
},
|
||||
{
|
||||
"drama_id": 100205,
|
||||
"errcode": 1,
|
||||
"errmsg": "获取剧目100205的授权信息失败!"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"drama_id": 100206,
|
||||
"limit": 100
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"objects": [
|
||||
{
|
||||
"drama_id": 100206,
|
||||
"authorized_appid": "wx**********",
|
||||
"authorized_time": 1702020510,
|
||||
"authz_expire_time": 0
|
||||
},
|
||||
{
|
||||
"drama_id": 100206,
|
||||
"authorized_appid": "wx**********",
|
||||
"authorized_time": 1702020549,
|
||||
"authz_expire_time": 1703120549
|
||||
}
|
||||
],
|
||||
"total_count": 2
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"authorizer_appid": "wx*********",
|
||||
"limit": 100
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"objects": [
|
||||
{
|
||||
"drama_id": 100206,
|
||||
"authorizer_appid": "wx**********",
|
||||
"authorized_time": 1702020510,
|
||||
"authz_expire_time": 0
|
||||
}
|
||||
],
|
||||
"total_count": 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user