Exemplo n.º 1
0
        /// <summary>
        /// Change the Footer settings
        /// </summary>
        /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Settings/mail.html</returns>
        public async Task UpdateFooterMailSettinsgAsync(bool enabled, string htmlContent, string textContent, CancellationToken cancellationToken = default(CancellationToken))
        {
            var footerGlobalSetting = new FooterGlobalSettings
            {
                Enabled     = enabled,
                HtmlContent = htmlContent,
                TextContent = textContent
            };
            var data     = JObject.FromObject(footerGlobalSetting);
            var response = await _client.PatchAsync("/mail_settings/footer", data, cancellationToken).ConfigureAwait(false);

            response.EnsureSuccess();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Change the Footer settings.
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="htmlContent">Content of the HTML.</param>
        /// <param name="textContent">Content of the text.</param>
        /// <param name="onBehalfOf">The user to impersonate.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="FooterGlobalSettings" />.
        /// </returns>
        public Task <FooterGlobalSettings> UpdateFooterMailSettingsAsync(bool enabled, string htmlContent, string textContent, string onBehalfOf = null, CancellationToken cancellationToken = default)
        {
            var data = new FooterGlobalSettings
            {
                Enabled     = enabled,
                HtmlContent = htmlContent,
                TextContent = textContent
            };

            return(_client
                   .PatchAsync("mail_settings/footer")
                   .OnBehalfOf(onBehalfOf)
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsObject <FooterGlobalSettings>());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Change the Footer settings
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="htmlContent">Content of the HTML.</param>
        /// <param name="textContent">Content of the text.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="FooterGlobalSettings" />.
        /// </returns>
        public Task <FooterGlobalSettings> UpdateFooterMailSettingsAsync(bool enabled, string htmlContent, string textContent, CancellationToken cancellationToken = default(CancellationToken))
        {
            var footerGlobalSetting = new FooterGlobalSettings
            {
                Enabled     = enabled,
                HtmlContent = htmlContent,
                TextContent = textContent
            };
            var data = JObject.FromObject(footerGlobalSetting);

            return(_client
                   .PatchAsync("mail_settings/footer")
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsSendGridObject <FooterGlobalSettings>());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Change the Footer settings
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="htmlContent">Content of the HTML.</param>
        /// <param name="textContent">Content of the text.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="FooterGlobalSettings" />.
        /// </returns>
        public async Task <FooterGlobalSettings> UpdateFooterMailSettingsAsync(bool enabled, string htmlContent, string textContent, CancellationToken cancellationToken = default(CancellationToken))
        {
            var footerGlobalSetting = new FooterGlobalSettings
            {
                Enabled     = enabled,
                HtmlContent = htmlContent,
                TextContent = textContent
            };
            var data     = JObject.FromObject(footerGlobalSetting);
            var response = await _client.PatchAsync("/mail_settings/footer", data, cancellationToken).ConfigureAwait(false);

            response.EnsureSuccess();

            var responseContent = await response.Content.ReadAsStringAsync(null).ConfigureAwait(false);

            var updatedSettings = JObject.Parse(responseContent).ToObject <FooterGlobalSettings>();

            return(updatedSettings);
        }