redditwarp.siteprocs.live_thread.SYNC#

class redditwarp.siteprocs.live_thread.SYNC.LiveThreadProcedures(client: Client)[source]#

Bases: object

get(idt: str) LiveThread | None[source]#

Get a live thread.

Parameters:

idt (str) –

Return type:

Optional[LiveThread]

bulk_fetch(idts: Iterable[str]) CallChunkChainingIterator[LiveThread][source]#

Bulk fetch live threads.

Entries are returned in the same order as specified.

If one of the IDs in a batch does not exist then a 500 HTTP error is returned.

Parameters:

idts (Iterable[str]) –

Return type:

CallChunkChainingIterator[LiveThread]

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 500:

    A specified ID does not exist.

create(title: str, description: str = '', resources: str = '', nsfw: bool = False) str[source]#

Create a live thread.

Parameters:
  • title (str) – Title. A string no longer than 120 characters.

  • description (str) –

    Description. Markdown text. This text is displayed under the title.

    Default: empty string.

  • resources (str) –

    The resources. Markdown text. This text is displayed on the sidebar.

    Default: empty string.

  • nsfw (bool) –

    Mark the live thread as NSFW.

    Default false.

Returns:

The ID of the newly created live thread.

Return type:

str

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • NO_TEXT:

    The specified title was empty.

  • RATELIMIT:

    You must wait one minute before creating another live thread.

config(idt: str, title: str, description: str = '', resources: str = '', nsfw: bool = False) None[source]#

Configure the live thread.

Requires the settings live thread permission.

All parameters must be specified otherwise they will be set to their effective defaults.

(parameters):

Same as create().

Return type:

None

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 403:
    • There is no user context.

    • You do not have the settings live thread permission.

    • You do not have permission.

  • 404:

    The specified live thread does not exist.

close(idt: str) None[source]#

Close a live thread.

This permanently closes the live thread, disallowing future updates.

Parameters:

idt (str) –

Return type:

None

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 403:
    • There is no user context.

    • You do not have the close permission.

    • The live thread is already closed.

  • 404:

    The specified live thread does not exist.

get_update(idt: str, uuid: str) LiveUpdate[source]#

Get a specific live update in a live thread.

Parameters:
  • idt (str) –

  • uuid (str) –

Return type:

None

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 404:

    The specified live thread ID or live update ID does not exist.

pull(idt: str, amount: int | None = None) ImpartedPaginatorChainingIterator[LiveUpdateListingPaginator, LiveUpdate][source]#

Pull live updates from a live thread.

Parameters:
  • idt (str) –

  • uuid (str) –

Return type:

ImpartedPaginatorChainingIterator[LiveUpdateListingPaginator, LiveUpdate]

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 404:

    The specified live thread does not exist.

create_update(idt: str, body: str) None[source]#

Post a live update to the thread.

Parameters:
  • idt (str) –

  • body (str) – Markdown text.

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • NO_TEXT:

    The body parameter was empty.

strike_update(idt: str, uuid: str) None[source]#

Strike the content of a live update.

Requires that specified update must have been authored by the user or that you have the edit permission.

Striken updates cannot be unstriken.

If an already striken item is striken it is treated as a success.

Parameters:
  • idt (str) –

  • uuid (str) –

Return type:

None

Raises:
delete_update(idt: str, uuid: str) None[source]#

Delete a live update.

Requires that specified update must have been authored by the current user or that you have the edit permission.

If an already deleted update is specified, the action will be treated as a success. But specifying a non-existing update ID will cause a NO_THING_ID API error.

Parameters:
  • idt (str) –

  • uuid (str) –

Return type:

None

Raises:
list_contributors(idt: str) ContributorList[source]#

Get a list of users that contribute to a thread.

Returns an object with a .contributors attribute containing a list of contributors, and a .invitations attribute containing a list of users that have been invited to be contributors.

The .invitations list will be empty if the current user does not have the manage live thread permission.

Parameters:

idt (str) –

Return type:

ContributorList

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 404:

    The live thread specified by idt does not exist.

send_contributor_invite(idt: str, user: str, permissions: Iterable[str]) None[source]#

Invite a user to contribute to the live thread.

Requires the manage live thread permission.

Parameters:
  • idt (str) –

  • user (str) –

  • permissions (Iterable[str]) –

    Values: empty string, all, close, discussions, edit, manage, settings, update.

    Default: empty string. On the interface it’ll say ‘no permissions’.

Return type:

None

Raises:
  • redditwarp.exceptions.RedditError

    • NO_USER:

      The user parameter was empty.

    • USER_DOESNT_EXIST:

      The specified user does not exist.

    • LIVEUPDATE_ALREADY_CONTRIBUTOR:

      The specified user is already a contributor or has already been invited.

    • INVALID_PERMISSIONS:

      An invalid permission was specified.

  • redditwarp.http.exceptions.StatusCodeException

    • 403:
      • There is no user context.

      • You do not have the manage permission.

    • 404:

      The specified live thread does not exist.

accept_contributor_invite(idt: str) None[source]#

Accept an invitation to contribute to a live thread.

Parameters:

idt (str) –

Return type:

None

Raises:
revoke_contributor_invite(idt: str, user_id: int | str) None[source]#

Revoke an outstanding contributor invite.

Requires the manage live thread permission.

If attempting to remove the invite for a user that was not invited, the action is treated as a success.

Parameters:
  • idt (str) –

  • user_id (Union[int, str]) –

Return type:

None

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 404:
    • There is no user context.

    • You do not have the manage permission.

    • You do not have permission.

leave_contributor(idt: str) None[source]#

Abdicate contributorship of the thread.

It is possible to leave a live thread and not have any contributors to it.

If leaving a live thread you were not a contributor to, the action is treated as a success.

Parameters:

idt (str) –

Return type:

None

Raises:
remove_contributor(idt: str, user_id: int) None[source]#

Revoke another user’s contributorship.

Requires the manage live thread permission.

It is possible to remove your own contributorship, having the same effect as leave_contributor().

If attempting to remove the invite for a user that was not invited, the action is treated as a success.

Parameters:
  • idt (str) –

  • user_id (int) –

Return type:

None

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 403: - There is no user context. - You are not a contributor to the live thread that has the manage permission.

  • 404:

    The specified live thread does not exist.

  • 500:

    The specified user was invalid.

set_contributor_permissions(idt: str, user: str, permissions: Iterable[str]) None[source]#

Change a contributor’s permissions.

Requires the manage live thread permission.

Parameters:
Return type:

None

Raises:
  • redditwarp.exceptions.RedditError

    • USER_REQUIRED:

      There is no user context.

    • NO_USER:

      The user parameter was empty.

    • USER_DOESNT_EXIST:

      The specified user does not exist.

    • INVALID_PERMISSIONS:

      An invalid permission was specified.

    • LIVEUPDATE_NOT_CONTRIBUTOR:

      The specified user is not a contributor.

  • redditwarp.http.exceptions.StatusCodeException

    • 403: - There is no user context. - You do not have the manage live thread permission.

    • 404:

      The specified live thread does not exist.

set_contributor_invite_permissions(idt: str, user: str, permissions: Iterable[str]) None[source]#

Change a contributor invite’s permissions.

Parameters:
Return type:

None

Raises:
  • redditwarp.exceptions.RedditError

    • USER_REQUIRED:

      There is no user context.

    • NO_USER:

      The user parameter was empty.

    • USER_DOESNT_EXIST:

      The specified user does not exist.

    • INVALID_PERMISSIONS:

      An invalid permission was specified.

    • LIVEUPDATE_NO_INVITE_FOUND:

      The specified user does not have an invite.

  • redditwarp.http.exceptions.StatusCodeException

    • 403: - There is no user context. - You do not have the manage live thread permission.

    • 404:

      The specified live thread does not exist.