using System.Collections.Generic;
using TVDBSharp.Models;
using TVDBSharp.Models.DAO;
using TVDBSharp.Models.Enums;
namespace TVDBSharp
{
///
/// The main class which will handle all user interaction.
///
public class TVDB
{
private readonly IDataProvider _dataProvider;
///
/// Creates a new instance with the provided API key and dataProvider.
///
/// The API key provided by TVDB.
/// Specify your own instance.
public TVDB(string apiKey, IDataProvider dataProvider)
{
_dataProvider = dataProvider;
_dataProvider.ApiKey = apiKey;
}
///
/// Creates a new instance with the provided API key and standard .
///
/// The API key provided by TVDB.
public TVDB(string apiKey)
{
_dataProvider = new DataProvider {ApiKey = apiKey};
}
///
/// Search for a show in the database.
///
/// Query that identifies the show.
/// Maximal amount of results in the returning set. Default is 5.
/// Returns a list of shows.
public List Search(string query, int results = 5)
{
return new Builder(_dataProvider).Search(query, results);
}
///
/// Get a specific show based on its ID.
///
/// ID of the show.
/// Returns the corresponding show.
public Show GetShow(int showId)
{
return new Builder(_dataProvider).BuildShow(showId);
}
///
/// Get a specific episode based on its ID.
///
/// ID of the episode
/// ISO 639-1 language code for the episode
/// The corresponding episode
public Episode GetEpisode(int episodeId, string lang = "en")
{
return new Builder(_dataProvider).BuildEpisode(episodeId, lang);
}
public Updates GetUpdates(Interval interval)
{
return new Builder(_dataProvider).BuildUpdates(interval);
}
}
}