diff --git a/.gitignore b/.gitignore index 66b07742..7e5c4c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -385,4 +385,5 @@ FodyWeavers.xsd # JetBrains Rider .idea/ -*.sln.iml \ No newline at end of file +*.sln.iml +/package.zip diff --git a/Brightcove.Core/Brightcove.Core.csproj b/Brightcove.Core/Brightcove.Core.csproj index f7c5abe7..ca68e880 100644 --- a/Brightcove.Core/Brightcove.Core.csproj +++ b/Brightcove.Core/Brightcove.Core.csproj @@ -54,6 +54,8 @@ + + diff --git a/Brightcove.Core/Models/Experience.cs b/Brightcove.Core/Models/Experience.cs new file mode 100644 index 00000000..51e867f0 --- /dev/null +++ b/Brightcove.Core/Models/Experience.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace Brightcove.Core.Models +{ + /// + /// Represents a experience object from the Brightcove API + /// For more information, see https://apis.support.brightcove.com/ipx/references/reference.html#operation/GetExperiences + /// + public class Experience : Asset + { + [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime CreationDate { get; set; } + + [JsonProperty("publishedUrl", NullValueHandling = NullValueHandling.Ignore)] + public string Url { get; set; } + + public Experience ShallowCopy() + { + return (Experience)this.MemberwiseClone(); + } + } + + public class ExperienceList + { + [JsonProperty("items", NullValueHandling = NullValueHandling.Ignore)] + public IEnumerable Items { get; set; } + } +} diff --git a/Brightcove.Core/Models/Player.cs b/Brightcove.Core/Models/Player.cs new file mode 100644 index 00000000..45741d58 --- /dev/null +++ b/Brightcove.Core/Models/Player.cs @@ -0,0 +1,47 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace Brightcove.Core.Models +{ + /// + /// Represents a players object from the Brightcove API + /// For more information, see https://apis.support.brightcove.com/player-management/references/reference.html#operation/GetPlayer + /// + public class Player : Asset + { + [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime CreattionDate { get; set; } + + [JsonProperty("url", NullValueHandling = NullValueHandling.Ignore)] + public string Url { get; set; } + + [JsonProperty("branches", NullValueHandling = NullValueHandling.Ignore)] + public Branches Branches { get; set; } + + public Player ShallowCopy() + { + return (Player)this.MemberwiseClone(); + } + } + + public class Branches + { + [JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)] + public Master Master { get; set; } + } + + public class Master + { + [JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime UpdatedAt { get; set; } + } + + public class PlayerList + { + [JsonProperty("items", NullValueHandling = NullValueHandling.Ignore)] + public IEnumerable Items { get; set; } + } + + +} diff --git a/Brightcove.Core/Services/BrightcoveService.cs b/Brightcove.Core/Services/BrightcoveService.cs index 34d883d6..37531a79 100644 --- a/Brightcove.Core/Services/BrightcoveService.cs +++ b/Brightcove.Core/Services/BrightcoveService.cs @@ -20,12 +20,14 @@ public class BrightcoveService readonly string cmsBaseUrl = "https://cms.api.brightcove.com/v1/accounts"; readonly string ingestBaseUrl = "https://ingest.api.brightcove.com/v1/accounts"; + readonly string playersBaseUrl = "https://players.api.brightcove.com/v1/accounts"; + readonly string experienceBaseUrl = "https://experiences.api.brightcove.com/v1/accounts"; readonly string accountId; readonly BrightcoveAuthenticationService authenticationService; public BrightcoveService(string accountId, string clientId, string clientSecret) { - if(string.IsNullOrWhiteSpace(accountId)) + if (string.IsNullOrWhiteSpace(accountId)) { throw new ArgumentException("argument must not be null or empty", nameof(accountId)); } @@ -162,6 +164,46 @@ public Video UpdateVideo(Video video) return JsonConvert.DeserializeObject