コード例 #1
0
        /// <summary>
        /// 获取设备标签
        /// </summary>
        /// <param name="registrationId"></param>
        /// <returns></returns>
        public string[] getDeviceTags(string registrationId)
        {
            if (string.IsNullOrEmpty(registrationId))
            {
                throw new ApiException(Commons.HTTP_STATUS_400, -1, "registrationId is null");
            }
            string path = MobPushConfig.deviceUrl + "/tags/" + registrationId;

            try
            {
                MobResult mr = Commons.WebClientGet(path);
                if (mr == null || mr.res == null)
                {
                    return(null);
                }
                string res = mr.res.ToString();
                Tags   t   = JsonExtension.FromJSON <Tags>(res);
                if (t == null)
                {
                    return(null);
                }
                return(t.tags);
            }
            catch (ApiException api)
            {
                throw api;
            }
        }
コード例 #2
0
 /// <summary>
 /// 获取推送任务统计信息
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 private PushStats pullStats(String path)
 {
     try
     {
         MobResult result = Commons.WebClientGet(path);
         if (result != null)
         {
             if (result.res == null)
             {
                 return(null);
             }
             PushStats stats = JsonExtension.FromJSON <PushStats>(result.res.ToJSON());
             return(stats);
         }
         return(null);
     }
     catch (ApiException api)
     {
         throw api;
     }
 }
コード例 #3
0
 /// <summary>
 /// 获取推送详情基础
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 private PushWork pullPush(string path)
 {
     try
     {
         MobResult result = Commons.WebClientGet(path);
         if (result != null)
         {
             if (result.res == null)
             {
                 return(null);
             }
             PushWork work = JsonExtension.FromJSON <PushWork>(result.res.ToJSON());
             return(work);
         }
         return(null);
     }
     catch (ApiException api)
     {
         throw api;
     }
 }
コード例 #4
0
        /// <summary>
        /// 获取地理位置列表 -- 子级列表
        /// 如果查询最上级则传入null即可
        /// </summary>
        /// <param name="parentId"></param>
        /// <returns></returns>
        public List <Area> getArea(string parentId)
        {
            if (string.IsNullOrEmpty(parentId))
            {
                parentId = "0";
            }
            string path = MobPushConfig.baseUrl + "/area/" + parentId;

            try
            {
                MobResult mr = Commons.WebClientGet(path);
                if (mr == null || mr.res == null)
                {
                    return(new List <Area>());
                }
                string      res  = mr.res.ToString();
                List <Area> list = JsonExtension.DeserializeJsonToList <Area>(res);
                return(list);
            }
            catch (ApiException api)
            {
                throw api;
            }
        }