Beispiel #1
0
        public void EditSubscription(string streamId, SubscriptionActionEnum action, string newTitle = null, string addToFolder = null, string removeFromFolder = null)
        {
            var request = new RestRequest("/reader/api/0/subscription/edit", Method.POST);

            request.AddParameter("s", streamId);
            request.AddParameter("ac", action.ToString().ToLower());
            request.AddParameterIfHasValue("t", newTitle);
            request.AddParameterIfHasValue("a", Helper.UnifyCustomTagName(addToFolder));
            request.AddParameterIfHasValue("r", Helper.UnifyCustomTagName(removeFromFolder));
        }
Beispiel #2
0
        /// <summary>
        /// Create a subscription for intersection signal status.  In this request, we will ask
        /// for new status to be sent to our External Center (at the specified returnAddress)
        /// on status change.
        ///
        /// In our example, we will only request status for the first traffic controller
        /// received in the prior service call; however, this subscription could easily have
        /// requested for multiple controllers or all controllers (blank devicefilter).
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="action"></param>
        private static void SubmitIntersectionStatusSubscriptionRequest(string orgId, SubscriptionActionEnum action)
        {
            try
            {
                var c2CMessageSubscription = new C2cMessageSubscription()

                {
                    informationalText  = "Example informationalText",
                    subscriptionID     = $"{SubscriptionId}",
                    returnAddress      = MyExternalCenterUrl,
                    subscriptionAction = new SubscriptionAction
                    {
                        subscriptionActionitem = new[]
                        {
                            action.ToString(),
                        }
                    },
                    subscriptionType = new SubscriptionType()
                    {
                        subscriptionTypeitem = SubscriptionTypeEnum.Periodic.ToString()
                    },
                    subscriptionFrequency = 5
                };
                var deviceInformationRequest = new DeviceInformationRequest()
                {
                    organizationinformation = new OrganizationInformation()
                    {
                        organizationid = $"{orgId}"
                    },
                    authentication = new Authentication()
                    {
                        userid   = Username,
                        password = Password
                    },
                    //devicefilter = new DeviceInformationRequestFilter()
                    //{
                    //    deviceidlist = new DeviceInformationRequestFilterDeviceidlist()
                    //    {
                    //        deviceid = new[] { _firstIntersectionSignalId.ToString() }
                    //    }
                    //},
                    devicetype            = Constants.DeviceTypes.SignalController,
                    deviceinformationtype = Constants.DeviceInformationTypes.Status
                };

                // Create the client
                var client = new TmddEnhancedServiceClient();

                var response = client.dlDeviceInformationSubscription(c2CMessageSubscription, deviceInformationRequest);
                Console.WriteLine($"Response: {response.informationalText}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }