예제 #1
0
        /// <summary>
        /// Change the New Relic settings
        /// </summary>
        /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Settings/partners.html</returns>
        public async Task UpdateNewRelicSettingsAsync(bool enabled, string licenseKey, CancellationToken cancellationToken = default(CancellationToken))
        {
            var newRelicSettings = new NewRelicSettings
            {
                Enabled    = enabled,
                LicenseKey = licenseKey
            };
            var data     = JObject.FromObject(newRelicSettings);
            var response = await _client.PatchAsync("/partner_settings/new_relic", data, cancellationToken).ConfigureAwait(false);

            response.EnsureSuccess();
        }
        public ActionResult SaveConfiguration(NewRelicSettings settings)
        {
            if (this.ModelState.IsValid)
            {
                SettingsRepository.Instance.SaveGadgetSettings(settings);
                Helpers.EmptyGadgetCache(settings.GadgetId);
            }

            RouteValueDictionary routeValueDictionary = new RouteValueDictionary { { "gadgetId", settings.GadgetId } };

            return this.RedirectToAction("Index", routeValueDictionary);
        }
예제 #3
0
        /// <summary>
        /// Change the New Relic settings.
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="licenseKey">The license key.</param>
        /// <param name="onBehalfOf">The user to impersonate.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="NewRelicSettings" />.
        /// </returns>
        public Task <NewRelicSettings> UpdateNewRelicSettingsAsync(bool enabled, string licenseKey, string onBehalfOf = null, CancellationToken cancellationToken = default)
        {
            var data = new NewRelicSettings
            {
                Enabled    = enabled,
                LicenseKey = licenseKey
            };

            return(_client
                   .PatchAsync("partner_settings/new_relic")
                   .OnBehalfOf(onBehalfOf)
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsObject <NewRelicSettings>());
        }
예제 #4
0
        /// <summary>
        /// Change the New Relic settings
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="licenseKey">The license key.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="NewRelicSettings" />.
        /// </returns>
        public Task <NewRelicSettings> UpdateNewRelicSettingsAsync(bool enabled, string licenseKey, CancellationToken cancellationToken = default(CancellationToken))
        {
            var newRelicSettings = new NewRelicSettings
            {
                Enabled    = enabled,
                LicenseKey = licenseKey
            };
            var data = JObject.FromObject(newRelicSettings);

            return(_client
                   .PatchAsync("partner_settings/new_relic")
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsSendGridObject <NewRelicSettings>());
        }
예제 #5
0
        /// <summary>
        /// Change the New Relic settings
        /// </summary>
        /// <param name="enabled">if set to <c>true</c> [enabled].</param>
        /// <param name="licenseKey">The license key.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// The <see cref="NewRelicSettings" />.
        /// </returns>
        public async Task <NewRelicSettings> UpdateNewRelicSettingsAsync(bool enabled, string licenseKey, CancellationToken cancellationToken = default(CancellationToken))
        {
            var newRelicSettings = new NewRelicSettings
            {
                Enabled    = enabled,
                LicenseKey = licenseKey
            };
            var data     = JObject.FromObject(newRelicSettings);
            var response = await _client.PatchAsync("/partner_settings/new_relic", data, cancellationToken).ConfigureAwait(false);

            response.EnsureSuccess();

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

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

            return(updatedSettings);
        }