/// <summary> /// Create a new Twilio Subaccount from the account making the request /// </summary> /// /// <param name="options"> Create Account parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Account </returns> public static AccountResource Create(CreateAccountOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Create a new Twilio Subaccount from the account making the request /// </summary> /// /// <param name="friendlyName"> A human readable description of the account </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Account </returns> public static AccountResource Create(string friendlyName = null, ITwilioRestClient client = null) { var options = new CreateAccountOptions { FriendlyName = friendlyName }; return(Create(options, client)); }
/// <summary> /// Create a new Twilio Subaccount from the account making the request /// </summary> /// /// <param name="friendlyName"> A human readable description of the account </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Account </returns> public static async System.Threading.Tasks.Task <AccountResource> CreateAsync(string friendlyName = null, ITwilioRestClient client = null) { var options = new CreateAccountOptions { FriendlyName = friendlyName }; return(await CreateAsync(options, client)); }
private static Request BuildCreateRequest(CreateAccountOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Api, "/2010-04-01/Accounts.json", postParams: options.GetParams() )); }
/// <summary> /// Create a new Twilio Subaccount from the account making the request /// </summary> /// /// <param name="options"> Create Account parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Account </returns> public static async System.Threading.Tasks.Task <AccountResource> CreateAsync(CreateAccountOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }