{-
   Vikunja API

   # Pagination Every endpoint capable of pagination will return two headers: * `x-pagination-total-pages`: The total number of available pages for this request * `x-pagination-result-count`: The number of items returned for this request. # Rights All endpoints which return a single item (project, task, etc.) - no array - will also return a `x-max-right` header with the max right the user has on this item as an int where `0` is `Read Only`, `1` is `Read & Write` and `2` is `Admin`. This can be used to show or hide ui elements based on the rights the user has. # Errors All errors have an error code and a human-readable error message in addition to the http status code. You should always check for the status code in the response, not only the http status code. Due to limitations in the swagger library we're using for this document, only one error per http status code is documented here. Make sure to check the [error docs](https://vikunja.io/docs/errors/) in Vikunja's documentation for a full list of available error codes. # Authorization **JWT-Auth:** Main authorization method, used for most of the requests. Needs `Authorization: Bearer <jwt-token>`-header to authenticate successfully.  **API Token:** You can create scoped API tokens for your user and use the token to make authenticated requests in the context of that user. The token must be provided via an `Authorization: Bearer <token>` header, similar to jwt auth. See the documentation for the `api` group to manage token creation and revocation.  **BasicAuth:** Only used when requesting tasks via CalDAV. <!-- ReDoc-Inject: <security-definitions> -->

   OpenAPI Version: 3.0.1
   Vikunja API API version: 0.24.6
   Contact: hello@vikunja.io
   Generated by OpenAPI Generator (https://openapi-generator.tech)
-}

{-|
Module : Vikunja.API.Webhooks
-}

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}

module Vikunja.API.Webhooks where

import Vikunja.Core
import Vikunja.MimeTypes
import Vikunja.Model as M

import qualified Data.Aeson as A
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import qualified Data.Data as P (Typeable, TypeRep, typeOf, typeRep)
import qualified Data.Foldable as P
import qualified Data.Map as Map
import qualified Data.Maybe as P
import qualified Data.Proxy as P (Proxy(..))
import qualified Data.Set as Set
import qualified Data.String as P
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Encoding as TL
import qualified Data.Time as TI
import qualified Network.HTTP.Client.MultipartFormData as NH
import qualified Network.HTTP.Media as ME
import qualified Network.HTTP.Types as NH
import qualified Web.FormUrlEncoded as WH
import qualified Web.HttpApiData as WH

import Data.Text (Text)
import GHC.Base ((<|>))

import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
import qualified Prelude as P

-- * Operations


-- ** Webhooks

-- *** projectsIdWebhooksGet

-- | @GET \/projects\/{id}\/webhooks@
-- 
-- Get all api webhook targets for the specified project
-- 
-- Get all api webhook targets for the specified project.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
projectsIdWebhooksGet
  :: Id -- ^ "id" -  Project ID
  -> VikunjaRequest ProjectsIdWebhooksGet MimeNoContent [ModelsWebhook] MimeJSON
projectsIdWebhooksGet :: Id
-> VikunjaRequest
     ProjectsIdWebhooksGet MimeNoContent [ModelsWebhook] MimeJSON
projectsIdWebhooksGet (Id Int
id) =
  Method
-> [ByteString]
-> VikunjaRequest
     ProjectsIdWebhooksGet MimeNoContent [ModelsWebhook] MimeJSON
forall req contentType res accept.
Method -> [ByteString] -> VikunjaRequest req contentType res accept
_mkRequest Method
"GET" [ByteString
"/projects/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
id,ByteString
"/webhooks"]
    VikunjaRequest
  ProjectsIdWebhooksGet MimeNoContent [ModelsWebhook] MimeJSON
-> Proxy AuthApiKeyJWTKeyAuth
-> VikunjaRequest
     ProjectsIdWebhooksGet MimeNoContent [ModelsWebhook] MimeJSON
