using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using System;
using System.Net;
namespace MediaBrowser.Api
{
///
/// Contains some helpers for the api
///
public static class ApiService
{
///
/// Gets a User by Id
///
/// The id of the user
/// User.
/// id
public static User GetUserById(string id)
{
if (string.IsNullOrEmpty(id))
{
throw new ArgumentNullException("id");
}
var guid = new Guid(id);
return Kernel.Instance.GetUserById(guid);
}
///
/// Determines whether [is API URL match] [the specified URL].
///
/// The URL.
/// The request.
/// true if [is API URL match] [the specified URL]; otherwise, false.
public static bool IsApiUrlMatch(string url, HttpListenerRequest request)
{
url = "/api/" + url;
return request.Url.LocalPath.EndsWith(url, StringComparison.OrdinalIgnoreCase);
}
}
}