packages feed

vikunja-api-0.24.6.0: lib/Vikunja/API/Team.hs

{-
   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.Team
-}

{-# 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.Team 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


-- ** Team

-- *** teamsGet

-- | @GET \/teams@
-- 
-- Get teams
-- 
-- Returns all teams the current user is part of.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsGet
  :: VikunjaRequest TeamsGet MimeNoContent [ModelsTeam] MimeJSON
teamsGet =
  _mkRequest "GET" ["/teams"]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

data TeamsGet  

-- | /Optional Param/ "page" - The page number. Used for pagination. If not provided, the first page of results is returned.
instance HasOptionalParam TeamsGet Page where
  applyOptionalParam req (Page xs) =
    req `addQuery` toQuery ("page", Just xs)

-- | /Optional Param/ "per_page" - The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.
instance HasOptionalParam TeamsGet PerPage where
  applyOptionalParam req (PerPage xs) =
    req `addQuery` toQuery ("per_page", Just xs)

-- | /Optional Param/ "s" - Search teams by its name.
instance HasOptionalParam TeamsGet S where
  applyOptionalParam req (S xs) =
    req `addQuery` toQuery ("s", Just xs)
-- | @application/json@
instance Produces TeamsGet MimeJSON


-- *** teamsIdDelete

-- | @DELETE \/teams\/{id}@
-- 
-- Deletes a team
-- 
-- Delets a team. This will also remove the access for all users in that team.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdDelete
  :: Id -- ^ "id" -  Team ID
  -> VikunjaRequest TeamsIdDelete MimeNoContent ModelsMessage MimeJSON
teamsIdDelete (Id id) =
  _mkRequest "DELETE" ["/teams/",toPath id]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

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


-- *** teamsIdGet

-- | @GET \/teams\/{id}@
-- 
-- Gets one team
-- 
-- Returns a team by its ID.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdGet
  :: Id -- ^ "id" -  Team ID
  -> VikunjaRequest TeamsIdGet MimeNoContent ModelsTeam MimeJSON
teamsIdGet (Id id) =
  _mkRequest "GET" ["/teams/",toPath id]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

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


-- *** teamsIdMembersPut

-- | @PUT \/teams\/{id}\/members@
-- 
-- Add a user to a team
-- 
-- Add a user to a team.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdMembersPut
  :: (Consumes TeamsIdMembersPut MimeJSON, MimeRender MimeJSON ModelsTeamMember)
  => ModelsTeamMember -- ^ "team" -  The user to be added to a team.
  -> Id -- ^ "id" -  Team ID
  -> VikunjaRequest TeamsIdMembersPut MimeJSON ModelsTeamMember MimeJSON
teamsIdMembersPut team (Id id) =
  _mkRequest "PUT" ["/teams/",toPath id,"/members"]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)
    `setBodyParam` team

data TeamsIdMembersPut 

-- | /Body Param/ "team" - The user to be added to a team.
instance HasBodyParam TeamsIdMembersPut ModelsTeamMember 

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

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


-- *** teamsIdMembersUserIDAdminPost

-- | @POST \/teams\/{id}\/members\/{userID}\/admin@
-- 
-- Toggle a team member's admin status
-- 
-- If a user is team admin, this will make them member and vise-versa.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdMembersUserIDAdminPost
  :: Id -- ^ "id" -  Team ID
  -> UserId -- ^ "userId" -  User ID
  -> VikunjaRequest TeamsIdMembersUserIDAdminPost MimeNoContent ModelsMessage MimeJSON
teamsIdMembersUserIDAdminPost (Id id) (UserId userId) =
  _mkRequest "POST" ["/teams/",toPath id,"/members/",toPath userId,"/admin"]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

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


-- *** teamsIdMembersUserIDDelete

-- | @DELETE \/teams\/{id}\/members\/{userID}@
-- 
-- Remove a user from a team
-- 
-- Remove a user from a team. This will also revoke any access this user might have via that team. A user can remove themselves from the team if they are not the last user in the team.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdMembersUserIDDelete
  :: Id -- ^ "id" -  Team ID
  -> UserId -- ^ "userId" -  User ID
  -> VikunjaRequest TeamsIdMembersUserIDDelete MimeNoContent ModelsMessage MimeJSON
teamsIdMembersUserIDDelete (Id id) (UserId userId) =
  _mkRequest "DELETE" ["/teams/",toPath id,"/members/",toPath userId]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)

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


-- *** teamsIdPost

-- | @POST \/teams\/{id}@
-- 
-- Updates a team
-- 
-- Updates a team.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsIdPost
  :: (Consumes TeamsIdPost MimeJSON, MimeRender MimeJSON ModelsTeam)
  => ModelsTeam -- ^ "team" -  The team with updated values you want to update.
  -> Id -- ^ "id" -  Team ID
  -> VikunjaRequest TeamsIdPost MimeJSON ModelsTeam MimeJSON
teamsIdPost team (Id id) =
  _mkRequest "POST" ["/teams/",toPath id]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)
    `setBodyParam` team

data TeamsIdPost 

-- | /Body Param/ "team" - The team with updated values you want to update.
instance HasBodyParam TeamsIdPost ModelsTeam 

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

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


-- *** teamsPut

-- | @PUT \/teams@
-- 
-- Creates a new team
-- 
-- Creates a new team.
-- 
-- AuthMethod: 'AuthApiKeyJWTKeyAuth'
-- 
teamsPut
  :: (Consumes TeamsPut MimeJSON, MimeRender MimeJSON ModelsTeam)
  => ModelsTeam -- ^ "team" -  The team you want to create.
  -> VikunjaRequest TeamsPut MimeJSON ModelsTeam MimeJSON
teamsPut team =
  _mkRequest "PUT" ["/teams"]
    `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyJWTKeyAuth)
    `setBodyParam` team

data TeamsPut 

-- | /Body Param/ "team" - The team you want to create.
instance HasBodyParam TeamsPut ModelsTeam 

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

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