init
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
"""Webhook payload schemas"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Any
|
||||
|
||||
|
||||
class GiteaPullRequest(BaseModel):
|
||||
"""Gitea pull request data"""
|
||||
id: int
|
||||
number: int
|
||||
title: str
|
||||
body: Optional[str] = None
|
||||
state: str
|
||||
user: Dict[str, Any]
|
||||
head: Dict[str, Any]
|
||||
base: Dict[str, Any]
|
||||
html_url: str
|
||||
|
||||
|
||||
class GiteaWebhook(BaseModel):
|
||||
"""Gitea webhook payload"""
|
||||
action: str = Field(..., description="Action type: opened, synchronized, closed, etc.")
|
||||
number: int = Field(..., description="Pull request number")
|
||||
pull_request: GiteaPullRequest
|
||||
repository: Dict[str, Any]
|
||||
sender: Dict[str, Any]
|
||||
|
||||
|
||||
class GitHubPullRequest(BaseModel):
|
||||
"""GitHub pull request data"""
|
||||
id: int
|
||||
number: int
|
||||
title: str
|
||||
body: Optional[str] = None
|
||||
state: str
|
||||
user: Dict[str, Any]
|
||||
head: Dict[str, Any]
|
||||
base: Dict[str, Any]
|
||||
html_url: str
|
||||
|
||||
|
||||
class GitHubWebhook(BaseModel):
|
||||
"""GitHub webhook payload"""
|
||||
action: str
|
||||
number: int
|
||||
pull_request: GitHubPullRequest
|
||||
repository: Dict[str, Any]
|
||||
sender: Dict[str, Any]
|
||||
|
||||
|
||||
class BitbucketPullRequest(BaseModel):
|
||||
"""Bitbucket pull request data"""
|
||||
id: int
|
||||
title: str
|
||||
description: Optional[str] = None
|
||||
state: str
|
||||
author: Dict[str, Any]
|
||||
source: Dict[str, Any]
|
||||
destination: Dict[str, Any]
|
||||
links: Dict[str, Any]
|
||||
|
||||
|
||||
class BitbucketWebhook(BaseModel):
|
||||
"""Bitbucket webhook payload"""
|
||||
pullrequest: BitbucketPullRequest
|
||||
repository: Dict[str, Any]
|
||||
actor: Dict[str, Any]
|
||||
|
||||
Reference in New Issue
Block a user