新增
`Server.apply` 方法现在能可以接受满足 `Provider` 或 `Router` 协议的类
`Provider` 是负责推送事件,以及ws连接时鉴权的类:
python
class Provider(Protocol):
def publisher(self) -> AsyncIterator[Event]:
...
def authenticate(self, token: str) -> bool:
...
async def get_logins(self) -> list[Login]:
...
`Router` 是负责接口响应的类:
python
class Router(Protocol):
def validate_headers(self, headers: dict[str, Any]) -> bool:
...
async def call_api(self, request: Request[Api]) -> Any:
...
async def call_internal_api(self, request: Request[str]) -> Any:
...
显然, `Adapter` 同时满足上述协议
改进
- `server` 现在会对内部接口的请求做单独处理
**Full Changelog**: https://github.com/RF-Tar-Railt/satori-python/compare/v0.5.0...v0.6.0