Ejemplo n.º 1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create SyncListItem parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncListItem </returns>
        public static SyncListItemResource Create(CreateSyncListItemOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathListSid"> The list_sid </param>
        /// <param name="data"> The data </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SyncListItem </returns>
        public static async System.Threading.Tasks.Task <SyncListItemResource> CreateAsync(string pathServiceSid,
                                                                                           string pathListSid,
                                                                                           object data,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new CreateSyncListItemOptions(pathServiceSid, pathListSid, data);

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathListSid"> The list_sid </param>
        /// <param name="data"> The data </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncListItem </returns>
        public static SyncListItemResource Create(string pathServiceSid,
                                                  string pathListSid,
                                                  object data,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateSyncListItemOptions(pathServiceSid, pathListSid, data);

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateSyncListItemOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Sync,
                "/v1/Services/" + options.PathServiceSid + "/Lists/" + options.PathListSid + "/Items",
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Sync Service to create the List Item in </param>
        /// <param name="pathListSid"> The SID of the Sync List to add the new List Item to </param>
        /// <param name="data"> A JSON string that represents an arbitrary, schema-less object that the List Item stores
        ///            </param>
        /// <param name="ttl"> An alias for item_ttl </param>
        /// <param name="itemTtl"> How long, in seconds, before the List Item expires </param>
        /// <param name="collectionTtl"> How long, in seconds, before the List Item's parent Sync List expires </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SyncListItem </returns>
        public static async System.Threading.Tasks.Task <SyncListItemResource> CreateAsync(string pathServiceSid,
                                                                                           string pathListSid,
                                                                                           object data,
                                                                                           int?ttl                  = null,
                                                                                           int?itemTtl              = null,
                                                                                           int?collectionTtl        = null,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new CreateSyncListItemOptions(pathServiceSid, pathListSid, data)
            {
                Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl
            };

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Sync Service to create the List Item in </param>
        /// <param name="pathListSid"> The SID of the Sync List to add the new List Item to </param>
        /// <param name="data"> A JSON string that represents an arbitrary, schema-less object that the List Item stores
        ///            </param>
        /// <param name="ttl"> An alias for item_ttl </param>
        /// <param name="itemTtl"> How long, in seconds, before the List Item expires </param>
        /// <param name="collectionTtl"> How long, in seconds, before the List Item's parent Sync List expires </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncListItem </returns>
        public static SyncListItemResource Create(string pathServiceSid,
                                                  string pathListSid,
                                                  object data,
                                                  int?ttl                  = null,
                                                  int?itemTtl              = null,
                                                  int?collectionTtl        = null,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateSyncListItemOptions(pathServiceSid, pathListSid, data)
            {
                Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl
            };

            return(Create(options, client));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create SyncListItem parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SyncListItem </returns>
        public static async System.Threading.Tasks.Task <SyncListItemResource> CreateAsync(CreateSyncListItemOptions options,
                                                                                           ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }