Ejemplo n.º 1
0
        /// <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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        /// <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));
        }
Ejemplo n.º 4
0
        /// <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));
        }
Ejemplo n.º 5
0
        /// <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));
        }
 private static Request BuildCreateRequest(CreateMemberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Chat,
                "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members",
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> Sid of the Service this member belongs to. </param>
        /// <param name="pathChannelSid"> Key that uniquely defines the channel this member belongs to. </param>
        /// <param name="identity"> A unique string identifier for this User in this Service. See the access tokens docs for
        ///                more details. </param>
        /// <param name="roleSid"> The role to be assigned to this member. Defaults to the roles specified on the Service.
        ///               </param>
        /// <param name="lastConsumedMessageIndex"> Field used to specify the last consumed Message index for the Channel for
        ///                                this Member.  Should only be used when recreating a Member from a backup/separate
        ///                                source. </param>
        /// <param name="lastConsumptionTimestamp"> ISO8601 time indicating the last datetime the Member consumed a Message in
        ///                                the Channel.  Should only be used when recreating a Member from a backup/separate
        ///                                source </param>
        /// <param name="dateCreated"> The ISO8601 time specifying the datetime the Members should be set as being created.
        ///                   Will be set to the current time by the Chat service if not specified.  Note that this should only
        ///                   be used in cases where a Member is being recreated from a backup/separate source </param>
        /// <param name="dateUpdated"> The ISO8601 time specifying the datetime the Member should be set as having been last
        ///                   updated.  Will be set to the null by the Chat service if not specified.  Note that this should
        ///                   only be used in cases where a Member is being recreated from a backup/separate source  and where a
        ///                   Member was previously updated. </param>
        /// <param name="attributes"> An optional string metadata field you can use to store any data you wish. </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));
        }