mirror of
https://github.com/ihabunek/toot.git
synced 2024-09-22 04:25:55 -04:00
wip
This commit is contained in:
parent
4f0c367995
commit
49ff138615
@ -161,6 +161,14 @@ def fetch_status(app, user, id):
|
||||
return http.get(app, user, f"/api/v1/statuses/{id}").json()
|
||||
|
||||
|
||||
def scheduled_status(app, user, id):
|
||||
"""
|
||||
Return a scheduled status by id
|
||||
https://docs.joinmastodon.org/methods/scheduled_statuses/#get-one
|
||||
"""
|
||||
return http.get(app, user, f"/api/v1/scheduled_statuses/{id}").json()
|
||||
|
||||
|
||||
def scheduled_statuses(app, user):
|
||||
"""
|
||||
List scheduled statuses
|
||||
|
@ -77,6 +77,33 @@ def thread(app, user, args):
|
||||
print_timeline(thread)
|
||||
|
||||
|
||||
def scheduled(app, user, args):
|
||||
if args.id:
|
||||
_show_scheduled(app, user, args.id)
|
||||
else:
|
||||
_list_scheduled(app, user)
|
||||
|
||||
|
||||
def _list_scheduled(app, user):
|
||||
statuses = api.scheduled_statuses(app, user)
|
||||
for status in statuses:
|
||||
print_scheduled(status)
|
||||
|
||||
|
||||
def _show_scheduled(app, user, id):
|
||||
status = api.scheduled_status(app, user, id)
|
||||
print_scheduled_full(status)
|
||||
|
||||
|
||||
def print_scheduled(status):
|
||||
print_out(f'{status["id"]}')
|
||||
|
||||
|
||||
def print_scheduled_full(status):
|
||||
print_out(f'ID: {status["id"]}')
|
||||
print_out(f'Scheduled at: {status["scheduled_at"]}')
|
||||
|
||||
|
||||
def post(app, user, args):
|
||||
if args.editor and not sys.stdin.isatty():
|
||||
raise ConsoleError("Cannot run editor if not in tty.")
|
||||
|
@ -317,6 +317,19 @@ READ_COMMANDS = [
|
||||
arguments=timeline_args,
|
||||
require_auth=True,
|
||||
),
|
||||
Command(
|
||||
name="scheduled",
|
||||
description="Show pending scheduled statuses",
|
||||
arguments=[
|
||||
(["id"], {
|
||||
"help": "Optional status ID, to show a single scheduled "
|
||||
"status, omit to list all",
|
||||
"type": str,
|
||||
"nargs": "?",
|
||||
})
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
]
|
||||
|
||||
POST_COMMANDS = [
|
||||
|
Loading…
Reference in New Issue
Block a user