Object
API::Discord::Object
NAME
API::Discord::Object - Base class for all the Discord things
DESCRIPTION
Object is a thin class that only contains the information required to populate
its $.real
object on demand. For most objects this is $.id
; some will have
additional data, like how Message also has channel ID. All consumers of this
role will be responsible for constructing their own $.real
on demand.
The key part here is that $.id
is the only part that is not required,
because a new object will not have an ID yet. Any other data (like channel ID)
is required.
The $.real
property must also do API::Discord::DataObject
.
As a result, we can now handle the CRUD methods, proxy them to $.real, and populate the ID field from the response, where necessary.
We then facade them so that their Promise now resolves to this outer Object and not the DataObject inside it.
We don't need "read" on these objects, as that is done simply by accessing any
of the properties of the $.real
object.
API::Discord::DataObject
This Role simply merges JSONy and HTTPResource. It is marshalled via API::Discord::Objects.
The purpose of this role is to be applied to classes whose structures mimic the
actual JSON data returned from Discord's API. As a result they all have
from-json
and to-json
.