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

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