public TwitterIds GetBlockIdsApi(long cursor) { if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) throw new WebApiException("AccountState invalid"); HttpStatusCode res; var content = ""; try { res = twCon.GetBlockUserIds(ref content, cursor); } catch(Exception e) { throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e); } var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); try { return TwitterIds.ParseJson(content); } catch(SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch(Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }
public async Task<TwitterIds> GetMuteUserIdsApiAsync(long cursor) { var content = ""; try { var res = await Task.Run(() => twCon.GetMuteUserIds(ref content, cursor)) .ConfigureAwait(false); var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); return TwitterIds.ParseJson(content); } catch (WebException ex) { var ex2 = new WebApiException("Err:" + ex.Message, ex); MyCommon.TraceOut(ex2); throw ex2; } catch (SerializationException ex) { var ex2 = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, ex); MyCommon.TraceOut(ex2); throw ex2; } }
private TwitterConfiguration ConfigurationApi() { HttpStatusCode res; var content = ""; try { res = twCon.GetConfiguration(ref content); } catch(Exception e) { throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e); } var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); try { return TwitterConfiguration.ParseJson(content); } catch(SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch(Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }
private long[] NoRetweetIdsApi() { if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) throw new WebApiException("AccountState invalid"); HttpStatusCode res; var content = ""; try { res = twCon.NoRetweetIds(ref content); } catch(Exception e) { throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e); } var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); try { return MyCommon.CreateDataFromJson<long[]>(content); } catch(SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch(Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }
public TwitterUser PostUpdateProfile(string name, string url, string location, string description) { if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) throw new WebApiException("AccountState invalid"); HttpStatusCode res; var content = ""; try { res = twCon.UpdateProfile(name, url, location, description, ref content); } catch(Exception ex) { throw new WebApiException("Err:" + ex.Message, content, ex); } var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); try { return TwitterUser.ParseJson(content); } catch (SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch (Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }
private TwitterDataModel.Ids GetFollowerIdsApi(ref long cursor) { if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) throw new WebApiException("AccountState invalid"); HttpStatusCode res; var content = ""; try { res = twCon.FollowerIds(cursor, ref content); } catch(Exception e) { throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e); } var err = this.CheckStatusCode(res, content); if (err != null) throw new WebApiException(err, content); try { var ret = MyCommon.CreateDataFromJson<TwitterDataModel.Ids>(content); if (ret.Id == null) { var ex = new WebApiException("Err: ret.id == null (GetFollowerIdsApi)", content); MyCommon.ExceptionOut(ex); throw ex; } return ret; } catch(SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch(Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }
private TwitterIds GetFollowerIdsApi(ref long cursor) { this.CheckAccountState(); HttpStatusCode res; var content = ""; try { res = twCon.FollowerIds(cursor, ref content); } catch(Exception e) { throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e); } this.CheckStatusCode(res, content); try { var ret = TwitterIds.ParseJson(content); if (ret.Ids == null) { var ex = new WebApiException("Err: ret.id == null (GetFollowerIdsApi)", content); MyCommon.ExceptionOut(ex); throw ex; } return ret; } catch(SerializationException e) { var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e); MyCommon.TraceOut(ex); throw ex; } catch(Exception e) { var ex = new WebApiException("Err:Invalid Json!", content, e); MyCommon.TraceOut(ex); throw ex; } }