/// <summary> /// create /// </summary> /// <param name="options"> Create User parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of User </returns> public static async System.Threading.Tasks.Task <UserResource> CreateAsync(CreateUserOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// create /// </summary> /// /// <param name="pathServiceSid"> The service_sid </param> /// <param name="identity"> The identity </param> /// <param name="roleSid"> The role_sid </param> /// <param name="attributes"> The attributes </param> /// <param name="friendlyName"> The friendly_name </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of User </returns> public static async System.Threading.Tasks.Task <UserResource> CreateAsync(string pathServiceSid, string identity, string roleSid = null, string attributes = null, string friendlyName = null, ITwilioRestClient client = null) { var options = new CreateUserOptions(pathServiceSid, identity) { RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName }; return(await CreateAsync(options, client)); }
/// <summary> /// create /// </summary> /// /// <param name="pathServiceSid"> The service_sid </param> /// <param name="identity"> The identity </param> /// <param name="roleSid"> The role_sid </param> /// <param name="attributes"> The attributes </param> /// <param name="friendlyName"> The friendly_name </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of User </returns> public static UserResource Create(string pathServiceSid, string identity, string roleSid = null, string attributes = null, string friendlyName = null, ITwilioRestClient client = null) { var options = new CreateUserOptions(pathServiceSid, identity) { RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName }; return(Create(options, client)); }
private static Request BuildCreateRequest(CreateUserOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.IpMessaging, "/v1/Services/" + options.PathServiceSid + "/Users", postParams: options.GetParams() )); }