indiehd / web-api

GNU Affero General Public License v3.0
6 stars 4 forks source link

Feature: Limit and Paginate #141

Closed poppabear8883 closed 5 years ago

poppabear8883 commented 5 years ago

Example: api/users?limit=10&paginate=2

{
  "data": [
    {
      "id": 1,
      "email": "jeremy95@example.com",
      "account": {
        "email": "ykoss@thiel.org",
        "first_name": null,
        "last_name": null,
        "address_one": null,
        "address_two": null,
        "city": null,
        "territory": null,
        "country_code": null,
        "country": null,
        "postal_code": null,
        "phone": null,
        "alt_phone": null
      },
      "permissions": null,
      "last_login": null
    },
    {
      "id": 2,
      "email": "dana48@example.com",
      "account": {
        "email": "lindsey.bechtelar@legros.com",
        "first_name": null,
        "last_name": null,
        "address_one": null,
        "address_two": null,
        "city": null,
        "territory": null,
        "country_code": null,
        "country": null,
        "postal_code": null,
        "phone": null,
        "alt_phone": null
      },
      "permissions": null,
      "last_login": null
    }
  ],
  "links": {
    "first": "\/?page=1",
    "last": "\/?page=5",
    "prev": null,
    "next": "\/?page=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 5,
    "path": "\/",
    "per_page": 2,
    "to": 2,
    "total": 10
  }
}
poppabear8883 commented 5 years ago

Thinking about this a bit more, I think I will refactor the way the tests are ... The test name doesn't really reflect whats being tested here ...

cbj4074 commented 5 years ago

Okay, I'll hold-off on a Review, then.