public async Task <YouTubeUploadRequest> CreateUploadRequest(string FileName, string Title, string Description, string[] Tags = null, YouTubePrivacyStatus PrivacyStatus = YouTubePrivacyStatus.Unlisted) { if (_youtubeService == null) { await Init(); } var video = new Video { Snippet = new VideoSnippet { Title = Title, Description = Description, Tags = Tags ?? new string[0], CategoryId = "22" }, Status = new VideoStatus { PrivacyStatus = GetPrivacyStatus(PrivacyStatus) } }; return(new YouTubeUploadRequest(FileName, _youtubeService, video)); }
/// <summary> /// Initializes a new instance from the specified <paramref name="json"/> object. /// </summary> /// <param name="json">The instance of <see cref="JObject"/> representing the object.</param> protected YouTubePlaylistItemStatus(JObject json) : base(json) { // Parse the privacy status string strStatus = json.GetString("privacyStatus"); if (Enum.TryParse(strStatus, true, out YouTubePrivacyStatus status) == false) { throw new Exception("Unknown privacy status \"" + strStatus + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social.Google.YouTube/issues/new"); } PrivacyStatus = status; }
static string GetPrivacyStatus(YouTubePrivacyStatus PrivacyStatus) { return(PrivacyStatus.ToString().ToLower()); }