Skip to content

instances

This module contains classes intended to parse and deal with data from Roblox item instance information endpoints.

AssetInstance

Bases: ItemInstance

Represents an instance of a Roblox asset.

Source code in roblox/instances.py
51
52
53
54
55
56
57
58
59
60
class AssetInstance(ItemInstance):
    """
    Represents an instance of a Roblox asset.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client
        super().__init__(client=self._client, data=data)

        self.asset: BaseAsset = BaseAsset(client=self._client, asset_id=data["id"])

BadgeInstance

Bases: ItemInstance

Represents an instance of a Roblox badge.

Source code in roblox/instances.py
63
64
65
66
67
68
69
70
71
72
class BadgeInstance(ItemInstance):
    """
    Represents an instance of a Roblox badge.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client
        super().__init__(client=self._client, data=data)

        self.badge: BaseBadge = BaseBadge(client=self._client, badge_id=data["id"])

GamePassInstance

Bases: ItemInstance

Represents an instance of a Roblox gamepass.

Source code in roblox/instances.py
75
76
77
78
79
80
81
82
83
84
class GamePassInstance(ItemInstance):
    """
    Represents an instance of a Roblox gamepass.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client
        super().__init__(client=self._client, data=data)

        self.gamepass: BaseGamePass = BaseGamePass(client=self._client, gamepass_id=data["id"])

InstanceType

Bases: Enum

Represents an asset instance type.

Source code in roblox/instances.py
20
21
22
23
24
25
26
class InstanceType(Enum):
    """
    Represents an asset instance type.
    """
    asset = "Asset"
    gamepass = "GamePass"
    badge = "Badge"

ItemInstance

Bases: BaseInstance

Represents an instance of a Roblox item of some kind.

Attributes:

Name Type Description
_client Client

The Client object, which is passed to all objects this Client generates.

Source code in roblox/instances.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class ItemInstance(BaseInstance):
    """
    Represents an instance of a Roblox item of some kind.

    Attributes:
        _client: The Client object, which is passed to all objects this Client generates.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client.
            data: The data from the endpoint.
        """
        self._client: Client = client

        self.name: str = data["name"]
        self.type: str = data["type"]  # fixme

        super().__init__(client=self._client, instance_id=data["instanceId"])

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client.

required
data dict

The data from the endpoint.

required
Source code in roblox/instances.py
37
38
39
40
41
42
43
44
45
46
47
48
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client.
        data: The data from the endpoint.
    """
    self._client: Client = client

    self.name: str = data["name"]
    self.type: str = data["type"]  # fixme

    super().__init__(client=self._client, instance_id=data["instanceId"])