Skip to content

Commit

Permalink
merge dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GiorgioCitterio committed Nov 27, 2023
2 parents 577d02b + f4854e1 commit cfe96e6
Show file tree
Hide file tree
Showing 179 changed files with 9,356 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,4 @@ FodyWeavers.xsd
*.sln.iml

src/keys.json
src/Sportify/.idea/.idea.Sportify/.idea/
252 changes: 252 additions & 0 deletions src/ProvaApiFootball/Classi.cs
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; }
}


}
24 changes: 24 additions & 0 deletions src/ProvaApiFootball/Program.cs
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);
}
}
}
}
14 changes: 14 additions & 0 deletions src/ProvaApiFootball/ProvaApiFootball.csproj
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>
25 changes: 25 additions & 0 deletions src/ProvaApiFootball/ProvaApiFootball.sln
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
15 changes: 15 additions & 0 deletions src/Sportify/Sportify/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style TargetType="Label" x:Key="BaseLabel">
<Setter Property="FontFamily" Value="TimesNewRoman" />
<Setter Property="TextColor" Value="#f7f9fa" />
<Setter Property="HorizontalOptions" Value="Center"/>
<Setter Property="VerticalOptions" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
</Style>

<Style TargetType="Image" x:Key="BaseImage">
<Setter Property="MaximumHeightRequest" Value="60" />
<Setter Property="MaximumWidthRequest" Value="60" />
<Setter Property="HorizontalOptions" Value="Center"/>
<Setter Property="VerticalOptions" Value="Center"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
Loading

0 comments on commit cfe96e6

Please sign in to comment.