module GitHub.Endpoints.Repos.Webhooks (
webhooksForR,
webhookForR,
createRepoWebhookR,
editRepoWebhookR,
testPushRepoWebhookR,
pingRepoWebhookR,
deleteRepoWebhookR,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
webhooksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector RepoWebhook)
webhooksForR :: forall (k :: RW).
Name Owner
-> Name Repo -> FetchCount -> Request k (Vector RepoWebhook)
webhooksForR Name Owner
user Name Repo
repo =
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"hooks"] []
webhookForR :: Name Owner -> Name Repo -> Id RepoWebhook -> Request k RepoWebhook
webhookForR :: forall (k :: RW).
Name Owner -> Name Repo -> Id RepoWebhook -> Request k RepoWebhook
webhookForR Name Owner
user Name Repo
repo Id RepoWebhook
hookId =
forall (mt :: RW) a. Paths -> QueryString -> Request mt a
query [Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"hooks", forall a. IsPathPart a => a -> Text
toPathPart Id RepoWebhook
hookId] []
createRepoWebhookR :: Name Owner -> Name Repo -> NewRepoWebhook -> Request 'RW RepoWebhook
createRepoWebhookR :: Name Owner
-> Name Repo -> NewRepoWebhook -> Request 'RW RepoWebhook
createRepoWebhookR Name Owner
user Name Repo
repo NewRepoWebhook
hook =
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post [Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"hooks"] (forall a. ToJSON a => a -> ByteString
encode NewRepoWebhook
hook)
editRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> EditRepoWebhook -> Request 'RW RepoWebhook
editRepoWebhookR :: Name Owner
-> Name Repo
-> Id RepoWebhook
-> EditRepoWebhook
-> Request 'RW RepoWebhook
editRepoWebhookR Name Owner
user Name Repo
repo Id RepoWebhook
hookId EditRepoWebhook
hookEdit =
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Patch [Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"hooks", forall a. IsPathPart a => a -> Text
toPathPart Id RepoWebhook
hookId] (forall a. ToJSON a => a -> ByteString
encode EditRepoWebhook
hookEdit)
testPushRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool
testPushRepoWebhookR :: Name Owner
-> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool
testPushRepoWebhookR Name Owner
user Name Repo
repo Id RepoWebhook
hookId =
forall (mt :: MediaType (*)) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Post (Name Owner -> Name Repo -> Id RepoWebhook -> Maybe Text -> Paths
createWebhookOpPath Name Owner
user Name Repo
repo Id RepoWebhook
hookId forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a
Just Text
"tests") (forall a. ToJSON a => a -> ByteString
encode ())
pingRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool
pingRepoWebhookR :: Name Owner
-> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool
pingRepoWebhookR Name Owner
user Name Repo
repo Id RepoWebhook
hookId =
forall (mt :: MediaType (*)) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Post (Name Owner -> Name Repo -> Id RepoWebhook -> Maybe Text -> Paths
createWebhookOpPath Name Owner
user Name Repo
repo Id RepoWebhook
hookId forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a
Just Text
"pings") (forall a. ToJSON a => a -> ByteString
encode ())
deleteRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtUnit 'RW ()
deleteRepoWebhookR :: Name Owner
-> Name Repo -> Id RepoWebhook -> GenRequest 'MtUnit 'RW ()
deleteRepoWebhookR Name Owner
user Name Repo
repo Id RepoWebhook
hookId =
forall (mt :: MediaType (*)) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete (Name Owner -> Name Repo -> Id RepoWebhook -> Maybe Text -> Paths
createWebhookOpPath Name Owner
user Name Repo
repo Id RepoWebhook
hookId forall a. Maybe a
Nothing) forall a. Monoid a => a
mempty
createBaseWebhookPath :: Name Owner -> Name Repo -> Id RepoWebhook -> Paths
createBaseWebhookPath :: Name Owner -> Name Repo -> Id RepoWebhook -> Paths
createBaseWebhookPath Name Owner
user Name Repo
repo Id RepoWebhook
hookId =
[Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"hooks", forall a. IsPathPart a => a -> Text
toPathPart Id RepoWebhook
hookId]
createWebhookOpPath :: Name Owner -> Name Repo -> Id RepoWebhook -> Maybe Text -> Paths
createWebhookOpPath :: Name Owner -> Name Repo -> Id RepoWebhook -> Maybe Text -> Paths
createWebhookOpPath Name Owner
owner Name Repo
reqName Id RepoWebhook
webhookId Maybe Text
Nothing = Name Owner -> Name Repo -> Id RepoWebhook -> Paths
createBaseWebhookPath Name Owner
owner Name Repo
reqName Id RepoWebhook
webhookId
createWebhookOpPath Name Owner
owner Name Repo
reqName Id RepoWebhook
webhookId (Just Text
operation) = Name Owner -> Name Repo -> Id RepoWebhook -> Paths
createBaseWebhookPath Name Owner
owner Name Repo
reqName Id RepoWebhook
webhookId forall a. [a] -> [a] -> [a]
++ [Text
operation]