diff --git a/docs/WechatApi/Basic_ModelDefinition.md b/docs/WechatApi/Basic_ModelDefinition.md index 8ddb0522..e1001230 100644 --- a/docs/WechatApi/Basic_ModelDefinition.md +++ b/docs/WechatApi/Basic_ModelDefinition.md @@ -162,18 +162,19 @@ -#### 5. 视频号 +#### 5. 微信小店(原视频号)
[展开查看] -| | 微信 API | 备注 | -| :-: | :--------: | :--: | -| √ | 视频号小店 | | -| √ | 视频号助手 | | -| √ | 招商团长 | | -| √ | 本地生活 | | +| | 微信 API | 备注 | +| :-: | :------------: | :--: | +| √ | 微信小店 | | +| √ | 合作账号 | | +| √ | 企业微信 | | +| √ | 小程序连接小店 | | +| √ | 罗盘商家版 | |
diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index d7d40d71..7d8e92f2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -5639,6 +5639,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api #endregion #endregion + #region ECWecom + /// + /// 异步调用 [POST] /channels/ec/wecom/get_wecom_id 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECWecomGetWecomIdAsync(this WechatApiClient client, Models.ChannelsECWecomGetWecomIdRequest 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 + .CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "wecom", "get_wecom_id") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + #endregion + #region ECWindow /// /// 异步调用 [POST] /channels/ec/window/product/add 接口。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs new file mode 100644 index 00000000..672e2b95 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/wecom/get_wecom_id 接口的请求。 + /// + public class ChannelsECWecomGetWecomIdRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置企业微信 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corp_id")] + [System.Text.Json.Serialization.JsonPropertyName("corp_id")] + public string CorpId { get; set; } = string.Empty; + + /// + /// 获取或设置企业微信 UserId。 + /// + [Newtonsoft.Json.JsonProperty("user_id")] + [System.Text.Json.Serialization.JsonPropertyName("user_id")] + public string UserId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs new file mode 100644 index 00000000..cdc86487 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs @@ -0,0 +1,35 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/wecom/get_wecom_id 接口的响应。 + /// + public class ChannelsECWecomGetWecomIdResponse : WechatApiResponse + { + public static class Types + { + public class Data + { + /// + /// 获取或设置企业微信 ID。 + /// + [Newtonsoft.Json.JsonProperty("wecom_corp_id")] + [System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")] + public string WecomAppId { get; set; } = default!; + + /// + /// 获取或设置企业微信账号 ID。 + /// + [Newtonsoft.Json.JsonProperty("wecom_user_id")] + [System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")] + public string WecomUserId { get; set; } = default!; + } + } + + /// + /// 获取或设置返回数据。 + /// + [Newtonsoft.Json.JsonProperty("data")] + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Types.Data Data { get; set; } = default!; + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json new file mode 100644 index 00000000..3c3f5918 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json @@ -0,0 +1,4 @@ +{ + "corp_id": "wwsdnnaoiwjeoifawe", + "user_id": "张三" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json new file mode 100644 index 00000000..4fd58f89 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json @@ -0,0 +1,8 @@ +{ + "errcode": "0", + "errmsg": "ok", + "data": { + "wecom_corp_id": "seuiwebrxuusdfasddfas", + "wecom_user_id": "sdnfanwbbbxcfzxvdfadf" + } +}