Skip to content

oldas.article_ids

Provides code for working with lists of article IDs.

ArticleID dataclass

ArticleID(
    article_id: str,
    direct_stream_ids: list[str],
    timestamp: datetime,
)

Holds an article ID.

article_id instance-attribute

article_id: str

The article ID.

direct_stream_ids instance-attribute

direct_stream_ids: list[str]

The direct stream IDs.

full_id property

full_id: str

The full, prefixed, ID for the article.

timestamp instance-attribute

timestamp: datetime

The timestamp associated with the article ID.

from_json classmethod

from_json(data: RawData) -> ArticleID

Load the article ID from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the article ID from.

required

Returns:

Type Description
ArticleID

The article ID.

ArticleIDs

ArticleIDs(data: Iterable[OldData] | None = None)

Bases: OldList[ArticleID]

Loads and holds article ID list.

full_ids property

full_ids: list[str]

The list of article IDs.

Note

This is a list of strings where each string is a full article ID.

load async classmethod

load(
    session: Session, state: State, **filters: Any
) -> ArticleIDs

Load article IDs.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

state

State

The State to stream.

required

filters

Any

Any addition filter values.

{}

Returns:

Type Description
ArticleIDs

The list of matching article IDs.

load_read async classmethod

load_read(session: Session) -> ArticleIDs

Load the list of IDs for all read articles.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
ArticleIDs

The list of read article IDs.

load_unread async classmethod

load_unread(session: Session) -> ArticleIDs

Load the list of IDs for all unread articles.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
ArticleIDs

The list of unread article IDs.

mark_read async

mark_read(session: Session) -> bool

Mark all the articles as read.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
bool

True if the request to mark as read worked,

bool

False if not.

mark_unread async

mark_unread(session: Session) -> bool

Mark all the articles as unread.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
bool

True if the request to mark as unread worked,

bool

False if not.

stream async classmethod

stream(
    session: Session, state: State, **filters: Any
) -> AsyncIterator[ArticleID]

Stream article IDs.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

state

State

The State to stream.

required

Yields:

Type Description
AsyncIterator[ArticleID]