Inheritance: MonoBehaviour
        public async Task AddPackage(Uri packageUrl)
        {
            var callbacks = _triggerRepository.GetTriggerCallbacks();

            var triggerBody = new TriggerBody {
                PackageUrl = packageUrl.ToString()
            };

            foreach (var callback in callbacks)
            {
                try
                {
                    await callback.InvokeAsync(
                        Runtime.FromAppSettings(),
                        triggerBody);
                }
                catch (HttpRequestException e)
                {
                    // Server Unavailable
                    Log.Write(() => e);
                }
                catch (InvalidOperationException e)
                {
                    // Bad Request
                    Log.Write(() => e);
                }
            }
        }
Ejemplo n.º 2
0
        private bool CheckRequestContainsPayload(IPusherRestRequest request, string channelName, string eventName, object eventData)
        {
            var expectedBody = new TriggerBody()
            {
                name     = eventName,
                channels = new[] { channelName },
                data     = JsonConvert.SerializeObject(eventData)
            };

            var expected = JsonConvert.SerializeObject(expectedBody);

            return(request.GetContentAsJsonString().Contains(expected));
        }
Ejemplo n.º 3
0
        private bool CheckRequestContainsPayload(IRestRequest request, string channelName, string eventName, object eventData)
        {
            var serializer   = new JsonSerializer();
            var expectedBody = new TriggerBody()
            {
                name     = eventName,
                channels = new string[] { channelName },
                data     = serializer.Serialize(eventData)
            };
            var expected = serializer.Serialize(expectedBody);

            return(request.Parameters[0].Type == ParameterType.RequestBody &&
                   request.Parameters[0].ToString().Contains(expected));
        }
Ejemplo n.º 4
0
        private bool CheckRequestContainsPayload(IRestRequest request, string channelName, string eventName, object eventData)
        {
            var serializer = new JsonSerializer();
            var expectedBody = new TriggerBody() {
                name = eventName,
                channels = new string[]{channelName},
                data = serializer.Serialize(eventData)
            };
            var expected = serializer.Serialize(expectedBody);

            return request.Parameters[0].Type == ParameterType.RequestBody &&
                request.Parameters[0].ToString().Contains( expected );
        }
Ejemplo n.º 5
0
        private bool CheckRequestContainsPayload(IPusherRestRequest request, string channelName, string eventName, object eventData)
        {
            var expectedBody = new TriggerBody()
            {
                name = eventName,
                channels = new[] { channelName },
                data = JsonConvert.SerializeObject(eventData)
            };

            var expected = JsonConvert.SerializeObject(expectedBody);

            return request.GetContentAsJsonString().Contains(expected);
        }