Exemple #1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create SyncMapItem parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncMapItem </returns>
        public static SyncMapItemResource Create(CreateSyncMapItemOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #2
0
 private static Request BuildCreateRequest(CreateSyncMapItemOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Sync,
                "/v1/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Items",
                postParams: options.GetParams()
                ));
 }
Exemple #3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathMapSid"> The map_sid </param>
        /// <param name="key"> The key </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 SyncMapItem </returns>
        public static async System.Threading.Tasks.Task <SyncMapItemResource> CreateAsync(string pathServiceSid,
                                                                                          string pathMapSid,
                                                                                          string key,
                                                                                          object data,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreateSyncMapItemOptions(pathServiceSid, pathMapSid, key, data);

            return(await CreateAsync(options, client));
        }
Exemple #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathMapSid"> The map_sid </param>
        /// <param name="key"> The key </param>
        /// <param name="data"> The data </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncMapItem </returns>
        public static SyncMapItemResource Create(string pathServiceSid,
                                                 string pathMapSid,
                                                 string key,
                                                 object data,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreateSyncMapItemOptions(pathServiceSid, pathMapSid, key, data);

            return(Create(options, client));
        }
Exemple #5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathMapSid"> The map_sid </param>
        /// <param name="key"> The unique user-defined key of this Map Item. </param>
        /// <param name="data"> Contains arbitrary user-defined, schema-less data that this Map Item stores, represented by a
        ///            JSON object, up to 16KB. </param>
        /// <param name="ttl"> Alias for item_ttl </param>
        /// <param name="itemTtl"> Time-to-live of this item in seconds, defaults to no expiration. </param>
        /// <param name="collectionTtl"> Time-to-live of this item's parent Map in seconds, defaults to no expiration. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SyncMapItem </returns>
        public static async System.Threading.Tasks.Task <SyncMapItemResource> CreateAsync(string pathServiceSid,
                                                                                          string pathMapSid,
                                                                                          string key,
                                                                                          object data,
                                                                                          int?ttl                  = null,
                                                                                          int?itemTtl              = null,
                                                                                          int?collectionTtl        = null,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreateSyncMapItemOptions(pathServiceSid, pathMapSid, key, data)
            {
                Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl
            };

            return(await CreateAsync(options, client));
        }
Exemple #6
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathMapSid"> The map_sid </param>
        /// <param name="key"> The unique user-defined key of this Map Item. </param>
        /// <param name="data"> Contains arbitrary user-defined, schema-less data that this Map Item stores, represented by a
        ///            JSON object, up to 16KB. </param>
        /// <param name="ttl"> Alias for item_ttl </param>
        /// <param name="itemTtl"> Time-to-live of this item in seconds, defaults to no expiration. </param>
        /// <param name="collectionTtl"> Time-to-live of this item's parent Map in seconds, defaults to no expiration. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SyncMapItem </returns>
        public static SyncMapItemResource Create(string pathServiceSid,
                                                 string pathMapSid,
                                                 string key,
                                                 object data,
                                                 int?ttl                  = null,
                                                 int?itemTtl              = null,
                                                 int?collectionTtl        = null,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreateSyncMapItemOptions(pathServiceSid, pathMapSid, key, data)
            {
                Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl
            };

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

            return(FromJson(response.Content));
        }