Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/UrbanAirSharp.PCL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UrbanAirSharp.PCL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UrbanAirSharp.PCL")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
190 changes: 190 additions & 0 deletions src/UrbanAirSharp.PCL/UrbanAirSharp.PCL.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UrbanAirSharp.PCL</RootNamespace>
<AssemblyName>UrbanAirSharp.PCL</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NOLOG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NOLOG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<None Include="..\UrbanAirSharp\app.config">
<Link>app.config</Link>
</None>
<None Include="project.json" />
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="..\UrbanAirSharp\Dto\Actions.cs">
<Link>Dto\Actions.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\AddRemoveList.cs">
<Link>Dto\AddRemoveList.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\AndroidAlert.cs">
<Link>Dto\AndroidAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Audience.cs">
<Link>Dto\Audience.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\BaseAlert.cs">
<Link>Dto\BaseAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\BlackberryAlert.cs">
<Link>Dto\BlackberryAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\DeviceToken.cs">
<Link>Dto\DeviceToken.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\IosAlert.cs">
<Link>Dto\IosAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Notification.cs">
<Link>Dto\Notification.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\OpenAction.cs">
<Link>Dto\OpenAction.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Options.cs">
<Link>Dto\Options.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Push.cs">
<Link>Dto\Push.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\RichMessage.cs">
<Link>Dto\RichMessage.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Schedule.cs">
<Link>Dto\Schedule.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\ScheduleInfo.cs">
<Link>Dto\ScheduleInfo.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\Tag.cs">
<Link>Dto\Tag.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\WindowsAlert.cs">
<Link>Dto\WindowsAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Dto\WindowsPhoneAlert.cs">
<Link>Dto\WindowsPhoneAlert.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\Base\BaseRequest.cs">
<Link>Request\Base\BaseRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\Base\DeleteRequest.cs">
<Link>Request\Base\DeleteRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\Base\GetRequest.cs">
<Link>Request\Base\GetRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\Base\PostRequest.cs">
<Link>Request\Base\PostRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\Base\PutRequest.cs">
<Link>Request\Base\PutRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\DeviceTokenRequest.cs">
<Link>Request\DeviceTokenRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\PushRequest.cs">
<Link>Request\PushRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\PushValidateRequest.cs">
<Link>Request\PushValidateRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\ScheduleCreateRequest.cs">
<Link>Request\ScheduleCreateRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\ScheduleDeleteRequest.cs">
<Link>Request\ScheduleDeleteRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\ScheduleEditRequest.cs">
<Link>Request\ScheduleEditRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\ScheduleGetRequest.cs">
<Link>Request\ScheduleGetRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\ScheduleListRequest.cs">
<Link>Request\ScheduleListRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\TagCreateRequest.cs">
<Link>Request\TagCreateRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\TagDeleteRequest.cs">
<Link>Request\TagDeleteRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Request\TagListRequest.cs">
<Link>Request\TagListRequest.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\BaseResponse.cs">
<Link>Response\BaseResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\PushResponse.cs">
<Link>Response\PushResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\ScheduleCreateResponse.cs">
<Link>Response\ScheduleCreateResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\ScheduleEditResponse.cs">
<Link>Response\ScheduleEditResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\ScheduleGetResponse.cs">
<Link>Response\ScheduleGetResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\ScheduleListResponse.cs">
<Link>Response\ScheduleListResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Response\TagListResponse.cs">
<Link>Response\TagListResponse.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\ServiceModelConfig.cs">
<Link>ServiceModelConfig.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Type\AudienceType.cs">
<Link>Type\AudienceType.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\Type\DeviceType.cs">
<Link>Type\DeviceType.cs</Link>
</Compile>
<Compile Include="..\UrbanAirSharp\UrbanAirSharpGateway.cs">
<Link>UrbanAirSharpGateway.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
16 changes: 16 additions & 0 deletions src/UrbanAirSharp.PCL/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"supports": {
"net46.app": {},
"uwp.10.0.app": {}
},
"dependencies": {
"Microsoft.NETCore": "5.0.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.0",
"Newtonsoft.Json": "7.0.1"
},
"frameworks": {
"dotnet": {
"imports": "portable-net452+win81"
}
}
}
10 changes: 8 additions & 2 deletions src/UrbanAirSharp.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrbanAirSharp", "UrbanAirSharp\UrbanAirSharp.csproj", "{21DE41E4-9100-4CD0-9E6D-07E459E7C80F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{3842F246-CBB8-4F29-994E-6A12CAF3E6AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrbanAirSharp.PCL", "UrbanAirSharp.PCL\UrbanAirSharp.PCL.csproj", "{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{3842F246-CBB8-4F29-994E-6A12CAF3E6AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3842F246-CBB8-4F29-994E-6A12CAF3E6AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3842F246-CBB8-4F29-994E-6A12CAF3E6AC}.Release|Any CPU.Build.0 = Release|Any CPU
{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CBB7BFA-45A4-464E-8257-0700E5CCA34C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 10 additions & 4 deletions src/UrbanAirSharp/Request/Base/BaseRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
#if !NOLOG
using log4net;
#endif
using Newtonsoft.Json;
using UrbanAirSharp.Response;

Expand All @@ -18,8 +20,9 @@ namespace UrbanAirSharp.Request.Base
protected String RequestUrl;
protected HttpMethod RequestMethod;

#if !NOLOG
protected static readonly ILog Log = LogManager.GetLogger(typeof(TResponse));

#endif
protected BaseRequest(String host, HttpClient httpClient, JsonSerializerSettings serializerSettings)
{
Host = host;
Expand All @@ -41,8 +44,9 @@ protected async Task<TResponse> DeserializeResponseAsync(HttpResponseMessage res
{
var contentJson = await response.Content.ReadAsStringAsync();

#if !NOLOG
Log.Info("Response - (" + response.StatusCode + ") - " + contentJson);

#endif
TResponse result;

try
Expand All @@ -51,9 +55,11 @@ protected async Task<TResponse> DeserializeResponseAsync(HttpResponseMessage res
}
catch (Exception e)
{
//Some calls to Urban Airship don't return with valid JSON :(
//Some calls to Urban Airship don't return with valid JSON :(
#if !NOLOG
Log.Debug("DeserializeResponseAsync - The server did not respond with valid JSON", e);
result = new TResponse
#endif
result = new TResponse
{
Message = "The server did not response with proper JSON (" + contentJson + ")"
};
Expand Down
3 changes: 2 additions & 1 deletion src/UrbanAirSharp/Request/Base/DeleteRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public DeleteRequest()

public override async Task<TResponse> ExecuteAsync()
{
#if !NOLOG
Log.Debug(RequestMethod + " - " + Host + RequestUrl);

#endif
var response = await HttpClient.DeleteAsync(Host + RequestUrl);

return await DeserializeResponseAsync(response);
Expand Down
3 changes: 2 additions & 1 deletion src/UrbanAirSharp/Request/Base/GetRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public GetRequest()

public override async Task<TResponse> ExecuteAsync()
{
#if !NOLOG
Log.Debug(RequestMethod + " - " + Host + RequestUrl);

#endif
var response = await HttpClient.GetAsync(Host + RequestUrl);

return await DeserializeResponseAsync(response);
Expand Down
6 changes: 4 additions & 2 deletions src/UrbanAirSharp/Request/Base/PostRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ public PostRequest(TContent content)

public override async Task<TResponse> ExecuteAsync()
{
#if !NOLOG
Log.Debug(RequestMethod + " - " + Host + RequestUrl);

#endif
var json = JsonConvert.SerializeObject(Content, SerializerSettings);

#if !NOLOG
Log.Debug("Payload - " + json);

#endif
var response = await HttpClient.PostAsync(Host + RequestUrl, new StringContent(json, Encoding, MediaType));

return await DeserializeResponseAsync(response);
Expand Down
6 changes: 4 additions & 2 deletions src/UrbanAirSharp/Request/Base/PutRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public PutRequest(TContent content)

public override async Task<TResponse> ExecuteAsync()
{
#if !NOLOG
Log.Debug(RequestMethod + " - " + Host + RequestUrl);

#endif
var json = JsonConvert.SerializeObject(Content, SerializerSettings);

#if !NOLOG
Log.Info("Payload - " + json);

#endif
var response = await HttpClient.PutAsync(Host + RequestUrl, new StringContent(json, Encoding, MediaType));

return await DeserializeResponseAsync(response);
Expand Down
Loading