-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Requesting and introspecting Tables within an Airtable project. -- -- Requesting and introspecting Tables within an Airtable project. @package airtable-api @version 0.3.2.3 module Airtable.Table -- | An airtable record. data Record a Record :: RecordID -> a -> UTCTime -> Record a [recordId] :: Record a -> RecordID [recordObj] :: Record a -> a [createdTime] :: Record a -> UTCTime -- | Airtable's record ID for use in indexing records newtype RecordID RecordID :: Text -> RecordID rec2str :: RecordID -> String -- | A convenience typeclass for selecting records using RecordID-like -- keys. class HasRecordId a toRecId :: HasRecordId a => a -> RecordID -- | An airtable table. data Table a Table :: HashMap RecordID (Record a) -> Maybe Text -> Table a -- | A mapping from RecordID to Record [tableRecords] :: Table a -> HashMap RecordID (Record a) -- | The "offset" parameter for the table. Is used to deal with airtable's -- pagination. [tableOffset] :: Table a -> Maybe Text -- | Synonym used in querying tables from the API. type TableName = String -- | Create a Table from a list of Records. fromRecords :: [Record a] -> Table a -- | Create a table from a list of key-record pairs. fromList :: [(RecordID, Record a)] -> Table a -- | Convert a Table to a list of key-record pairs. toList :: Table a -> [(RecordID, Record a)] -- | Check if a record exists at the given key in a table. exists :: (HasRecordId r) => Table a -> r -> Bool -- | Unsafely lookup a record using its RecordID. Will throw a -- pretty-printed error if record does not exist. select :: (HasCallStack, HasRecordId r, Show a) => Table a -> r -> Record a -- | Safely lookup a record using its RecordID. selectMaybe :: (HasRecordId r) => Table a -> r -> Maybe (Record a) -- | Read all records. selectAll :: Table a -> [Record a] -- | Read all RecordID's. selectAllKeys :: Table a -> [RecordID] -- | Select all records satisfying a condition. selectWhere :: Table a -> (Record a -> Bool) -> [Record a] -- | Select all RecordID's satisfying a condition. selectKeyWhere :: Table a -> (Record a -> Bool) -> [RecordID] -- | Delete all Records satisfying a condition. deleteWhere :: Table a -> (Record a -> Bool) -> Table a instance GHC.Base.Functor Airtable.Table.Table instance GHC.Generics.Generic (Airtable.Table.Table a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Airtable.Table.Table a) instance GHC.Read.Read a => GHC.Read.Read (Airtable.Table.Table a) instance GHC.Show.Show a => GHC.Show.Show (Airtable.Table.Table a) instance GHC.Base.Functor Airtable.Table.Record instance GHC.Classes.Ord a => GHC.Classes.Ord (Airtable.Table.Record a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Airtable.Table.Record a) instance GHC.Generics.Generic (Airtable.Table.Record a) instance GHC.Read.Read a => GHC.Read.Read (Airtable.Table.Record a) instance GHC.Show.Show a => GHC.Show.Show (Airtable.Table.Record a) instance GHC.Classes.Ord Airtable.Table.RecordID instance GHC.Generics.Generic Airtable.Table.RecordID instance GHC.Classes.Eq Airtable.Table.RecordID instance GHC.Read.Read Airtable.Table.RecordID instance GHC.Show.Show Airtable.Table.RecordID instance Data.Aeson.Types.ToJSON.ToJSON Airtable.Table.RecordID instance Data.Aeson.Types.FromJSON.FromJSON Airtable.Table.RecordID instance Data.Hashable.Class.Hashable Airtable.Table.RecordID instance Airtable.Table.HasRecordId Airtable.Table.RecordID instance Airtable.Table.HasRecordId GHC.Base.String instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Airtable.Table.Record a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Airtable.Table.Record a) instance Airtable.Table.HasRecordId (Airtable.Table.Record a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Airtable.Table.Table a) instance GHC.Base.Monoid (Airtable.Table.Table a) module Airtable.Query -- | Options data AirtableOptions AirtableOptions :: String -> String -> Int -> AirtableOptions -- | the API key for your project [apiKey] :: AirtableOptions -> String -- | the app ID for your project (http://api.airtable.com/v0/app...) [appId] :: AirtableOptions -> String -- | api version (http://api.airtable.com/v../...) [apiVersion] :: AirtableOptions -> Int -- | Airtable options defaulting to API version 0. Please change the -- apiKey and appId fields. defaultAirtableOptions :: AirtableOptions -- | Produce Wreq options from AirtableOptions mkWreqOptions :: AirtableOptions -> Options -- | Produce a request URL to a table. tableNameToUrl :: AirtableOptions -> TableName -> String -- | Retrieve the records for a table from airtable.com given its name. -- Handles pagination correctly. getRecords :: (HasCallStack, FromJSON a) => AirtableOptions -> TableName -> IO (Table a) -- | Retrieve the records for a table given a URL and network (Wreq) -- options. getRecordsFromUrl :: (HasCallStack, FromJSON a) => Options -> String -> IO (Table a) -- | Upload a record to a given table. Returns the newly created -- RecordID. createRecord :: (HasCallStack, ToJSON a, FromJSON a) => AirtableOptions -> TableName -> a -> IO (Record a) -- | Update a record on a given table, using the supplied fields -- (a). updateRecord :: (ToJSON a) => AirtableOptions -> TableName -> RecordID -> a -> IO () -- | Delete a record on a table. deleteRecord :: AirtableOptions -> TableName -> RecordID -> IO () respJsonBody :: (HasCallStack, FromJSON a) => Response ByteString -> a