feat: implement cdn mirrors endpoints, closes #15 (#17)

* feat: add cdn mirror endpoints

* refactor: change API version in docs

* docs: fix titles on API docs page
This commit is contained in:
Alexandre Teles
2022-10-13 01:06:50 -03:00
committed by GitHub
parent 24d78709fc
commit 4cb02c55ea
7 changed files with 345 additions and 24 deletions

View File

@ -48,4 +48,24 @@ class Unauthorized(BaseModel):
"""
error: str = "Unauthorized"
message: str = "The client is unauthorized to access this resource"
message: str = "The client is unauthorized to access this resource"
class MirrorNotFoundError(BaseModel):
"""Implements the response fields for when a mirror is not found.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
error: str = "Not Found"
message: str = "No mirror was found for the organization, repository, and version provided."
class MirrorAlreadyExistsError(BaseModel):
"""Implements the response fields for when a mirror already exists.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
error: str = "Conflict"
message: str = "A mirror already exists for the organization, repository, and version provided. Please use the PUT method to update the mirror."

View File

@ -0,0 +1,52 @@
from pydantic import BaseModel
class MirrorModel(BaseModel):
"""Implements the response fields for the CDN mirror.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
repository: str
version: str
cid: str
filenames: list[str]
class MirrorStoreModel(BaseModel):
"""Implements the fields for storing CDN mirror information.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
cid: str
filenames: list[str]
class MirrorCreatedResponseModel(BaseModel):
"""Implements the response fields for stored CDN mirrors.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
created: bool
key: str
class MirrorUpdatedResponseModel(BaseModel):
"""Implements the response fields for updated CDN mirrors.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
updated: bool
key: str
class MirrorDeletedResponseModel(BaseModel):
"""Implements the response fields for deleted CDN mirrors.
Args:
BaseModel (pydantic.BaseModel): BaseModel from pydantic
"""
deleted: bool
key: str