forked from Fishes/TMDbWrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTheMovieDbCompany.cs
47 lines (45 loc) · 1.76 KB
/
TheMovieDbCompany.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TmdbWrapper.Cache;
using TmdbWrapper.Companies;
using TmdbWrapper.Search;
using TmdbWrapper.Utilities;
namespace TmdbWrapper
{
public partial class TheMovieDb
{
/// <summary>
/// Gets a specific company
/// </summary>
/// <param name="CompanyId">Id of the requested company.</param>
/// <returns>The company that is associated to the id.</returns>
public static async Task<Company> GetCompanyAsync(int CompanyId)
{
Company company = DatabaseCache.GetObject<Company>(CompanyId);
if (company == null)
{
Request<Company> request = new Request<Company>("company/" + CompanyId.ToString());
company = await request.ProcesRequestAsync();
DatabaseCache.SetObject(CompanyId, company);
}
return company;
}
/// <summary>
/// Gets the credits of the specified company.
/// </summary>
/// <param name="CompanyId">The id of the company</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <returns>A page of credits</returns>
public static async Task<SearchResult<MovieSummary>> GetCompanyCreditsAsync(int CompanyId, int page = 1)
{
Request<MovieSummary> request = new Request<MovieSummary>("company/" + CompanyId.ToString() + "/movies");
request.AddParameter("page", page);
if(!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
return await request.ProcessSearchRequestAsync();
}
}
}