-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
179 changed files
with
9,356 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -398,3 +398,4 @@ FodyWeavers.xsd | |
*.sln.iml | ||
|
||
src/keys.json | ||
src/Sportify/.idea/.idea.Sportify/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProvaApiFootball | ||
{ | ||
// Root myDeserializedClass = JsonSerializer.Deserialize<Root>(myJsonResponse); | ||
public class Away | ||
{ | ||
[JsonPropertyName("id")] | ||
public int? Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("logo")] | ||
public string Logo { get; set; } | ||
|
||
[JsonPropertyName("winner")] | ||
public bool? Winner { get; set; } | ||
} | ||
|
||
public class Extratime | ||
{ | ||
[JsonPropertyName("home")] | ||
public object Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public object Away { get; set; } | ||
} | ||
|
||
public class Fixture | ||
{ | ||
[JsonPropertyName("id")] | ||
public int? Id { get; set; } | ||
|
||
[JsonPropertyName("referee")] | ||
public string Referee { get; set; } | ||
|
||
[JsonPropertyName("timezone")] | ||
public string Timezone { get; set; } | ||
|
||
[JsonPropertyName("date")] | ||
public DateTime? Date { get; set; } | ||
|
||
[JsonPropertyName("timestamp")] | ||
public int? Timestamp { get; set; } | ||
|
||
[JsonPropertyName("periods")] | ||
public Periods Periods { get; set; } | ||
|
||
[JsonPropertyName("venue")] | ||
public Venue Venue { get; set; } | ||
|
||
[JsonPropertyName("status")] | ||
public Status Status { get; set; } | ||
} | ||
|
||
public class Fulltime | ||
{ | ||
[JsonPropertyName("home")] | ||
public int? Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public int? Away { get; set; } | ||
} | ||
|
||
public class Goals | ||
{ | ||
[JsonPropertyName("home")] | ||
public int? Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public int? Away { get; set; } | ||
} | ||
|
||
public class Halftime | ||
{ | ||
[JsonPropertyName("home")] | ||
public int? Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public int? Away { get; set; } | ||
} | ||
|
||
public class Home | ||
{ | ||
[JsonPropertyName("id")] | ||
public int? Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("logo")] | ||
public string Logo { get; set; } | ||
|
||
[JsonPropertyName("winner")] | ||
public bool? Winner { get; set; } | ||
} | ||
|
||
public class League | ||
{ | ||
[JsonPropertyName("id")] | ||
public int? Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("country")] | ||
public string Country { get; set; } | ||
|
||
[JsonPropertyName("logo")] | ||
public string Logo { get; set; } | ||
|
||
[JsonPropertyName("flag")] | ||
public string Flag { get; set; } | ||
|
||
[JsonPropertyName("season")] | ||
public int? Season { get; set; } | ||
|
||
[JsonPropertyName("round")] | ||
public string Round { get; set; } | ||
} | ||
|
||
public class Paging | ||
{ | ||
[JsonPropertyName("current")] | ||
public int? Current { get; set; } | ||
|
||
[JsonPropertyName("total")] | ||
public int? Total { get; set; } | ||
} | ||
|
||
public class Parameters | ||
{ | ||
[JsonPropertyName("league")] | ||
public string League { get; set; } | ||
|
||
[JsonPropertyName("season")] | ||
public string Season { get; set; } | ||
} | ||
|
||
public class Penalty | ||
{ | ||
[JsonPropertyName("home")] | ||
public object Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public object Away { get; set; } | ||
} | ||
|
||
public class Periods | ||
{ | ||
[JsonPropertyName("first")] | ||
public int? First { get; set; } | ||
|
||
[JsonPropertyName("second")] | ||
public int? Second { get; set; } | ||
} | ||
|
||
public class Response | ||
{ | ||
[JsonPropertyName("fixture")] | ||
public Fixture Fixture { get; set; } | ||
|
||
[JsonPropertyName("league")] | ||
public League League { get; set; } | ||
|
||
[JsonPropertyName("teams")] | ||
public Teams Teams { get; set; } | ||
|
||
[JsonPropertyName("goals")] | ||
public Goals Goals { get; set; } | ||
|
||
[JsonPropertyName("score")] | ||
public Score Score { get; set; } | ||
} | ||
|
||
public class Root | ||
{ | ||
[JsonPropertyName("get")] | ||
public string Get { get; set; } | ||
|
||
[JsonPropertyName("parameters")] | ||
public Parameters Parameters { get; set; } | ||
|
||
[JsonPropertyName("errors")] | ||
public List<object> Errors { get; set; } | ||
|
||
[JsonPropertyName("results")] | ||
public int? Results { get; set; } | ||
|
||
[JsonPropertyName("paging")] | ||
public Paging Paging { get; set; } | ||
|
||
[JsonPropertyName("response")] | ||
public List<Response> Response { get; set; } | ||
} | ||
|
||
public class Score | ||
{ | ||
[JsonPropertyName("halftime")] | ||
public Halftime Halftime { get; set; } | ||
|
||
[JsonPropertyName("fulltime")] | ||
public Fulltime Fulltime { get; set; } | ||
|
||
[JsonPropertyName("extratime")] | ||
public Extratime Extratime { get; set; } | ||
|
||
[JsonPropertyName("penalty")] | ||
public Penalty Penalty { get; set; } | ||
} | ||
|
||
public class Status | ||
{ | ||
[JsonPropertyName("long")] | ||
public string Long { get; set; } | ||
|
||
[JsonPropertyName("short")] | ||
public string Short { get; set; } | ||
|
||
[JsonPropertyName("elapsed")] | ||
public int? Elapsed { get; set; } | ||
} | ||
|
||
public class Teams | ||
{ | ||
[JsonPropertyName("home")] | ||
public Home Home { get; set; } | ||
|
||
[JsonPropertyName("away")] | ||
public Away Away { get; set; } | ||
} | ||
|
||
public class Venue | ||
{ | ||
[JsonPropertyName("id")] | ||
public int? Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("city")] | ||
public string City { get; set; } | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using RestSharp; | ||
using System.Net.Http.Json; | ||
|
||
namespace ProvaApiFootball | ||
{ | ||
internal class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
var client = new HttpClient(); | ||
client.BaseAddress = new Uri("https://v3.football.api-sports.io"); | ||
client.DefaultRequestHeaders.Add("x-rapidapi-key", "7169e21806353dcad1a1592a2b7043bd"); | ||
client.DefaultRequestHeaders.Add("x-rapidapi-host", "v3.football.api-sports.io"); | ||
var response = await client.GetAsync("/fixtures?league=135&season=2023"); | ||
var lista = await response.Content.ReadFromJsonAsync<Root>(); | ||
//var lista = await response.Content.ReadAsStringAsync(); | ||
//Console.WriteLine(lista); | ||
foreach (var item in lista.Response) | ||
{ | ||
Console.WriteLine(item.Teams.Home.Name + "" + item.Teams.Away.Name + "" + item.Goals.Home + "-" + item.Goals.Away); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="RestSharp" Version="110.2.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProvaApiFootball", "ProvaApiFootball.csproj", "{C328E011-E5D6-4F8D-B09D-68C3A3334C8F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C328E011-E5D6-4F8D-B09D-68C3A3334C8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C328E011-E5D6-4F8D-B09D-68C3A3334C8F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C328E011-E5D6-4F8D-B09D-68C3A3334C8F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C328E011-E5D6-4F8D-B09D-68C3A3334C8F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BB99A0E2-8450-4ED5-9A88-744AB67350F5} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.