module Network.GitHub.API
where
import Servant.API
import Network.GitHub.Types
type UserOrganisations = "user" :> "orgs" :> Get '[JSON] [Organisation]
type UserOrganisationMemberships = "user" :> "memberships" :> "orgs" :> Get '[JSON] [OrganisationMember]
type OrganisationTeams = "orgs" :> Capture "org" OrgLogin :> "teams" :> Get '[JSON] [Team]
type TeamMembers = "teams" :> Capture "id" TeamId :> "members" :> Get '[JSON] [Member]
type TeamRepositories = "teams" :> Capture "id" TeamId :> "repos" :> Get '[JSON] [Repository]
type GetTeam = "teams" :> Capture "id" TeamId :> Get '[JSON] Team
type GetUser = "user" :> Get '[JSON] User
type GetUserByLogin = "user" :> QueryParam "username" String :> Get '[JSON] User
type UserRepositories = "user" :> "repos" :> QueryParam "type" String :> Get '[JSON] [Repository]
type UserInstallationRepositories = "user" :> "installations" :> Capture "installation_id" Int :> "repositories" :> Get '[EarlyAccessJSON] Repositories
type OrganisationRepositories = "orgs" :> Capture "org" OrgLogin :> "repos" :> Get '[JSON] [Repository]
type InstallationRepositories = "installation" :> "repositories" :> Get '[EarlyAccessJSON] Repositories
type AppInstallations = "app" :> "installations" :> Get '[EarlyAccessJSON] [Installation]
type UserInstallations = "user" :> "installations" :> QueryParam "access_token" String :> Get '[EarlyAccessJSON] Installations
type RepositoryCollaborators = "repos" :> Capture "org" OrgLogin :> Capture "repo" RepoName :> "collaborators" :> Get '[JSON] [Member]
type GetCommit
= "repos" :> Capture "org" OrgLogin :> Capture "repo" RepoName
:> "commits" :> Capture "sha" Sha :> Get '[JSON] Commit
type GetContent
= "repos" :> Capture "org" OrgLogin :> Capture "repo" RepoName
:> "contents" :> Capture "path" String :> QueryParam "ref" String :> QueryParam "path" String
:> Get '[JSON] Content
type GetIssues
= "repos" :> Capture "owner" Owner :> Capture "repo" RepoName :> "issues"
:> QueryParam "milestone" String :> QueryParam "state" String
:> QueryParam "assignee" String :> QueryParam "creator" String
:> QueryParam "mentioned" String :> QueryParam "labels" String
:> QueryParam "sort" String :> QueryParam "direction" String
:> QueryParam "since" String
:> Get '[JSON] [Issue]
type ReqInstallationAccessToken = "installations" :> Capture "installation_id" Int :> "access_tokens"
:> Header "User-Agent" String
:> Header "Authorization" String
:> ReqBody '[JSON] (Maybe InstallationUser)
:> Post '[EarlyAccessJSON] InstallationAccessToken