示例#1
0
        /// <summary>
        /// Create a new Stream Message.
        /// </summary>
        /// <param name="options"> Create StreamMessage parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of StreamMessage </returns>
        public static StreamMessageResource Create(CreateStreamMessageOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
示例#2
0
        /// <summary>
        /// Create a new Stream Message.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Sync Service to create the new Stream Message in </param>
        /// <param name="pathStreamSid"> The SID of the Sync Stream to create the new Stream Message resource for </param>
        /// <param name="data"> A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message
        ///            body </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of StreamMessage </returns>
        public static async System.Threading.Tasks.Task <StreamMessageResource> CreateAsync(string pathServiceSid,
                                                                                            string pathStreamSid,
                                                                                            object data,
                                                                                            ITwilioRestClient client = null)
        {
            var options = new CreateStreamMessageOptions(pathServiceSid, pathStreamSid, data);

            return(await CreateAsync(options, client));
        }
示例#3
0
        /// <summary>
        /// Create a new Stream Message.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Sync Service to create the new Stream Message in </param>
        /// <param name="pathStreamSid"> The SID of the Sync Stream to create the new Stream Message resource for </param>
        /// <param name="data"> A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message
        ///            body </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of StreamMessage </returns>
        public static StreamMessageResource Create(string pathServiceSid,
                                                   string pathStreamSid,
                                                   object data,
                                                   ITwilioRestClient client = null)
        {
            var options = new CreateStreamMessageOptions(pathServiceSid, pathStreamSid, data);

            return(Create(options, client));
        }
示例#4
0
 private static Request BuildCreateRequest(CreateStreamMessageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Sync,
                "/v1/Services/" + options.PathServiceSid + "/Streams/" + options.PathStreamSid + "/Messages",
                postParams: options.GetParams()
                ));
 }
示例#5
0
        /// <summary>
        /// Create a new Stream Message.
        /// </summary>
        /// <param name="options"> Create StreamMessage parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of StreamMessage </returns>
        public static async System.Threading.Tasks.Task <StreamMessageResource> CreateAsync(CreateStreamMessageOptions options,
                                                                                            ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }