public function getActivities($limit = 0, $type = null, $startsAt = null)
    {
        $options = [];
        if ($type !== null) {
            $options['query']['type'] = $type;
        }
        if ($startsAt !== null) {
            $options['query']['starts_at'] = Activity::formatStartsAt($startsAt);
        }

        $activities = Activity::getCollection($this->getUri() . '/activities', $limit, $options, $this->client);

        // Guarantee the type filter (works around a temporary bug).
        if ($type !== null) {
            $activities = array_filter($activities, function (Activity $activity) use ($type) {
                return $activity->type === $type;
            });
        }

        return $activities;
    }