Пример #1
0
        /// <summary>
        /// Create a new Asset.
        /// </summary>
        /// <param name="options"> Create Asset parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Asset </returns>
        public static AssetResource Create(CreateAssetOptions 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 Asset.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="friendlyName"> A human-readable description of this Asset. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Asset </returns>
        public static async System.Threading.Tasks.Task <AssetResource> CreateAsync(string pathServiceSid,
                                                                                    string friendlyName,
                                                                                    ITwilioRestClient client = null)
        {
            var options = new CreateAssetOptions(pathServiceSid, friendlyName);

            return(await CreateAsync(options, client));
        }
Пример #3
0
        /// <summary>
        /// Create a new Asset.
        /// </summary>
        /// <param name="options"> Create Asset parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Asset </returns>
        public static async System.Threading.Tasks.Task <AssetResource> CreateAsync(CreateAssetOptions options,
                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateAssetOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Assets",
                postParams: options.GetParams()
                ));
 }
Пример #5
0
        /// <summary>
        /// Create a new Asset.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="friendlyName"> A human-readable description of this Asset. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Asset </returns>
        public static AssetResource Create(string pathServiceSid, string friendlyName, ITwilioRestClient client = null)
        {
            var options = new CreateAssetOptions(pathServiceSid, friendlyName);

            return(Create(options, client));
        }