public async Task <MobileDataResponse> GetDataFlatAsync(string refid) { try { RestRequest request = new RestRequest(ApiConstants.GET_DATA_FLAT, Method.GET); request.AddParameter("refid", refid); request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse iresp = await HttpClient.ExecuteAsync(request); if (iresp.IsSuccessful) { return(JsonConvert.DeserializeObject <MobileDataResponse>(iresp.Content)); } else { EbLog.Error(iresp.Content); } } catch (Exception ex) { EbLog.Error(ex.Message); } return(null); }
private void UpdateList() { listinha.Clear(); comboBox1.Items.Clear(); var request = new RestRequest("getItens", Method.GET); HttpClient.ExecuteAsync(request, r => { try { Debug.WriteLine(r.Content); var obj = JObject.Parse(r.Content); var lista = obj["Result"]; foreach (var item in lista) { var i = JsonConvert.DeserializeObject <Item>(item.ToString()); listinha.Add(i); Invoke((MethodInvoker) delegate { comboBox1.Items.Insert(comboBox1.Items.Count, i.Nome); }); } } catch { } }); }
public async Task <MobileDataResponse> GetDataAsyncPs(string refid, int limit, int offset, List <Param> param, List <Param> search) { try { RestRequest req = new RestRequest(ApiConstants.GET_DATA_PS, Method.POST); req.AddParameter("refid", refid); if (param != null && param.Count > 0) { req.AddParameter("param", JsonConvert.SerializeObject(param)); } if (search != null && search.Count > 0) { req.AddParameter("search", JsonConvert.SerializeObject(search)); } req.AddParameter("limit", limit); req.AddParameter("offset", offset); // auth Headers for api req.AddHeader(AppConst.BTOKEN, App.Settings.BToken); req.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse iresp = await HttpClient.ExecuteAsync(req); return(JsonConvert.DeserializeObject <MobileDataResponse>(iresp.Content)); } catch (Exception ex) { EbLog.Error(ex.Message); } return(new MobileDataResponse()); }
public async Task <ApiGenerateOTPResponse> GenerateOTP(ApiAuthResponse autheresp) { RestRequest request = new RestRequest(ApiConstants.RESEND_OTP, Method.POST); if (!string.IsNullOrEmpty(autheresp.BToken)) { request.AddHeader(AppConst.BTOKEN, autheresp.BToken); request.AddHeader(AppConst.RTOKEN, autheresp.RToken); } request.AddParameter("token", autheresp.TwoFAToken); request.AddParameter("authid", autheresp.User.AuthId); try { IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <ApiGenerateOTPResponse>(response.Content)); } } catch (Exception ex) { EbLog.Error("2FA verification failed :: " + ex.Message); } return(null); }
public async Task <ApiAuthResponse> AuthenticateSSOAsync(string username, string authid, string token) { ApiAuthResponse resp; try { RestRequest request = new RestRequest(ApiConstants.AUTHETICATE_SSO, Method.GET); request.AddParameter("username", username.Trim().ToLower()); request.AddParameter("authid", authid); request.AddParameter("token", token); IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.StatusCode == HttpStatusCode.OK) { resp = JsonConvert.DeserializeObject <ApiAuthResponse>(response.Content); } else { resp = new ApiAuthResponse { IsValid = false } }; } catch (Exception ex) { EbLog.Error(ex.Message); resp = new ApiAuthResponse { IsValid = false }; } return(resp); }
/// <summary> /// Attempts to retrieve a token by passing over the Sezzle configuration public and private keys /// </summary> /// <returns></returns> public Task <AuthResponse> RequestToken() { Ensure.ArgumentNotNullOrEmptyString(SezzleConfig.ApiPrivateKey, nameof(SezzleConfig.ApiPrivateKey)); Ensure.ArgumentNotNullOrEmptyString(SezzleConfig.ApiPublicKey, nameof(SezzleConfig.ApiPublicKey)); Client = new HttpClient() { BaseAddress = new Uri(new Uri(SezzleConfig.ApiUrl), "authentication") }; var request = new HttpRequestMessage(HttpMethod.Post, new Uri(Client.BaseAddress, String.Empty)); var authentication = new Authentication() { PrivateKey = SezzleConfig.ApiPrivateKey, PublicKey = SezzleConfig.ApiPublicKey }; // TODO: Clean up code between Auth any of the Sezzle based endpoint classes, etc. // TODO: Abstract the string payload convert into StringContent to an extension method var stringPayload = JsonConvert.SerializeObject(authentication, SezzleConfig.DefaultSerializerSettings); var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json"); request.Content = httpContent; return(Client.ExecuteAsync <AuthResponse>(request)); }
public async Task <ApiAuthResponse> SendAuthenticationOTP(string username, SignInOtpType type) { ApiAuthResponse resp; RestRequest request = new RestRequest(ApiConstants.SEND_AUTH_OTP, Method.POST); request.AddParameter("username", username); request.AddParameter("type", (int)type); try { IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.StatusCode == HttpStatusCode.OK) { resp = JsonConvert.DeserializeObject <ApiAuthResponse>(response.Content); } else { resp = new ApiAuthResponse { IsValid = false } }; } catch (Exception ex) { EbLog.Error("AuthenticateSSOAsync failed :: " + ex.Message); resp = new ApiAuthResponse { IsValid = false }; } return(resp); }
public async Task <EbStageInfo> GetMyActionInfoAsync(int stageid, string refid, int dataid) { try { RestRequest request = new RestRequest(ApiConstants.GET_ACTION_INFO, Method.GET); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); request.AddParameter("stageid", stageid); request.AddParameter("refid", refid); request.AddParameter("dataid", dataid); IRestResponse iresp = await HttpClient.ExecuteAsync(request); return(JsonConvert.DeserializeObject <EbStageInfo>(iresp.Content)); } catch (Exception ex) { EbLog.Error("Error in action info api"); EbLog.Error(ex.Message); } return(new EbStageInfo()); }
public async Task <EbNFRegisterResponse> CreateOrUpdateRegistration(string regid, DeviceRegistration device) { RestRequest request = new RestRequest("api/notifications/register", Method.POST); request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); request.AddParameter("regid", regid); request.AddParameter("device", JsonConvert.SerializeObject(device)); try { IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <EbNFRegisterResponse>(response.Content)); } } catch (Exception ex) { EbLog.Error("Failed to update or create registration::" + ex.Message); } return(null); }
public async Task <ReportRenderResponse> GetPdfOnline(string refid, string param) { ReportRenderResponse resp = null; try { RestRequest request = new RestRequest(ApiConstants.GET_PDF, Method.GET); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); request.AddParameter("refid", refid); request.AddParameter("param", param); IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.IsSuccessful) { resp = JsonConvert.DeserializeObject <ReportRenderResponse>(response.Content); } } catch (Exception ex) { EbLog.Error(ex.Message); } return(resp); }
public bool UploadCsd(Csd csd) { var request = new RestRequest($"{UriResource}UploadCsd", Method.PUT); request.AddHeader("Content-Type", "application/json"); var json = JsonConvert.SerializeObject(csd, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); request.AddParameter("application/json", json, ParameterType.RequestBody); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; if (response.StatusCode == HttpStatusCode.InternalServerError) { throw new Exception(response.ErrorMessage); } if (response.StatusCode == HttpStatusCode.NoContent) { return(true); } return(false); }
public async Task <PushResponse> SendFormDataAsync(string pageRefId, WebformData WebFormData, int RowId, string WebFormRefId, int LocId) { try { RestRequest request = new RestRequest(ApiConstants.PUSH_DATA, Method.POST); request.AddParameter("webform_data", JsonConvert.SerializeObject(WebFormData)); request.AddParameter("rowid", RowId); request.AddParameter("refid", WebFormRefId); request.AddParameter("locid", LocId); request.AddParameter("mobile_refid", pageRefId); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse response = await HttpClient.ExecuteAsync(request); return(JsonConvert.DeserializeObject <PushResponse>(response.Content)); } catch (Exception e) { EbLog.Error(e.Message); } return(null); }
public async Task <WebformData> GetFormLiveDataAsync(string refid, int row_id, int loc_id) { WebformData wd; try { RestRequest request = new RestRequest("api/get_formdata", Method.GET); request.AddParameter("refid", refid); request.AddParameter("row_id", row_id); request.AddParameter("loc_id", loc_id); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse iresp = await HttpClient.ExecuteAsync(request); MobileFormDataResponse response = JsonConvert.DeserializeObject <MobileFormDataResponse>(iresp.Content); wd = response.Data; } catch (Exception ex) { EbLog.Error(ex.Message); wd = new WebformData(); } return(wd); }
public async Task <ApiFileResponse> GetFile(EbFileCategory category, string filename) { ApiFileResponse resp = null; try { RestRequest request = new RestRequest("api/get_file", Method.GET); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); request.AddParameter("category", (int)category); request.AddParameter("filename", filename); IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.IsSuccessful) { resp = JsonConvert.DeserializeObject <ApiFileResponse>(response.Content); } } catch (Exception ex) { EbLog.Error(ex.Message); } return(resp); }
public async Task <List <ApiFileData> > SendFilesAsync(List <FileWrapper> Files) { List <ApiFileData> FileData = null; try { RestRequest request = new RestRequest("api/files/upload", Method.POST); foreach (FileWrapper file in Files) { request.AddFileBytes(file.Name, file.Bytea, file.FileName); } // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.StatusCode == HttpStatusCode.OK) { FileData = JsonConvert.DeserializeObject <List <ApiFileData> >(response.Content); } } catch (Exception e) { EbLog.Error(e.Message); } return(FileData); }
private void Button1_Click(object sender, EventArgs e) { var request = new RestRequest("finishPool", Method.POST); string jsonFile = JsonConvert.SerializeObject(listinha[comboBox1.SelectedIndex]); Debug.WriteLine(jsonFile); request.AddParameter("application/json; charset=utf-8", jsonFile, ParameterType.RequestBody); request.RequestFormat = DataFormat.Json; HttpClient.ExecuteAsync(request, r => { if (r.StatusCode == System.Net.HttpStatusCode.OK) { pbAddStatus.BackColor = Color.Green; } else { pbAddStatus.BackColor = Color.Red; } Thread.Sleep(600); pbAddStatus.BackColor = Color.Gray; }); UpdateList(); }
public Task<OAuthResponse> RequestToken(string code) { HttpClient client = new HttpClient { BaseAddress = new Uri(_config.OAuthURI) }; var request = new HttpRequestMessage(HttpMethod.Post, "access_token"); request.AddParameter("client_id", _config.ClientId); request.AddParameter("client_secret", _config.ClientSecret); request.AddParameter("grant_type", "authorization_code"); request.AddParameter("redirect_uri", _config.RedirectURI); request.AddParameter("code", code); return client.ExecuteAsync<OAuthResponse>(request); }
private InvoiceFile GetFile(string id, FileFormat format, InvoiceType type = InvoiceType.Issued) { var request = new RestRequest($"{UriResource}cfdi/{format}/{type}/{id}", Method.GET); request.AddHeader("Content-Type", "application/json"); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; var file = JsonConvert.DeserializeObject <InvoiceFile>(response.Content); return(file); }
public Task TestUserAgent() { HttpRequest request = new HttpRequest(); request.Uri = new Uri("http://httpbin.org/user-agent"); request.Method = "GET"; HttpClient client = new HttpClient(); return(client.ExecuteAsync(request, null, null, new CancellationToken()).ContinueWith(t => { Assert.IsFalse(t.IsFaulted); Assert.IsFalse(t.IsCanceled); string body = t.Result.Item2; Assert.IsTrue(body.Contains("LeanCloud-dotNet-SDK/")); })); }
public CfdiSearchResults[] List(string keyword, CfdiStatus status = CfdiStatus.Active, InvoiceType type = InvoiceType.Issued) { keyword = HttpUtility.UrlEncode(keyword); var request = new RestRequest($"{UriResource}Cfdi?type={type}&keyword={keyword}&status={status}", Method.GET); request.AddHeader("Content-Type", "application/json"); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; var file = JsonConvert.DeserializeObject <CfdiSearchResults[]>(response.Content); return(file); }
public bool SendByMail(string id, string email, string subject = null, InvoiceType type = InvoiceType.Issued) { var request = new RestRequest($"Cfdi?cfdiType={type}&cfdiId={id}&email={email}&subject={subject}", Method.POST); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; var result = JsonConvert.DeserializeObject <IDictionary <string, object> >(response.Content); if (result != null && result.ContainsKey("success")) { return((bool)result["success"]); } return(false); }
/// <summary> /// Obtiene el Archivo de la factura en Base64. /// </summary> /// <param name="id">Identificador del CFDI</param> /// <param name="format">Formato en que se desea obtener, debe ser una instancia de la enumeración (Xml, Pdf, Html)</param> /// <returns>Objeto InvoiceFile el cual en el atributo 'Content' tiene el Base64 del archivo</returns> public InvoiceFile GetFile(string id, FileFormat format) { var strFormat = format.ToString().ToLower(); var request = new RestRequest($"{UriResource}cfdi/{strFormat}/issuedLite/{id}", Method.GET); request.AddHeader("Content-Type", "application/json"); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; var file = JsonConvert.DeserializeObject <InvoiceFile>(response.Content); return(file); }
public Task <SubscriptionsResponse> Create(Object type, Aspect aspect) { // create a new guid that uniquely identifies this subscription request var verifyToken = Guid.NewGuid().ToString(); var request = new HttpRequestMessage { Method = HttpMethod.Post }; request.AddParameter("client_id", config.ClientId); request.AddParameter("client_secret", config.ClientSecret); request.AddParameter("object", type.ToString().ToLower()); request.AddParameter("aspect", aspect.ToString().ToLower()); request.AddParameter("verify_token", verifyToken); request.AddParameter("callback_url", config.CallbackUri); return(client.ExecuteAsync <SubscriptionsResponse>(request)); }
public async Task <string> GetAzureTokenAsync() { string token = string.Empty; RestRequest request = new RestRequest("api/notifications/get_registration_id", Method.GET); request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse response = await HttpClient.ExecuteAsync <string>(request); if (response.IsSuccessful) { token = response.Content.Trim('"'); } return(token); }
public async Task <bool> UnRegisterAsync(string regid) { RestRequest request = new RestRequest("api/notifications/delete_registration", Method.DELETE); request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); request.AddParameter("regid", regid); IRestResponse response = await HttpClient.ExecuteAsync(request); if (response.IsSuccessful) { return(true); } return(false); }
private void Button2_Click(object sender, EventArgs e) { if (cbUpdate.Checked) { try { var p = new Player { IsPlaying = Player.IsPlaying, ItemAtual = Player.ItemAtual, PoolResult = Player.PoolResult, Atk = int.Parse(pAtk.Text), Def = int.Parse(pDef.Text), Hp = int.Parse(pHp.Text), MaxHp = int.Parse(pMaxHp.Text), Luck = int.Parse(pLucky.Text), Range = int.Parse(pRange.Text), Speed = int.Parse(pSpeed.Text), R = 1 }; var request = new RestRequest("updatePlayer", Method.POST); string jsonFile = JsonConvert.SerializeObject(p); Debug.WriteLine(jsonFile); request.AddParameter("application/json; charset=utf-8", jsonFile, ParameterType.RequestBody); request.RequestFormat = DataFormat.Json; HttpClient.ExecuteAsync(request, r => { if (r.StatusCode == System.Net.HttpStatusCode.OK) { pbAddStatus.BackColor = Color.Green; } else { pbAddStatus.BackColor = Color.Red; } Thread.Sleep(600); pbAddStatus.BackColor = Color.Gray; }); } catch { } } }
public Task<OAuthResponse> RequestToken(string code) { HttpClient client = new HttpClient { BaseAddress = new Uri(config.OAuthUri) }; var request = new HttpRequestMessage(HttpMethod.Post, new Uri(client.BaseAddress, "access_token")); //HttpClient client = new HttpClient(); //var request = new HttpRequestMessage(HttpMethod.Post, "https://api.instagram.com/oauth/access_token"); string myParameters = string.Format("client_id={0}&client_secret={1}&grant_type={2}&redirect_uri={3}&code={4}", config.ClientId.UrlEncode(), config.ClientSecret.UrlEncode(), "authorization_code".UrlEncode(), config.RedirectUri.UrlEncode(), code.UrlEncode()); request.Content = new StringContent(myParameters); return client.ExecuteAsync<OAuthResponse>(request); }
private void BtnPoolStart_Click(object sender, System.EventArgs e) { var request = new RestRequest("createPool", Method.GET); HttpClient.ExecuteAsync(request, r => { if (r.StatusCode == System.Net.HttpStatusCode.OK) { pbAddStatus.BackColor = Color.Green; } else { pbAddStatus.BackColor = Color.Red; } Thread.Sleep(600); pbAddStatus.BackColor = Color.Gray; }); }
public CfdiSearchResults[] List(int folioStart = -1, int folioEnd = -1, string rfc = null, string taxEntityName = null, string dateStart = "", string dateEnd = "", string idBranch = "", string serie = "", CfdiStatus status = CfdiStatus.Active, InvoiceType type = InvoiceType.Issued) { var request = new RestRequest($"{UriResource}Cfdi?type={type}&status={status}&folioStart={folioStart}&folioEnd={folioEnd}&rfc={rfc}&taxEntityName={taxEntityName}&dateStart={dateStart}&dateEnd={dateEnd}&idBranch={idBranch}&serie={serie}", Method.GET); request.AddHeader("Content-Type", "application/json"); var taskCompletionSource = new TaskCompletionSource <IRestResponse>(); HttpClient.ExecuteAsync(request, restResponse => taskCompletionSource.SetResult(restResponse)); var response = taskCompletionSource.Task.Result; var list = JsonConvert.DeserializeObject <CfdiSearchResults[]>(response.Content); return(list); }
/// <summary> /// Requests the token. /// </summary> /// <param name="code">The code.</param> /// <returns>An OAuthResponse object</returns> public Task <OAuthResponse> RequestToken(string code) { var client = new HttpClient { BaseAddress = new Uri(Config.OAuthUri) }; var request = new HttpRequestMessage(HttpMethod.Post, new Uri(client.BaseAddress, "access_token")); //HttpClient client = new HttpClient(); //var request = new HttpRequestMessage(HttpMethod.Post, "https://api.instagram.com/oauth/access_token"); var myParameters = string.Format("client_id={0}&client_secret={1}&grant_type={2}&redirect_uri={3}&code={4}", Config.ClientId.UrlEncode(), Config.ClientSecret.UrlEncode(), "authorization_code".UrlEncode(), Config.RedirectUri.UrlEncode(), code.UrlEncode()); request.Content = new StringContent(myParameters); return(client.ExecuteAsync <OAuthResponse>(request)); }
public async Task <MobileDataResponse> GetDataAsyncV2(string refid, int limit, int offset, List <Param> param, List <SortColumn> sort, List <Param> search) { try { RestRequest request = base.GetRequest(ApiConstants.GET_VIS_DATA_V2, Method.GET); request.AddParameter("refid", refid); if (param != null) { request.AddParameter("param", JsonConvert.SerializeObject(param)); } if (sort != null) { request.AddParameter("sort_order", JsonConvert.SerializeObject(sort)); } if (search != null) { request.AddParameter("search", JsonConvert.SerializeObject(search)); } request.AddParameter("limit", limit); request.AddParameter("offset", offset); IRestResponse iresp = await HttpClient.ExecuteAsync(request); if (iresp.IsSuccessful) { return(JsonConvert.DeserializeObject <MobileDataResponse>(iresp.Content)); } else { base.LogHttpResponse(iresp); } } catch (Exception ex) { EbLog.Error(ex.Message); } return(null); }
public async Task <MobileDataResponse> GetDataAsync(string refid, int limit, int offset, List <Param> param, List <SortColumn> sort, List <Param> search, bool is_powerselect, bool no_wrap = false) { try { RestRequest request = new RestRequest(ApiConstants.GET_VIS_DATA, Method.POST); request.AddParameter("refid", refid); if (param != null) { request.AddParameter("param", JsonConvert.SerializeObject(param)); } if (sort != null) { request.AddParameter("sort_order", JsonConvert.SerializeObject(sort)); } if (search != null) { request.AddParameter("search", JsonConvert.SerializeObject(search)); } request.AddParameter("limit", limit); request.AddParameter("offset", offset); request.AddParameter("is_powerselect", is_powerselect); request.AddParameter("no_wrap", no_wrap); // auth Headers for api request.AddHeader(AppConst.BTOKEN, App.Settings.BToken); request.AddHeader(AppConst.RTOKEN, App.Settings.RToken); IRestResponse iresp = await HttpClient.ExecuteAsync(request); return(JsonConvert.DeserializeObject <MobileDataResponse>(iresp.Content)); } catch (Exception ex) { EbLog.Error(ex.Message); } return(new MobileDataResponse()); }
/// <summary> /// Requests the token. /// </summary> /// <param name="code">The code.</param> /// <returns>An OAuthResponse object</returns> public Task<OAuthResponse> RequestToken(string code) { var client = new HttpClient { BaseAddress = new Uri(config.OAuthUri) }; var request = new HttpRequestMessage(HttpMethod.Post, new Uri(client.BaseAddress, "access_token")); var multipartFormDataContent = new MultipartFormDataContent { {new StringContent(config.ClientId), "client_id"}, {new StringContent(config.ClientSecret), "client_secret"}, {new StringContent("authorization_code"), "grant_type"}, {new StringContent(config.RedirectUri), "redirect_uri"}, {new StringContent(code), "code"}, }; request.Content = multipartFormDataContent; return client.ExecuteAsync<OAuthResponse>(request); }