Skip to content

oldas.subscriptions

Provides a class for getting subscription information.

Categories

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

Bases: OldList[Category]

Holds a collection of categories.

__contains__

__contains__(data: Category | Folder | str) -> bool

Check if some data is in the categories.

Parameters:

Name Type Description Default

data

Category | Folder | str

The category, folder or string to look for.

required

Returns:

Type Description
bool

True if the data was found, False if not.

Category dataclass

Category(id: str, label: str)

Holds details of a category.

id instance-attribute

id: str

The ID for the category.

label instance-attribute

label: str

The label for the category.

from_json classmethod

from_json(data: RawData) -> Category

Load the category from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the category from.

required

Returns:

Type Description
Category

The category.

SubscribeResult dataclass

SubscribeResult(
    query: str,
    number_of_results: int,
    stream_id: str | None,
    error: str | None,
)

Class that holds the request of adding a subscription.

error instance-attribute

error: str | None

The reason why the subscribe failed, if it did.

failed property

failed: bool

Did the request to subscribe fail?

number_of_results instance-attribute

number_of_results: int

The number of requests from the query to add.

query instance-attribute

query: str

The query that was performed.

stream_id instance-attribute

stream_id: str | None

The stream ID if the subscription took place.

succeeded property

succeeded: bool

Did the request to subscribe succeed?

__bool__

__bool__() -> bool

The bool of a SubscribeResult is if it succeeded.

from_json classmethod

from_json(data: RawData) -> SubscribeResult

Load the subscribe result from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the subscribe result from.

required

Returns:

Type Description
SubscribeResult

The result of making the subscribe request.

Subscription dataclass

Subscription(
    id: str,
    title: str,
    sort_id: str,
    first_item_time: datetime,
    url: str,
    html_url: str,
    categories: Categories,
)

Holds a subscription.

categories instance-attribute

categories: Categories

The categories for the subscription.

first_item_time instance-attribute

first_item_time: datetime

The time of the first item.

folder_id property

folder_id: str | None

The ID of the folder that this subscription belongs to

Note

Will be None if it is outside any folder.

According to the API documentation it would appear that a subscription could be a member of multiple folders. Note that this property is the ID of the first folder that could be found amongst the categories.

html_url instance-attribute

html_url: str

The HTML URL of the subscription.

id instance-attribute

id: str

The ID of the subscription.

sort_id instance-attribute

sort_id: str

The sort ID of the subscription.

title instance-attribute

title: str

The title of the subscription.

url instance-attribute

url: str

The URL of the subscription.

from_json classmethod

from_json(data: RawData) -> Subscription

Load the subscription from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the subscription from.

required

Returns:

Type Description
Subscription

The subscription.

Subscriptions

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

Bases: OldList[Subscription]

Loads and holds the full list of subscriptions.

add async staticmethod

Add a subscription.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

feed

str

The feed to subscribe to.

required

Returns:

Type Description
SubscribeResult
Notes

The feed will normally be the URL of the feed to subscribe to.

full_id staticmethod

Get the full ID for a given subscription.

Parameters:

Name Type Description Default

subscription

str | Subscription

The subscription to get the full ID for.

required

Returns:

Type Description
str

The full ID for the subscription.

load async classmethod

Load the subscriptions.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
Subscriptions

A list of subscriptions.

move async classmethod

Move a subscription to a different folder.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

subscription

str | Subscription

The subscription to move.

required

target_folder

str | Folder | None

The folder to move the subscription to.

None

Returns:

Type Description
bool

True if the move call worked, False if not.

Note

If target_folder is omitted, is None, or is an empty string, the subscription will be moved to the top-level default folder.

remove async classmethod

Remove a subscription.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

subscription

str | Subscription

The subscription to unsubscribe.

required

Returns:

Type Description
bool

True if the unsubscribe call worked, False if not.

Note

The subscription can either be a string that is the ID of a feed, or it can be a Subscription object.

rename async classmethod

Rename a subscription.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

subscription

str | Subscription

The subscription to rename.

required

new_name

str

The new name for the subscription.

required

Returns:

Type Description
bool

True if the rename call worked, False if not.

Note

The subscription can either be a string that is the ID of a feed, or it can be a Subscription object.