RateLimit
public struct RateLimit
The RateLimit struct abstracts any rate-limit information returned from an
Response.
-
The number of calls allowed for this resource during the refresh period.
Declaration
Swift
public let limit: Int -
The number of calls remaining for this resource during the current refresh period.
Declaration
Swift
public let remaining: Int -
The date and time at which the refresh period will reset.
Declaration
Swift
public let resetDate: Date
-
Initializes the struct.
Declaration
Swift
public init(limit: Int, remaining: Int, resetDate: Date)Parameters
limitThe total number of calls allowed in the rate limit period for the endpoint.
remainingThe number of calls remaining in the rate limit period.
resetDateThe time at which the rate limit will reset.
-
Initializes a new instance from the headers of an API response.
Declaration
Swift
public init?(headers: [AnyHashable : Any])Parameters
headersThe headers of the API response.
-
Abstracts out the rate-limiting headers from an
URLResponseand stores their value in a new instance ofRateLimit.Declaration
Swift
public init?(response: URLResponse?)Parameters
responseAn instance of
URLResponse.
View on GitHub
RateLimit Structure Reference