Added first real test

This commit is contained in:
tidusjar 2016-03-09 11:21:06 +00:00
parent f7a6614748
commit 68850fd8b7
29 changed files with 461 additions and 22 deletions

View file

@ -0,0 +1,62 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexAuthentication.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
namespace PlexRequests.Api.Models
{
public class PlexAuthentication
{
public User user { get; set; }
}
public class Subscription
{
public bool active { get; set; }
public string status { get; set; }
public object plan { get; set; }
public object features { get; set; }
}
public class Roles
{
public List<object> roles { get; set; }
}
public class User
{
public string email { get; set; }
public string joined_at { get; set; }
public string username { get; set; }
public string title { get; set; }
public string authentication_token { get; set; }
public Subscription subscription { get; set; }
public Roles roles { get; set; }
public List<string> entitlements { get; set; }
public object confirmed_at { get; set; }
public int forum_id { get; set; }
}
}

View file

@ -0,0 +1,38 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexError.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Xml.Serialization;
namespace PlexRequests.Api.Models
{
[XmlRoot(ElementName = "errors")]
public class PlexError
{
[XmlElement(ElementName = "error")]
public string Error { get; set; }
}
}

View file

@ -0,0 +1,87 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexFriends.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Xml.Serialization;
namespace PlexRequests.Api.Models
{
[XmlRoot(ElementName = "Server")]
public class Server
{
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "serverId")]
public string ServerId { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "name")]
public string Name { get; set; }
[XmlAttribute(AttributeName = "lastSeenAt")]
public string LastSeenAt { get; set; }
[XmlAttribute(AttributeName = "numLibraries")]
public string NumLibraries { get; set; }
[XmlAttribute(AttributeName = "owned")]
public string Owned { get; set; }
}
[XmlRoot(ElementName = "User")]
public class UserFriends
{
[XmlElement(ElementName = "Server")]
public Server Server { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "title")]
public string Title { get; set; }
[XmlAttribute(AttributeName = "username")]
public string Username { get; set; }
[XmlAttribute(AttributeName = "email")]
public string Email { get; set; }
[XmlAttribute(AttributeName = "recommendationsPlaylistId")]
public string RecommendationsPlaylistId { get; set; }
[XmlAttribute(AttributeName = "thumb")]
public string Thumb { get; set; }
}
[XmlRoot(ElementName = "MediaContainer")]
public class PlexFriends
{
[XmlElement(ElementName = "User")]
public UserFriends[] User { get; set; }
[XmlAttribute(AttributeName = "friendlyName")]
public string FriendlyName { get; set; }
[XmlAttribute(AttributeName = "identifier")]
public string Identifier { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "totalSize")]
public string TotalSize { get; set; }
[XmlAttribute(AttributeName = "size")]
public string Size { get; set; }
}
}

View file

