Makes a call on the Collection API

        :param collection_id: Id of the collection to retrieve
        :param nav: Direction of the navigation
        :param page: Page to retrieve
        :return: Response
        :rtype: requests.Response
320177
def get_collection(self, collection_id=None, nav="children", page=None):
        
        return self.call(
            "collections",
            {
                "id": collection_id,
                "nav": nav,
                "page": page
            },
            defaults={
                "id": None,
                "nav": "children",
                "page": 1
            }
        )
736209
def resource_collection_response(cls, offset=0, limit=20):
        
        request_args = {'page[offset]': offset, 'page[limit]': limit}
        return cls.get_collection(request_args)
602875
def collections(page = 1, per_page = 10)
      params = {
        page:     page,
        per_page: per_page
      }

      list = JSON.parse(connection.get("/users/#{username}/collections", params).body)
      list.map do |collection|
        Unsplash::Collection.new collection.to_hash
      end
    end
160845
def add_to_collection(self, request, pk=None):
        """"""
        entity = self.get_object()

        # TODO use `self.get_ids` (and elsewhere). Backwards
        # incompatible because raised error's response contains
        # ``detail`` instead of ``error``).
        if 'ids' not in request.data:
            return Response({"error": "`ids` parameter is required"}, status=status.HTTP_400_BAD_REQUEST)

        for collection_id in request.data['ids']:
            self._get_collection_for_user(collection_id, request.user)

        for collection_id in request.data['ids']:
            entity.collections.add(collection_id)

            collection = Collection.objects.get(pk=collection_id)
            for data in entity.data.all():
                collection.data.add(data)

        return Response()
462647
def update(self, request, _id):
        
        _id = deserialize(_id)

        to_update = self.collection.find_one({'_id': _id})
        if to_update:
            document = self.collection(dict(to_update, **request.json))
            document.updated_at = datetime.utcnow()

            updated = document.update()
            return Response(
                response=serialize(updated),
                status=(
                    200 if not all(
                        key in updated for key in [
                            'error_code', 'error_type', 'error_message'
                        ]
                    ) else 400
                )
            )
        else:
            return Response(
                response=serialize(
                    DocumentNotFoundError(self.collection.__name__, _id)
                ),
                status=400
            )
1047273
def get_page_property(self, page_id, page_property_key):
        
        url = 'rest/api/content/{page_id}/property/{key}'.format(page_id=page_id,
                                                                 key=str(page_property_key))
        return self.get(path=url)
1180304
def get_page_ancestors(self, page_id):
        
        url = 'rest/api/content/{page_id}?expand=ancestors'.format(page_id=page_id)
        return (self.get(path=url) or {}).get('ancestors')
185717
def found(self):
        
        if 'ids' in self.kwargs:
            cid = self.kwargs['query']['collection']['eq']
            return len(self.items_by_id(self.kwargs['ids'], cid))
        kwargs = {
            'page': 1,
            'limit': 0
        }
        kwargs.update(self.kwargs)
        results = self.query(**kwargs)
        return results['meta']['found']
693980
def get_collection(self, request, **kwargs):
        
        qs = self.queryset(request, **kwargs)

        if self.display_collection_fields:
            display_fields = self.display_collection_fields
        else:
            display_fields = self.display_fields

        if self.paginate_by is not None:
            page = request.GET.get('page', 1)
            paginator = Paginator(qs, self.paginate_by)
            try:
                qs = paginator.page(page).object_list
            except PageNotAnInteger:
                data = _('Invalid `page` parameter: Not a valid integer.')
                return HttpResponseBadRequest(data)
            except EmptyPage:
                data = _('Invalid `page` parameter: Out of range.')
                return HttpResponseBadRequest(data)
        data = [
            self.serialize(obj, ['id'] + list(display_fields)) for obj in qs
        ]
        return HttpResponse(self.json_dumps(data), content_type='application/json')
856105
def retrieve(payment_id):
        
        http_client = HttpClient()
        response, __ = http_client.get(routes.url(routes.PAYMENT_RESOURCE, resource_id=payment_id))
        return resources.Payment(**response)
281864
def get_page_by_id(self, page_id, expand=None):
        
        url = 'rest/api/content/{page_id}?expand={expand}'.format(page_id=page_id, expand=expand)
        return self.get(url)
462689
def get_next_page(self, page_num, page_size):
        
        url = self._response_json.get(self.next_page_attr, None)
        if url is None:
            raise StopIteration()
        params, url = self.process_url(page_num, page_size, url)
        response = self.response_handler.api._get(url, raw_response=True, params=params)
        return response.json()
537455
def tandem_navigation_tag(active_page, pages_collection = nil, html_options = {})
      html_options, pages_collection = pages_collection, nil if pages_collection.is_a?(Hash)

      html_options[:class] ||= 'nav'

      page_groups = (pages_collection || Page.all).inject({}) do |groups, page|
        if groups[page.parent_id.to_s]
          groups[page.parent_id.to_s] << page
        else
          groups[page.parent_id.to_s] = [page]
        end
        groups
      end

      # generate must be in scope for the iterate proc declaration, but must be defined below iterate, so that iterate is recursively in scope
      generate = nil

      iterate = Proc.new do |parent_id|
        #very important to delete the group from the collection, or it is possible users can create looping relationships
        (page_groups.delete(parent_id.to_s) || {}).inject(''.html_safe) do |buffer, page|
          buffer + generate.call(page)
        end
      end

      generate = Proc.new do |page|
        content_tag_for(:li, page, :tandem, class: "#{page == active_page ? 'active' : ''}") do
          link_to(page.link_label, tandem.page_path(page), class: "#{page == active_page ? 'active' : ''}") +
          content_tag(:ul) do
            iterate.call(page.id)
          end
        end
      end

      content_tag(:ul, html_options) do
        iterate.call(page_groups.keys.first)
      end
    end
933668
def get_project_by_id(self, project_id):
        
        return self._create_item_response(
            self.data_service.get_project_by_id(project_id),
            Project)
1030967
def get_curated(self, collection_id):
        
        url = "/collections/curated/%s" % collection_id
        result = self._get(url)
        return CollectionModel.parse(result)
65158
def get_page(self, page_number):
        

        if page_number:
            kwargs = dict(self._list_kwargs)
            kwargs['limit'] = self.limit
            kwargs['page'] = page_number

            return self._controller.list(**kwargs)
326123
public function listCollectionItem($collection_id)
    {
        $this->setCollectionCollection($collection_id);
        $this->actionListCollectionItem();

        $this->setTitleListCollectionItem();
        $this->setBreadcrumbListCollectionItem();
        $this->setFilterListCollectionItem();
        $this->setPagerListCollectionItem();

        $this->setData('collection', $this->data_collection);
        $this->setData('items', $this->getListCollectionItem());

        $this->outputListCollectionItem();
    }