# Collection

class `praw.models.``Collection`(reddit: Reddit, _data: Dict[str, Any] = None, collection_id: Optional[str] = None, permalink: Optional[str] = None)

  Class to represent a Collection.

  Obtain an instance via:

      collection = reddit.subreddit("SUBREDDIT").collections("some_uuid")

  or

      collection = reddit.subreddit("SUBREDDIT").collections(
          permalink="https://reddit.com/r/SUBREDDIT/collection/some_uuid"
      )

  Typical Attributes

  This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor that they will be the only attributes present.

  Attribute | Description
  --- | ---
  `author` | The `Redditor` who created the collection.
  `collection_id` | The UUID of the collection.
  `created_at_utc` | Time the collection was created, represented in Unix Time.
  `description` | The collection description.
  `last_update_utc` | Time the collection was last updated, represented in Unix Time.
  `link_ids` | A `list` of `Submission` fullnames.
  `permalink` | The collection’s permalink (to view on the web).
  `sorted_links` | An iterable listing of the posts in this collection.
  `title` | The title of the collection.

  `__init__`(reddit: Reddit, _data: Dict[str, Any] = None, collection_id: Optional[str] = None, permalink: Optional[str] = None)

    Initialize this collection.

    Parameters

      - reddit – An instance of `Reddit`.

      - _data – Any data associated with the Collection (optional).

      - collection_id – The ID of the Collection (optional).

      - permalink – The permalink of the Collection (optional).

  `__iter__`() → Generator[Any, None, None]

    Provide a way to iterate over the posts in this Collection.

    Example usage:

        collection = reddit.subreddit("SUBREDDIT").collections("some_uuid")
        for submission in collection:
            print(submission.title, submission.permalink)

  `__len__`() → int

    Get the number of posts in this Collection.

    Example usage:

        collection = reddit.subreddit("SUBREDDIT").collections("some_uuid")
        print(len(collection))

  `follow`()

    Follow this Collection.

    Example usage:

        reddit.subreddit("SUBREDDIT").collections("some_uuid").follow()

    See also

    `unfollow()`

  `mod`()

    Get an instance of `CollectionModeration`.

    Provides access to various methods, including `add_post()`, `delete()`, `reorder()`, and `update_title()`.

    Example usage:

        collection = reddit.subreddit("SUBREDDIT").collections("some_uuid")
        collection.mod.update_title("My new title!")

  classmethod `parse`(data: Dict[str, Any], reddit: Reddit) → Any

    Return an instance of `cls` from `data`.

    Parameters

      - data – The structured data.

      - reddit – An instance of `Reddit`.

  `subreddit`()

    Get the subreddit that this collection belongs to.

    For example:

        collection = reddit.subreddit("SUBREDDIT").collections("some_uuid")
        subreddit = collection.subreddit

  `unfollow`()

    Unfollow this Collection.

    Example usage:

        reddit.subreddit("SUBREDDIT").collections("some_uuid").unfollow()

    See also

    `follow()`