----------------------------------------------------------------------------- -- | -- License : BSD-3-Clause -- Maintainer : Todd Mohney -- -- The public keys API, as described at -- module GitHub.Endpoints.Users.PublicSSHKeys ( -- * Querying public SSH keys publicSSHKeys', publicSSHKeysR, publicSSHKeysFor', publicSSHKeysForR, publicSSHKey', publicSSHKeyR, -- ** Create createUserPublicSSHKey', createUserPublicSSHKeyR, -- ** Delete deleteUserPublicSSHKey', deleteUserPublicSSHKeyR, ) where import GitHub.Data import GitHub.Internal.Prelude import GitHub.Request import Prelude () -- | Querying public SSH keys. publicSSHKeysFor' :: Name Owner -> IO (Either Error (Vector PublicSSHKeyBasic)) publicSSHKeysFor' user = executeRequest' $ publicSSHKeysForR user FetchAll -- | Querying public SSH keys. -- See publicSSHKeysForR :: Name Owner -> FetchCount -> Request 'RO (Vector PublicSSHKeyBasic) publicSSHKeysForR user = pagedQuery ["users", toPathPart user, "keys"] [] -- | Querying the authenticated users' public SSH keys publicSSHKeys' :: Auth -> IO (Either Error (Vector PublicSSHKey)) publicSSHKeys' auth = executeRequest auth publicSSHKeysR -- | Querying the authenticated users' public SSH keys -- See publicSSHKeysR :: Request 'RA (Vector PublicSSHKey) publicSSHKeysR = query ["user", "keys"] [] -- | Querying a public SSH key publicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error PublicSSHKey) publicSSHKey' auth keyId = executeRequest auth $ publicSSHKeyR keyId -- | Querying a public SSH key. -- See publicSSHKeyR :: Id PublicSSHKey -> Request 'RA PublicSSHKey publicSSHKeyR keyId = query ["user", "keys", toPathPart keyId] [] -- | Create a public SSH key createUserPublicSSHKey' :: Auth -> NewPublicSSHKey -> IO (Either Error PublicSSHKey) createUserPublicSSHKey' auth key = executeRequest auth $ createUserPublicSSHKeyR key -- | Create a public SSH key. -- See . createUserPublicSSHKeyR :: NewPublicSSHKey -> Request 'RW PublicSSHKey createUserPublicSSHKeyR key = command Post ["user", "keys"] (encode key) deleteUserPublicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error ()) deleteUserPublicSSHKey' auth keyId = executeRequest auth $ deleteUserPublicSSHKeyR keyId -- | Delete a public SSH key. -- See deleteUserPublicSSHKeyR :: Id PublicSSHKey -> GenRequest 'MtUnit 'RW () deleteUserPublicSSHKeyR keyId = Command Delete ["user", "keys", toPathPart keyId] mempty