123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- using System;
- using System.Text;
- using System.Net.Http;
- using System.Net.Http.Headers;
- using System.Threading.Tasks;
- using Newtonsoft.Json;
- namespace ConsoleApp1
- {
- /*public class OrdinaryUrl
- {
- public string? type { get; set; }
- public string? url { get; set; }
- public string? suggested_link_text { get; set; }
- public OrdinaryUrl(string? type, string? url, string? suggested_link_text)
- {
- this.type = type;
- this.url = url;
- this.suggested_link_text = suggested_link_text;
- }
- }*/
- /*
- public class InformationCriminals
- {
-
- [JsonProperty("@id")] public string? Newid { get; set; }
- [JsonProperty("title")] public string? Title { get; set; }
- [JsonProperty("field_offices")] public string? Office { get; set; }
- [JsonProperty("details")] public string? Detail { get; set; }
- [JsonProperty("sex")] public string? Pol { get; set; }
- [JsonProperty("nationality")] public string? National { get; set; }
- [JsonProperty("age_max")] public int? Age { get; set; }
- [JsonProperty("height_max")] public int? Height { get; set; }
- [JsonProperty("race_raw")] public string? Race { get; set; }
- [JsonProperty("hair_raw")] public string? Hair { get; set; }
- [JsonProperty("languages")] public string? Language { get; set; }
- [JsonProperty("files")] public string? Urlpdf { get; set; }
- public InformationCriminals(string? underNewid, string? underTitle, string? underOffice, string?
- underDetails, string? underPol, string? underNational, int? underAge, int? underHeight,
- string? underRace,
- string? underHair, string? underLanguage, string? underPdf)
- {
- this.Newid = underNewid;
- this.Title = underTitle;
- this.Office = underOffice;
- this.Detail = underDetails;
- this.Pol = underPol;
- this.National = underNational;
- this.Age = underAge;
- this.Height = underHeight;
- this.Race = underRace;
- this.Hair = underHair;
- this.Language = underLanguage;
- this.Urlpdf = underPdf;
-
- }
- }*/
-
- class Contributor
- {
- public string items { get; set; }
-
- public override string ToString()
- {
- return $"{items} ";
- }
- }
- class Program
- {
- private static async Task Main()
- {
- using var client = new HttpClient();
- client.BaseAddress = new Uri("https://api.fbi.gov/wanted/v1/list");
-
- client.DefaultRequestHeaders.Accept.Add(
- new MediaTypeWithQualityHeaderValue("application/json"));
- var url = "https://api.fbi.gov/wanted/v1/list";
- HttpResponseMessage response = await client.GetAsync(url);
- response.EnsureSuccessStatusCode();
- var resp = await response.Content.ReadAsStringAsync();
- List<Contributor> contributors =
- JsonConvert.DeserializeObject<List<Contributor>>(resp);
- contributors.ForEach(Console.WriteLine);
- }
- }
-
- }
- /*class WantedPersons
- {
- public string title { get; set; }
- public char dates_of_birth_used { get; set; }
- public string nationality { get; set; }
- public string race_raw { get; set; }
- public string race { get; set; }
- public string hair_raw { get; set; }
- public string place_of_birth { get; set; }
- public string person_classification { get; set; }
- public string description { get; set; }
- public int height_max { get; set; }
- public int height_min { get; set; }
-
- public override string ToString()
- {
- return $"{title}: {dates_of_birth_used}: {nationality} nationality: {race_raw}:" +
- $" {race}: {hair_raw}: {place_of_birth}: {person_classification}: {description}:" +
- $"{height_max}: {height_min}";
- }
- }
- class Program
- {
- static async Task Main(string[] args)
- {
-
- using var client = new HttpClient();
- client.BaseAddress = new Uri("https://www.fbi.gov/wanted");
- client.DefaultRequestHeaders.Add("MostWanted Persons", "");
- client.DefaultRequestHeaders.Accept.Add(
- new MediaTypeWithQualityHeaderValue("application/json"));
- var url = "repos/symfony/symfony/persons";
- HttpResponseMessage response = await client.GetAsync(url);
- response.EnsureSuccessStatusCode();
- var resp = await response.Content.ReadAsStringAsync();
- List<WantedPersons> persons = JsonConvert.DeserializeObject<List<WantedPersons>>(resp);
- persons.ForEach(Console.WriteLine);
-
-
-
-
-
- }*/
-
|