GitHub Action commited on
Commit
ec8c142
·
1 Parent(s): f328d48

Sync from GitHub with Git LFS

Browse files
Files changed (1) hide show
  1. scripts/publish_to_hashnode.py +6 -6
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(draft_id, title, markdown_content):
71
- """Используем draftId для обновления, чтобы соответствовать текущему API Hashnode."""
72
  query = """
73
- mutation UpdateDraft($input: UpdateDraftInput!) {
74
- updateDraft(input: $input) { draft { id slug title } }
75
  }
76
  """
77
  variables = {
78
  "input": {
79
- "draftId": draft_id,
80
  "title": title,
81
  "contentMarkdown": markdown_content
82
  }
83
  }
84
- return graphql_request(query, variables)["data"]["updateDraft"]["draft"]
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):