/// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create Member parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Member </returns>
        public static async System.Threading.Tasks.Task <MemberResource> CreateAsync(CreateMemberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #2
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Member parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Member </returns>
        public static MemberResource Create(CreateMemberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #3
0
 private static Request BuildCreateRequest(CreateMemberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.IpMessaging,
                "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="identity"> The identity </param>
        /// <param name="roleSid"> The role_sid </param>
        /// <param name="lastConsumedMessageIndex"> The last_consumed_message_index </param>
        /// <param name="lastConsumptionTimestamp"> The last_consumption_timestamp </param>
        /// <param name="dateCreated"> The date_created </param>
        /// <param name="dateUpdated"> The date_updated </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Member </returns>
        public static async System.Threading.Tasks.Task <MemberResource> CreateAsync(string pathServiceSid, string pathChannelSid, string identity, string roleSid = null, int?lastConsumedMessageIndex = null, DateTime?lastConsumptionTimestamp = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, ITwilioRestClient client = null)
        {
            var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity)
            {
                RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="identity"> The identity </param>
        /// <param name="roleSid"> The role_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Member </returns>
        public static async System.Threading.Tasks.Task <MemberResource> CreateAsync(string pathServiceSid, string pathChannelSid, string identity, string roleSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity)
            {
                RoleSid = roleSid
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="identity"> The identity </param>
        /// <param name="roleSid"> The role_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Member </returns>
        public static MemberResource Create(string pathServiceSid, string pathChannelSid, string identity, string roleSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity)
            {
                RoleSid = roleSid
            };

            return(Create(options, client));
        }
Exemple #7
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the resource under </param>
        /// <param name="pathChannelSid"> The SID of the channel the new member belongs to </param>
        /// <param name="identity"> The `identity` value that identifies the new resource's User </param>
        /// <param name="roleSid"> The SID of the Role to assign to the member </param>
        /// <param name="lastConsumedMessageIndex"> The index of the last Message in the Channel the Member has read </param>
        /// <param name="lastConsumptionTimestamp"> The ISO 8601 based timestamp string representing the datetime of the last
        ///                                Message read event for the member within the Channel </param>
        /// <param name="dateCreated"> The ISO 8601 date and time in GMT when the resource was created </param>
        /// <param name="dateUpdated"> The ISO 8601 date and time in GMT when the resource was updated </param>
        /// <param name="attributes"> A valid JSON string that contains application-specific data </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Member </returns>
        public static MemberResource Create(string pathServiceSid,
                                            string pathChannelSid,
                                            string identity,
                                            string roleSid = null,
                                            int?lastConsumedMessageIndex      = null,
                                            DateTime?lastConsumptionTimestamp = null,
                                            DateTime?dateCreated     = null,
                                            DateTime?dateUpdated     = null,
                                            string attributes        = null,
                                            ITwilioRestClient client = null)
        {
            var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity)
            {
                RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes
            };

            return(Create(options, client));
        }