Skip to content

Commit

Permalink
Merge pull request #88 from tidusjar/dev
Browse files Browse the repository at this point in the history
Release 1.5.0
  • Loading branch information
Jamie committed Mar 25, 2016
2 parents 79e7cc5 + 339bb91 commit 7b55f07
Show file tree
Hide file tree
Showing 111 changed files with 22,095 additions and 512 deletions.
4 changes: 3 additions & 1 deletion PlexRequests.Api.Interfaces/IPushbulletApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Threading.Tasks;

using PlexRequests.Api.Models.Notifications;

namespace PlexRequests.Api.Interfaces
Expand All @@ -38,6 +40,6 @@ public interface IPushbulletApi
/// <param name="message">The message.</param>
/// <param name="deviceIdentifier">The device identifier.</param>
/// <returns></returns>
PushbulletResponse Push(string accessToken, string title, string message, string deviceIdentifier = default(string));
Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string));
}
}
37 changes: 37 additions & 0 deletions PlexRequests.Api.Interfaces/IPushoverApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: IPushoverApi.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.Threading.Tasks;

using PlexRequests.Api.Models.Notifications;

namespace PlexRequests.Api.Interfaces
{
public interface IPushoverApi
{
Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken);
}
}
5 changes: 4 additions & 1 deletion PlexRequests.Api.Interfaces/ISickRageApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
#endregion

using System;
using System.Threading.Tasks;
using PlexRequests.Api.Models.SickRage;

namespace PlexRequests.Api.Interfaces
{
public interface ISickRageApi
{
SickRageTvAdd AddSeries(int tvdbId, bool latest, string quality, string apiKey,
Task<SickRageTvAdd> AddSeries(int tvdbId, int seasoncount, int[] seasons, string quality, string apiKey,
Uri baseUrl);

SickRagePing Ping(string apiKey, Uri baseUrl);

Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl);
}
}
2 changes: 1 addition & 1 deletion PlexRequests.Api.Interfaces/ISonarrApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface ISonarrApi
List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl);

SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath,
bool episodes, string apiKey, Uri baseUrl);
int seasonCount, int[] seasons, string apiKey, Uri baseUrl);

