Class BucketId
Represents a ratelimit bucket.
public class BucketId : IEquatable<BucketId>
- Inheritance
-
BucketId
- Implements
- Inherited Members
Properties
BucketHash
Gets the hash of this bucket.
public string BucketHash { get; }
Property Value
Remarks
The hash is provided by Discord to group ratelimits.
Endpoint
Gets the endpoint that is going to be requested if available.
public string Endpoint { get; }
Property Value
HttpMethod
Gets the http method used to make the request if available.
public string HttpMethod { get; }
Property Value
IsHashBucket
Gets if this bucket is a hash type.
public bool IsHashBucket { get; }
Property Value
MajorParameters
Gets the major parameters of the route.
public IOrderedEnumerable<KeyValuePair<string, string>> MajorParameters { get; }
Property Value
Methods
Create(string, BucketId)
Creates a new BucketId based on a BucketHash and a previous BucketId.
public static BucketId Create(string hash, BucketId oldBucket)
Parameters
hash
stringBucket hash provided by Discord.
oldBucket
BucketIdBucketId that is going to be upgraded to a hash type.
Returns
- BucketId
A BucketId based on the BucketHash and MajorParameters.
Create(string, string, Dictionary<string, string>)
Creates a new BucketId based on the HttpMethod and Endpoint.
public static BucketId Create(string httpMethod, string endpoint, Dictionary<string, string> majorParams)
Parameters
httpMethod
stringHttp method used to make the request.
endpoint
stringEndpoint that is going to receive requests.
majorParams
Dictionary<string, string>Major parameters of the route of this endpoint.
Returns
- BucketId
A BucketId based on the HttpMethod and the Endpoint with the provided data.
Equals(BucketId)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(BucketId other)
Parameters
other
BucketIdAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetBucketHash()
Gets the string that will define this bucket as a hash based one.
public string GetBucketHash()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetUniqueEndpoint()
Gets the string that will define this bucket as an endpoint based one.
public string GetUniqueEndpoint()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.