Skip to content

Commit 30f505e

Browse files
committed
use posts API v1 instead of v0
1 parent 0f69c06 commit 30f505e

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/aleph/sdk/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ async def get_posts(
616616
end_date = end_date.timestamp()
617617
params["endDate"] = end_date
618618

619-
async with self.http_session.get("/api/v0/posts.json", params=params) as resp:
619+
async with self.http_session.get("/api/v1/posts.json", params=params) as resp:
620620
resp.raise_for_status()
621621
response_json = await resp.json()
622622
posts_raw = response_json["posts"]

src/aleph/sdk/models.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from typing import Any, Dict, List, Optional, Union
1+
from datetime import datetime
2+
from typing import Any, Dict, List, Optional
23

3-
from aleph_message.models import AlephMessage, BaseMessage, ChainRef, ItemHash
4+
from aleph_message.models import AlephMessage, ItemHash
45
from pydantic import BaseModel, Field
56

67

@@ -18,29 +19,28 @@ class MessagesResponse(PaginationResponse):
1819
pagination_item = "messages"
1920

2021

21-
class Post(BaseMessage):
22+
class Post(BaseModel):
2223
"""
2324
A post is a type of message that can be updated. Over the get_posts API
2425
we get the latest version of a post.
2526
"""
2627

27-
hash: ItemHash = Field(description="Hash of the content (sha256 by default)")
28+
item_hash: ItemHash = Field(description="Hash of the content (sha256 by default)")
29+
content: Dict[str, Any] = Field(
30+
description="The content.content of the POST message"
31+
)
2832
original_item_hash: ItemHash = Field(
2933
description="Hash of the original content (sha256 by default)"
3034
)
31-
original_signature: Optional[str] = Field(
32-
description="Cryptographic signature of the original message by the sender"
33-
)
3435
original_type: str = Field(
3536
description="The original, user-generated 'content-type' of the POST message"
3637
)
37-
content: Dict[str, Any] = Field(
38-
description="The content.content of the POST message"
39-
)
40-
type: str = Field(description="The content.type of the POST message")
4138
address: str = Field(description="The address of the sender of the POST message")
42-
ref: Optional[Union[str, ChainRef]] = Field(
43-
description="Other message referenced by this one"
39+
ref: Optional[str] = Field(description="Other message referenced by this one")
40+
channel: str = Field(description="The channel where the POST message was published")
41+
created: datetime = Field(description="The time when the POST message was created")
42+
last_updated: datetime = Field(
43+
description="The time when the POST message was last updated"
4444
)
4545

4646

0 commit comments

Comments
 (0)