#145 : Ajout du seeder Spotify.

This commit is contained in:
Loic Masi
2026-04-02 17:59:36 +02:00
parent 9b12d2a255
commit 943fc00f3c
21 changed files with 728 additions and 351 deletions

View File

@@ -0,0 +1,34 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Objet album de spotify.
/// </summary>
public class SpotifyAlbumDto
{
/// <summary>
/// Id de l'album.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
/// <summary>
/// Nom de l'album.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Date de sortie.
/// </summary>
[JsonPropertyName("release_date")]
public string? ReleaseDate { get; set; }
/// <summary>
/// Urls de la jaquette.
/// </summary>
[JsonPropertyName("images")]
public List<SpotifyImageDto> Images { get; set; } = new ();
}
}

View File

@@ -0,0 +1,16 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Objet Spotify qui contient une liste d'album.
/// </summary>
public class SpotifyAlbumsResponseDto
{
/// <summary>
/// Container de plusieurs albums spotify.
/// </summary>
[JsonPropertyName("items")]
public List<SpotifyAlbumDto> Items { get; set; } = new ();
}
}

View File

@@ -0,0 +1,28 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Objet artiste retourne depuis spotify.
/// </summary>
public class SpotifyArtistDto
{
/// <summary>
/// Id de l'artiste.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
/// <summary>
/// Nom de l'artiste.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Genre musical de l'artiste.
/// </summary>
[JsonPropertyName("genres")]
public List<string> Genres { get; set; } = new ();
}
}

View File

@@ -0,0 +1,16 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Container d'artistes spotify.
/// </summary>
public class SpotifyArtistsContainerDto
{
/// <summary>
/// Liste d'artiste spotify.
/// </summary>
[JsonPropertyName("items")]
public List<SpotifyArtistDto> Items { get; set; } = new ();
}
}

View File

@@ -0,0 +1,9 @@
namespace Webzine.Business.DTOs.Spotify;
using System.Text.Json.Serialization;
public class SpotifyExternalUrlsDto
{
[JsonPropertyName("spotify")]
public string? Spotify { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace Webzine.Business.DTOs.Spotify;
using System.Text.Json.Serialization;
public class SpotifyImageDto
{
[JsonPropertyName("url")]
public string? Url { get; set; }
}

View File

@@ -0,0 +1,16 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Resultat d'une recherche spotify avec un objet artist.
/// </summary>
public class SpotifySearchArtistsResponseDto
{
/// <summary>
/// Liste d'artistes.
/// </summary>
[JsonPropertyName("artists")]
public SpotifyArtistsContainerDto? Artists { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Recuperation Token Bearer de spotify.
/// </summary>
public class SpotifyTokenResponseDto
{
/// <summary>
/// Jeton d'acces.
/// </summary>
[JsonPropertyName("access_token")]
public string? AccessToken { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Objet track de spotify.
/// </summary>
public class SpotifyTrackDto
{
/// <summary>
/// Id de la track.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
/// <summary>
/// Nom de la musique.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Duree de la musique en millieseconde.
/// </summary>
[JsonPropertyName("duration_ms")]
public int DurationMs { get; set; }
/// <summary>
/// urls spotify.
/// </summary>
[JsonPropertyName("external_urls")]
public SpotifyExternalUrlsDto? ExternalUrls { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace Webzine.Business.DTOs.Spotify
{
using System.Text.Json.Serialization;
/// <summary>
/// Reponse spotify qui contient une liste de tracks.
/// </summary>
public class SpotifyTracksResponseDto
{
/// <summary>
/// Container qui contient plusieurs tracks.
/// </summary>
[JsonPropertyName("items")]
public List<SpotifyTrackDto> Items { get; set; } = new ();
}
}