#!/usr/bin/env python3
"""Create Toora pages in Wiki.js via GraphQL API."""
import json, sys
JWT = sys.argv[1] if len(sys.argv) > 1 else ""
pages = [
{
"title": "Toora Home",
"path": "home",
"tags": ["home", "toora"],
"desc": "Household knowledge base home",
"content": (
'
'
'
Household Knowledge Base
'
'
TOORA
'
'
Everything about our home โ how things work, what we use, and how to fix it.
'
'
'
''
'
Home Notes'
'
'
'
๐บ Entertainment
TV, streaming, music, and internet services for the home.
'
'
๐ก Lights
Lighting controls, switches, and smart bulbs.
'
'
๐ณ Kitchen
Composting system, appliances, and kitchen setup.
'
'
๐ฑ Garden
BBQ, fires, and outdoor living.
'
'
๐พ Pets
Dogs and fish โ care routines and setups.
'
'
๐งบ Laundry
Washer and drier โ usage and maintenance.
'
'
'
)
},
{
"title": "Entertainment",
"path": "entertainment",
"tags": ["entertainment", "tv", "music", "internet"],
"desc": "TV, streaming, music and internet",
"content": (
''
'
Section
'
'
ENTERTAINMENT
'
'
TV and streaming setup, music systems, and home internet.
'
'
'
''
'
Topics'
'
'
'
๐บ TV & Streaming
Television setup, streaming services, subscriptions, and devices.
'
'
๐ต Music
Music systems, speakers, playlists, and audio setup.
'
'
๐ Internet
Home internet, WiFi, router, and network services.
'
'
'
)
},
{
"title": "Lights",
"path": "lights",
"tags": ["lights", "switches"],
"desc": "Lighting controls and switches",
"content": (
''
'
Section
'
'
LIGHTS
'
'
Lighting around the home โ controls, switches, and smart options.
'
'
'
''
'
Topics'
'
'
'
๐ Controlling
Smart controls, dimmers, timers, and automation.
'
'
๐ Switches
Wall switches, smart switches, and wiring notes.
'
'
'
)
},
{
"title": "Kitchen",
"path": "kitchen",
"tags": ["kitchen", "compost", "appliances"],
"desc": "Composting and kitchen appliances",
"content": (
''
'
Section
'
'
KITCHEN
'
'
Compost system and kitchen appliances.
'
'
'
''
'
Topics'
'
'
'
๐ฟ Compost
Composting system, what goes in, and maintenance.
'
'
๐ Appliances
Kitchen appliances, usage, and care.
'
'
'
)
},
{
"title": "Garden",
"path": "garden",
"tags": ["garden", "bbq", "fires"],
"desc": "Outdoor living โ BBQ and fires",
"content": (
''
'
Section
'
'
GARDEN
'
'
Outdoor living โ BBQ, fires, and garden setup.
'
'
'
''
'
Topics'
'
'
'
๐ BBQ
BBQ setup, care, and usage.
'
'
๐ฅ Fires
Fire pits and outdoor heating.
'
'
'
)
},
{
"title": "Pets",
"path": "pets",
"tags": ["pets", "dogs", "fish"],
"desc": "Pet care โ dogs and fish",
"content": (
''
'
Section
'
'
PETS
'
'
Our pets and how we care for them.
'
'
'
''
'
Topics'
'
'
'
๐ Dogs
Dog care, feeding, and routines.
'
'
๐ Fish
Fish tank setup, feeding, and maintenance.
'
'
'
)
},
{
"title": "Laundry",
"path": "laundry",
"tags": ["laundry", "washer", "drier"],
"desc": "Washer and drier notes",
"content": (
''
'
Section
'
'
LAUNDRY
'
'
Laundry appliances โ washer and drier.
'
'
'
''
'
Topics'
'
'
'
๐ Washer
Washing machine usage, programs, and maintenance.
'
'
๐ฌ Drier
Drier usage, settings, and lint care.
'
'
'
)
}
]
mutations = []
for idx, p in enumerate(pages):
content_escaped = p['content'].replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n')
tag_str = json.dumps(p['tags'])
mutation = f''' p{idx}: pages {{
create(
title: "{p['title']}"
path: "{p['path']}"
content: "{content_escaped}"
editor: "wysiwyg"
isPublished: true
isPrivate: false
locale: "en"
tags: {tag_str}
description: "{p['desc']}"
) {{
page {{ id path title }}
responseResult {{ succeeded message }}
}}
}}'''
mutations.append(mutation)
query = 'mutation {\n' + '\n'.join(mutations) + '\n}'
payload = {"query": query}
print(json.dumps(payload))
PYEOF