Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
moving files to own dir
Browse files Browse the repository at this point in the history
refactor for compile issues

adding badges

refactor interfaces

ignore nuget packages

documentation

remove excess methods

add multiple notifications

sanitizing code

change text

update uri

change data type

refactor properties in winphone client

changing names of variables
  • Loading branch information
Shawn Feldman committed Jan 23, 2015
1 parent 2d0d68c commit eb025c9
Show file tree
Hide file tree
Showing 19 changed files with 805 additions and 266 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -84,3 +84,4 @@ portal/js/templates.js
/stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/QueryFilterParser.java
!/stack/corepersistence/common/src/test/resources/usergrid-UNIT.properties
*.iml
sdks/dotnet/samples/notifications/packages/*
6 changes: 4 additions & 2 deletions portal/js/push/push-config.html
Expand Up @@ -165,7 +165,7 @@
<br>
A Notifier allows App Services to connect to and deliver a message to a communication provider such as
Windows Notifications Service (WNS). Copy and paste your API key to create a bridge between your app
and GCM for push notifications on Android devices..
and WNS for push notifications on windows devices..
<br><br>

For more help: see our <a href="#!/getting-started/setup" class="notifications-links">getting started page</a> page.
Expand All @@ -189,10 +189,12 @@
</div>

<div class="control-group">
<strong>API Key </strong>
<strong>Secret </strong>
<div >
<input ng-model="notifier.winNotifierAPISecret" id="win-secret-value" required type="text" class="span6" autocomplete="off" ug-validate/>
</div>
<br/>
Secret will not be returned in other api calls for security reasons.
</div>

<div class="control-group">
Expand Down
40 changes: 40 additions & 0 deletions sdks/dotnet/samples/notifications/Usergrid.Notifications.sln
@@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Usergrid.Notifications", "Usergrid.Notifications\Usergrid.Notifications.csproj", "{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.ActiveCfg = Debug|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.Build.0 = Debug|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.Deploy.0 = Debug|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.ActiveCfg = Debug|x86
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.Build.0 = Debug|x86
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.Deploy.0 = Debug|x86
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.Build.0 = Release|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.Deploy.0 = Release|Any CPU
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.ActiveCfg = Release|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.Build.0 = Release|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.Deploy.0 = Release|ARM
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.ActiveCfg = Release|x86
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.Build.0 = Release|x86
{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Expand Up @@ -3,5 +3,25 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Usergrid.Notifications">

<!--
/*
*
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. The ASF licenses this file to You
* * under the Apache License, Version 2.0 (the "License"); you may not
* * use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License. For additional information regarding
* * copyright in this work, please see the NOTICE file in the top level
* * directory of this distribution.
*
*/
-->
</Application>
@@ -1,4 +1,23 @@
using System;
/*
*
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. The ASF licenses this file to You
* * under the Apache License, Version 2.0 (the "License"); you may not
* * use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License. For additional information regarding
* * copyright in this work, please see the NOTICE file in the top level
* * directory of this distribution.
*
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down
@@ -0,0 +1,80 @@
/*
*
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. The ASF licenses this file to You
* * under the Apache License, Version 2.0 (the "License"); you may not
* * use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License. For additional information regarding
* * copyright in this work, please see the NOTICE file in the top level
* * directory of this distribution.
*
*/

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Usergrid.Notifications.Client
{
public class EntityResponse : JObject
{
private HttpResponseMessage response;

private EntityResponse(HttpResponseMessage response, JObject jObject)
: base()
{
this.response = response;
parseResponse(jObject);
}

private void parseResponse(JObject jobject)
{
foreach (var kv in jobject)
{
this[kv.Key] = kv.Value;
}
}

public HttpStatusCode Status
{
get { return this.response.StatusCode; }
}

public static async Task<EntityResponse> Parse(HttpResponseMessage httpResponseMessage)
{
JObject jobject;

using (var stream = await httpResponseMessage.Content.ReadAsStreamAsync())
{
using (var reader = new StreamReader(stream, Encoding.UTF8))
{
jobject = JObject.Parse(reader.ReadToEnd());
}
}

return new EntityResponse(httpResponseMessage, jobject);
}

public bool StatusIsOk
{
get
{
return this.Status == HttpStatusCode.OK;
}
}
}
}
@@ -0,0 +1,123 @@
/*
*
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. The ASF licenses this file to You
* * under the Apache License, Version 2.0 (the "License"); you may not
* * use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License. For additional information regarding
* * copyright in this work, please see the NOTICE file in the top level
* * directory of this distribution.
*
*/

using Newtonsoft.Json.Linq;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Windows.Networking.PushNotifications;
namespace Usergrid.Notifications.Client
{
/// <summary>
/// encapsulates usergrid calls, use UsergridFactory
/// </summary>
public interface IUsergridClient
{
/// <summary>
/// Authenticate your calls
/// </summary>
/// <param name="user"></param>
/// <param name="password"></param>
/// <param name="isManagement"></param>
/// <returns></returns>
Task Authenticate(string user, string password, bool isManagement);
/// <summary>
/// Send a message
/// </summary>
/// <param name="method"></param>
/// <param name="url"></param>
/// <param name="obj"></param>
/// <returns></returns>
Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj);
/// <summary>
/// Send a message
/// </summary>
/// <param name="method"></param>
/// <param name="url"></param>
/// <param name="obj"></param>
/// <param name="useManagementUrl"></param>
/// <returns></returns>
Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl);
/// <summary>
/// Reference the push client, you should call register before using
/// </summary>
IPushClient Push { get; }

Exception LastException { get; }

}

/// <summary>
/// Only show http calls
/// </summary>
public interface IUsergridHttpClient
{
/// <summary>
/// Send Http call async
/// </summary>
/// <param name="method"></param>
/// <param name="url"></param>
/// <param name="obj"></param>
/// <param name="useManagementUrl">use management endpoint</param>
/// <returns></returns>
Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl);
/// <summary>
/// send Http call async
/// </summary>
/// <param name="method"></param>
/// <param name="url"></param>
/// <param name="obj"></param>
/// <returns></returns>
Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj);
}

/// <summary>
/// Push client, call register
/// </summary>
public interface IPushClient
{
/// <summary>
/// the notifier you are currently using
/// </summary>
string Notifier { get; set; }

/// <summary>
/// Device id in usergrid
/// </summary>
Guid DeviceId { get; set; }
/// <summary>
/// send a toast
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
Task<bool> SendToast(string message);

/// <summary>
/// Send a badge update
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
Task<bool> SendBadge<T>(T message);

Exception LastException { get; }

}

}

0 comments on commit eb025c9

Please sign in to comment.