aboutsummaryrefslogtreecommitdiff
path: root/graphql_queries.py
blob: 92e373440682390fa3a680bf0ceeb0390a00d8ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import graphql_requests

def get_single_page(page_id):
    query = 'query {\npages {\nsingle (id: %s) {\nid\npath\ntitle\ncontent\n}\n}\n}' % page_id
    return graphql_requests.send_query(query)

def create_page(content, title, path):
    query = 'mutation {\npages {\ncreate(\ncontent: "%s"\ndescription: ""\neditor: "markdown"\nisPrivate: false\nisPublished: true\nlocale: "en"\npath: "%s"\npublishEndDate: ""\npublishStartDate: ""\nscriptCss: ""\nscriptJs: ""\ntags: []\ntitle: "%s"\n) {\nresponseResult {\nsucceeded\nerrorCode\nslug\nmessage\n__typename\n}\npage {\nid\nupdatedAt\n__typename\n}\n__typename\n}\n__typename\n}\n}' % ( content, path, title )
    return graphql_requests.send_query(query)

def get_tree():
    query = 'query {\n pages {\n list (orderBy: PATH) {\n id\npath\ntitle\n}\n}\n}'
    return graphql_requests.send_query(query)