oldas.subscriptions
Provides a class for getting subscription information.
Categories
Holds a collection of categories.
__contains__
Category
dataclass
Holds details of a category.
SubscribeResult
dataclass
Class that holds the request of adding a subscription.
number_of_results
instance-attribute
number_of_results: int
The number of requests from the query to add.
from_json
classmethod
from_json(data: RawData) -> SubscribeResult
Load the subscribe result from JSON data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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.
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.
from_json
classmethod
from_json(data: RawData) -> Subscription
Load the subscription from JSON data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
RawData
|
The data to load the subscription from. |
required |
Returns:
| Type | Description |
|---|---|
Subscription
|
The subscription. |
Subscriptions
Bases: OldList[Subscription]
Loads and holds the full list of subscriptions.
add
async
staticmethod
add(session: Session, feed: str) -> SubscribeResult
Add a subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
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
full_id(subscription: str | Subscription) -> str
Get the full ID for a given subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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(session: Session) -> Subscriptions
Load the subscriptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
Returns:
| Type | Description |
|---|---|
Subscriptions
|
A list of subscriptions. |
move
async
classmethod
move(
session: Session,
subscription: str | Subscription,
target_folder: str | Folder | None = None,
) -> bool
Move a subscription to a different folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
str | Subscription
|
The subscription to move. |
required |
|
str | Folder | None
|
The folder to move the subscription to. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
remove
async
classmethod
remove(
session: Session, subscription: str | Subscription
) -> bool
Remove a subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
str | Subscription
|
The subscription to unsubscribe. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
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(
session: Session,
subscription: str | Subscription,
new_name: str,
) -> bool
Rename a subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
str | Subscription
|
The subscription to rename. |
required |
|
str
|
The new name for the subscription. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Note
The subscription can either be a string that is the ID of a feed, or
it can be a Subscription object.