from typing import Any, Callable, Dict, List, Optional, Protocol, TypeVar
from typing_extensions import ParamSpec
from colander import SchemaNode
from pyramid.request import Request
from cowbird.typedefs import JSON, AnyResponseType
[docs]
ViewCallableParam = ParamSpec("ViewCallableParam")
[docs]
ViewCallableType = TypeVar("ViewCallableType", bound=Callable[[Request], AnyResponseType])
[docs]
ViewCallableDecorator = Callable[[Request], AnyResponseType]
[docs]
ViewCallableService = Callable[[ViewCallableDecorator], ViewCallableDecorator]
# class ViewService(Protocol):
# def __call__(
# self,
# view: Callable[ViewCallableParam, ViewCallableType],
# ) -> Callable[ViewCallableParam, ViewCallableType]: ...
[docs]
class Service:
def __init__(
self,
name: str,
path: Optional[str] = None,
description: Optional[str] = None,
cors_policy: Dict[str, str] = None,
pyramid_route: Optional[str] = None,
depth: int = 1,
**kwargs: Any,
) -> None: ...
@property
[docs]
def name(self) -> str: ...
@property
[docs]
def path(self) -> str: ...
@staticmethod
[docs]
def head(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...
@staticmethod
[docs]
def get(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...
@staticmethod
[docs]
def put(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...
@staticmethod
[docs]
def post(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...
@staticmethod
[docs]
def patch(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...
@staticmethod
[docs]
def delete(
*,
response_schemas: Dict[str, SchemaNode],
schema: Optional[SchemaNode] = None,
tags: Optional[List[str]] = None,
api_security: Optional[JSON] = None,
) -> ViewCallableService: ...