googleplus-0.3.1.1: Haskell implementation of the Google+ API v1

Portabilityportable
Stabilityprovisional
MaintainerMichael Xavier <michael@michaelxavier.net>

Web.GooglePlus

Description

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" }

Synopsis

Documentation

getPersonSource

Arguments

:: PersonID

Identifier for the person to fetch

-> GooglePlusM (Either Text Person) 

Get a person who matches the given identifier

getActivitySource

Arguments

:: ID

Specific ID to fetch

-> GooglePlusM (Either Text Activity) 

Get an activity which matches the given activity ID

getCommentSource

Arguments

:: ID

Specific ID to fetch

-> GooglePlusM (Either Text Comment) 

Get a comment which matches the given comment ID

getLatestActivityFeedSource

Arguments

:: 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.

enumActivityFeedSource

Arguments

:: 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.

enumActivitiesSource

Arguments

:: 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.

getActivitiesSource

Arguments

:: 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.

enumPersonSearchSource

Arguments

:: 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.

getPersonSearchSource

Arguments

:: 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.

enumPeopleByActivitySource

Arguments

:: 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.

getPeopleByActivitySource

Arguments

:: 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.

enumActivitySearchSource

Arguments

:: 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.

getActivitySearchSource

Arguments

:: 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.

enumCommentsSource

Arguments

:: 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.

getCommentsSource

Arguments

:: 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

Constructors

Best

Sort by relevance to the to the user, most relevant first

Recent

Sort by most recent results first

data ActivityCollection Source

Specifies the type of Activities to get in an Activity listing. Currently the API only allows public.

Constructors

PublicCollection 

data ListByActivityCollection Source

Constructors

PlusOners

List of people who have +1ed an activity

Resharers

List of people who have reshared an activity