Ejemplo n.º 1
0
        private static async Task <bool> UpdateClientAsync(IAuthedService authedService, string session, string userSession)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var updateClientInformation = new UpdateClientInformation
            {
                ClientField = ClientField.Email,
                Value       = "*****@*****.**",
                UserSession = userSession,
                Session     = session
            };

            var updateClientResponse = await clientEndpoint.UpdateClientAsync(updateClientInformation);

            return(updateClientResponse.Success && updateClientResponse.Response.Code == 200);
        }
Ejemplo n.º 2
0
        public async Task <IAuthedResult <AuthedResponse> > UpdateClientAsync(UpdateClientInformation updateClientInformation)
        {
            updateClientInformation.GuardAgainstNull();

            using (var requestMessage = new HttpRequestMessage(HttpMethod.Post, "users/set"))
            {
                string clientField = updateClientInformation.ClientField.ToString();
                string field       = char.ToUpper(clientField[0]) + clientField.Substring(1);

                requestMessage.Content = new FormUrlEncodedContent(new Dictionary <string, string>
                {
                    { "userSession", updateClientInformation.UserSession },
                    { "field", field },
                    { "value", updateClientInformation.Value.ToString() }
                });

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

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