diff --git a/aiosnow/models/attachment/model.py b/aiosnow/models/attachment/model.py index ad9cb3d..a04a284 100644 --- a/aiosnow/models/attachment/model.py +++ b/aiosnow/models/attachment/model.py @@ -1,7 +1,7 @@ import asyncio from concurrent.futures import ThreadPoolExecutor from mimetypes import guess_type -from typing import Union +from typing import Union, Any from aiosnow.query import Condition, Selector from aiosnow.request import Response, methods @@ -11,22 +11,20 @@ from .schema import AttachmentModelSchema -class AttachmentModel(BaseTableModel): +class AttachmentModel(BaseTableModel, AttachmentModelSchema): """Attachment API Model""" - schema_cls = AttachmentModelSchema - - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any): self.io_pool_exc = ThreadPoolExecutor(max_workers=10) self.loop = asyncio.get_running_loop() super(AttachmentModel, self).__init__(*args, **kwargs) - async def create(self, *_) -> None: + async def create(self, payload: dict) -> Response: raise AttributeError( "Attachment doesn't support create(), use upload() instead" ) - async def update(self, *_) -> None: + async def update(self, selection: Union[Condition, str], payload: dict) -> Response: raise AttributeError("Attachment doesn't support update()") @property diff --git a/aiosnow/models/table/model.py b/aiosnow/models/table/model.py index 6cfb336..f82ce7a 100644 --- a/aiosnow/models/table/model.py +++ b/aiosnow/models/table/model.py @@ -5,12 +5,13 @@ from aiosnow.models.attachment.file import FileHandler from aiosnow.query import Condition, Selector from aiosnow.request import Response +from aiosnow.client import Client from .._base.table import BaseTableModel class TableModel(BaseTableModel): - def __init__(self, client, **kwargs): + def __init__(self, client: Client, **kwargs: Any): self._attachment = AttachmentModel(client, table_name=kwargs.get("table_name")) super(TableModel, self).__init__(client, **kwargs)