/// <summary>
        /// Fetch a list of all United States numbers that have been deactivated on a specific date.
        /// </summary>
        /// <param name="options"> Fetch Deactivations parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Deactivations </returns>
        public static DeactivationsResource Fetch(FetchDeactivationsOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Fetch a list of all United States numbers that have been deactivated on a specific date.
        /// </summary>
        /// <param name="date"> The date to retrieve deactivated numbers for. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Deactivations </returns>
        public static DeactivationsResource Fetch(DateTime?date = null, ITwilioRestClient client = null)
        {
            var options = new FetchDeactivationsOptions()
            {
                Date = date
            };

            return(Fetch(options, client));
        }
        /// <summary>
        /// Fetch a list of all United States numbers that have been deactivated on a specific date.
        /// </summary>
        /// <param name="date"> The date to retrieve deactivated numbers for. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Deactivations </returns>
        public static async System.Threading.Tasks.Task <DeactivationsResource> FetchAsync(DateTime?date            = null,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new FetchDeactivationsOptions()
            {
                Date = date
            };

            return(await FetchAsync(options, client));
        }
 private static Request BuildFetchRequest(FetchDeactivationsOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Messaging,
                "/v1/Deactivations",
                queryParams: options.GetParams(),
                headerParams: null
                ));
 }
        /// <summary>
        /// Fetch a list of all United States numbers that have been deactivated on a specific date.
        /// </summary>
        /// <param name="options"> Fetch Deactivations parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Deactivations </returns>
        public static async System.Threading.Tasks.Task <DeactivationsResource> FetchAsync(FetchDeactivationsOptions options,
                                                                                           ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }