redditwarp.siteprocs.custom_feed.SYNC#

class redditwarp.siteprocs.custom_feed.SYNC.CustomFeedProcedures(client: Client)[source]#

Bases: object

fetch(user: str, feed: str) CustomFeed[source]#

Fetch a custom feed resource.

Parameters:
  • user (str) – A user name.

  • feed (str) – Custom feed name.

Return type:

CustomFeed

Raises:

redditwarp.exceptions.RedditError

  • MULTI_NOT_FOUND:

    The custom feed specified doesn’t exist or you don’t have permission to view it.

get(user: str, feed: str) CustomFeed | None[source]#

Get a custom feed resource.

Returns None if the custom feed was not found.

Parameters:
  • user (str) – A user name.

  • feed (str) – Custom feed name.

Return type:

Optional[CustomFeed]

retrieve_mine() Sequence[CustomFeed][source]#

Fetch a list of custom feeds curated by the current user.

Return type:

Sequence[CustomFeed]

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

retrieve_yours(user: str) Sequence[CustomFeed][source]#

Fetch a list of custom feeds curated by a given user.

Parameters:

user (Optional[str]) – The user in which to retrieve custom feeds for.

Return type:

Sequence[CustomFeed]

Raises:

redditwarp.exceptions.RedditError

  • USER_DOESNT_EXIST:

    The specified user does not exist.

retrieve(user: str | None = None) Sequence[CustomFeed][source]#

Fetch a list of custom feeds.

Calls retrieve_yours() if the parameter is specified, else calls retrieve_mine().

create(user: str, feed: str, *, title: str | None = None, description: str | None = None, subreddit_names: Sequence[str] = (), exposed: bool = False) CustomFeed[source]#

Create a custom feed.

Parameters:
  • user (str) –

  • feed (str) –

  • title (Optional[str]) –

    Title.

    No longer than 50 characters.

    If null, feed name is used.

  • description (Optional[str]) –

    Markdown description text.

    Defaults to empty string.

  • subreddit_names (Sequence[str]) – A list of subreddit names to include in the custom feed.

  • exposed (bool) – Whether the custom feed is publicly accessible.

Returns:

The newly created custom feed.

Return type:

CustomFeed

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • MULTI_CANNOT_EDIT:
    • The username specified does not exist.

    • You don’t have permission to create a custom feed there.

  • MULTI_EXISTS:

    The custom feed already exists.

  • TOO_LONG:

    The text specified by title is over 50 characters.

put(user: str, feed: str, *, title: str | None = None, description: str | None = None, subreddit_names: Sequence[str] = (), exposed: bool = False) CustomFeed[source]#

Create or update a custom feed.

Behaves similar to create().

Parameters:
  • user (str) –

  • feed (str) –

  • title (Optional[str]) –

  • description (Optional[str]) –

  • subreddit_names (Sequence[str]) –

  • exposed (bool) –

Returns:

The created/updated created custom feed.

Return type:

CustomFeed

(raises):

Similar to create(), but RedditError('MULTI_EXISTS') is not possible.

delete(user: str, feed: str) None[source]#

Delete a custom feed.

Parameters:
  • user (str) –

  • feed (str) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • MULTI_NOT_FOUND:
    • The custom feed name specified does not exist.

    • The username specified does not exist.

  • MULTI_CANNOT_EDIT:

    You don’t have permission to delete the specified custom feed because it does not belong to you.

copy(src_user: str, src_feed: str, dst_user: str, dst_feed: str, *, title: str | None = None, description: str | None = None) CustomFeed[source]#

Copy a custom feed.

The description for the new custom feed will be like “copied from u/spez” etc. unless overridden by the description parameter.

Parameters:
  • src_user (str) –

  • src_feed (str) –

  • dst_user (str) –

  • dst_feed (str) –

Returns:

The newly created custom feed.

Return type:

CustomFeed

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • MULTI_NOT_FOUND:

    The source custom feed was not found.

  • BAD_MULTI_PATH:

    The destination path was not valid.

  • MULTI_EXISTS:

    The destination custom feed already exists.

  • TOO_LONG:

    The text specified by title is over 50 characters.

contains(user: str, feed: str, sr_name: str) bool[source]#

Tell if a subreddit is in a custom feed.

Parameters:
  • user (str) –

  • feed (str) –

  • sr_name (str) – Subreddit name.

Return type:

bool

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • MULTI_NOT_FOUND:

    The custom feed does not exist.

add_item(user: str, feed: str, sr_name: str) None[source]#

Add a subreddit to a custom feed.

The user parameter does not have to match the current user’s name! If the user name refers to a user that exists and the feed name you specify exists on that user, you’ll get a MULTI_CANNOT_EDIT API error. If the username or feed name you specify doesn’t exist, the custom feed will be created, seemingly under that user’s name, but the custom feed will only be visible to you.

If the specified feed name doesn’t exist, it will be created.

Parameters:
  • user (str) –

  • feed (str) –

  • sr_name (str) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • SUBREDDIT_NOEXIST:

    The specified subreddit does not exist.

  • MULTI_CANNOT_EDIT:

    The target custom feed exists and you don’t have permission to add to it.

bulk_add_items(user: str, feed: str, sr_names: Iterable[str]) CallChunkCallingIterator[None][source]#

Bulk add subreddits to a custom feed.

If any of the subreddit names in sr_names doesn’t exist, the request will fail with a 500 HTTP error and none of the subreddits will be added.

Parameters:
  • user (str) –

  • feed (str) –

  • sr_names (Iterable[str]) –

Return type:

~.iterators.call_chunk_calling_iterator.CallChunkCallingIterator[None]

Raises:
remove_item(user: str, feed: str, sr_name: str) None[source]#

Remove a subreddit from a custom feed.

Parameters:
  • user (str) –

  • feed (str) –

  • sr_name (str) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • MULTI_NOT_FOUND:
    • The specified username does not exist.

    • The specified custom feed name does not exist.

  • MULTI_CANNOT_EDIT:

    You don’t have permission.