@ -0,0 +1,258 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexSearch.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Xml.Serialization;
namespace PlexRequests.Api.Models
{
[XmlRoot(ElementName = "Part")]
public class Part
{
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "key")]
public string Key { get; set; }
[XmlAttribute(AttributeName = "duration")]
public string Duration { get; set; }
[XmlAttribute(AttributeName = "file")]
public string File { get; set; }
[XmlAttribute(AttributeName = "size")]
public string Size { get; set; }
[XmlAttribute(AttributeName = "audioProfile")]
public string AudioProfile { get; set; }
[XmlAttribute(AttributeName = "container")]
public string Container { get; set; }
[XmlAttribute(AttributeName = "videoProfile")]
public string VideoProfile { get; set; }
[XmlAttribute(AttributeName = "has64bitOffsets")]
public string Has64bitOffsets { get; set; }
[XmlAttribute(AttributeName = "hasChapterTextStream")]
public string HasChapterTextStream { get; set; }
[XmlAttribute(AttributeName = "optimizedForStreaming")]
public string OptimizedForStreaming { get; set; }
}
[XmlRoot(ElementName = "Media")]
public class Media
{
[XmlElement(ElementName = "Part")]
public Part Part { get; set; }
[XmlAttribute(AttributeName = "videoResolution")]
public string VideoResolution { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "duration")]
public string Duration { get; set; }
[XmlAttribute(AttributeName = "bitrate")]
public string Bitrate { get; set; }
[XmlAttribute(AttributeName = "width")]
public string Width { get; set; }
[XmlAttribute(AttributeName = "height")]
public string Height { get; set; }
[XmlAttribute(AttributeName = "aspectRatio")]
public string AspectRatio { get; set; }
[XmlAttribute(AttributeName = "audioChannels")]
public string AudioChannels { get; set; }
[XmlAttribute(AttributeName = "audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute(AttributeName = "videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute(AttributeName = "container")]
public string Container { get; set; }
[XmlAttribute(AttributeName = "videoFrameRate")]
public string VideoFrameRate { get; set; }
[XmlAttribute(AttributeName = "audioProfile")]
public string AudioProfile { get; set; }
[XmlAttribute(AttributeName = "videoProfile")]
public string VideoProfile { get; set; }
[XmlAttribute(AttributeName = "optimizedForStreaming")]
public string OptimizedForStreaming { get; set; }
[XmlAttribute(AttributeName = "has64bitOffsets")]
public string Has64bitOffsets { get; set; }
}
[XmlRoot(ElementName = "Genre")]
public class Genre
{
[XmlAttribute(AttributeName = "tag")]
public string Tag { get; set; }
}
[XmlRoot(ElementName = "Writer")]
public class Writer
{
[XmlAttribute(AttributeName = "tag")]
public string Tag { get; set; }
}
[XmlRoot(ElementName = "Director")]
public class Director
{
[XmlAttribute(AttributeName = "tag")]
public string Tag { get; set; }
}
[XmlRoot(ElementName = "Country")]
public class Country
{
[XmlAttribute(AttributeName = "tag")]
public string Tag { get; set; }
}
[XmlRoot(ElementName = "Role")]
public class Role
{
[XmlAttribute(AttributeName = "tag")]
public string Tag { get; set; }
}
[XmlRoot(ElementName = "Video")]
public class Video
{
[XmlElement(ElementName = "Media")]
public List<Media> Media { get; set; }
[XmlElement(ElementName = "Genre")]
public List<Genre> Genre { get; set; }
[XmlElement(ElementName = "Writer")]
public List<Writer> Writer { get; set; }
[XmlElement(ElementName = "Director")]
public Director Director { get; set; }
[XmlElement(ElementName = "Country")]
public Country Country { get; set; }
[XmlElement(ElementName = "Role")]
public List<Role> Role { get; set; }
[XmlAttribute(AttributeName = "allowSync")]
public string AllowSync { get; set; }
[XmlAttribute(AttributeName = "librarySectionID")]
public string LibrarySectionID { get; set; }
[XmlAttribute(AttributeName = "librarySectionTitle")]
public string LibrarySectionTitle { get; set; }
[XmlAttribute(AttributeName = "librarySectionUUID")]
public string LibrarySectionUUID { get; set; }
[XmlAttribute(AttributeName = "personal")]
public string Personal { get; set; }
[XmlAttribute(AttributeName = "sourceTitle")]
public string SourceTitle { get; set; }
[XmlAttribute(AttributeName = "ratingKey")]
public string RatingKey { get; set; }
[XmlAttribute(AttributeName = "key")]
public string Key { get; set; }
[XmlAttribute(AttributeName = "studio")]
public string Studio { get; set; }
[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
[XmlAttribute(AttributeName = "title")]
public string Title { get; set; }
[XmlAttribute(AttributeName = "contentRating")]
public string ContentRating { get; set; }
[XmlAttribute(AttributeName = "summary")]
public string Summary { get; set; }
[XmlAttribute(AttributeName = "rating")]
public string Rating { get; set; }
[XmlAttribute(AttributeName = "audienceRating")]
public string AudienceRating { get; set; }
[XmlAttribute(AttributeName = "year")]
public string Year { get; set; }
[XmlAttribute(AttributeName = "tagline")]
public string Tagline { get; set; }
[XmlAttribute(AttributeName = "thumb")]
public string Thumb { get; set; }
[XmlAttribute(AttributeName = "art")]
public string Art { get; set; }
[XmlAttribute(AttributeName = "duration")]
public string Duration { get; set; }
[XmlAttribute(AttributeName = "originallyAvailableAt")]
public string OriginallyAvailableAt { get; set; }
[XmlAttribute(AttributeName = "addedAt")]
public string AddedAt { get; set; }
[XmlAttribute(AttributeName = "updatedAt")]
public string UpdatedAt { get; set; }
[XmlAttribute(AttributeName = "audienceRatingImage")]
public string AudienceRatingImage { get; set; }
[XmlAttribute(AttributeName = "chapterSource")]
public string ChapterSource { get; set; }
[XmlAttribute(AttributeName = "ratingImage")]
public string RatingImage { get; set; }
[XmlAttribute(AttributeName = "titleSort")]
public string TitleSort { get; set; }
[XmlAttribute(AttributeName = "parentRatingKey")]
public string ParentRatingKey { get; set; }
[XmlAttribute(AttributeName = "grandparentRatingKey")]
public string GrandparentRatingKey { get; set; }
[XmlAttribute(AttributeName = "grandparentKey")]
public string GrandparentKey { get; set; }
[XmlAttribute(AttributeName = "parentKey")]
public string ParentKey { get; set; }
[XmlAttribute(AttributeName = "grandparentTitle")]
public string GrandparentTitle { get; set; }
[XmlAttribute(AttributeName = "index")]
public string Index { get; set; }
[XmlAttribute(AttributeName = "parentIndex")]
public string ParentIndex { get; set; }
[XmlAttribute(AttributeName = "parentThumb")]
public string ParentThumb { get; set; }
[XmlAttribute(AttributeName = "grandparentThumb")]
public string GrandparentThumb { get; set; }
[XmlAttribute(AttributeName = "grandparentArt")]
public string GrandparentArt { get; set; }
[XmlAttribute(AttributeName = "viewCount")]
public string ViewCount { get; set; }
[XmlAttribute(AttributeName = "lastViewedAt")]
public string LastViewedAt { get; set; }
[XmlAttribute(AttributeName = "grandparentTheme")]
public string GrandparentTheme { get; set; }
}
[XmlRoot(ElementName = "Provider")]
public class Provider
{
[XmlAttribute(AttributeName = "key")]
public string Key { get; set; }
[XmlAttribute(AttributeName = "title")]
public string Title { get; set; }
[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
}
[XmlRoot(ElementName = "MediaContainer")]
public class PlexSearch
{
[XmlElement(ElementName = "Video")]
public List<Video> Video { get; set; }
[XmlElement(ElementName = "Provider")]
public List<Provider> Provider { get; set; }
[XmlAttribute(AttributeName = "size")]
public string Size { get; set; }
[XmlAttribute(AttributeName = "identifier")]
public string Identifier { get; set; }
[XmlAttribute(AttributeName = "mediaTagPrefix")]
public string MediaTagPrefix { get; set; }
[XmlAttribute(AttributeName = "mediaTagVersion")]
public string MediaTagVersion { get; set; }
}
}

View file

@ -0,0 +1,40 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexUserRequest.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
namespace PlexRequests.Api.Models
{
public class PlexUserRequest
{
public UserRequest user { get; set; }
}
public class UserRequest
{
public string login { get; set; }
public string password { get; set; }
}
}