Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Member = Member {
- memberLogin :: Text
- memberId :: Integer
- data MemberWithKey = MemberWithKey {}
- data Team = Team {}
- newtype BearerToken = BearerToken {}
- data StatusInTeam
- data EmptyBody = EmptyBody
- data DidDelete
- data PublicKey = PublicKey {
- publicKeyId :: Integer
- publicKey :: Text
- data PublicKeyFingerprint = PublicKeyFingerprint {}
- data TeamCreateRequest = TeamCreateRequest {}
- data GitHubReturnStatus
- data DidAddKey
- data AddPublicKeyRequest = AddPublicKeyRequest {}
- runGitHub :: GitHub a -> IO (Either GitHubReturnStatus a)
- runGitHub' :: GitHub a -> BearerToken -> IO (Either GitHubReturnStatus a)
- type GitHub = EitherT GitHubReturnStatus (ReaderT BearerToken IO)
Documentation
Represents a user in GitHub. Contains no more than login and user ID
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
Represents a team in GitHub. Contains the team's ID, the team's name and an optional description
newtype BearerToken Source
GitHub's OAuth 2.0 bearer token. This is simply added in an Authorization header
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.
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.
Sum type to represent the success or failure of deletion of a resource within GitHub's API
Represents a PublicKey within GitHub. It includes its ID and the public key encoded as base 64
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
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