/// <summary> /// Lists accounts, limited to state /// </summary> /// <param name="state">Account state to retrieve</param> /// <param name="filter">FilterCriteria used to apply server side sorting and filtering</param> /// <returns></returns> public static RecurlyList <Account> List(Account.AccountState state, FilterCriteria filter) { filter = filter ?? FilterCriteria.Instance; var parameters = filter.ToNamedValueCollection(); parameters["state"] = state.ToString().EnumNameToTransportCase(); return(new AccountList(Account.UrlPrefix + "?" + parameters.ToString())); }
/// <summary> /// Lists accounts, limited to state /// </summary> /// <param name="state">Account state to retrieve</param> /// <returns></returns> public static RecurlyList <Account> List(Account.AccountState state = Account.AccountState.Active) { return(new AccountList(Account.UrlPrefix + "?state=" + state.ToString().EnumNameToTransportCase())); }
/// <summary> /// Lists accounts, limited to state /// </summary> /// <param name="state">Account state to retrieve</param> /// <returns></returns> public static RecurlyList <Account> List(Account.AccountState state = Account.AccountState.Active) { return(List(state, null)); }
/// <summary> /// Adds the <paramref name="target"/> <see cref="Account.AccountState"/> to the given <paramref name="source"/> <see cref="Account.AccountState"/>. /// </summary> /// <param name="source">The <see cref="Account.AccountState"/> flags to be added to.</param> /// <param name="target">The <see cref="Account.AccountState"/> flags to add to <paramref name="source"/>.</param> /// <returns>The result of the bitwise OR of the two <see cref="Account.AccountState"/> flags.</returns> public static Account.AccountState Add(this Account.AccountState source, Account.AccountState target) { return(source | target); }
/// <summary> /// Removes the <paramref name="target"/> <see cref="Account.AccountState"/> flag from the <paramref name="source"/> <see cref="Account.AccountState"/> (if it exists). /// </summary> /// <param name="source">The <see cref="Account.AccountState"/> to remove the <paramref name="target"/> from.</param> /// <param name="target">The <see cref="Account.AccountState"/> 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 Account.AccountState Remove(this Account.AccountState source, Account.AccountState target) { return(source.Is(target) ? source ^ target : source); }
/// <summary> /// Checks if the <paramref name="source"/> <see cref="Account.AccountState"/> contains the flag for the <paramref name="target"/> <see cref="Account.AccountState"/>. /// </summary> /// <param name="source">The <see cref="Account.AccountState"/> to question for the given <paramref name="target"/> flag.</param> /// <param name="target">The <see cref="Account.AccountState"/> 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 Account.AccountState source, Account.AccountState target) { return((source & target) == target); }