generated from tpl/purs
439 lines
11 KiB
Plaintext
439 lines
11 KiB
Plaintext
module Gitea.Types where
|
|
|
|
import Prelude
|
|
|
|
import Data.Maybe (Maybe)
|
|
import Data.Newtype (class Newtype)
|
|
import Foreign.Object (Object)
|
|
import Simple.JSON (class ReadForeign, class WriteForeign)
|
|
import Type.Row (type (+))
|
|
|
|
data Ref = RefBranch BranchName | RefCommit CommitId | RefTag TagName
|
|
|
|
newtype RepoName = RepoName String
|
|
|
|
derive instance Newtype RepoName _
|
|
derive newtype instance Eq RepoName
|
|
derive newtype instance Ord RepoName
|
|
derive newtype instance Show RepoName
|
|
derive newtype instance WriteForeign RepoName
|
|
derive newtype instance ReadForeign RepoName
|
|
|
|
newtype TopicName = TopicName String
|
|
|
|
derive instance Newtype TopicName _
|
|
derive newtype instance Eq TopicName
|
|
derive newtype instance Ord TopicName
|
|
derive newtype instance Show TopicName
|
|
derive newtype instance WriteForeign TopicName
|
|
derive newtype instance ReadForeign TopicName
|
|
|
|
newtype OrgName = OrgName String
|
|
|
|
derive instance Newtype OrgName _
|
|
derive newtype instance Eq OrgName
|
|
derive newtype instance Ord OrgName
|
|
derive newtype instance Show OrgName
|
|
derive newtype instance WriteForeign OrgName
|
|
derive newtype instance ReadForeign OrgName
|
|
|
|
newtype TagName = TagName String
|
|
|
|
derive instance Newtype TagName _
|
|
derive newtype instance Eq TagName
|
|
derive newtype instance Ord TagName
|
|
derive newtype instance Show TagName
|
|
derive newtype instance WriteForeign TagName
|
|
derive newtype instance ReadForeign TagName
|
|
|
|
newtype CommitId = CommitId String
|
|
|
|
derive instance Newtype CommitId _
|
|
derive newtype instance Eq CommitId
|
|
derive newtype instance Ord CommitId
|
|
derive newtype instance Show CommitId
|
|
derive newtype instance WriteForeign CommitId
|
|
derive newtype instance ReadForeign CommitId
|
|
|
|
newtype BranchName = BranchName String
|
|
|
|
derive instance Newtype BranchName _
|
|
derive newtype instance Eq BranchName
|
|
derive newtype instance Ord BranchName
|
|
derive newtype instance Show BranchName
|
|
derive newtype instance WriteForeign BranchName
|
|
derive newtype instance ReadForeign BranchName
|
|
|
|
newtype BranchProtectionName = BranchProtectionName String
|
|
|
|
derive instance Newtype BranchProtectionName _
|
|
derive newtype instance Eq BranchProtectionName
|
|
derive newtype instance Ord BranchProtectionName
|
|
derive newtype instance Show BranchProtectionName
|
|
derive newtype instance WriteForeign BranchProtectionName
|
|
derive newtype instance ReadForeign BranchProtectionName
|
|
|
|
newtype TeamName = TeamName String
|
|
|
|
derive instance Newtype TeamName _
|
|
derive newtype instance Eq TeamName
|
|
derive newtype instance Ord TeamName
|
|
derive newtype instance Show TeamName
|
|
derive newtype instance WriteForeign TeamName
|
|
derive newtype instance ReadForeign TeamName
|
|
|
|
newtype SecretName = SecretName String
|
|
|
|
derive instance Newtype SecretName _
|
|
derive newtype instance Eq SecretName
|
|
derive newtype instance Ord SecretName
|
|
derive newtype instance Show SecretName
|
|
derive newtype instance WriteForeign SecretName
|
|
derive newtype instance ReadForeign SecretName
|
|
|
|
newtype RepoId = RepoId Int
|
|
|
|
derive instance Newtype RepoId _
|
|
derive newtype instance Eq RepoId
|
|
derive newtype instance Ord RepoId
|
|
derive newtype instance Show RepoId
|
|
derive newtype instance WriteForeign RepoId
|
|
derive newtype instance ReadForeign RepoId
|
|
|
|
newtype Username = Username String
|
|
|
|
derive instance Newtype Username _
|
|
derive newtype instance Eq Username
|
|
derive newtype instance Ord Username
|
|
derive newtype instance Show Username
|
|
derive newtype instance WriteForeign Username
|
|
derive newtype instance ReadForeign Username
|
|
|
|
newtype UserId = UserId Int
|
|
|
|
derive instance Newtype UserId _
|
|
derive newtype instance Eq UserId
|
|
derive newtype instance Ord UserId
|
|
derive newtype instance Show UserId
|
|
derive newtype instance WriteForeign UserId
|
|
derive newtype instance ReadForeign UserId
|
|
|
|
newtype OrgId = OrgId Int
|
|
|
|
derive instance Newtype OrgId _
|
|
derive newtype instance Eq OrgId
|
|
derive newtype instance Ord OrgId
|
|
derive newtype instance Show OrgId
|
|
derive newtype instance WriteForeign OrgId
|
|
derive newtype instance ReadForeign OrgId
|
|
|
|
newtype TeamId = TeamId Int
|
|
|
|
derive instance Newtype TeamId _
|
|
derive newtype instance Eq TeamId
|
|
derive newtype instance Ord TeamId
|
|
derive newtype instance Show TeamId
|
|
derive newtype instance WriteForeign TeamId
|
|
derive newtype instance ReadForeign TeamId
|
|
|
|
type Permission =
|
|
{ "admin" :: Boolean
|
|
, "pull" :: Boolean
|
|
, "push" :: Boolean
|
|
}
|
|
|
|
type Org =
|
|
{ "avatar_url" :: String
|
|
, "description" :: String
|
|
, "full_name" :: String
|
|
, "id" :: Int
|
|
, "location" :: String
|
|
, "name" :: String
|
|
, "repo_admin_change_team_access" :: Boolean
|
|
, "username" :: String
|
|
, "visibility" :: String
|
|
, "website" :: String
|
|
}
|
|
|
|
type Team =
|
|
{ "can_create_org_repo" :: Boolean
|
|
, "description" :: String
|
|
, "id" :: OrgId
|
|
, "includes_all_repositories" :: Boolean
|
|
, "name" :: String
|
|
, "organization" :: Org
|
|
, "permission" :: String
|
|
, "units" :: Array String
|
|
, "units_map" :: Object String
|
|
}
|
|
|
|
type User =
|
|
{ "active" :: Boolean
|
|
, "avatar_url" :: String
|
|
, "created" :: String
|
|
, "description" :: String
|
|
, "email" :: String
|
|
, "followers_count" :: Int
|
|
, "following_count" :: Int
|
|
, "full_name" :: String
|
|
, "id" :: UserId
|
|
, "is_admin" :: Boolean
|
|
, "language" :: String
|
|
, "last_login" :: String
|
|
, "location" :: String
|
|
, "login" :: Username
|
|
, "login_name" :: String
|
|
, "prohibit_login" :: Boolean
|
|
, "restricted" :: Boolean
|
|
, "starred_repos_count" :: Int
|
|
, "visibility" :: String
|
|
, "website" :: String
|
|
}
|
|
|
|
type RepoInternalTracker =
|
|
{ "allow_only_contributors_to_track_time" :: Boolean
|
|
, "enable_issue_dependencies" :: Boolean
|
|
, "enable_time_tracker" :: Boolean
|
|
}
|
|
|
|
type RepoTransfer =
|
|
{ "doer" :: User
|
|
, "recipient" :: User
|
|
, "teams" :: Array Team
|
|
}
|
|
|
|
type RepoExternalTracker =
|
|
{ "external_tracker_format" :: String
|
|
, "external_tracker_regexp_pattern" :: String
|
|
, "external_tracker_style" :: String
|
|
, "external_tracker_url" :: String
|
|
}
|
|
|
|
type RepoExternalWiki =
|
|
{ "external_wiki_url" :: String
|
|
}
|
|
|
|
type RepoSectionMergeSettingsMutable r =
|
|
( "allow_merge_commits" :: Boolean
|
|
, "allow_rebase" :: Boolean
|
|
, "allow_rebase_explicit" :: Boolean
|
|
, "allow_rebase_update" :: Boolean
|
|
, "allow_squash_merge" :: Boolean
|
|
, "default_merge_style" :: String
|
|
, "default_delete_branch_after_merge" :: Boolean
|
|
, "default_branch" :: String
|
|
, "ignore_whitespace_conflicts" :: Boolean
|
|
| r
|
|
)
|
|
|
|
type RepoPermsMutable r =
|
|
( "default_allow_maintainer_edit" :: Boolean
|
|
| r
|
|
)
|
|
|
|
type RepoPermsImmutable r =
|
|
( "permissions" :: Permission
|
|
| r
|
|
)
|
|
|
|
type RepoSectionVisibilityMutable r =
|
|
( "archived" :: Boolean
|
|
, "private" :: Boolean
|
|
| r
|
|
)
|
|
|
|
type RepoSectionVisibilityImmutable r =
|
|
( "archived_at" :: String
|
|
| r
|
|
)
|
|
|
|
type RepoSectionProfileMutable r =
|
|
( "avatar_url" :: String
|
|
, "description" :: String
|
|
, "website" :: String
|
|
| r
|
|
)
|
|
|
|
type RepoSectionProfileImmutable r =
|
|
( "language" :: String
|
|
, "languages_url" :: String
|
|
, "link" :: String
|
|
, "original_url" :: String
|
|
| r
|
|
)
|
|
|
|
type RepoGiteaSettingsMutable r =
|
|
( "has_actions" :: Boolean
|
|
, "has_issues" :: Boolean
|
|
, "has_packages" :: Boolean
|
|
, "has_projects" :: Boolean
|
|
, "has_pull_requests" :: Boolean
|
|
, "has_releases" :: Boolean
|
|
, "has_wiki" :: Boolean
|
|
| r
|
|
)
|
|
|
|
type RepoSectionGiteaStatsMutable r =
|
|
( "template" :: Boolean
|
|
, "external_wiki" :: Maybe RepoExternalWiki
|
|
| r
|
|
)
|
|
|
|
type RepoSectionGiteaStatsImmutable r =
|
|
( "open_issues_count" :: Int
|
|
, "open_pr_counter" :: Int
|
|
, "release_counter" :: Int
|
|
, "size" :: Int
|
|
, "stars_count" :: Int
|
|
, "watchers_count" :: Int
|
|
, "fork" :: Boolean
|
|
, "forks_count" :: Int
|
|
, "repo_transfer" :: Maybe RepoTransfer
|
|
| r
|
|
)
|
|
|
|
type RepoMeta =
|
|
{ "id" :: RepoId
|
|
, "owner" :: Username
|
|
, "name" :: RepoName
|
|
, "full_name" :: String
|
|
}
|
|
|
|
type RepoSectionStatsMutable r =
|
|
( "name" :: RepoName
|
|
, "full_name" :: String
|
|
, "mirror_interval" :: String
|
|
| r
|
|
)
|
|
|
|
type RepoSectionStatsImmutable r =
|
|
( "id" :: RepoId
|
|
, "created_at" :: String
|
|
, "empty" :: Boolean
|
|
, "owner" :: User
|
|
, "updated_at" :: String
|
|
, "html_url" :: String
|
|
, "clone_url" :: String
|
|
, "ssh_url" :: String
|
|
| r
|
|
)
|
|
|
|
type RepoSectionTrackerMutable r =
|
|
( "external_tracker" :: Maybe RepoExternalTracker
|
|
, "internal_tracker" :: Maybe RepoInternalTracker
|
|
| r
|
|
)
|
|
|
|
type RepoSectionTrackerImmutable r =
|
|
( "internal" :: Boolean
|
|
| r
|
|
)
|
|
|
|
type Repo =
|
|
( RepoSectionTrackerMutable
|
|
+ RepoSectionTrackerImmutable
|
|
+ RepoSectionStatsMutable
|
|
+ RepoSectionStatsImmutable
|
|
+ RepoSectionGiteaStatsMutable
|
|
+ RepoSectionGiteaStatsImmutable
|
|
+ RepoGiteaSettingsMutable
|
|
+ RepoPermsMutable
|
|
+ RepoPermsImmutable
|
|
+ RepoSectionProfileMutable
|
|
+ RepoSectionProfileImmutable
|
|
+ RepoSectionVisibilityMutable
|
|
+ RepoSectionVisibilityImmutable
|
|
+ RepoSectionMergeSettingsMutable ()
|
|
)
|
|
|
|
type RepoUpdate =
|
|
( RepoSectionTrackerMutable
|
|
+ RepoSectionStatsMutable
|
|
+ RepoSectionGiteaStatsMutable
|
|
+ RepoGiteaSettingsMutable
|
|
+ RepoPermsMutable
|
|
+ RepoSectionProfileMutable
|
|
+ RepoSectionVisibilityMutable
|
|
+ RepoSectionMergeSettingsMutable ()
|
|
)
|
|
|
|
type CommitUser =
|
|
{ "email" :: String
|
|
, "name" :: String
|
|
, "username" :: Username
|
|
}
|
|
|
|
type CommitVerification =
|
|
{ "signer" :: CommitUser
|
|
, "payload" :: String
|
|
, "reason" :: String
|
|
, "signature" :: String
|
|
, "verified" :: Boolean
|
|
}
|
|
|
|
type Commit =
|
|
{ "id" :: CommitId
|
|
, "added" :: Array String
|
|
, "author" :: CommitUser
|
|
, "committer" :: CommitUser
|
|
, "message" :: String
|
|
, "modified" :: Array String
|
|
, "removed" :: Array String
|
|
, "timestamp" :: String
|
|
, "url" :: String
|
|
, "verification" :: CommitVerification
|
|
}
|
|
|
|
type Branch =
|
|
{ "commit" :: Commit
|
|
, "effective_branch_protection_name" :: String
|
|
, "enable_status_check" :: Boolean
|
|
, "name" :: String
|
|
, "protected" :: Boolean
|
|
, "required_approvals" :: Int
|
|
, "status_check_contexts" :: Maybe (Array String)
|
|
, "user_can_merge" :: Boolean
|
|
, "user_can_push" :: Boolean
|
|
}
|
|
|
|
type BranchProtectionMutable r =
|
|
( "approvals_whitelist_teams" :: Array TeamName
|
|
, "approvals_whitelist_username" :: Array Username
|
|
, "block_on_official_review_requests" :: Boolean
|
|
, "block_on_outdated_branch" :: Boolean
|
|
, "block_on_rejected_reviews" :: Boolean
|
|
, "branch_name" :: BranchName
|
|
, "dismiss_stale_approvals" :: Boolean
|
|
, "enable_approvals_whitelist" :: Boolean
|
|
, "enable_merge_whitelist" :: Boolean
|
|
, "enable_push" :: Boolean
|
|
, "enable_push_whitelist" :: Boolean
|
|
, "enable_status_check" :: Boolean
|
|
, "merge_whitelist_teams" :: Array TeamName
|
|
, "merge_whitelist_usernames" :: Array String
|
|
, "protected_file_patterns" :: String
|
|
, "push_whitelist_deploy_keys" :: Boolean
|
|
, "push_whitelist_teams" :: Array TeamName
|
|
, "push_whitelist_usernames" :: Array String
|
|
, "require_signed_commits" :: Boolean
|
|
, "required_approvals" :: Int
|
|
, "status_check_contexts" :: Maybe (Array String)
|
|
, "unprotected_file_patterns" :: String
|
|
| r
|
|
)
|
|
|
|
type BranchProtectionMutableOnCreate r =
|
|
( "rule_name" :: BranchProtectionName
|
|
| r
|
|
)
|
|
|
|
type BranchProtectionImmutable r =
|
|
( "updated_at" :: String
|
|
, "created_at" :: String
|
|
| r
|
|
)
|
|
|
|
type BranchProtectionCreate = (BranchProtectionMutable + BranchProtectionMutableOnCreate ())
|
|
type BranchProtectionUpdate = BranchProtectionMutable ()
|
|
type BranchProtection = (BranchProtectionMutable + BranchProtectionImmutable + BranchProtectionMutableOnCreate ())
|