http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/AuthenticationManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/AuthenticationManager.cs b/Usergrid.Sdk/Manager/AuthenticationManager.cs new file mode 100644 index 0000000..d733683 --- /dev/null +++ b/Usergrid.Sdk/Manager/AuthenticationManager.cs @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using RestSharp; +using Usergrid.Sdk.Model; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Manager +{ + internal class AuthenticationManager : ManagerBase, IAuthenticationManager + { + public AuthenticationManager(IUsergridRequest request) : base(request) + { + } + + public void ChangePassword(string userName, string oldPassword, string newPassword) + { + var payload = new ChangePasswordPayload {OldPassword = oldPassword, NewPassword = newPassword}; + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/users/{0}/password", userName), Method.POST, payload); + ValidateResponse(response); + } + + public void Login(string loginId, string secret, AuthType authType) + { + if (authType == AuthType.None) + { + Request.AccessToken = null; + return; + } + + object body = GetLoginBody(loginId, secret, authType); + + IRestResponse<LoginResponse> response = Request.ExecuteJsonRequest<LoginResponse>("/token", Method.POST, body); + ValidateResponse(response); + + Request.AccessToken = response.Data.AccessToken; + } + + private object GetLoginBody(string loginId, string secret, AuthType authType) + { + object body = null; + + if (authType == AuthType.Organization || authType == AuthType.Application) + { + body = new ClientIdLoginPayload + { + ClientId = loginId, + ClientSecret = secret + }; + } + else if (authType == AuthType.User) + { + body = new UserLoginPayload + { + UserName = loginId, + Password = secret + }; + } + return body; + } + } +}
http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/ConnectionManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/ConnectionManager.cs b/Usergrid.Sdk/Manager/ConnectionManager.cs new file mode 100644 index 0000000..c253af6 --- /dev/null +++ b/Usergrid.Sdk/Manager/ConnectionManager.cs @@ -0,0 +1,99 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System.Collections.Generic; +using System.Net; +using Newtonsoft.Json; +using RestSharp; +using Usergrid.Sdk.Model; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Manager +{ + internal class ConnectionManager : ManagerBase, IConnectionManager + { + internal ConnectionManager(IUsergridRequest request) : base(request) + { + } + + public void CreateConnection(Connection connection) + { + // e.g. /user/fred/following/user/barney + IRestResponse response = Request.ExecuteJsonRequest(string.Format( + "/{0}/{1}/{2}/{3}/{4}", + connection.ConnectorCollectionName, + connection.ConnectorIdentifier, + connection.ConnectionName, + connection.ConnecteeCollectionName, + connection.ConnecteeIdentifier), Method.POST); + + ValidateResponse(response); + } + + public IList<UsergridEntity> GetConnections(Connection connection) + { + // e.g. /user/fred/following + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/{0}/{1}/{2}", + connection.ConnectorCollectionName, + connection.ConnectorIdentifier, + connection.ConnectionName), Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + { + return default(List<UsergridEntity>); + } + + ValidateResponse(response); + + var entity = JsonConvert.DeserializeObject<UsergridGetResponse<UsergridEntity>>(response.Content); + + return entity.Entities; + } + + public IList<TConnectee> GetConnections<TConnectee>(Connection connection) + { + // e.g. /user/fred/following/user + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/{0}/{1}/{2}/{3}", + connection.ConnectorCollectionName, + connection.ConnectorIdentifier, + connection.ConnectionName, + connection.ConnecteeCollectionName), Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + { + return default(List<TConnectee>); + } + + ValidateResponse(response); + + var entity = JsonConvert.DeserializeObject<UsergridGetResponse<TConnectee>>(response.Content); + + return entity.Entities; + } + + public void DeleteConnection(Connection connection) + { + IRestResponse response = Request.ExecuteJsonRequest(string.Format( + "/{0}/{1}/{2}/{3}/{4}", + connection.ConnectorCollectionName, + connection.ConnectorIdentifier, + connection.ConnectionName, + connection.ConnecteeCollectionName, + connection.ConnecteeIdentifier), Method.DELETE); + + ValidateResponse(response); + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/EntityManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/EntityManager.cs b/Usergrid.Sdk/Manager/EntityManager.cs new file mode 100644 index 0000000..349d16e --- /dev/null +++ b/Usergrid.Sdk/Manager/EntityManager.cs @@ -0,0 +1,177 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using RestSharp; +using Usergrid.Sdk.Model; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Manager { + internal class EntityManager : ManagerBase, IEntityManager { + private readonly IDictionary<Type, Stack<string>> _cursorStates = new Dictionary<Type, Stack<string>>(); + private readonly IDictionary<Type, int> _pageSizes = new Dictionary<Type, int>(); + + internal EntityManager(IUsergridRequest request) : base(request) {} + + public T CreateEntity<T>(string collection, T entity) { + IRestResponse response = Request.ExecuteJsonRequest("/" + collection, Method.POST, entity); + ValidateResponse(response); + var returnedEntity = JsonConvert.DeserializeObject<UsergridGetResponse<T>>(response.Content); + + return returnedEntity.Entities.FirstOrDefault(); + } + + public void DeleteEntity(string collection, string identifer) { + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/{0}/{1}", collection, identifer), Method.DELETE); + ValidateResponse(response); + } + + public void UpdateEntity<T>(string collection, string identifer, T entity) { + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/{0}/{1}", collection, identifer), Method.PUT, entity); + ValidateResponse(response); + } + + public T GetEntity<T>(string collectionName, string identifer) { + IRestResponse response = Request.ExecuteJsonRequest(string.Format("/{0}/{1}", collectionName, identifer), Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + return default(T); + ValidateResponse(response); + + var entity = JsonConvert.DeserializeObject<UsergridGetResponse<T>>(response.Content); + + return entity.Entities.FirstOrDefault(); + } + + public UsergridCollection<T> GetEntities<T>(string collectionName, int limit = 10, string query = null) { + _pageSizes.Remove(typeof (T)); + _pageSizes.Add(typeof (T), limit); + + string url = string.Format("/{0}?limit={1}", collectionName, limit); + if (query != null) + url += "&query=" + query; + + IRestResponse response = Request.ExecuteJsonRequest(url, Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + return new UsergridCollection<T>(); + + ValidateResponse(response); + + var getResponse = JsonConvert.DeserializeObject<UsergridGetResponse<T>>(response.Content); + var collection = new UsergridCollection<T>(getResponse.Entities); + + _cursorStates.Remove(typeof (T)); + + if (getResponse.Cursor != null) { + collection.HasNext = true; + collection.HasPrevious = false; + _cursorStates.Add(typeof (T), new Stack<string>(new[] {null, null, getResponse.Cursor})); + } + + return collection; + } + + public UsergridCollection<T> GetNextEntities<T>(string collectionName, string query = null) { + if (!_cursorStates.ContainsKey(typeof (T))) { + return new UsergridCollection<T>(); + } + + Stack<string> stack = _cursorStates[typeof (T)]; + string cursor = stack.Peek(); + + if (cursor == null) { + return new UsergridCollection<T> {HasNext = false, HasPrevious = true}; + } + + int limit = _pageSizes[typeof (T)]; + + string url = string.Format("/{0}?cursor={1}&limit={2}", collectionName, cursor, limit); + if (query != null) + url += "&query=" + query; + + IRestResponse response = Request.ExecuteJsonRequest(url, Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + return new UsergridCollection<T>(); + + ValidateResponse(response); + + var getResponse = JsonConvert.DeserializeObject<UsergridGetResponse<T>>(response.Content); + var collection = new UsergridCollection<T>(getResponse.Entities); + + if (getResponse.Cursor != null) { + collection.HasNext = true; + stack.Push(getResponse.Cursor); + } + else { + stack.Push(null); + } + + collection.HasPrevious = true; + + return collection; + } + + public UsergridCollection<T> GetPreviousEntities<T>(string collectionName, string query = null) { + if (!_cursorStates.ContainsKey(typeof (T))) { + var error = new UsergridError + { + Error = "cursor_not_initialized", + Description = "Call GetEntities method to initialize the cursor" + }; + throw new UsergridException(error); + } + + Stack<string> stack = _cursorStates[typeof (T)]; + stack.Pop(); + stack.Pop(); + string cursor = stack.Peek(); + + int limit = _pageSizes[typeof (T)]; + + if (cursor == null) { + return GetEntities<T>(collectionName, limit); + } + + string url = string.Format("/{0}?cursor={1}&limit={2}", collectionName, cursor, limit); + if (query != null) + url += "&query=" + query; + + IRestResponse response = Request.ExecuteJsonRequest(url, Method.GET); + + if (response.StatusCode == HttpStatusCode.NotFound) + return new UsergridCollection<T>(); + + ValidateResponse(response); + + var getResponse = JsonConvert.DeserializeObject<UsergridGetResponse<T>>(response.Content); + var collection = new UsergridCollection<T>(getResponse.Entities) + { + HasNext = true, + HasPrevious = true + }; + + stack.Push(getResponse.Cursor); + + return collection; + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/IAuthenticationManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/IAuthenticationManager.cs b/Usergrid.Sdk/Manager/IAuthenticationManager.cs new file mode 100644 index 0000000..797ebd0 --- /dev/null +++ b/Usergrid.Sdk/Manager/IAuthenticationManager.cs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Manager +{ + internal interface IAuthenticationManager + { + void ChangePassword(string userName, string oldPassword, string newPassword); + void Login(string loginId, string secret, AuthType authType); + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/IConnectionManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/IConnectionManager.cs b/Usergrid.Sdk/Manager/IConnectionManager.cs new file mode 100644 index 0000000..563b164 --- /dev/null +++ b/Usergrid.Sdk/Manager/IConnectionManager.cs @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System.Collections.Generic; +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Manager { + internal interface IConnectionManager { + void CreateConnection(Connection connection); + IList<UsergridEntity> GetConnections(Connection connection); + IList<TConnectee> GetConnections<TConnectee>(Connection connection); + void DeleteConnection(Connection connection); + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/IEntityManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/IEntityManager.cs b/Usergrid.Sdk/Manager/IEntityManager.cs new file mode 100644 index 0000000..4ab8a1f --- /dev/null +++ b/Usergrid.Sdk/Manager/IEntityManager.cs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Manager +{ + public interface IEntityManager + { + T CreateEntity<T>(string collection, T entity); + void DeleteEntity(string collection, string identifer /*name or uuid*/); + void UpdateEntity<T>(string collection, string identifer /*name or uuid*/, T entity); + T GetEntity<T>(string collectionName, string identifer /*name or uuid*/); + UsergridCollection<T> GetEntities<T> (string collectionName, int limit = 10, string query = null); + UsergridCollection<T> GetNextEntities<T>(string collectionName, string query = null); + UsergridCollection<T> GetPreviousEntities<T>(string collectionName, string query = null); + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/INotificationsManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/INotificationsManager.cs b/Usergrid.Sdk/Manager/INotificationsManager.cs new file mode 100644 index 0000000..34fd1ea --- /dev/null +++ b/Usergrid.Sdk/Manager/INotificationsManager.cs @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System.Collections.Generic; +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Manager +{ + internal interface INotificationsManager + { + void CreateNotifierForApple(string notifierName, string environment, string p12CertificatePath); + void CreateNotifierForAndroid(string notifierName, string apiKey); + void PublishNotification (IEnumerable<Notification> notification, INotificationRecipients recipients, NotificationSchedulerSettings schedulingSettings = null); + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/ManagerBase.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/ManagerBase.cs b/Usergrid.Sdk/Manager/ManagerBase.cs new file mode 100644 index 0000000..00aa167 --- /dev/null +++ b/Usergrid.Sdk/Manager/ManagerBase.cs @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System.Collections.Generic; +using System.Net; +using Newtonsoft.Json; +using RestSharp; +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Manager +{ + internal abstract class ManagerBase + { + protected readonly IUsergridRequest Request; + + internal ManagerBase(IUsergridRequest request) + { + Request = request; + } + + protected void ValidateResponse(IRestResponse response) + { + if (response.StatusCode != HttpStatusCode.OK) + { + var userGridError = JsonConvert.DeserializeObject<UsergridError>(response.Content); + throw new UsergridException(userGridError); + } + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Manager/NotificationsManager.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Manager/NotificationsManager.cs b/Usergrid.Sdk/Manager/NotificationsManager.cs new file mode 100644 index 0000000..96fa138 --- /dev/null +++ b/Usergrid.Sdk/Manager/NotificationsManager.cs @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; +using RestSharp; +using Usergrid.Sdk.Model; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Manager +{ + internal class NotificationsManager : ManagerBase, INotificationsManager + { + public NotificationsManager(IUsergridRequest request) : base(request) + { + } + + public void CreateNotifierForApple(string notifierName, string environment, string p12CertificatePath) + { + var formParameters = new Dictionary<string, object> + { + {"name", notifierName}, + {"provider", "apple"}, + {"environment", environment} + }; + + var fileParameters = new Dictionary<string, string> + { + {"p12Certificate", p12CertificatePath} + }; + + + IRestResponse response = Request.ExecuteMultipartFormDataRequest("/notifiers", Method.POST, formParameters, fileParameters); + ValidateResponse(response); + } + + public void CreateNotifierForAndroid(string notifierName, string apiKey) + { + IRestResponse response = Request.ExecuteJsonRequest("/notifiers", Method.POST, new AndroidNotifierPayload {ApiKey = apiKey, Name = notifierName}); + ValidateResponse(response); + } + + public void PublishNotification(IEnumerable<Notification> notifications, INotificationRecipients recipients, NotificationSchedulerSettings schedulerSettings = null) + { + var payload = new NotificationPayload(); + foreach (Notification notification in notifications) + { + payload.Payloads.Add(notification.NotifierIdentifier, notification.GetPayload()); + } + + if (schedulerSettings != null) + { + if (schedulerSettings.DeliverAt != DateTime.MinValue) + payload.DeliverAt = schedulerSettings.DeliverAt.ToUnixTime(); + if (schedulerSettings.ExpireAt != DateTime.MinValue) + payload.ExpireAt = schedulerSettings.ExpireAt.ToUnixTime(); + } + + string query = recipients.BuildQuery(); + + IRestResponse response = Request.ExecuteJsonRequest(query, Method.POST, payload); + ValidateResponse(response); + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/AndroidNotification.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/AndroidNotification.cs b/Usergrid.Sdk/Model/AndroidNotification.cs new file mode 100644 index 0000000..f3e4260 --- /dev/null +++ b/Usergrid.Sdk/Model/AndroidNotification.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; +using System.Dynamic; +using RestSharp; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Model +{ + + public class AndroidNotification : Notification + { + public AndroidNotification(string notifierIdentifier, string message) : base(notifierIdentifier, message) + { + } + + internal override object GetPayload() + { + return new {data = Message}; + } + } + +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/AppleNotification.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/AppleNotification.cs b/Usergrid.Sdk/Model/AppleNotification.cs new file mode 100644 index 0000000..0c9229d --- /dev/null +++ b/Usergrid.Sdk/Model/AppleNotification.cs @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; +using System.Dynamic; +using RestSharp; +using Usergrid.Sdk.Payload; + +namespace Usergrid.Sdk.Model +{ + + public class AppleNotification : Notification + { + public AppleNotification(string notifierIdentifier, string message, string sound = null) + : base(notifierIdentifier, message) + { + Sound = sound; + } + + public string Sound { get; set; } + + internal override object GetPayload() + { + + if (Sound != null) + { + return new {aps = new {alert = Message, sound = Sound}}; + } + else + { + return Message; + } + } + } + +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/AuthType.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/AuthType.cs b/Usergrid.Sdk/Model/AuthType.cs new file mode 100644 index 0000000..c1922ce --- /dev/null +++ b/Usergrid.Sdk/Model/AuthType.cs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Model +{ + public enum AuthType + { + Organization, + Application, + User, + None + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/Connection.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/Connection.cs b/Usergrid.Sdk/Model/Connection.cs new file mode 100644 index 0000000..b044350 --- /dev/null +++ b/Usergrid.Sdk/Model/Connection.cs @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Model { + public class Connection { + public string ConnectorCollectionName { get; set; } + public string ConnectorIdentifier { get; set; } + public string ConnecteeCollectionName { get; set; } + public string ConnecteeIdentifier { get; set; } + public string ConnectionName { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/INotificationRecipients.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/INotificationRecipients.cs b/Usergrid.Sdk/Model/INotificationRecipients.cs new file mode 100644 index 0000000..6f4d05c --- /dev/null +++ b/Usergrid.Sdk/Model/INotificationRecipients.cs @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk.Model +{ + public interface INotificationRecipients + { + INotificationRecipients AddUserWithName(string name); + INotificationRecipients AddUserWithUuid(string uuid); + INotificationRecipients AddUserWithQuery(string query); + INotificationRecipients AddGroupWithPath(string path); + INotificationRecipients AddGroupWithQuery(string query); + INotificationRecipients AddDeviceWithName(string name); + INotificationRecipients AddDeviceWithQuery(string query); + string BuildQuery(); + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/Notification.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/Notification.cs b/Usergrid.Sdk/Model/Notification.cs new file mode 100644 index 0000000..be94993 --- /dev/null +++ b/Usergrid.Sdk/Model/Notification.cs @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Model +{ + public abstract class Notification + { + protected Notification(string notifierIdentifier, string message) + { + NotifierIdentifier = notifierIdentifier; + Message = message; + } + + public string NotifierIdentifier { get; set; } + public string Message { get; set; } + + internal abstract object GetPayload(); + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/NotificationRecipients.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/NotificationRecipients.cs b/Usergrid.Sdk/Model/NotificationRecipients.cs new file mode 100644 index 0000000..0aa79cd --- /dev/null +++ b/Usergrid.Sdk/Model/NotificationRecipients.cs @@ -0,0 +1,137 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk.Model +{ + public class NotificationRecipients : INotificationRecipients + { + string _userName; + string _userUuid; + string _userQuery; + string _groupPath; + string _groupQuery; + string _deviceName; + string _deviceQuery; + + public INotificationRecipients AddUserWithName (string name) + { + if (_userUuid != null) + throw new ArgumentException("User name and uuid can not be added at the same time."); + _userName = name; + return this; + } + + public INotificationRecipients AddUserWithUuid (string uuid) + { + if (_userName != null) + throw new ArgumentException ("User name and uuid can not be added at the same time."); + + _userUuid = uuid; + return this; + } + + public INotificationRecipients AddUserWithQuery (string query) + { + if (_userName != null || _userUuid != null) + throw new ArgumentException("User query can not be added together with user name or uuid."); + + _userQuery = query; + return this; + } + + public INotificationRecipients AddGroupWithPath (string path) + { + if (_groupQuery != null) + throw new ArgumentException("Group path and query can not be added at the same time."); + + _groupPath = path; + return this; + } + + public INotificationRecipients AddGroupWithQuery (string query) + { + if (_groupPath != null) + throw new ArgumentException("Group path and query can not be added at the same time."); + + _groupQuery = query; + return this; + } + + public INotificationRecipients AddDeviceWithName (string name) + { + if (_deviceQuery != null) + throw new ArgumentException("Device name and query can not be added at the same time."); + + _deviceName = name; + return this; + } + + public INotificationRecipients AddDeviceWithQuery (string query) + { + if (_deviceName != null) + throw new ArgumentException("Device name and query can not be added at the same time."); + + _deviceQuery = query; + return this; + } + + public string BuildQuery() + { + var query = string.Empty; + + if (_groupPath != null) + { + query += string.Format ("/groups/{0}", _groupPath); + } + + if (_groupQuery != null) + { + query += string.Format ("/groups;ql={0}", _groupQuery); + } + + if (_userName != null) + { + query += string.Format ("/users/{0}", _userName); + } + + if (_userUuid != null) + { + query += string.Format ("/users/{0}", _userUuid); + } + + if (_userQuery != null) + { + query += string.Format ("/users;ql={0}", _userQuery); + } + + if (_deviceName != null) + { + query += string.Format ("/devices/{0}", _deviceName); + } + + if (_deviceQuery != null) + { + query += string.Format ("/devices;ql={0}", _deviceQuery); + } + + query += "/notifications"; + + return query; + } + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/NotificationSchedulerSettings.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/NotificationSchedulerSettings.cs b/Usergrid.Sdk/Model/NotificationSchedulerSettings.cs new file mode 100644 index 0000000..45b7261 --- /dev/null +++ b/Usergrid.Sdk/Model/NotificationSchedulerSettings.cs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Model +{ + public class NotificationSchedulerSettings + { + [JsonProperty("deliver")] + public DateTime DeliverAt {get;set;} + [JsonProperty("expire")] + public DateTime ExpireAt { get; set;} + + public NotificationSchedulerSettings() + { + DeliverAt = DateTime.MinValue; + ExpireAt = DateTime.MinValue; + } + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UnixDateTimeHelper.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UnixDateTimeHelper.cs b/Usergrid.Sdk/Model/UnixDateTimeHelper.cs new file mode 100644 index 0000000..d2b8017 --- /dev/null +++ b/Usergrid.Sdk/Model/UnixDateTimeHelper.cs @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk +{ + public static class UnixDateTimeHelper + { + private const string InvalidUnixEpochErrorMessage = "Unix epoc starts January 1st, 1970"; + + /// <summary> + /// Convert a long into a DateTime + /// </summary> + public static DateTime FromUnixTime(this Int64 self) + { + var ret = new DateTime(1970, 1, 1); + return ret.AddSeconds(self/1000); + } + + /// <summary> + /// Convert a DateTime into a long + /// </summary> + public static Int64 ToUnixTime(this DateTime self) + { + + if (self == DateTime.MinValue) + { + return 0; + } + + var epoc = new DateTime(1970, 1, 1); + var delta = self - epoc; + + if (delta.TotalSeconds < 0) throw new ArgumentOutOfRangeException(InvalidUnixEpochErrorMessage); + + return (long) delta.TotalSeconds * 1000; + } + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UserGridEntity.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UserGridEntity.cs b/Usergrid.Sdk/Model/UserGridEntity.cs new file mode 100644 index 0000000..889a43a --- /dev/null +++ b/Usergrid.Sdk/Model/UserGridEntity.cs @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Model +{ + public class UsergridEntity + { + public string Uuid { get; set; } + public string Type { get; set; } + public string Name { get; set; } + + [JsonProperty("created")] + private long createdLong { get; set; } + + [JsonIgnore] + public DateTime CreatedDate + { + get { return createdLong.FromUnixTime(); } + } + + [JsonProperty("modified")] + private long modifiedLong { get; set; } + + [JsonIgnore] + public DateTime ModifiedDate + { + get { return modifiedLong.FromUnixTime(); } + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridActivity.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridActivity.cs b/Usergrid.Sdk/Model/UsergridActivity.cs new file mode 100644 index 0000000..0d39b0a --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridActivity.cs @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Model +{ + public class UsergridActivity + { + public UsergridActivity(){} + + public UsergridActivity(UsergridUser user, UsergridImage image = null){ + Actor = new UsergridActor { + DisplayName = user.Name, + Email = user.Email, + Image = image, + UserName = user.UserName, + Uuid = user.Uuid + }; + } + + public UsergridActor Actor {get;set;} + + public string Verb {get;set;} + + public string Content { get; set;} + + [JsonProperty("published")] + private long PublishedLong { get; set;} + + [JsonIgnore] + public DateTime PublishedDate { + get { return PublishedLong.FromUnixTime(); } + } + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridActor.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridActor.cs b/Usergrid.Sdk/Model/UsergridActor.cs new file mode 100644 index 0000000..8e562ec --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridActor.cs @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk +{ + public class UsergridActor + { + public string DisplayName {get;set;} + public string Uuid { get; set;} + public string UserName {get;set;} + public UsergridImage Image {get;set;} + public string Email {get;set;} + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridCollection.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridCollection.cs b/Usergrid.Sdk/Model/UsergridCollection.cs new file mode 100644 index 0000000..ca801a4 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridCollection.cs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; + +namespace Usergrid.Sdk +{ + public class UsergridCollection<T> : List<T> + { + public UsergridCollection() : base() {} + public UsergridCollection(IEnumerable<T> items) : base(items) {} + + public bool HasNext {get;set;} + public bool HasPrevious {get;set;} + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridDevice.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridDevice.cs b/Usergrid.Sdk/Model/UsergridDevice.cs new file mode 100644 index 0000000..b0837a9 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridDevice.cs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk.Model +{ + public class UsergridDevice : UsergridEntity {} +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridEntitySerializer.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridEntitySerializer.cs b/Usergrid.Sdk/Model/UsergridEntitySerializer.cs new file mode 100644 index 0000000..2ca84ed --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridEntitySerializer.cs @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Usergrid.Sdk.Model +{ + public class EntitySerializer : JsonConverter + { + public override object ReadJson (JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var jsonSerializer = new JsonSerializer (); + + var obj = JObject.Load(reader); + var r1 = obj.CreateReader(); + var r2 = obj.CreateReader (); + + var usergridEntity = jsonSerializer.Deserialize (r1, objectType); + var entityProperty = usergridEntity.GetType ().GetProperty ("Entity"); + var entity = jsonSerializer.Deserialize(r2, entityProperty.PropertyType); + entityProperty.SetValue (usergridEntity, entity, null); + + return usergridEntity; + } + + public override void WriteJson (JsonWriter writer, object value, JsonSerializer serializer) + { + throw new NotImplementedException (); + } + + public override bool CanConvert (Type objectType) + { + return typeof(UsergridEntity).IsAssignableFrom (objectType); + } + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridError.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridError.cs b/Usergrid.Sdk/Model/UsergridError.cs new file mode 100644 index 0000000..b70433b --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridError.cs @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Model +{ + public class UsergridError + { + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } + + [JsonProperty(PropertyName = "exception")] + public string Exception { get; set; } + + [JsonProperty(PropertyName = "error_description")] + public string Description { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridException.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridException.cs b/Usergrid.Sdk/Model/UsergridException.cs new file mode 100644 index 0000000..c7f9816 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridException.cs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using Usergrid.Sdk.Model; + +namespace Usergrid.Sdk.Model +{ + public class UsergridException : Exception + { + public UsergridException(UsergridError error) : base(error.Description) + { + ErrorCode = error.Error; + } + + public string ErrorCode { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridGroup.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridGroup.cs b/Usergrid.Sdk/Model/UsergridGroup.cs new file mode 100644 index 0000000..6be20f6 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridGroup.cs @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Model +{ + public class UsergridGroup : UsergridEntity + { + public string Title { get; set; } + public string Path { get; set; } + + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridImage.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridImage.cs b/Usergrid.Sdk/Model/UsergridImage.cs new file mode 100644 index 0000000..53d7a24 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridImage.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; + +namespace Usergrid.Sdk +{ + public class UsergridImage + { + public int Duration {get;set;} + public int Height {get;set;} + public int Width {get;set;} + public string Url {get;set;} + } +} + http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridNotifier.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridNotifier.cs b/Usergrid.Sdk/Model/UsergridNotifier.cs new file mode 100644 index 0000000..a6f6964 --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridNotifier.cs @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Model +{ + public class UsergridNotifier : UsergridEntity + { + public string Provider { get; set; } + public string Environment { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Model/UsergridUser.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Model/UsergridUser.cs b/Usergrid.Sdk/Model/UsergridUser.cs new file mode 100644 index 0000000..dbddb2c --- /dev/null +++ b/Usergrid.Sdk/Model/UsergridUser.cs @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Model +{ + public class UsergridUser : UsergridEntity + { + [JsonProperty("username")] + public string UserName { get; set; } + [JsonProperty("email")] + public string Email { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/AndroidNotifierPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/AndroidNotifierPayload.cs b/Usergrid.Sdk/Payload/AndroidNotifierPayload.cs new file mode 100644 index 0000000..ec41723 --- /dev/null +++ b/Usergrid.Sdk/Payload/AndroidNotifierPayload.cs @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +namespace Usergrid.Sdk.Payload +{ + internal class AndroidNotifierPayload + { + public string Name { get; set; } + + public string Provider + { + get { return "google"; } + } + + public string ApiKey { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/CancelNotificationPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/CancelNotificationPayload.cs b/Usergrid.Sdk/Payload/CancelNotificationPayload.cs new file mode 100644 index 0000000..aa3694b --- /dev/null +++ b/Usergrid.Sdk/Payload/CancelNotificationPayload.cs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class CancelNotificationPayload + { + [JsonProperty(PropertyName = "canceled")] + internal bool Canceled { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/ChangePasswordPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/ChangePasswordPayload.cs b/Usergrid.Sdk/Payload/ChangePasswordPayload.cs new file mode 100644 index 0000000..9143664 --- /dev/null +++ b/Usergrid.Sdk/Payload/ChangePasswordPayload.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class ChangePasswordPayload + { + [JsonProperty(PropertyName = "oldpassword")] + internal string OldPassword { get; set; } + + [JsonProperty(PropertyName = "newpassword")] + internal string NewPassword { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/ClientIdLoginPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/ClientIdLoginPayload.cs b/Usergrid.Sdk/Payload/ClientIdLoginPayload.cs new file mode 100644 index 0000000..b7b155b --- /dev/null +++ b/Usergrid.Sdk/Payload/ClientIdLoginPayload.cs @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class ClientIdLoginPayload + { + [JsonProperty(PropertyName = "grant_type")] + internal string GrantType + { + get { return "client_credentials"; } + } + + [JsonProperty(PropertyName = "client_id")] + internal string ClientId { get; set; } + + [JsonProperty(PropertyName = "client_secret")] + internal string ClientSecret { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/LoginResponse.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/LoginResponse.cs b/Usergrid.Sdk/Payload/LoginResponse.cs new file mode 100644 index 0000000..07bee35 --- /dev/null +++ b/Usergrid.Sdk/Payload/LoginResponse.cs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class LoginResponse + { + [JsonProperty(PropertyName = "access_token")] + public string AccessToken { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/NotificationPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/NotificationPayload.cs b/Usergrid.Sdk/Payload/NotificationPayload.cs new file mode 100644 index 0000000..499af3a --- /dev/null +++ b/Usergrid.Sdk/Payload/NotificationPayload.cs @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System; +using System.Collections.Generic; +using System.Dynamic; +using RestSharp; +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class NotificationPayload + { + + public IDictionary<string, object> Payloads { get; set; } + [JsonProperty("deliver", NullValueHandling = NullValueHandling.Ignore)] + public long? DeliverAt {get;set;} + [JsonProperty("expire", NullValueHandling = NullValueHandling.Ignore)] + public long? ExpireAt { get; set;} + + public NotificationPayload() + { + Payloads = new Dictionary<string, object>(); + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/UserLoginPayload.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/UserLoginPayload.cs b/Usergrid.Sdk/Payload/UserLoginPayload.cs new file mode 100644 index 0000000..a45ca71 --- /dev/null +++ b/Usergrid.Sdk/Payload/UserLoginPayload.cs @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + internal class UserLoginPayload + { + [JsonProperty(PropertyName = "grant_type")] + internal string GrantType + { + get { return "password"; } + } + + [JsonProperty(PropertyName = "username")] + internal string UserName { get; set; } + + [JsonProperty(PropertyName = "password")] + internal string Password { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Payload/UsergridGetResponse.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Payload/UsergridGetResponse.cs b/Usergrid.Sdk/Payload/UsergridGetResponse.cs new file mode 100644 index 0000000..b29c7b9 --- /dev/null +++ b/Usergrid.Sdk/Payload/UsergridGetResponse.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Usergrid.Sdk.Payload +{ + public class UsergridGetResponse<T> + { + [JsonProperty(PropertyName = "cursor")] + internal string Cursor; + [JsonProperty(PropertyName = "entities")] + internal IList<T> Entities; + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Properties/AssemblyInfo.cs b/Usergrid.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bca6c49 --- /dev/null +++ b/Usergrid.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +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("Usergrid.Sdk")] +[assembly: AssemblyCompany("Apigee")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("8718e539-88e7-44ce-8c8f-b2ca37632a81")] + +// 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("0.1.0.0")] +[assembly: AssemblyFileVersion("0.1.0.0")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Usergrid.Sdk.Tests")] http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/RestSharpJsonSerializer.cs ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/RestSharpJsonSerializer.cs b/Usergrid.Sdk/RestSharpJsonSerializer.cs new file mode 100644 index 0000000..ff4557c --- /dev/null +++ b/Usergrid.Sdk/RestSharpJsonSerializer.cs @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// 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. + +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp.Serializers; + +namespace Usergrid.Sdk +{ + public class RestSharpJsonSerializer : ISerializer + { + public string Serialize(object obj) + { + var serializeObject = JsonConvert.SerializeObject(obj, new JsonSerializerSettings() + { + ContractResolver = new CamelCasePropertyNamesContractResolver() + }); + return serializeObject; + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + public string ContentType { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk/Usergrid.Sdk.csproj ---------------------------------------------------------------------- diff --git a/Usergrid.Sdk/Usergrid.Sdk.csproj b/Usergrid.Sdk/Usergrid.Sdk.csproj new file mode 100644 index 0000000..d422771 --- /dev/null +++ b/Usergrid.Sdk/Usergrid.Sdk.csproj @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + 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. +--> + +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{437D108F-528C-4B2A-B399-06CF02DEB08B}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Usergrid.Sdk</RootNamespace> + <AssemblyName>Usergrid.Sdk</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</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</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Configuration" /> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="RestSharp"> + <HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Client.cs" /> + <Compile Include="IClient.cs" /> + <Compile Include="IUsergridRequest.cs" /> + <Compile Include="Manager\INotificationsManager.cs" /> + <Compile Include="Manager\NotificationsManager.cs" /> + <Compile Include="Model\Connection.cs" /> + <Compile Include="Model\UsergridEntity.cs" /> + <Compile Include="Model\UsergridError.cs" /> + <Compile Include="Model\UsergridNotifier.cs" /> + <Compile Include="Payload\AndroidNotifierPayload.cs" /> + <Compile Include="Payload\CancelNotificationPayload.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RestSharpJsonSerializer.cs" /> + <Compile Include="UsergridRequest.cs" /> + <Compile Include="Model\UsergridUser.cs" /> + <Compile Include="Model\UsergridGroup.cs" /> + <Compile Include="Payload\UserLoginPayload.cs" /> + <Compile Include="Payload\ChangePasswordPayload.cs" /> + <Compile Include="Payload\ClientIdLoginPayload.cs" /> + <Compile Include="Payload\LoginResponse.cs" /> + <Compile Include="Payload\UsergridGetResponse.cs" /> + <Compile Include="Manager\EntityManager.cs" /> + <Compile Include="Manager\IAuthenticationManager.cs" /> + <Compile Include="Manager\IConnectionManager.cs" /> + <Compile Include="Manager\IEntityManager.cs" /> + <Compile Include="Manager\ManagerBase.cs" /> + <Compile Include="Model\UsergridException.cs" /> + <Compile Include="Model\AuthType.cs" /> + <Compile Include="Manager\AuthenticationManager.cs" /> + <Compile Include="Manager\ConnectionManager.cs" /> + <Compile Include="Model\UsergridCollection.cs" /> + <Compile Include="Model\UsergridEntitySerializer.cs" /> + <Compile Include="Model\UsergridActivity.cs" /> + <Compile Include="Model\UsergridActor.cs" /> + <Compile Include="Model\UsergridImage.cs" /> + <Compile Include="Model\UnixDateTimeHelper.cs" /> + <Compile Include="Model\INotificationRecipients.cs" /> + <Compile Include="Model\NotificationRecipients.cs" /> + <Compile Include="Model\Notification.cs" /> + <Compile Include="Model\AndroidNotification.cs" /> + <Compile Include="Model\AppleNotification.cs" /> + <Compile Include="Payload\NotificationPayload.cs" /> + <Compile Include="Model\NotificationSchedulerSettings.cs" /> + <Compile Include="Model\UsergridDevice.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.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> + --> + <ItemGroup /> +</Project>
