Package net.ygbstudio.jbrave.api.rate
Record Class XRateLimit
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.rate.XRateLimit
- Record Components:
requestsPerSecond- Burst rate limitrequestsPerMonth- Monthly quota (0 for unlimited)
Shows the maximum number of requests allowed for each time window in your plan.
-
Constructor Summary
ConstructorsConstructorDescriptionXRateLimit(int requestsPerSecond, int requestsPerMonth) Creates an instance of aXRateLimitrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static <T> Optional<XRateLimit> from(@NotNull HttpResponse<T> httpResponse) Extracts the rate limit from the HTTP Response.final inthashCode()Returns a hash code value for this object.intReturns the value of therequestsPerMonthrecord component.intReturns the value of therequestsPerSecondrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
XRateLimit
public XRateLimit(int requestsPerSecond, int requestsPerMonth) Creates an instance of aXRateLimitrecord class.- Parameters:
requestsPerSecond- the value for therequestsPerSecondrecord componentrequestsPerMonth- the value for therequestsPerMonthrecord component
-
-
Method Details
-
from
Extracts the rate limit from the HTTP Response.- Type Parameters:
T- the type of the response body- Parameters:
httpResponse- the HTTP httpResponse containing the rate limit information- Returns:
- an optional of the rate limit extracted from the httpResponse
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
requestsPerSecond
public int requestsPerSecond()Returns the value of therequestsPerSecondrecord component.- Returns:
- the value of the
requestsPerSecondrecord component
-
requestsPerMonth
public int requestsPerMonth()Returns the value of therequestsPerMonthrecord component.- Returns:
- the value of the
requestsPerMonthrecord component
-