Add models for Gitea webhooks

This commit is contained in:
2026-04-29 19:17:58 +02:00
parent d66875cae3
commit 1b26f5c86f
3 changed files with 102 additions and 1 deletions
+2 -1
View File
@@ -5,4 +5,5 @@
### Added
- Add basic API structure
- Add configuration file template
- Add configuration file template
- Add models for Gitea webhooks
@@ -0,0 +1,19 @@
# Copyright 2026 jCloud Services GbR
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import gitea
__all__ = [
'gitea'
]
@@ -0,0 +1,81 @@
# Copyright 2026 jCloud Services GbR
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pydantic import BaseModel, HttpUrl
from typing import Optional, List
from datetime import datetime
__all__ = [
'User',
'Repository',
'ReleaseAsset',
'Release',
'ReleaseEvent'
]
class User(BaseModel):
id: int
login: str
username: Optional[str] = None
full_name: Optional[str] = None
email: Optional[str] = None
class Config:
extra = 'allow'
class Repository(BaseModel):
id: int
name: str
full_name: str
clone_url: Optional[HttpUrl] = None
default_branch: Optional[str] = None
class Config:
extra = 'allow'
class ReleaseAsset(BaseModel):
id: int
name: str
size: Optional[int] = None
download_count: Optional[int] = None
browser_download_url: Optional[HttpUrl] = None
class Config:
extra = 'allow'
class Release(BaseModel):
id: int
tag_name: str
target_commitish: Optional[str] = None
name: Optional[str] = None
body: Optional[str] = None
draft: bool
prerelease: bool
created_at: Optional[datetime] = None
published_at: Optional[datetime] = None
author: Optional[User] = None
assets: Optional[List[ReleaseAsset]] = None
class Config:
extra = 'allow'
class ReleaseEvent(BaseModel):
action: str # 'published', 'created', ...
release: Release
repository: Repository
sender: User
class Config:
extra = 'allow'