Esempio n. 1
0
        public Task <Result> Remove(Firebase reference)
        {
            CheckDisposed();
            ArgUtils.CheckForNull(reference, nameof(reference));

            var request = new Request(reference, HttpMethod.Delete);

            return(PerformRequest(request));
        }
Esempio n. 2
0
        public Task <Result> Push(Firebase reference, object content = null)
        {
            CheckDisposed();

            ArgUtils.CheckForNull(reference, nameof(reference));

            var request = new PushRequest(reference, content);

            return(PerformRequest(request));
        }
Esempio n. 3
0
        public Task <Result> Set(Firebase reference, object content)
        {
            CheckDisposed();

            ArgUtils.CheckForNull(reference, nameof(reference));
            ArgUtils.CheckForNull(content, nameof(content));

            var request = new Request(reference, HttpMethod.Put, content);

            return(PerformRequest(request));
        }
Esempio n. 4
0
        public void RemoveEventListener(IEventContract contract)
        {
            CheckDisposed();

            ArgUtils.CheckForNull(contract, nameof(contract));

            EventListenerRequest eventListenerRequest;

            if (!eventListenerRequests.TryGetValue(contract, out eventListenerRequest))
            {
                return;
            }

            eventListenerRequests.Remove(contract);

            eventListenerRequest.Stop();
        }
Esempio n. 5
0
        public async void AddEventListener(IEventContract contract)
        {
            CheckDisposed();

            ArgUtils.CheckForNull(contract, nameof(contract));

            if (eventListenerRequests.ContainsKey(contract))
            {
                return;
            }

            var eventListenerRequest = new EventListenerRequest(contract, new Cache());

            eventListenerRequests.Add(contract, eventListenerRequest);

            HttpRequestMessage  requestMessage      = eventListenerRequest.CreateRequestMessage(Context);
            HttpResponseMessage httpResponseMessage =
                await SendRequestMessage(requestMessage, HttpCompletionOption.ResponseHeadersRead);

            eventListenerRequest.CreateResult(httpResponseMessage, Context);
        }