/// <summary> /// Creates a user on your Echosign account. /// </summary> /// <param name="info">The info of the user you want to create.</param> /// <returns></returns> public async Task <UserCreationResponse> CreateUser(UserCreationInfo info) { string serializedObject = JsonConvert.SerializeObject(info); using (StringContent content = new StringContent(serializedObject, Encoding.UTF8)) { content.Headers.Remove("Content-Type"); content.Headers.Add("Content-Type", "application/json"); HttpResponseMessage result = await client.PostAsync(apiEndpointVer + "/users", content).ConfigureAwait(false); if (result.IsSuccessStatusCode) { string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false); UserCreationResponse user = JsonConvert.DeserializeObject <UserCreationResponse>(response); return(user); } else { string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false); HandleError(result.StatusCode, response, false); return(null); } } }
public static UserCreationResponse ToDtoObject(this Trex.Server.Core.Model.UserCreationResponse userCreationResponse) { var dtoUserCreationResponse = new UserCreationResponse(userCreationResponse.Response, userCreationResponse.Success); dtoUserCreationResponse.User = userCreationResponse.User.ToDtoObject(false); return(dtoUserCreationResponse); }
public static object GenerateSaveResponse <T>(ref T typedResponse, TableResult response) { if (typedResponse is UserCreationResponse) { var userCreationResponse = new UserCreationResponse { Message = GetResponseMessage(response) }; return(userCreationResponse); } return(null); }
public CreateUserResponse(UserCreationResponse UserCreationResponse) { this.UserCreationResponse = UserCreationResponse; }