Release v2
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from nyekiapi.lib.integrations import Profile
|
||||
|
||||
|
||||
class ProfileSchema(BaseModel):
|
||||
id: str = Field(
|
||||
..., description="The unique identifier of the profile at the source."
|
||||
)
|
||||
url: str = Field(..., description="The URL of the profile at the source.")
|
||||
name: str = Field(..., description="The display name of the profile at the source.")
|
||||
username: str = Field(..., description="The username of the profile at the source.")
|
||||
avatar_url: str = Field(
|
||||
..., description="The avatar URL of the profile at the source."
|
||||
)
|
||||
banner_url: str | None = Field(
|
||||
None, description="The banner URL of the profile at the source."
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_integration(cls, profile: Profile) -> "ProfileSchema":
|
||||
return cls(
|
||||
id=profile.id,
|
||||
url=profile.url,
|
||||
name=profile.name,
|
||||
username=profile.username,
|
||||
avatar_url=profile.avatar_url,
|
||||
banner_url=profile.banner_url,
|
||||
)
|
||||
Reference in New Issue
Block a user