Skip to content

Commit

Permalink
more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Aug 19, 2024
1 parent 3137940 commit 61a8de2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
36 changes: 31 additions & 5 deletions kscale/store/gen/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Auto-generated by kscale/store/gen/generate.sh"""

# generated by datamodel-codegen:
# filename: openapi.json
# timestamp: 2024-08-19T03:45:20+00:00
# timestamp: 2024-08-19T06:06:06+00:00

from __future__ import annotations

Expand Down Expand Up @@ -69,6 +71,17 @@ class GoogleLogin(BaseModel):
token: str = Field(..., title="Token")


class Permission(Enum):
read = "read"
write = "write"
admin = "admin"


class KeysResponseItem(BaseModel):
token: str = Field(..., title="Token")
permissions: Optional[List[Permission]] = Field(..., title="Permissions")


class ArtifactType(Enum):
image = "image"

Expand Down Expand Up @@ -105,6 +118,10 @@ class ListArtifactsResponse(BaseModel):
artifacts: List[ListArtifactsItem] = Field(..., title="Artifacts")


class ListKeysResponse(BaseModel):
keys: List[KeysResponseItem] = Field(..., title="Keys")


class ListListingsResponse(BaseModel):
listing_ids: List[str] = Field(..., title="Listing Ids")
has_next: Optional[bool] = Field(False, title="Has Next")
Expand Down Expand Up @@ -136,7 +153,7 @@ class LoginResponse(BaseModel):
token: str = Field(..., title="Token")


class Permission(Enum):
class Permission1(Enum):
is_admin = "is_admin"


Expand All @@ -145,7 +162,16 @@ class MyUserInfoResponse(BaseModel):
email: str = Field(..., title="Email")
github_id: Optional[str] = Field(..., title="Github Id")
google_id: Optional[str] = Field(..., title="Google Id")
permissions: Optional[List[Permission]] = Field(..., title="Permissions")
permissions: Optional[List[Permission1]] = Field(..., title="Permissions")


class NewKeyRequest(BaseModel):
readonly: Optional[bool] = Field(True, title="Readonly")


class NewKeyResponse(BaseModel):
user_id: str = Field(..., title="User Id")
key: KeysResponseItem


class NewListingRequest(BaseModel):
Expand All @@ -161,7 +187,7 @@ class NewListingResponse(BaseModel):
class PublicUserInfoResponseItem(BaseModel):
id: str = Field(..., title="Id")
email: str = Field(..., title="Email")
permissions: Optional[List[Permission]] = Field(None, title="Permissions")
permissions: Optional[List[Permission1]] = Field(None, title="Permissions")
created_at: Optional[int] = Field(None, title="Created At")
updated_at: Optional[int] = Field(None, title="Updated At")
first_name: Optional[str] = Field(None, title="First Name")
Expand Down Expand Up @@ -208,7 +234,7 @@ class UserInfoResponseItem(BaseModel):
class UserPublic(BaseModel):
id: str = Field(..., title="Id")
email: str = Field(..., title="Email")
permissions: Optional[List[Permission]] = Field(None, title="Permissions")
permissions: Optional[List[Permission1]] = Field(None, title="Permissions")
created_at: Optional[int] = Field(None, title="Created At")
updated_at: Optional[int] = Field(None, title="Updated At")
first_name: Optional[str] = Field(None, title="First Name")
Expand Down
5 changes: 5 additions & 0 deletions kscale/store/gen/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
openapi_url="https://api.kscale.store/openapi.json"
curl -s $openapi_url > openapi.json
datamodel-codegen --input openapi.json --input-file-type openapi --output api.py

# Prepends docstring.
echo "\"\"\"Auto-generated by kscale/store/gen/generate.sh\"\"\"\n" | cat - api.py > temp && mv temp api.py
black api.py
ruff format api.py

0 comments on commit 61a8de2

Please sign in to comment.