Skip to content

Commit

Permalink
format and fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
MHHukiewitz committed Sep 6, 2023
1 parent 93d1e2e commit ba18628
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/aleph/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
MessageNotFoundError,
MultipleMessagesError,
)
from .models import MessagesResponse, PostsResponse, Post
from .models import MessagesResponse, Post, PostsResponse
from .utils import check_unix_socket_valid, get_message_type_value

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -722,7 +722,7 @@ async def get_messages(
pagination: int = 200,
page: int = 1,
message_type: Optional[MessageType] = None,
message_types: Optional[List[MessageType]] = None,
message_types: Optional[Iterable[MessageType]] = None,
content_types: Optional[Iterable[str]] = None,
content_keys: Optional[Iterable[str]] = None,
refs: Optional[Iterable[str]] = None,
Expand Down
21 changes: 15 additions & 6 deletions src/aleph/sdk/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional, Any, Dict, Union
from typing import Any, Dict, List, Optional, Union

from aleph_message.models import AlephMessage, BaseMessage, ItemHash, ChainRef
from aleph_message.models import AlephMessage, BaseMessage, ChainRef, ItemHash
from pydantic import BaseModel, Field


Expand All @@ -23,16 +23,25 @@ class Post(BaseMessage):
A post is a type of message that can be updated. Over the get_posts API
we get the latest version of a post.
"""

hash: ItemHash = Field(description="Hash of the content (sha256 by default)")
original_item_hash: ItemHash = Field(description="Hash of the original content (sha256 by default)")
original_item_hash: ItemHash = Field(
description="Hash of the original content (sha256 by default)"
)
original_signature: Optional[str] = Field(
description="Cryptographic signature of the original message by the sender"
)
original_type: str = Field(description="The original, user-generated 'content-type' of the POST message")
content: Dict[str, Any] = Field(description="The content.content of the POST message")
original_type: str = Field(
description="The original, user-generated 'content-type' of the POST message"
)
content: Dict[str, Any] = Field(
description="The content.content of the POST message"
)
type: str = Field(description="The content.type of the POST message")
address: str = Field(description="The address of the sender of the POST message")
ref: Optional[Union[str, ChainRef]] = Field(description="Other message referenced by this one")
ref: Optional[Union[str, ChainRef]] = Field(
description="Other message referenced by this one"
)


class PostsResponse(PaginationResponse):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_asynchronous_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest.mock import AsyncMock

import pytest
from aleph_message.models import MessagesResponse, MessageType
from aleph_message.models import MessagesResponse

from aleph.sdk.client import AlephClient
from aleph.sdk.conf import settings
Expand Down

0 comments on commit ba18628

Please sign in to comment.