summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/APIClient/Pagination.hs
blob: bb9bcd10d64a3191a95bfd405c38770e66e26199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}

module SpaceTraders.APIClient.Pagination
  ( Pagination(..)
  , nextPage
  ) where

import Data.Aeson
import GHC.Generics

data Pagination = Pagination { limit :: Int
                             , page :: Int
                             , total :: Int
                             } deriving (FromJSON, Generic, Show)

nextPage :: Pagination -> Pagination
nextPage (Pagination l p t) = Pagination l (p + 1) t