using System.Threading;
using System.Threading.Tasks;
namespace AMWD.Net.Api.Cloudflare.Zones
{
///
/// Extensions for Zone Plans.
///
public static class ZonePlansExtensions
{
///
/// Details of the available plan that the zone can subscribe to.
///
/// The instance.
/// The zone identifier.
/// The plan identifier.
/// A cancellation token used to propagate notification that this operation should be canceled.
public static Task> AvailablePlanDetails(this ICloudflareClient client, string zoneId, string planId, CancellationToken cancellationToken = default)
{
zoneId.ValidateCloudflareId();
planId.ValidateCloudflareId();
return client.GetAsync($"/zones/{zoneId}/available_plans/{planId}", cancellationToken: cancellationToken);
}
///
/// Lists available plans the zone can subscribe to.
///
/// The instance.
/// The zone identifier.
/// A cancellation token used to propagate notification that this operation should be canceled.
public static Task>> ListAvailablePlans(this ICloudflareClient client, string zoneId, CancellationToken cancellationToken = default)
{
zoneId.ValidateCloudflareId();
return client.GetAsync>($"/zones/{zoneId}/available_plans", cancellationToken: cancellationToken);
}
///
/// Lists all rate plans the zone can subscribe to.
///
/// The instance.
/// The zone identifier.
/// A cancellation token used to propagate notification that this operation should be canceled.
public static Task> ListAvailableRatePlans(this ICloudflareClient client, string zoneId, CancellationToken cancellationToken = default)
{
zoneId.ValidateCloudflareId();
return client.GetAsync($"/zones/{zoneId}/available_rate_plans", cancellationToken: cancellationToken);
}
}
}