servant-github-0.1.0.6: Bindings to GitHub API using servant.

Copyright(c) Finlay Thompson 2015
LicenseBSD3
Maintainerfinlay.thompson@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Network.GitHub

Contents

Description

The GitHub monad provides support for:

  • Managing the authentication token. It can be Nothing, in which case no Authentication header is sent to the API,
  • Setting the User-agent header string. This defaults to "servant-github", but can be set inside the GitHub monad using the setUserAgent, and
  • Keeping track of the pagination in the case of calls that return lists of objects.

Synopsis

GitHub API calls

Functions that directly access the GitHub API. These functions all run in the GitHub monad.

userOrganisations :: GitHub [Organisation] Source #

Get list of Organisation records for authorised user

organisationTeams :: OrgLogin -> GitHub [Team] Source #

Get list of Team records, given the organisation login

getTeam :: TeamId -> GitHub Team Source #

Get the Team record associated to a TeamId

teamMembers :: TeamId -> GitHub [Member] Source #

Get list of Member records assoctiated to Team given by Team Id

teamRepositories :: TeamId -> GitHub [Repository] Source #

Get list of Repository records assoctiated to Team given by Team Id

user :: GitHub User Source #

Get the current user for the authorised user

userByLogin :: Maybe String -> GitHub User Source #

Lookup user by login

userRepositories :: Maybe String -> GitHub [Repository] Source #

Get repositories for the authorised user

userInstallationRepositories :: Int -> GitHub Repositories Source #

List repositories that are accessible to the authenticated user for an installation.

organisationRepositories :: OrgLogin -> GitHub [Repository] Source #

Get repositories for an organisation login

installationRepositories :: GitHub Repositories Source #

Get repositories for the installation (current token should be an installation token)

appInstallations :: GitHub [Installation] Source #

Get installations for the appliction

userInstallations :: Maybe String -> GitHub Installations Source #

List installations that are accessible to the authenticated user.

repositoryCollaborators :: OrgLogin -> RepoName -> GitHub [Member] Source #

Get repositories for the installation (current token should be an installation token)

getCommit :: OrgLogin -> RepoName -> Sha -> GitHub Commit Source #

Get commit for repo and reference

getContent :: OrgLogin -> RepoName -> String -> Maybe String -> Maybe String -> GitHub Content Source #

Get content for repo and reference and path

getIssues :: GHOptions -> Owner -> RepoName -> GitHub [Issue] Source #

GitHub monad

Use the runGitHub function to execute the GitHub client function.

type GitHub = ReaderT (Maybe AuthToken) (StateT GitHubState ClientM) Source #

The GitHub monad provides execution context

runGitHubNotApiClientM :: ClientM a -> IO (Either ServantError a) Source #

Most of the time we must use api.github.com, but calling loginoauthaccess_token only works if sent to github.com.

runGitHub :: GitHub a -> Maybe AuthToken -> IO (Either ServantError a) Source #

You need to provide a 'Maybe AuthToken' to lift a GitHub computation into the IO monad.

data AuthToken Source #

Token used to authorize access to the GitHub API. see https://developer.github.com/v3/oauth/

Instances

Eq AuthToken Source # 
IsString AuthToken Source # 
ToHttpApiData AuthToken Source # 
HasGitHub (Paginated a) Source #

Instance for the case where we have paginated results

HasGitHub (Single a) Source #

Instance for the case where we have single result

HasGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> m -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> m -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> m -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> l -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> h -> i -> k -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> h -> i -> k -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> g -> h -> i -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> h -> i -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> h -> i -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> g -> h -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> h -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> h -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> g -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> g -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> g -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> e -> Paginated f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> Paginated f) -> EmbedGitHub (a -> b -> c -> d -> e -> Paginated f) Source #

HasGitHub (a -> b -> c -> d -> Paginated e) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> Paginated e) -> EmbedGitHub (a -> b -> c -> d -> Paginated e) Source #

HasGitHub (a -> b -> c -> Paginated d) Source # 

Methods

embedGitHub :: (a -> b -> c -> Paginated d) -> EmbedGitHub (a -> b -> c -> Paginated d) Source #

HasGitHub (a -> b -> Paginated c) Source # 

Methods

embedGitHub :: (a -> b -> Paginated c) -> EmbedGitHub (a -> b -> Paginated c) Source #

HasGitHub (a -> Paginated b) Source # 

Methods

embedGitHub :: (a -> Paginated b) -> EmbedGitHub (a -> Paginated b) Source #

HasGitHub (a -> b -> c -> d -> e -> Single f) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> e -> Single f) -> EmbedGitHub (a -> b -> c -> d -> e -> Single f) Source #

HasGitHub (a -> b -> c -> d -> Single e) Source # 

Methods

embedGitHub :: (a -> b -> c -> d -> Single e) -> EmbedGitHub (a -> b -> c -> d -> Single e) Source #

HasGitHub (a -> b -> c -> Single d) Source # 

Methods

embedGitHub :: (a -> b -> c -> Single d) -> EmbedGitHub (a -> b -> c -> Single d) Source #

HasGitHub (a -> b -> Single c) Source # 

Methods

embedGitHub :: (a -> b -> Single c) -> EmbedGitHub (a -> b -> Single c) Source #

HasGitHub (a -> Single b) Source # 

Methods

embedGitHub :: (a -> Single b) -> EmbedGitHub (a -> Single b) Source #

setUserAgent :: Text -> GitHub () Source #

Overide default value for User-agent header. Note, GitHub requires that a User-agent header be set.

Pagination

Functions for managing the pagination features of the GitHub API

resetPagination :: GitHub () Source #

Set next page back to 1, and remove the links

recurseOff :: GitHub () Source #

Turn automatic recusive behaviour on and off.

If recursive is on, paginated results will be automatically followed and concated together.

recurseOn :: GitHub () Source #

Turn automatic recusive behaviour on and off.

If recursive is on, paginated results will be automatically followed and concated together.

pageSize :: Int -> GitHub () Source #

The default number of records per page is set to 100. Smaller pages can be set, but not bigger than 100.

getLinks :: GitHub (Maybe [Link]) Source #

Return the Link header. This is only set when there are futher pages.