module GitHub.Endpoints.Repos.Collaborators (
collaboratorsOn,
collaboratorsOn',
collaboratorsOnR,
isCollaboratorOn,
isCollaboratorOnR,
addCollaborator,
addCollaboratorR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
collaboratorsOn :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
collaboratorsOn :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
collaboratorsOn = Maybe Auth
-> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
collaboratorsOn' Maybe Auth
forall a. Maybe a
Nothing
collaboratorsOn' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
collaboratorsOn' :: Maybe Auth
-> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
collaboratorsOn' auth :: Maybe Auth
auth user :: Name Owner
user repo :: Name Repo
repo =
Maybe Auth
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser))
forall am (mt :: MediaType *) a.
(AuthMethod am, ParseResponse mt a) =>
Maybe am -> GenRequest mt 'RO a -> IO (Either Error a)
executeRequestMaybe Maybe Auth
auth (GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser)))
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser))
forall a b. (a -> b) -> a -> b
$ Name Owner
-> Name Repo
-> FetchCount
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
forall (k :: RW).
Name Owner
-> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
collaboratorsOnR Name Owner
user Name Repo
repo FetchCount
FetchAll
collaboratorsOnR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
collaboratorsOnR :: Name Owner
-> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
collaboratorsOnR user :: Name Owner
user repo :: Name Repo
repo =
Paths -> QueryString -> FetchCount -> Request k (Vector SimpleUser)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery ["repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, "collaborators"] []
isCollaboratorOn
:: Maybe Auth
-> Name Owner
-> Name Repo
-> Name User
-> IO (Either Error Bool)
isCollaboratorOn :: Maybe Auth
-> Name Owner -> Name Repo -> Name User -> IO (Either Error Bool)
isCollaboratorOn auth :: Maybe Auth
auth user :: Name Owner
user repo :: Name Repo
repo coll :: Name User
coll =
Maybe Auth
-> GenRequest 'MtStatus 'RO Bool -> IO (Either Error Bool)
forall am (mt :: MediaType *) a.
(AuthMethod am, ParseResponse mt a) =>
Maybe am -> GenRequest mt 'RO a -> IO (Either Error a)
executeRequestMaybe Maybe Auth
auth (GenRequest 'MtStatus 'RO Bool -> IO (Either Error Bool))
-> GenRequest 'MtStatus 'RO Bool -> IO (Either Error Bool)
forall a b. (a -> b) -> a -> b
$ Name Owner
-> Name Repo -> Name User -> GenRequest 'MtStatus 'RO Bool
forall (rw :: RW).
Name Owner
-> Name Repo -> Name User -> GenRequest 'MtStatus rw Bool
isCollaboratorOnR Name Owner
user Name Repo
repo Name User
coll
isCollaboratorOnR
:: Name Owner
-> Name Repo
-> Name User
-> GenRequest 'MtStatus rw Bool
isCollaboratorOnR :: Name Owner
-> Name Repo -> Name User -> GenRequest 'MtStatus rw Bool
isCollaboratorOnR user :: Name Owner
user repo :: Name Repo
repo coll :: Name User
coll =
Paths -> QueryString -> GenRequest 'MtStatus rw Bool
forall (mt :: MediaType *) (rw :: RW) a.
Paths -> QueryString -> GenRequest mt rw a
Query ["repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, "collaborators", Name User -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name User
coll] []
addCollaborator
:: Auth
-> Name Owner
-> Name Repo
-> Name User
-> IO (Either Error (Maybe RepoInvitation))
addCollaborator :: Auth
-> Name Owner
-> Name Repo
-> Name User
-> IO (Either Error (Maybe RepoInvitation))
addCollaborator auth :: Auth
auth owner :: Name Owner
owner repo :: Name Repo
repo coll :: Name User
coll =
Auth
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
-> IO (Either Error (Maybe RepoInvitation))
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
-> IO (Either Error (Maybe RepoInvitation)))
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
-> IO (Either Error (Maybe RepoInvitation))
forall a b. (a -> b) -> a -> b
$ Name Owner
-> Name Repo
-> Name User
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
addCollaboratorR Name Owner
owner Name Repo
repo Name User
coll
addCollaboratorR
:: Name Owner
-> Name Repo
-> Name User
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
addCollaboratorR :: Name Owner
-> Name Repo
-> Name User
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
addCollaboratorR owner :: Name Owner
owner repo :: Name Repo
repo coll :: Name User
coll =
CommandMethod
-> Paths
-> ByteString
-> GenRequest 'MtJSON 'RW (Maybe RepoInvitation)
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Put ["repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
owner, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, "collaborators", Name User -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name User
coll] ByteString
forall a. Monoid a => a
mempty