Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
85930ddb
Commit
85930ddb
authored
6 years ago
by
crokkon
Browse files
Options
Downloads
Patches
Plain Diff
Conveyor: adding draft handling
* save_draft() * list_drafts() * remove_draft()
parent
08d9e329
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beem/conveyor.py
+51
-0
51 additions, 0 deletions
beem/conveyor.py
with
51 additions
and
0 deletions
beem/conveyor.py
+
51
−
0
View file @
85930ddb
...
...
@@ -34,6 +34,11 @@ class Conveyor(object):
assigning tags to accounts (or other identifiers) and querying for
them.
"
Not contained in the documentation, but implemented and working:
* Draft handling: saving, listing and removing post drafts
consisting of a post title and a body.
The underlying RPC authentication and request signing procedure is
described here: https://github.com/steemit/rpc-auth
...
...
@@ -225,3 +230,49 @@ class Conveyor(object):
return
self
.
_conveyor_method
(
account
,
signing_account
,
"
conveyor.get_feature_flag
"
,
[
account
[
'
name
'
],
flag
])
def
save_draft
(
self
,
account
,
title
,
body
):
"""
Save a draft in the Conveyor database
:param str account: requested account
:param str title: draft post title
:param str body: draft post body
"""
account
=
Account
(
account
,
steem_instance
=
self
.
steem
)
draft
=
{
'
title
'
:
title
,
'
body
'
:
body
}
return
self
.
_conveyor_method
(
account
,
None
,
"
conveyor.save_draft
"
,
[
account
[
'
name
'
],
draft
])
def
list_drafts
(
self
,
account
):
"""
List all saved drafts from `account`
:param str account: requested account
Sample output:
.. code-block:: js
{
'
jsonrpc
'
:
'
2.0
'
,
'
id
'
: 2,
'
result
'
: [
{
'
title
'
:
'
draft-title
'
,
'
body
'
:
'
draft-body
'
,
'
uuid
'
:
'
06497e1e-ac30-48cb-a069-27e1672924c9
'
}
]
}
"""
account
=
Account
(
account
,
steem_instance
=
self
.
steem
)
return
self
.
_conveyor_method
(
account
,
None
,
"
conveyor.list_drafts
"
,
[
account
[
'
name
'
]])
def
remove_draft
(
self
,
account
,
uuid
):
"""
Remove a draft from the Conveyor database
:param str account: requested account
:param str uuid: draft identifier as returned from
`list_drafts`
"""
account
=
Account
(
account
,
steem_instance
=
self
.
steem
)
return
self
.
_conveyor_method
(
account
,
None
,
"
conveyor.remove_draft
"
,
[
account
[
'
name
'
],
uuid
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment