GitHub Action
commited on
Commit
·
ec8c142
1
Parent(s):
f328d48
Sync from GitHub with Git LFS
Browse files
scripts/publish_to_hashnode.py
CHANGED
@@ -67,21 +67,21 @@ def create_post(title, slug, markdown_content):
|
|
67 |
return graphql_request(query, variables)["data"]["createDraft"]["draft"]
|
68 |
|
69 |
|
70 |
-
def update_post(
|
71 |
-
"""
|
72 |
query = """
|
73 |
-
mutation
|
74 |
-
|
75 |
}
|
76 |
"""
|
77 |
variables = {
|
78 |
"input": {
|
79 |
-
"
|
80 |
"title": title,
|
81 |
"contentMarkdown": markdown_content
|
82 |
}
|
83 |
}
|
84 |
-
return graphql_request(query, variables)["data"]["
|
85 |
|
86 |
|
87 |
def publish_draft(draft_id):
|
|
|
67 |
return graphql_request(query, variables)["data"]["createDraft"]["draft"]
|
68 |
|
69 |
|
70 |
+
def update_post(post_id, title, markdown_content):
|
71 |
+
"""Обновляем уже опубликованный пост."""
|
72 |
query = """
|
73 |
+
mutation UpdatePost($input: UpdatePostInput!) {
|
74 |
+
updatePost(input: $input) { post { id slug title } }
|
75 |
}
|
76 |
"""
|
77 |
variables = {
|
78 |
"input": {
|
79 |
+
"id": post_id,
|
80 |
"title": title,
|
81 |
"contentMarkdown": markdown_content
|
82 |
}
|
83 |
}
|
84 |
+
return graphql_request(query, variables)["data"]["updatePost"]["post"]
|
85 |
|
86 |
|
87 |
def publish_draft(draft_id):
|