Beispiel #1
0
        //POST https://api.jpush.cn/v3/schedules
        //创建一个新的定时任务。
        public ScheduleResult sendSchedule(SchedulePayload schedulepayload)
        {
            Preconditions.checkArgument(schedulepayload != null, "schedulepayload should not be empty");
            schedulepayload.Check();
            String schedulepayloadJson = schedulepayload.ToJson();

            Console.WriteLine(schedulepayloadJson);
            return(sendSchedule(schedulepayloadJson));
        }
Beispiel #2
0
        //PUT  https://api.jpush.cn/v3/schedules/{schedule_id}
        //修改指定的Schedule
        public ScheduleResult putSchedule(SchedulePayload schedulepayload, String schedule_id)
        {
            Preconditions.checkArgument(schedulepayload != null, "schedulepayload should not be empty");
            Preconditions.checkArgument(schedule_id != null, "schedule_id should not be empty");

            if (schedulepayload.push.audience == null || schedulepayload.push.platform == null)
            {
                schedulepayload.push = null;
            }

            if (schedulepayload.trigger.getTime() == null && schedulepayload.trigger.getSingleTime() == null)
            {
                schedulepayload.trigger = null;
            }

            String schedulepayloadJson = schedulepayload.ToJson();

            Console.WriteLine(schedulepayloadJson);
            return(putSchedule(schedulepayloadJson, schedule_id));
        }