Esempio n. 1
0
        private static async Task <bool> UpdateAppAsync(IAuthedService authedService, string applicationSecret, string session)
        {
            var appEndpoint = authedService.AppEndpoint;

            var updateAppInformation = new UpdateAppInformation
            {
                AppField          = AppField.IsFree,
                ApplicationSecret = applicationSecret,
                Session           = session,
                Value             = true
            };

            var updateAppResponse = await appEndpoint.UpdatAppAsync(updateAppInformation);

            return(updateAppResponse.Success && updateAppResponse.Response.Code == 200);
        }
Esempio n. 2
0
        public async Task <IAuthedResult <AuthedResponse> > UpdatAppAsync(UpdateAppInformation updateAppInformation)
        {
            updateAppInformation.GuardAgainstNull();

            string appField = updateAppInformation.AppField.ToString();
            string mode     = char.ToLower(appField[0]) + appField.Substring(1);

            using (var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"set/{mode}"))
            {
                requestMessage.Content = new FormUrlEncodedContent(new Dictionary <string, string>
                {
                    { "secret", updateAppInformation.ApplicationSecret },
                    { "value", updateAppInformation.Value.ToString() }
                });

                requestMessage.Headers.Add("Session", updateAppInformation.Session);

                return(await _requester.SendRequestAsync(requestMessage).ConfigureAwait(false));
            }
        }