Snuze classes for Reddit "thing" objects
The classes described here are in the
\snuze\Reddit\Thing namespace hierarchy.
One "thing" leads to another
Most first-class Reddit entities have a similar basic data structure, which Reddit calls a "thing." These objects share a set of common properties:
kind: A discriminator to identify the type of thing; one of
id: A base36 identifier, e.g.
idcombined, separated by an underscore, e.g.
created: The unix epoch timestamp when the object was created, e.g.
In Snuze, "thing" entities are represented by classes in the
namespace. Snuze returns objects of these types from many of
which retrieve data from the Reddit API.
\snuze\Reddit\Thing\Thing class is an abstract class defining the
common properties and methods shared by all of the "thing" subtypes. As mentioned
above, these include the
fullname, and the
This class also provides methods called
let you get the JSON representing a given object, or create a new object from a
JSON string, respectively. Subtypes of
Thing will occasionally override these
two methods if any special tweaking of the JSON is needed.
Account and its subtypes
The Reddit API lets you fetch information about two types of accounts: your own account (the one Snuze is using to talk to the API), and other users' accounts.
\snuze\Reddit\Thing\Account\Account class is an abstract class that
holds shared properties common to both account types.
\snuze\Reddit\Thing\Account\MyAccount class extends
to expose all of the attributes of your own account (the one Snuze is using to
talk to the API). The data returned from this API endpoint is not actually
a "thing" entity, but Snuze treats it as one.
\snuze\Reddit\Thing\Account\UserAccount class extends
to expose the limited public attributes available for other users' accounts.
\snuze\Reddit\Thing\Link class represents the attributes of a
link, otherwise known as a post or a submission.
\snuze\Reddit\Thing\Subreddit class represents the significant
attributes of a subreddit.