Portability | portable |
---|---|
Stability | provisional |
Maintainer | Michael Xavier <michael@michaelxavier.net> |
Toplevel module for the Google+ API operating in the GooglePlusM Monad. Currently covers the (very) limited, read-only API that Google has exposed in v1 of the Google+ API
{-# LANGUAGE OverloadedStrings #-} import Web.GooglePlus import Web.GooglePlus.Monad import Web.GooglePlus.Types import Control.Monad.Reader import Data.Text (unpack) doStuff :: GooglePlusM () doStuff = do Right person <- getPerson Me Right feed <- getLatestActivityFeed Me PublicCollection -- ... return () main :: IO () main = do runReaderT (unGooglePlusM doStuff) env where env = GooglePlusEnv { gpAuth = APIKey "MYKEY" }
- getPerson :: PersonID -> GooglePlusM (Either Text Person)
- getActivity :: ID -> GooglePlusM (Either Text Activity)
- getComment :: ID -> GooglePlusM (Either Text Comment)
- getLatestActivityFeed :: PersonID -> ActivityCollection -> Maybe Integer -> GooglePlusM (Either Text ActivityFeed)
- enumActivityFeed :: PersonID -> ActivityCollection -> Maybe Integer -> Enumerator ActivityFeed GooglePlusM b
- getActivityFeed :: PersonID -> ActivityCollection -> GooglePlusM ActivityFeed
- enumActivities :: PersonID -> ActivityCollection -> Maybe Integer -> Enumerator Activity GooglePlusM b
- getActivities :: PersonID -> ActivityCollection -> GooglePlusM [Activity]
- enumPersonSearch :: Text -> Maybe Integer -> Enumerator PersonSearchResult GooglePlusM b
- getPersonSearch :: Text -> GooglePlusM [PersonSearchResult]
- enumPeopleByActivity :: ID -> ListByActivityCollection -> Maybe Integer -> Enumerator Person GooglePlusM b
- getPeopleByActivity :: ID -> ListByActivityCollection -> GooglePlusM [Person]
- enumActivitySearch :: Text -> SearchOrderBy -> Maybe Integer -> Enumerator Activity GooglePlusM b
- getActivitySearch :: Text -> SearchOrderBy -> GooglePlusM [Activity]
- enumComments :: ID -> Maybe Integer -> Enumerator Comment GooglePlusM b
- getComments :: ID -> GooglePlusM [Comment]
- data SearchOrderBy
- data ActivityCollection = PublicCollection
- data ListByActivityCollection
Documentation
:: PersonID | Identifier for the person to fetch |
-> GooglePlusM (Either Text Person) |
Get a person who matches the given identifier
:: ID | Specific ID to fetch |
-> GooglePlusM (Either Text Activity) |
Get an activity which matches the given activity ID
:: ID | Specific ID to fetch |
-> GooglePlusM (Either Text Comment) |
Get a comment which matches the given comment ID
:: PersonID | Feed owner ID |
-> ActivityCollection | Indicates what type of feed to retrieve |
-> Maybe Integer | Page size. Should be between 1 and 100. Default 20. |
-> GooglePlusM (Either Text ActivityFeed) |
Get an activity who matches the given activity ID and collection to use. Default page size is (20) and only fetches the first page. You will receive an error from the server if the page size exceeds 100.
:: PersonID | Feed owner ID |
-> ActivityCollection | Indicates what type of feed to retrieve |
-> Maybe Integer | Page size. Should be between 1 and 100. Defualt 20 |
-> Enumerator ActivityFeed GooglePlusM b |
Paginating enumerator to consume a user's activity stream. Each chunk will end up being an array with a single ActivityFeed in it with 1 page of data in it. This weirdness about the chunks only containing 1 element is mostly to maintain the metadata available on ActivityFeed and have it available in each chunk. For a more natural chunking of just Activities if you don't need that additional metadata, see enumActivities. Note that this Enumerator will abort if it encounters an error from the server, thus cutting the list short.
getActivityFeed :: PersonID -> ActivityCollection -> GooglePlusM ActivityFeedSource
Simplified version of enumActivityFeed which retrieves all pages of an activity feed and merges them into one. Note that this will not be as efficient as enumActivityFeed in terms of memory/time because it collects them all in memory first. Note that this should incur 1 API call per page of results, so the max page size of 100 is used.
:: PersonID | Feed owner ID |
-> ActivityCollection | Indicates what type of feed to retrieve |
-> Maybe Integer | Page size. Should be between 1 and 100. Defualt 20 |
-> Enumerator Activity GooglePlusM b |
Paginating enumerator yielding a Chunk for each page. Use this if you don't need the feed metadata that enumActivityFeed provides.
:: PersonID | Feed owner ID |
-> ActivityCollection | Indicates what type of feed to retrieve |
-> GooglePlusM [Activity] |
Simplified version of enumActivities that fetches all the activitys of a Person first, thus returning them. Note that this should incur 1 API call per page of results, so the max page size of 100 is used.
:: Text | Search string |
-> Maybe Integer | Optional page size. Shold be between 1 and 20. Default 10 |
-> Enumerator PersonSearchResult GooglePlusM b |
Search for a member of Google+. Paginating enumerator yielding a Chunk for each page. Note that this Enumerator will abort if it encounters an error from the server, thus cutting the list short.
:: Text | Search string |
-> GooglePlusM [PersonSearchResult] |
Returns the full result set for a person search given a search string. This interface is simpler to use but does not have the flexibility/memory usage benefit of enumPersonSearch.
:: ID | Activity ID |
-> ListByActivityCollection | Indicates which collection of people to list |
-> Maybe Integer | Optional page size. Should be between 1 and 100. Default 20. |
-> Enumerator Person GooglePlusM b |
Find people associated with a particular Activity. Paginating enumerator yielding a Chunk for each page. Paginating enumerator yielding a Chunk for each page. Note that this Enumerator will abort if it encounters an error from the server, thus cutting the list short.
:: ID | Activity ID |
-> ListByActivityCollection | Indicates which collection of people to list |
-> GooglePlusM [Person] |
Returns the full result set for a person search given a search string. This interface is simpler to use but does not have the flexibility/memory usage benefit of enumPeopleByActivity.
:: Text | Search string |
-> SearchOrderBy | Order of search results |
-> Maybe Integer | Optional page size. Shold be between 1 and 20. Default 10 |
-> Enumerator Activity GooglePlusM b |
Search for an activity on Google+. Paginating enumerator yielding a Chunk for each page. Note that this Enumerator will abort if it encounters an error from the server, thus cutting the list short.
:: Text | Search string |
-> SearchOrderBy | Order of search results |
-> GooglePlusM [Activity] |
Returns the full result set for an activity search given a search string. This interface is simpler to use but does not have the flexibility/memory usage benefit of enumActivitySearch.
:: ID | Activity ID |
-> Maybe Integer | Optional page size. Should be between 1 and 100. Default 20 |
-> Enumerator Comment GooglePlusM b |
Find comments for an activity on Google+. Paginating enumerator yielding a Chunk for each page. Note that this Enumerator will abort if it encounters an error from the server, thus cutting the list short.
:: ID | Activity ID |
-> GooglePlusM [Comment] |
Returns the full result set for an activity's comments. This interface is simpler to use but does not have the flexibility/memory usage benefit of enumComments.
data SearchOrderBy Source
data ActivityCollection Source
Specifies the type of Activities to get in an Activity listing. Currently the API only allows public.