123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- #region Apache License Version 2.0
- #endregion Apache License Version 2.0
- using System.Threading.Tasks;
- using Senparc.NeuChar;
- using Senparc.Weixin.CommonAPIs;
- using Senparc.Weixin.Entities;
- using Senparc.Weixin.MP.CommonAPIs;
- namespace Senparc.Weixin.MP.AdvancedAPIs
- {
-
-
-
- public static class ExpressApi
- {
- #region 同步方法
-
-
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.AddExpress", true)]
- public static AddExpressResult AddExpress(string accessToken, AddExpressData addExpressData)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/add?access_token={0}";
- return CommonJsonSend.Send<AddExpressResult>(accessToken, urlFormat, addExpressData);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.DeleteExpress", true)]
- public static WxJsonResult DeleteExpress(string accessToken, int templateId)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/del?access_token={0}";
- var data = new
- {
- template_id = templateId
- };
- return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.UpDateExpress", true)]
- public static WxJsonResult UpDateExpress(string accessToken, UpDateExpressData upDateExpressData)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/update?access_token={0}";
- return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, upDateExpressData);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.GetByIdExpress", true)]
- public static GetByIdExpressResult GetByIdExpress(string accessToken, int templateId)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/getbyid?access_token={0}";
- var data = new
- {
- template_id = templateId
- };
- return CommonJsonSend.Send<GetByIdExpressResult>(accessToken, urlFormat, data);
- }
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.GetAllExpress", true)]
- public static GetAllExpressResult GetAllExpress(string accessToken)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/getall?access_token={0}";
- return CommonJsonSend.Send<GetAllExpressResult>(accessToken, urlFormat, null, CommonJsonSendType.GET);
- }
- #endregion
- #if !NET35 && !NET40
- #region 异步方法
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.AddExpressAsync", true)]
- public static async Task<AddExpressResult> AddExpressAsync(string accessToken, AddExpressData addExpressData)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/add?access_token={0}";
- return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<AddExpressResult>(accessToken, urlFormat, addExpressData);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.DeleteExpressAsync", true)]
- public static async Task<WxJsonResult> DeleteExpressAsync(string accessToken, int templateId)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/del?access_token={0}";
- var data = new
- {
- template_id = templateId
- };
- return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<WxJsonResult>(accessToken, urlFormat, data);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.UpDateExpressAsync", true)]
- public static async Task<WxJsonResult> UpDateExpressAsync(string accessToken, UpDateExpressData upDateExpressData)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/update?access_token={0}";
- return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<WxJsonResult>(accessToken, urlFormat, upDateExpressData);
- }
-
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.GetByIdExpressAsync", true)]
- public static async Task<GetByIdExpressResult> GetByIdExpressAsync(string accessToken, int templateId)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/getbyid?access_token={0}";
- var data = new
- {
- template_id = templateId
- };
- return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<GetByIdExpressResult>(accessToken, urlFormat, data);
- }
-
-
-
-
-
- [ApiBind(NeuChar.PlatformType.WeChat_OfficialAccount, "ExpressApi.GetAllExpressAsync", true)]
- public static async Task<GetAllExpressResult> GetAllExpressAsync(string accessToken)
- {
- var urlFormat = Config.ApiMpHost + "/merchant/express/getall?access_token={0}";
- return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<GetAllExpressResult>(accessToken, urlFormat, null, CommonJsonSendType.GET);
- }
- #endregion
- #endif
- }
- }
|