forall authMethod req contentType res accept.
AuthMethod authMethod =>
VikunjaRequest req contentType res accept
-> Proxy authMethod -> VikunjaRequest req contentType res accept
`_hasAuthType` (Proxy AuthApiKeyJWTKeyAuth
forall k (t :: k). Proxy t
P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

data ProjectsIdWebhooksGet  

-- | /Optional Param/ "page" - The page number. Used for pagination. If not provided, the first page of results is returned.
instance HasOptionalParam ProjectsIdWebhooksGet Page where
  applyOptionalParam :: VikunjaRequest ProjectsIdWebhooksGet contentType res accept
-> Page
-> VikunjaRequest ProjectsIdWebhooksGet contentType res accept
applyOptionalParam VikunjaRequest ProjectsIdWebhooksGet contentType res accept
req (Page Int
xs) =
    VikunjaRequest ProjectsIdWebhooksGet contentType res accept
req VikunjaRequest ProjectsIdWebhooksGet contentType res accept
-> [QueryItem]
-> VikunjaRequest ProjectsIdWebhooksGet contentType res accept
forall req contentType res accept.
VikunjaRequest req contentType res accept
-> [QueryItem] -> VikunjaRequest req contentType res accept
`addQuery` (Method, Maybe Int) -> [QueryItem]
forall a. ToHttpApiData a => (Method, Maybe a) -> [QueryItem]
toQuery (Method
"page", Int -> Maybe Int
forall a. a -> Maybe a
Just Int
xs)

-- | /Optional Param/ "per_page" - The maximum number of items per bucket per page. This parameter is limited by the configured maximum of items per page.
instance HasOptionalParam ProjectsIdWebhooksGet PerPage where
  applyOptionalParam :: VikunjaRequest ProjectsIdWebhooksGet contentType res accept
-> PerPage
-> VikunjaRequest ProjectsIdWebhooksGet contentType res accept
applyOptionalParam VikunjaRequest ProjectsIdWebhooksGet contentType res accept
req (PerPage Int
xs) =
    VikunjaRequest ProjectsIdWebhooksGet contentType res accept
req VikunjaRequest ProjectsIdWebhooksGet contentType res accept
-> [QueryItem]
-> VikunjaRequest ProjectsIdWebhooksGet contentType res accept
forall req contentType res accept.
VikunjaRequest req contentType res accept
-> [QueryItem] -> VikunjaRequest req contentType res accept
`addQuery` (Method, Maybe Int) -> [QueryItem]
forall a. ToHttpApiData a => (Method, Maybe a) -> [QueryItem]
toQuery (Method
"per_page", Int -> Maybe Int
forall a. a -> Maybe a
Just Int
xs)
-- | @application/json@
instance Produces ProjectsIdWebhooksGet MimeJSON


-- *** projectsIdWebhooksPut

-- | @PUT \/projects\/{id}\/webhooks@
-- 
-- Create a webhook target
-- 
-- Create a webhook target which receives POST requests about specified events from a project.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
projectsIdWebhooksPut
  :: (Consumes ProjectsIdWebhooksPut MimeJSON, MimeRender MimeJSON ModelsWebhook)
  => ModelsWebhook -- ^ "webhook" -  The webhook target object with required fields
  -> Id -- ^ "id" -  Project ID
  -> VikunjaRequest ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
projectsIdWebhooksPut :: ModelsWebhook
-> Id
-> VikunjaRequest
     ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
projectsIdWebhooksPut ModelsWebhook
webhook (Id Int
id) =
  Method
-> [ByteString]
-> VikunjaRequest
     ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
forall req contentType res accept.
Method -> [ByteString] -> VikunjaRequest req contentType res accept
_mkRequest Method
"PUT" [ByteString
"/projects/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
id,ByteString
"/webhooks"]
    VikunjaRequest
  ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
-> Proxy AuthApiKeyJWTKeyAuth
-> VikunjaRequest
     ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
forall authMethod req contentType res accept.
AuthMethod authMethod =>
VikunjaRequest req contentType res accept
-> Proxy authMethod -> VikunjaRequest req contentType res accept
`_hasAuthType` (Proxy AuthApiKeyJWTKeyAuth
forall k (t :: k). Proxy t
P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)
    VikunjaRequest
  ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
-> ModelsWebhook
-> VikunjaRequest
     ProjectsIdWebhooksPut MimeJSON ModelsWebhook MimeJSON
forall req param contentType res accept.
(HasBodyParam req param, Consumes req contentType,
 MimeRender contentType param) =>
VikunjaRequest req contentType res accept
-> param -> VikunjaRequest req contentType res accept
`setBodyParam` ModelsWebhook
webhook

data ProjectsIdWebhooksPut 

-- | /Body Param/ "webhook" - The webhook target object with required fields
instance HasBodyParam ProjectsIdWebhooksPut ModelsWebhook 

-- | @application/json@
instance Consumes ProjectsIdWebhooksPut MimeJSON

-- | @application/json@
instance Produces ProjectsIdWebhooksPut MimeJSON


-- *** projectsIdWebhooksWebhookIDDelete

-- | @DELETE \/projects\/{id}\/webhooks\/{webhookID}@
-- 
-- Deletes an existing webhook target
-- 
-- Delete any of the project's webhook targets.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
projectsIdWebhooksWebhookIDDelete
  :: Id -- ^ "id" -  Project ID
  -> WebhookId -- ^ "webhookId" -  Webhook ID
  -> VikunjaRequest ProjectsIdWebhooksWebhookIDDelete MimeNoContent ModelsMessage MimeJSON
projectsIdWebhooksWebhookIDDelete :: Id
-> WebhookId
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDDelete
     MimeNoContent
     ModelsMessage
     MimeJSON
projectsIdWebhooksWebhookIDDelete (Id Int
id) (WebhookId Int
webhookId) =
  Method
-> [ByteString]
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDDelete
     MimeNoContent
     ModelsMessage
     MimeJSON
forall req contentType res accept.
Method -> [ByteString] -> VikunjaRequest req contentType res accept
_mkRequest Method
"DELETE" [ByteString
"/projects/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
id,ByteString
"/webhooks/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
webhookId]
    VikunjaRequest
  ProjectsIdWebhooksWebhookIDDelete
  MimeNoContent
  ModelsMessage
  MimeJSON
-> Proxy AuthApiKeyJWTKeyAuth
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDDelete
     MimeNoContent
     ModelsMessage
     MimeJSON
forall authMethod req contentType res accept.
AuthMethod authMethod =>
VikunjaRequest req contentType res accept
-> Proxy authMethod -> VikunjaRequest req contentType res accept
`_hasAuthType` (Proxy AuthApiKeyJWTKeyAuth
forall k (t :: k). Proxy t
P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

data ProjectsIdWebhooksWebhookIDDelete  
-- | @application/json@
instance Produces ProjectsIdWebhooksWebhookIDDelete MimeJSON


-- *** projectsIdWebhooksWebhookIDPost

-- | @POST \/projects\/{id}\/webhooks\/{webhookID}@
-- 
-- Change a webhook target's events.
-- 
-- Change a webhook target's events. You cannot change other values of a webhook.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
projectsIdWebhooksWebhookIDPost
  :: Id -- ^ "id" -  Project ID
  -> WebhookId -- ^ "webhookId" -  Webhook ID
  -> VikunjaRequest ProjectsIdWebhooksWebhookIDPost MimeNoContent ModelsWebhook MimeJSON
projectsIdWebhooksWebhookIDPost :: Id
-> WebhookId
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDPost
     MimeNoContent
     ModelsWebhook
     MimeJSON
projectsIdWebhooksWebhookIDPost (Id Int
id) (WebhookId Int
webhookId) =
  Method
-> [ByteString]
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDPost
     MimeNoContent
     ModelsWebhook
     MimeJSON
forall req contentType res accept.
Method -> [ByteString] -> VikunjaRequest req contentType res accept
_mkRequest Method
"POST" [ByteString
"/projects/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
id,ByteString
"/webhooks/",Int -> ByteString
forall a. ToHttpApiData a => a -> ByteString
toPath Int
webhookId]
    VikunjaRequest
  ProjectsIdWebhooksWebhookIDPost
  MimeNoContent
  ModelsWebhook
  MimeJSON
-> Proxy AuthApiKeyJWTKeyAuth
-> VikunjaRequest
     ProjectsIdWebhooksWebhookIDPost
     MimeNoContent
     ModelsWebhook
     MimeJSON
forall authMethod req contentType res accept.
AuthMethod authMethod =>
VikunjaRequest req contentType res accept
-> Proxy authMethod -> VikunjaRequest req contentType res accept
`_hasAuthType` (Proxy AuthApiKeyJWTKeyAuth
forall k (t :: k). Proxy t
P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

data ProjectsIdWebhooksWebhookIDPost  
-- | @application/json@
instance Produces ProjectsIdWebhooksWebhookIDPost MimeJSON


-- *** webhooksEventsGet

-- | @GET \/webhooks\/events@
-- 
-- Get all possible webhook events
-- 
-- Get all possible webhook events to use when creating or updating a webhook target.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
webhooksEventsGet
  :: VikunjaRequest WebhooksEventsGet MimeNoContent [Text] MimeJSON
webhooksEventsGet :: VikunjaRequest WebhooksEventsGet MimeNoContent [Text] MimeJSON
webhooksEventsGet =
  Method
-> [ByteString]
-> VikunjaRequest WebhooksEventsGet MimeNoContent [Text] MimeJSON
forall req contentType res accept.
Method -> [ByteString] -> VikunjaRequest req contentType res accept
_mkRequest Method
"GET" [ByteString
"/webhooks/events"]
    VikunjaRequest WebhooksEventsGet MimeNoContent [Text] MimeJSON
-> Proxy AuthApiKeyJWTKeyAuth
-> VikunjaRequest WebhooksEventsGet MimeNoContent [Text] MimeJSON
forall authMethod req contentType res accept.
AuthMethod authMethod =>
VikunjaRequest req contentType res accept
-> Proxy authMethod -> VikunjaRequest req contentType res accept
`_hasAuthType` (Proxy AuthApiKeyJWTKeyAuth
forall k (t :: k). Proxy t
P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

data WebhooksEventsGet  
-- | @application/json@
instance Produces WebhooksEventsGet MimeJSON