Base Classes¶
The API is built around a few base classes that are used to represent the data returned by the API.
- class fortnite_api.IdComparable¶
Represents an object that can be compared to another object by id.
- x == y
Determine if two objects are equal.
- x != y
Determine if two objects are not equal.
- class fortnite_api.Hashable¶
Represents a hashable object.
This inherits
fortnite_api.IdComparableand adds a hash function.- hash(x)
Return the hash of the object.
- class fortnite_api.ReconstructAble(*, data, http)¶
Denotes a class that can be reconstructed from a raw data dictionary, such as one returned from any API endpoint.
- classmethod from_dict(data, *, client)¶
Reconstructs this class from a raw dictionary object. This is useful for when you store the raw data and want to reconstruct the object later on.
- Parameters:
data (Dict[Any, Any]) – The raw data to reconstruct the object from.
client (Union[
fortnite_api.Client,fortnite_api.SyncClient]) – The currently used client to reconstruct the object with. Can either be a sync or async client.
- to_dict()¶
Turns this object into a raw dictionary object. This is useful for when you want to store the raw data and reconstruct the object later on.
- Returns:
The raw data of this object. Note that this is a deep copy of the raw data, and not a reference to the underlying raw data this object was constructed with.
- Return type:
Dict[Any, Any]