SystemStatus SystemStatus(string apiKey, Uri baseUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="ICouchPotatoApi.cs" />
<Compile Include="IPlexApi.cs" />
<Compile Include="IPushbulletApi.cs" />
<Compile Include="IPushoverApi.cs" />
<Compile Include="ISickRageApi.cs" />
<Compile Include="ISonarrApi.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
34 changes: 34 additions & 0 deletions PlexRequests.Api.Models/Notifications/PushoverResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PushoverResponse.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.Notifications
{
public class PushoverResponse
{
public int status { get; set; }
public string request { get; set; }
}
}
3 changes: 3 additions & 0 deletions PlexRequests.Api.Models/PlexRequests.Api.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Compile Include="Movie\CouchPotatoStatus.cs" />
<Compile Include="Notifications\PushbulletPush.cs" />
<Compile Include="Notifications\PushbulletResponse.cs" />
<Compile Include="Notifications\PushoverResponse.cs" />
<Compile Include="Plex\PlexAccount.cs" />
<Compile Include="Plex\PlexAuthentication.cs" />
<Compile Include="Plex\PlexError.cs" />
Expand All @@ -59,13 +60,15 @@
<Compile Include="Plex\PlexUserRequest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SickRage\SickRagePing.cs" />
<Compile Include="SickRage\SickRageShowInformation.cs" />
<Compile Include="SickRage\SickRageStatus.cs" />
<Compile Include="SickRage\SickRageTvAdd.cs" />
<Compile Include="Sonarr\SonarrAddSeries.cs" />
<Compile Include="Sonarr\SonarrProfile.cs" />
<Compile Include="Sonarr\SystemStatus.cs" />
<Compile Include="Tv\Authentication.cs" />
<Compile Include="Tv\TvMazeSearch.cs" />
<Compile Include="Tv\TvMazeSeasons.cs" />
<Compile Include="Tv\TVMazeShow.cs" />
<Compile Include="Tv\TvSearchResult.cs" />
<Compile Include="Tv\TvShow.cs" />
Expand Down
85 changes: 85 additions & 0 deletions PlexRequests.Api.Models/SickRage/SickRageShowInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: SickRageShowInformation.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.SickRage
{
public class Cache
{
public int banner { get; set; }
public int poster { get; set; }
}

public class QualityDetails
{
public List<object> archive { get; set; }
public List<string> initial { get; set; }
}

public class SeasonList
{
}

public class Data
{
public int air_by_date { get; set; }
public string airs { get; set; }
public int anime { get; set; }
public int archive_firstmatch { get; set; }
public Cache cache { get; set; }
public int dvdorder { get; set; }
public int flatten_folders { get; set; }
public List<string> genre { get; set; }
public string imdbid { get; set; }
public int indexerid { get; set; }
public string language { get; set; }
public string location { get; set; }
public string network { get; set; }
public string next_ep_airdate { get; set; }
public int paused { get; set; }
public string quality { get; set; }
public QualityDetails quality_details { get; set; }
public List<object> rls_ignore_words { get; set; }
public List<object> rls_require_words { get; set; }
public int scene { get; set; }
public SeasonList season_list { get; set; }
public string show_name { get; set; }
public int sports { get; set; }
public string status { get; set; }
public int subtitles { get; set; }
public int tvdbid { get; set; }
}

public class SickRageShowInformation
{
public Data data { get; set; }
public string message { get; set; }
public string result { get; set; }
}

}
1 change: 1 addition & 0 deletions PlexRequests.Api.Models/Tv/TVMazeShow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public class TvMazeShow
public string summary { get; set; }
public int updated { get; set; }
public Links _links { get; set; }
public int seasonCount { get; set; }
}
}
13 changes: 13 additions & 0 deletions PlexRequests.Api.Models/Tv/TvMazeSeasons.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlexRequests.Api.Models.Tv
{
public class TvMazeSeasons : TvMazeShow
{
public int number { get; set; }
}
}
2 changes: 1 addition & 1 deletion PlexRequests.Api/Mocks/MockSonarrApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl)
return obj;
}

public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, bool episodes,
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons,
string apiKey, Uri baseUrl)
{
var json = MockApiData.Sonarr_AddSeriesResult;
Expand Down
1 change: 1 addition & 0 deletions PlexRequests.Api/PlexRequests.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<DependentUpon>MockApiData.resx</DependentUpon>
</Compile>
<Compile Include="Mocks\MockSonarrApi.cs" />
<Compile Include="PushoverApi.cs" />
<Compile Include="PushbulletApi.cs" />
<Compile Include="SickrageApi.cs" />
<Compile Include="SonarrApi.cs" />
Expand Down
5 changes: 3 additions & 2 deletions PlexRequests.Api/PushbulletApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// ************************************************************************/
#endregion
using System;
using System.Threading.Tasks;

using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Notifications;
Expand All @@ -35,7 +36,7 @@ namespace PlexRequests.Api
{
public class PushbulletApi : IPushbulletApi
{
public PushbulletResponse Push(string accessToken, string title, string message, string deviceIdentifier = default(string))
public async Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string))
{
var request = new RestRequest
{
Expand All @@ -56,7 +57,7 @@ public class PushbulletApi : IPushbulletApi
request.AddJsonBody(push);

var api = new ApiRequest();
return api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes"));
return await Task.Run(() => api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes")));
}
}
}
Expand Down
57 changes: 57 additions & 0 deletions PlexRequests.Api/PushoverApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexApi.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;
using System.Threading.Tasks;

using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Notifications;

using RestSharp;

namespace PlexRequests.Api
{
public class PushoverApi : IPushoverApi
{
public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken)
{
var request = new RestRequest
{
Method = Method.POST,
Resource = "messages.json?token={token}&user={user}&message={message}"
};

request.AddUrlSegment("token", accessToken);
request.AddUrlSegment("message", message);
request.AddUrlSegment("user", userToken);


var api = new ApiRequest();
return await Task.Run(() => api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1")));
}
}
}

Loading

0 comments on commit 7b55f07

Please sign in to comment.