Example #1
0
 public PushRequest(AbstractClient client, string collection, ICache <T> cache, ISyncQueue queue, WritePolicy policy)
     : base(client, collection, cache, queue, policy)
 {
 }
Example #2
0
        static internal void Initialize(string channelGroup, string publishKey, string subscribeKey, string authKey, AbstractClient client, RealtimeReconnectionPolicy realtimeReconnectionPolicy)
        {
            if (instance == null)
            {
                lock (lockObject)
                {
                    if (instance == null)
                    {
                        instance = new RealtimeRouter();
                        if (instance.pubnubClient == null)
                        {
                            PubnubApi.PNConfiguration PNconfig = new PubnubApi.PNConfiguration();
                            PNconfig.SubscribeKey       = subscribeKey;
                            PNconfig.PublishKey         = publishKey;
                            PNconfig.AuthKey            = authKey;
                            PNconfig.Secure             = true;
                            PNconfig.ReconnectionPolicy = realtimeReconnectionPolicy.ConvertToPNReconnectionPolicy();
                            instance.pubnubClient       = new PubnubApi.Pubnub(PNconfig);

                            instance.subscribeCallback = new PubnubApi.SubscribeCallbackExt(
                                (pubnubObj, message) => { instance.SubscribeCallback(message.Channel, message.Message as string); },
                                (pubnubObj, presence) => { /* presence not currently supported */ }, // TODO Support PubNub presence
                                (pubnubObj, status) =>
                            {
                                instance.HandleStatusMessage(status);
                            }
                                );

                            instance.pubnubClient.AddListener(instance.subscribeCallback);

                            instance.ChannelGroup = channelGroup;
                            instance.pubnubClient.Subscribe <string>().ChannelGroups(new string[] { instance.ChannelGroup }).Execute();

                            //FOR UNIQUE DEVICE GUID GENERATION --> Guid deviceGUID = pubnubClient.GenerateGuid(); string deviceID = deviceGUID.ToString();
                            instance.KinveyClient         = client;
                            instance.mapChannelToCallback = new Dictionary <string, KinveyRealtimeDelegate>();
                        }
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoveRequest{T}"/> class.
 /// </summary>
 /// <param name="query">Query.</param>
 /// <param name="client">Client that the user is logged in.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="sync">Synchronization queue.</param>
 /// <param name="policy">Write policy.</param>
 public RemoveRequest(IQueryable <object> query, AbstractClient client, string collection, ICache <T> cache, ISyncQueue sync, WritePolicy policy) : base(client, collection, cache, sync, policy)
 {
     _query = query;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PagedPullRequest{T}"/> class.
 /// </summary>
 /// <param name="client">Client that the user is logged in.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="deltaSetFetchingEnabled">If set to <c>true</c> delta set fetching enabled.</param>
 /// <param name="query">Query.</param>
 /// <param name="count">Limit of entities.</param>
 /// <param name="isInitial">If <c>true</c> then entities received from backend are expected to be not existing in Cache, otherwise <c>false</c>.</param>
 public PagedPullRequest(AbstractClient client, string collection, ICache <T> cache, bool deltaSetFetchingEnabled, IQueryable <object> query, int count, bool isInitial)
     : base(client, collection, cache, query, ReadPolicy.FORCE_NETWORK, deltaSetFetchingEnabled)
 {
     this.count     = count;
     this.isInitial = isInitial;
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:KinveyXamarin.CustomEndpoint`2"/> class.
 /// </summary>
 /// <param name="client">Client.</param>
 public CustomEndpoint(AbstractClient client)
 {
     this.client             = client;
     customRequestProperties = client.GetCustomRequestProperties();
 }
Example #6
0
 public Request(AbstractClient client)
 {
     this.Client = client;
 }
Example #7
0
 internal UploadMetaDataRequest(FileMetaData meta, Dictionary <string, string> urlProperties, AbstractClient client)
     : base(client, "PUT", REST_PATH, meta, urlProperties)
 {
     this.fileID = urlProperties["fileID"];
 }
Example #8
0
 public AbstractDataRequest(AbstractClient client, string method, string template, Object httpContent, string collection) : base(client, method, template, httpContent, new Dictionary <string, string>())
 {
     this.CollectionName = collection;
     uriResourceParameters.Add("appKey", ((KinveyClientRequestInitializer)client.RequestInitializer).AppKey);
     uriResourceParameters.Add("collectionName", collection);
 }
Example #9
0
 public GetCountRequest(AbstractClient client, string collection, ICache <T> cache, ReadPolicy policy, bool deltaSetFetchingEnabled, KinveyDelegate <uint> cacheDelegate, IQueryable <object> query)
     : base(client, collection, cache, query, policy, deltaSetFetchingEnabled)
 {
     this.cacheDelegate = cacheDelegate;
 }
Example #10
0
 internal UploadFileWithMetaDataRequest(FileMetaData meta, string mode, Dictionary <string, string> urlProperties, AbstractClient client)
     : base(client, mode, REST_PATH, meta, urlProperties)
 {
     if (mode.Equals("PUT"))
     {
         this.fileID       = urlProperties["fileID"];
         this.uriTemplate += "/{fileID}";
     }
 }
Example #11
0
 /// <summary>
 /// Gets an instance of the <see cref="DataStore{T}"/>.
 /// </summary>
 /// <returns>The DataStore instance.</returns>
 /// <param name="type">The <see cref="DataStoreType"/> of this DataStore instance</param>
 /// <param name="collectionName">Collection name of the Kinvey collection backing this DataStore</param>
 /// <param name="client">[optional] Kinvey Client used by this DataStore. If the client is not specified, the <see cref="Client.SharedClient"/> is used.</param>
 public static DataStore <T> Collection(string collectionName, DataStoreType type, AbstractClient client = null)
 {
     // TODO do we need to make this a singleton based on collection, store type and store ID?
     return(new DataStore <T> (type, collectionName, client));
 }
Example #12
0
 public static DataStore <T> Collection(string collectionName, AbstractClient client = null)
 {
     return(new DataStore <T>(DataStoreType.CACHE, collectionName, client));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KinveyXamarin.AbstractKinveyClientRequest`1"/> class.
 /// </summary>
 /// <param name="client">Client.</param>
 /// <param name="requestMethod">Request method.</param>
 /// <param name="uriTemplate">URI template.</param>
 /// <param name="httpContent">Http content.</param>
 /// <param name="uriParameters">URI parameters.</param>
 protected AbstractKinveyClientRequest(AbstractClient client, string requestMethod, string uriTemplate, Object httpContent, Dictionary <string, string> uriParameters) :
     this(client, client.BaseUrl, requestMethod, uriTemplate, httpContent, uriParameters)
 {
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PullRequest{T}"/> class.
 /// </summary>
 /// <param name="client">Client that the user is logged in.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="deltaSetFetchingEnabled">If set to <c>true</c> delta set fetching enabled.</param>
 /// <param name="query">Query.</param>
 public PullRequest(AbstractClient client, string collection, ICache <T> cache, bool deltaSetFetchingEnabled, IQueryable <object> query)
     : base(client, collection, cache, query, ReadPolicy.FORCE_NETWORK, deltaSetFetchingEnabled)
 {
 }
Example #15
0
 internal DownloadMetaDataRequest(Dictionary <string, string> urlProperties, AbstractClient client)
     : base(client, "GET", REST_PATH, default(FileMetaData), urlProperties)
 {
     this.fileID = urlProperties["fileID"];
 }
Example #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkFactory"/> class.
 /// </summary>
 /// <param name="client">Client that the user is logged in.</param>
 public NetworkFactory(AbstractClient client)
 {
     this.client = client;
 }
Example #17
0
 internal DeleteFileAndMetaDataRequest(Dictionary <string, string> urlProperties, AbstractClient client)
     : base(client, "DELETE", REST_PATH, default(KinveyDeleteResponse), urlProperties)
 {
     this.fileID = urlProperties["fileID"];
 }
Example #18
0
 internal PingRequest(AbstractClient client, Dictionary <string, string> urlProperties)
     : base(client, "GET", REST_PATH, default(PingResponse), urlProperties)
 {
 }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveRequest{T}"/> class.
 /// </summary>
 /// <param name="entity">Entity.</param>
 /// <param name="client">Client that the user is logged in.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="sync">Synchronization queue.</param>
 /// <param name="policy">Write policy.</param>
 public SaveRequest(T entity, AbstractClient client, string collection, ICache <T> cache, ISyncQueue sync, WritePolicy policy)
     : base(client, collection, cache, sync, policy)
 {
     this.entity = entity;
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FindRequest{T}"/> class.
 /// </summary>
 /// <param name="client">Client.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="policy">Read policy.</param>
 /// <param name="deltaSetFetchingEnabled">If set to <c>true</c> delta set fetching enabled.</param>
 /// <param name="cacheDelegate">Cache delegate.</param>
 /// <param name="query">Query.</param>
 /// <param name="listIDs">List identifiers.</param>
 public FindRequest(AbstractClient client, string collection, ICache <T> cache, ReadPolicy policy, bool deltaSetFetchingEnabled, KinveyDelegate <List <T> > cacheDelegate, IQueryable <object> query, List <string> listIDs)
     : base(client, collection, cache, query, policy, deltaSetFetchingEnabled, listIDs)
 {
     this.cacheDelegate = cacheDelegate;
 }
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:KinveyXamarin.CustomCommand`2"/> class.
 /// </summary>
 /// <param name="client">Client.</param>
 /// <param name="endpoint">Endpoint.</param>
 /// <param name="input">Input.</param>
 /// <param name="urlProperties">URL properties.</param>
 public CustomEndpointRequest(AbstractClient client, string endpoint, I input, Dictionary <string, string> urlProperties) :
     base(client, "POST", REST_PATH, input, urlProperties)
 {
     this.endpoint = endpoint;
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="client">Client.</param>
 /// <param name="requestMethod">Request method.</param>
 /// <param name="uriTemplate">URI template.</param>
 /// <param name="httpContent">Http content.</param>
 /// <param name="uriParameters">URI parameters.</param>
 public NetworkRequest(AbstractClient client, string requestMethod, string uriTemplate, Object httpContent, Dictionary <string, string> uriParameters) :
     base(client, client.BaseUrl, requestMethod, uriTemplate, httpContent, uriParameters)
 {
 }
Example #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoveRequest{T}"/> class.
 /// </summary>
 /// <param name="entityID">Entity Id.</param>
 /// <param name="client">Client that the user is logged in.</param>
 /// <param name="collection">Collection name.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="sync">Synchronization queue.</param>
 /// <param name="policy">Write policy.</param>
 public RemoveRequest(string entityID, AbstractClient client, string collection, ICache <T> cache, ISyncQueue sync, WritePolicy policy)
     : base(client, collection, cache, sync, policy)
 {
     this.entityID = entityID;
 }