Esempio n. 1
0
        /// <summary>
        /// create
        /// </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));
        }
Esempio n. 2
0
        /// <summary>
        /// create
        /// </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));
        }
 private static Request BuildCreateRequest(CreateRoleOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Chat,
                "/v2/Services/" + options.PathServiceSid + "/Roles",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="type"> The type </param>
        /// <param name="permission"> The permission </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 pathServiceSid,
                                                                                   string friendlyName,
                                                                                   RoleResource.RoleTypeEnum type,
                                                                                   List <string> permission,
                                                                                   ITwilioRestClient client = null)
        {
            var options = new CreateRoleOptions(pathServiceSid, friendlyName, type, permission);

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="type"> The type </param>
        /// <param name="permission"> The permission </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Role </returns>
        public static RoleResource Create(string pathServiceSid,
                                          string friendlyName,
                                          RoleResource.RoleTypeEnum type,
                                          List <string> permission,
                                          ITwilioRestClient client = null)
        {
            var options = new CreateRoleOptions(pathServiceSid, friendlyName, type, permission);

            return(Create(options, client));
        }