generated from tpl/purs
feat: create branch protection
This commit is contained in:
parent
2a4ee6482d
commit
8a806e9064
@ -8,9 +8,9 @@ import Data.URL (URL, (/))
|
||||
import Effect.Aff.Class (class MonadAff)
|
||||
import Gitea.Auth as Auth
|
||||
import Gitea.Error as Error
|
||||
import Gitea.Trans (GiteaT)
|
||||
import Gitea.Types (BranchProtection, BranchProtectionName(..), BranchProtectionUpdate, RepoName(..), Username(..))
|
||||
import Gitea.HTTP (fetch) as HTTP
|
||||
import Gitea.Trans (GiteaT)
|
||||
import Gitea.Types (BranchProtection, BranchProtectionName(..), BranchProtectionUpdate, RepoName(..), Username(..), BranchProtectionCreate)
|
||||
import HTTP (Method(..)) as HTTP
|
||||
import HTTP.Request (json) as HTTP
|
||||
import Simple.JSON (class WriteForeign)
|
||||
@ -54,3 +54,9 @@ delete u r b = do
|
||||
url <- branchProtectionOneURL u r b
|
||||
rep <- HTTP.fetch $ HTTP.DELETE /\ url
|
||||
Error.guardStatusOk rep
|
||||
|
||||
create :: forall m. MonadAff m => Username -> RepoName -> Record BranchProtectionCreate -> GiteaT m (Record BranchProtection)
|
||||
create u r new = do
|
||||
url <- branchProtectionURL u r
|
||||
rep <- HTTP.fetch $ HTTP.POST /\ url /\ HTTP.json new
|
||||
Error.tryGetRepJSON rep
|
||||
|
@ -433,5 +433,6 @@ type BranchProtectionImmutable r =
|
||||
| r
|
||||
)
|
||||
|
||||
type BranchProtectionCreate = (BranchProtectionMutable + BranchProtectionMutableOnCreate ())
|
||||
type BranchProtectionUpdate = BranchProtectionMutable ()
|
||||
type BranchProtection = (BranchProtectionMutable + BranchProtectionImmutable + BranchProtectionMutableOnCreate ())
|
||||
|
Loading…
Reference in New Issue
Block a user