/// <inheritdoc/> public async Task UploadTax(MarketTaxRates taxRates) { var clientState = Service <ClientState.ClientState> .Get(); // ==================================================================================== var taxUploadObject = new UniversalisTaxUploadRequest { WorldId = clientState.LocalPlayer?.CurrentWorld.Id ?? 0, UploaderId = clientState.LocalContentId.ToString(), TaxData = new UniversalisTaxData { LimsaLominsa = taxRates.LimsaLominsaTax, Gridania = taxRates.GridaniaTax, Uldah = taxRates.UldahTax, Ishgard = taxRates.IshgardTax, Kugane = taxRates.KuganeTax, Crystarium = taxRates.CrystariumTax, Sharlayan = taxRates.SharlayanTax, }, }; var taxPath = "/upload"; var taxUpload = JsonConvert.SerializeObject(taxUploadObject); Log.Verbose($"{taxPath}: {taxUpload}"); await Util.HttpClient.PostAsync($"{ApiBase}{taxPath}/{ApiKey}", new StringContent(taxUpload, Encoding.UTF8, "application/json")); // ==================================================================================== Log.Verbose("Universalis tax upload completed."); }
public void UploadTax(MarketTaxRates taxRates) { using (var client = new WebClient()) { var taxRatesRequest = new UniversalisTaxUploadRequest(); taxRatesRequest.WorldId = this.dalamud.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0; taxRatesRequest.UploaderId = this.dalamud.ClientState.LocalContentId; taxRatesRequest.TaxData = new UniversalisTaxData { LimsaLominsa = taxRates.LimsaLominsaTax, Gridania = taxRates.GridaniaTax, Uldah = taxRates.UldahTax, Ishgard = taxRates.IshgardTax, Kugane = taxRates.KuganeTax, Crystarium = taxRates.CrystariumTax }; client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); var historyUpload = JsonConvert.SerializeObject(taxRatesRequest); client.UploadString(ApiBase + $"/upload/{ApiKey}", "POST", historyUpload); Log.Verbose(historyUpload); Log.Verbose("Universalis tax upload completed."); } }