cn.jpush.api.schedule.ScheduleClient.getScheduleById C# (CSharp) Method

getScheduleById() public method

public getScheduleById ( String id ) : SchedulePayload
id String
return SchedulePayload
        public SchedulePayload getScheduleById(String id)
        {
            Preconditions.checkArgument(!String.IsNullOrEmpty(id), "id should be set.");
            jSetting = new JsonSerializerSettings();
            jSetting.NullValueHandling = NullValueHandling.Ignore;
            jSetting.DefaultValueHandling = DefaultValueHandling.Ignore;
            String url = HOST_NAME_SSL;
            url += PUSH_PATH;
            url += "/";
            url += id;
            ResponseWrapper result = sendGet(url, Authorization(),id);

            String schedule = result.responseContent;
            SchedulePayload schedulepayload = JsonConvert.DeserializeObject<SchedulePayload>(schedule, jSetting);
            return schedulepayload;
        }

Usage Example

コード例 #1
0
        public static void Main(string[] args)
        {
            //init a pushpayload
            PushPayload pushPayload = new PushPayload();
            pushPayload.platform = Platform.all();
            pushPayload.audience = Audience.all();
            pushPayload.notification = new Notification().setAlert(ALERT);

            ScheduleClient scheduleclient = new ScheduleClient(app_key, master_secret);

            //get schedule by id
            try
            {
                var result = scheduleclient.getScheduleById(PUT_SCHEDULE_ID);
                Console.WriteLine(result.name);
                Console.WriteLine(result);
            }
            catch (APIRequestException e)
            {
                Console.WriteLine("Error response from JPush server. Should review and fix it. ");
                Console.WriteLine("HTTP Status: " + e.Status);
                Console.WriteLine("Error Code: " + e.ErrorCode);
                Console.WriteLine("Error Message: " + e.ErrorCode);
            }
            catch (APIConnectionException e)
            {
                Console.WriteLine(e.Message);
            }
        }
All Usage Examples Of cn.jpush.api.schedule.ScheduleClient::getScheduleById