octohat-0.1.1: A tested, minimal wrapper around GitHub's API.

Safe HaskellNone
LanguageHaskell2010

Network.Octohat.Types

Synopsis

Documentation

data Member Source

Represents a user in GitHub. Contains no more than login and user ID

Constructors

Member 

data MemberWithKey Source

Represents a GitHub user with its public keys and fingerprints. A GitHub user might or might not have any public keys

data Team Source

Represents a team in GitHub. Contains the team's ID, the team's name and an optional description

Constructors

Team 

newtype BearerToken Source

GitHub's OAuth 2.0 bearer token. This is simply added in an Authorization header

Constructors

BearerToken 

Fields

unBearerToken :: Text
 

data StatusInTeam Source

When adding a user to a team GitHub will add it immediately if the user already belongs to the to the organization the team is in. Otherwise it will send an email for the user to accept the request to join the team. Functions related adding or removing teams will return either Active or Pending correspondingly.

Constructors

Active 
Pending 

data EmptyBody Source

Some Wreq functions expect a body, but often GitHub's API will request no body. The PUT verb and its implementation in Wreq is an example of this.

Constructors

EmptyBody 

Instances

Eq EmptyBody 
Show EmptyBody 
Putable EmptyBody

Instance that does not add anything to the body or headers of a PUT request

data DidDelete Source

Sum type to represent the success or failure of deletion of a resource within GitHub's API

Constructors

Deleted 
NotDeleted 

data PublicKey Source

Represents a PublicKey within GitHub. It includes its ID and the public key encoded as base 64

Constructors

PublicKey 

data PublicKeyFingerprint Source

Represents a Fingerprint. The fingerprintId field should match the fingerprint's public key ID within GitHub

data TeamCreateRequest Source

Represents a request to create a new team within an organization. The rest of the paramaters are passed in the URL. Refer to https://developer.github.com/v3/orgs/teams/#create-team

data GitHubReturnStatus Source

Error codes GitHub might return when attempting to use an API endpoint

Constructors

InvalidJSON

GitHub could not parse the JSON document sent

ValidationFailed

Validation failed, an example of this error is trying to create teams with the same name within one organization

InternalError

In case GitHub returns 500 Internal Server Error to some request

NotFound

When a resource has not been found. It does not imply the resource does not exist

NotAllowed

Usually returned after GitHub replies with 403 Forbidden. The user might not have permission to access/modify that resource

AllOk

This should never be returned

RequiresAuthentication

Accesing this resource requires authentication

UnexpectedJSON String

This library has failed to fulfill its purpose and could not handle GitHub's response

runGitHub :: GitHub a -> IO (Either GitHubReturnStatus a) Source

Executes a computation built within the GitHub monad returning an Either within the IO data type. Reads an API token from an environment variable named GITHUB_TOKEN

runGitHub' :: GitHub a -> BearerToken -> IO (Either GitHubReturnStatus a) Source

Executes a computation built within the GitHub monad returning an Either within the IO data type using the provided token

type GitHub = EitherT GitHubReturnStatus (ReaderT BearerToken IO) Source

The monad transformer where all operations run. Supports initial configuration through a Reader monad and the possibility of failure through Either