Example #1
0
 /// <summary>
 /// Delete/remove registered webhook.
 /// </summary>
 /// <example>
 /// <code>
 /// try
 /// {
 ///     connectApi.DeleteWebhook();
 /// }
 /// catch (CloudApiException)
 /// {
 ///     throw;
 /// }
 /// </code>
 /// </example>
 /// <exception cref="CloudApiException">CloudApiException</exception>
 public void DeleteWebhook()
 {
     try
     {
         NotificationsApi.DeregisterWebhook();
         ResourceSubscribtions.Clear();
     }
     catch (mds.Client.ApiException ex)
     {
         throw new CloudApiException(ex.ErrorCode, ex.Message, ex.ErrorContent);
     }
 }
        /// <summary>
        /// Remove all subscriptions
        /// </summary>
        /// <remarks>
        /// Warning: This could be slow for large numbers of connected devices. If possible, explicitly delete subscriptions known to have been created.
        /// </remarks>
        /// <example>
        /// <code>
        /// try
        /// {
        ///     connectApi.DeleteSubscriptions();
        /// }
        /// catch (CloudApiException)
        /// {
        ///     throw;
        /// }
        /// </code>
        /// </example>
        /// <exception cref="CloudApiException">CloudApiException</exception>
        public void DeleteSubscriptions()
        {
            try
            {
                foreach (var item in ListConnectedDevices())
                {
                    try
                    {
                        DeleteDeviceSubscriptions(item.Id);
                    }
                    catch (CloudApiException)
                    {
                        Log.Debug("no subscriptions found for this device");
                    }
                }

                ResourceSubscribtions.Clear();
            }
            catch (mds.Client.ApiException e)
            {
                throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent);
            }
        }