Class SpendLimit

  • All Implemented Interfaces:

    
    public final class SpendLimit
    
                        

    A configured spend limit: a cap on metered spend for one scope and period.

    • Constructor Detail

    • Method Detail

      • id

         final String id()

        Unique tagged ID of the spend limit (spl_...).

      • amount

         final Optional<String> amount()

        Limit amount as a non-negative integer decimal string in the minor unit of currency (cents for USD): "50000" is $500.00. null means no numeric cap is configured at this scope — see the effective report for whether a limit applies.

      • currency

         final String currency()

        ISO 4217 code of the organization's billing currency; the unit for amount.

      • isEnabled

         final Boolean isEnabled()

        Read-only. false when extra usage is switched off for this organization (organization limit); amount is kept and applies again when it's switched back on. Always true for other limits.

      • period

         final SpendLimitPeriod period()

        Length of the window the limit resets over. amount caps spend within each period.

      • scope

         final SpendLimit.Scope scope()

        What the limit applies to. A tagged union on type; each variant carries the identifier for its scope.

      • _type

         final JsonValue _type()

        Object type. Always spend_limit.

        Expected to always return the following:

        JsonValue.from("spend_limit")

        However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).

      • _id

         final JsonField<String> _id()

        Returns the raw JSON value of id.

        Unlike id, this method doesn't throw if the JSON field has an unexpected type.

      • _amount

         final JsonField<String> _amount()

        Returns the raw JSON value of amount.

        Unlike amount, this method doesn't throw if the JSON field has an unexpected type.

      • _createdAt

         final JsonField<OffsetDateTime> _createdAt()

        Returns the raw JSON value of createdAt.

        Unlike createdAt, this method doesn't throw if the JSON field has an unexpected type.

      • _currency

         final JsonField<String> _currency()

        Returns the raw JSON value of currency.

        Unlike currency, this method doesn't throw if the JSON field has an unexpected type.

      • _isEnabled

         final JsonField<Boolean> _isEnabled()

        Returns the raw JSON value of isEnabled.

        Unlike isEnabled, this method doesn't throw if the JSON field has an unexpected type.

      • _period

         final JsonField<SpendLimitPeriod> _period()

        Returns the raw JSON value of period.

        Unlike period, this method doesn't throw if the JSON field has an unexpected type.

      • _scope

         final JsonField<SpendLimit.Scope> _scope()

        Returns the raw JSON value of scope.

        Unlike scope, this method doesn't throw if the JSON field has an unexpected type.

      • _updatedAt

         final JsonField<OffsetDateTime> _updatedAt()

        Returns the raw JSON value of updatedAt.

        Unlike updatedAt, this method doesn't throw if the JSON field has an unexpected type.

      • validate

         final SpendLimit validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • builder

         final static SpendLimit.Builder builder()

        Returns a mutable builder for constructing an instance of SpendLimit.

        The following fields are required:

        .id()
        .amount()
        .createdAt()
        .currency()
        .isEnabled()
        .period()
        .scope()
        .updatedAt()