Ejemplo n.º 1
0
        public static AddScheduleJsonResult Add(string accessTokenOrAppKey, ScheduleJson.Schedule schedule, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = Config.ApiWorkHost + "/cgi-bin/oa/schedule/add?access_token={0}";

                var data = new
                {
                    schedule
                };

                return Senparc.Weixin.CommonAPIs.CommonJsonSend.Send <AddScheduleJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppKey));
        }
Ejemplo n.º 2
0
        public static async Task <AddScheduleJsonResult> AddAsync(string accessTokenOrAppKey, ScheduleJson.Schedule schedule, int timeOut = Config.TIME_OUT)
        {
            return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                var url = Config.ApiWorkHost + "/cgi-bin/oa/schedule/add?access_token={0}";

                var data = new
                {
                    schedule
                };

                return await Weixin.CommonAPIs.CommonJsonSend.SendAsync <AddScheduleJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut).ConfigureAwait(false);
            }, accessTokenOrAppKey).ConfigureAwait(false));
        }