-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from lsst-sqre/u/jsickcodes/v2-only-api
Move root and auth endpoints out of v1 blueprint
- Loading branch information
Showing
9 changed files
with
78 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from flask import Blueprint | ||
|
||
apiroot = Blueprint("apiroot", __name__) | ||
|
||
from . import auth, root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""Pydantic Models for the root API endpoints.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from pydantic import BaseModel, HttpUrl, SecretStr | ||
|
||
|
||
class AuthTokenResponse(BaseModel): | ||
"""The auth token resource.""" | ||
|
||
token: SecretStr | ||
"""Token string. Use this token in the basic auth "username" field.""" | ||
|
||
class Config: | ||
json_encoders = { | ||
SecretStr: lambda v: v.get_secret_value() if v else None, | ||
} | ||
|
||
|
||
class RootLinks(BaseModel): | ||
"""Sub-resource containing links to APIs.""" | ||
|
||
self_url: HttpUrl | ||
"""The URL of this resource.""" | ||
|
||
token: HttpUrl | ||
"""The URL of the authorization endpoint to obtain a token.""" | ||
|
||
products: Optional[HttpUrl] = None | ||
"""The endpoint for the products listing.""" | ||
|
||
|
||
class RootData(BaseModel): | ||
"""Sub-resource providing metadata about the service.""" | ||
|
||
server_version: str | ||
"""The service vesion.""" | ||
|
||
documentation: HttpUrl | ||
"""The URL of the service's documentation.""" | ||
|
||
message: str | ||
"""Description of the service.""" | ||
|
||
|
||
class RootResponse(BaseModel): | ||
"""The root endpoint resources provides metadata and links for the | ||
service. | ||
""" | ||
|
||
data: RootData | ||
|
||
links: RootLinks |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters