/// <summary> /// Returns a list of recurly subscriptions /// /// A subscription will belong to more than one state. /// </summary> /// <param name="state">State of subscriptions to return, defaults to "live"</param> /// <param name="filter">FilterCriteria used to apply server side sorting and filtering</param> /// <returns></returns> public static RecurlyList <Subscription> List(Subscription.SubscriptionState state, FilterCriteria filter) { filter = filter ?? FilterCriteria.Instance; var parameters = filter.ToNamedValueCollection(); parameters["state"] = state.ToString().EnumNameToTransportCase(); return(new SubscriptionList(Subscription.UrlPrefix + "?" + parameters.ToString())); }
/// <summary> /// Returns a list of subscriptions for this account /// </summary> /// <param name="state"></param> /// <returns></returns> public RecurlyList <Subscription> GetSubscriptions(Subscription.SubscriptionState state = Subscription.SubscriptionState.All) { return(new SubscriptionList(UrlPrefix + Uri.EscapeUriString(AccountCode) + "/subscriptions/" + Build.QueryStringWith(state.Equals(Subscription.SubscriptionState.All) ? "" : "state=" + state.ToString().EnumNameToTransportCase()))); }
/// <summary> /// Returns a list of recurly subscriptions /// /// A subscription will belong to more than one state. /// </summary> /// <param name="state">State of subscriptions to return, defaults to "live"</param> /// <returns></returns> public static RecurlyList <Subscription> List(Subscription.SubscriptionState state = Subscription.SubscriptionState.Live) { return(new SubscriptionList(Subscription.UrlPrefix + "?state=" + state.ToString().EnumNameToTransportCase())); }
/// <summary> /// Returns a list of recurly subscriptions /// /// A subscription will belong to more than one state. /// </summary> /// <param name="state">State of subscriptions to return, defaults to "live"</param> /// <returns></returns> public static RecurlyList <Subscription> List(Subscription.SubscriptionState state = Subscription.SubscriptionState.Live) { return(List(state, null)); }
/// <summary> /// Adds the <paramref name="target"/> <see cref="Subscription.SubscriptionState"/> to the given <paramref name="source"/> <see cref="Subscription.SubscriptionState"/>. /// </summary> /// <param name="source">The <see cref="Subscription.SubscriptionState"/> flags to be added to.</param> /// <param name="target">The <see cref="Subscription.SubscriptionState"/> flags to add to <paramref name="source"/>.</param> /// <returns>The result of the bitwise OR of the two <see cref="Subscription.SubscriptionState"/> flags.</returns> public static Subscription.SubscriptionState Add(this Subscription.SubscriptionState source, Subscription.SubscriptionState target) { return(source | target); }
/// <summary> /// Removes the <paramref name="target"/> <see cref="Subscription.SubscriptionState"/> flag from the <paramref name="source"/> <see cref="Subscription.SubscriptionState"/> (if it exists). /// </summary> /// <param name="source">The <see cref="Subscription.SubscriptionState"/> to remove the <paramref name="target"/> from.</param> /// <param name="target">The <see cref="Subscription.SubscriptionState"/> flag to attempt to remove from <paramref name="source"/>.</param> /// <returns><paramref name="source"/> with <paramref name="target"/> removed if <paramref name="target"/> was present, merely <paramref name="source"/> otherwise.</returns> public static Subscription.SubscriptionState Remove(this Subscription.SubscriptionState source, Subscription.SubscriptionState target) { return(source.Is(target) ? source ^ target : source); }
/// <summary> /// Checks if the <paramref name="source"/> <see cref="Subscription.SubscriptionState"/> contains the flag for the <paramref name="target"/> <see cref="Subscription.SubscriptionState"/>. /// </summary> /// <param name="source">The <see cref="Subscription.SubscriptionState"/> to question for the given <paramref name="target"/> flag.</param> /// <param name="target">The <see cref="Subscription.SubscriptionState"/> flag to question for.</param> /// <returns>true if the <paramref name="source"/> flags contain the <paramref name="target"/> flags, false otherwise.</returns> public static bool Is(this Subscription.SubscriptionState source, Subscription.SubscriptionState target) { return((source & target) == target); }