/// <summary>
        /// Add a new Participant to the Session
        /// </summary>
        /// <param name="options"> Create Participant parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Participant </returns>
        public static ParticipantResource Create(CreateParticipantOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateParticipantOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Proxy,
                "/v1/Services/" + options.PathServiceSid + "/Sessions/" + options.PathSessionSid + "/Participants",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Add a new Participant to the Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSessionSid"> Session Sid. </param>
        /// <param name="identifier"> The phone number of this Participant. </param>
        /// <param name="friendlyName"> A human readable description of this resource. </param>
        /// <param name="participantType"> The Participant Type of this Participant </param>
        /// <param name="proxyIdentifier"> The proxy phone number for this Participant. </param>
        /// <param name="proxyIdentifierSid"> Proxy Identifier Sid. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Participant </returns>
        public static async System.Threading.Tasks.Task <ParticipantResource> CreateAsync(string pathServiceSid, string pathSessionSid, string identifier, string friendlyName = null, ParticipantResource.ParticipantTypeEnum participantType = null, string proxyIdentifier = null, string proxyIdentifierSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateParticipantOptions(pathServiceSid, pathSessionSid, identifier)
            {
                FriendlyName = friendlyName, ParticipantType = participantType, ProxyIdentifier = proxyIdentifier, ProxyIdentifierSid = proxyIdentifierSid
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Add a new Participant to the Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSessionSid"> Session Sid. </param>
        /// <param name="identifier"> The phone number of this Participant. </param>
        /// <param name="friendlyName"> A human readable description of this resource. </param>
        /// <param name="participantType"> The Participant Type of this Participant </param>
        /// <param name="proxyIdentifier"> The proxy phone number for this Participant. </param>
        /// <param name="proxyIdentifierSid"> Proxy Identifier Sid. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Participant </returns>
        public static ParticipantResource Create(string pathServiceSid, string pathSessionSid, string identifier, string friendlyName = null, ParticipantResource.ParticipantTypeEnum participantType = null, string proxyIdentifier = null, string proxyIdentifierSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateParticipantOptions(pathServiceSid, pathSessionSid, identifier)
            {
                FriendlyName = friendlyName, ParticipantType = participantType, ProxyIdentifier = proxyIdentifier, ProxyIdentifierSid = proxyIdentifierSid
            };

            return(Create(options, client));
        }
        /// <summary>
        /// Add a new Participant to the Session
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the parent Service resource </param>
        /// <param name="pathSessionSid"> The SID of the parent Session resource </param>
        /// <param name="identifier"> The phone number of the Participant </param>
        /// <param name="friendlyName"> The string that you assigned to describe the participant </param>
        /// <param name="proxyIdentifier"> The proxy phone number to use for the Participant </param>
        /// <param name="proxyIdentifierSid"> The Proxy Identifier Sid </param>
        /// <param name="failOnParticipantConflict"> An experimental parameter to override the ProxyAllowParticipantConflict
        ///                                 account flag on a per-request basis. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Participant </returns>
        public static ParticipantResource Create(string pathServiceSid,
                                                 string pathSessionSid,
                                                 string identifier,
                                                 string friendlyName            = null,
                                                 string proxyIdentifier         = null,
                                                 string proxyIdentifierSid      = null,
                                                 bool?failOnParticipantConflict = null,
                                                 ITwilioRestClient client       = null)
        {
            var options = new CreateParticipantOptions(pathServiceSid, pathSessionSid, identifier)
            {
                FriendlyName = friendlyName, ProxyIdentifier = proxyIdentifier, ProxyIdentifierSid = proxyIdentifierSid, FailOnParticipantConflict = failOnParticipantConflict
            };

            return(Create(options, client));
        }
        /// <summary>
        /// Add a new Participant to the Session
        /// </summary>
        /// <param name="options"> Create Participant parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Participant </returns>
        public static async System.Threading.Tasks.Task <ParticipantResource> CreateAsync(CreateParticipantOptions options,
                                                                                          ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }