more services from Web API
This commit is contained in:
parent
8e8f4d3896
commit
25b261f4ee
19 changed files with 26 additions and 133 deletions
23
src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs
Normal file
23
src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
using Models.societe.com;
|
||||
using Yavsc.Server;
|
||||
|
||||
public static class ComapnyInfoHelpers {
|
||||
public static async Task<CompanyInfoMessage> CheckSiren(this HttpClient web,
|
||||
string siren, CompanyInfoSettings api)
|
||||
{
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get,
|
||||
string.Format(ServerConstants.CompanyInfoUrl,siren,api.ApiKey))) {
|
||||
using (var response = await web.SendAsync(request)) {
|
||||
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
|
||||
return payload.ToObject<CompanyInfoMessage>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue