Exemplo n.º 1
0
        /// <summary>
        /// Get the current callback URL if it exists.
        /// </summary>
        /// <returns>Webhook</returns>
        /// <example>
        /// <code>
        /// try
        /// {
        ///     var webhook = connectApi.GetWebhook();
        ///     return webhook;
        /// }
        /// catch (CloudApiException)
        /// {
        ///     throw;
        /// }
        /// </code>
        /// </example>
        /// <exception cref="CloudApiException">CloudApiException</exception>
        public Webhook GetWebhook()
        {
            try
            {
                return(Webhook.Map(NotificationsApi.GetWebhook()));
            }
            catch (mds.Client.ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    // no webhook
                    return(null);
                }

                throw new CloudApiException(ex.ErrorCode, ex.Message, ex.ErrorContent);
            }
        }