/// <summary> /// Create a new user role in your service /// </summary> /// <param name="options"> Create Role parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Role </returns> public static RoleResource Create(CreateRoleOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Create a new user role in your service /// </summary> /// <param name="options"> Create Role parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Role </returns> public static async System.Threading.Tasks.Task <RoleResource> CreateAsync(CreateRoleOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Create a new user role in your service /// </summary> /// <param name="pathChatServiceSid"> The SID of the Conversation Service to create the resource under </param> /// <param name="friendlyName"> A string to describe the new resource </param> /// <param name="type"> The type of role </param> /// <param name="permission"> A permission the role should have </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Role </returns> public static RoleResource Create(string pathChatServiceSid, string friendlyName, RoleResource.RoleTypeEnum type, List <string> permission, ITwilioRestClient client = null) { var options = new CreateRoleOptions(pathChatServiceSid, friendlyName, type, permission); return(Create(options, client)); }
private static Request BuildCreateRequest(CreateRoleOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Conversations, "/v1/Services/" + options.PathChatServiceSid + "/Roles", postParams: options.GetParams(), headerParams: null )); }
/// <summary> /// Create a new user role in your service /// </summary> /// <param name="pathChatServiceSid"> The SID of the Conversation Service to create the resource under </param> /// <param name="friendlyName"> A string to describe the new resource </param> /// <param name="type"> The type of role </param> /// <param name="permission"> A permission the role should have </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Role </returns> public static async System.Threading.Tasks.Task <RoleResource> CreateAsync(string pathChatServiceSid, string friendlyName, RoleResource.RoleTypeEnum type, List <string> permission, ITwilioRestClient client = null) { var options = new CreateRoleOptions(pathChatServiceSid, friendlyName, type, permission); return(await CreateAsync(options, client)); }