Funções de Blueprints e o cliente da API
Cada etapa de Blueprint que você pode declarar no objeto JSON também oferece uma função que pode ser chamada diretamente.
Por exemplo:
import { startPlaygroundWeb, login, installPlugin } from 'https://playground.wordpress.net/client/index.js';
const client = await startPlaygroundWeb({
iframe: document.getElementById('wp'),
remoteUrl: `https://playground.wordpress.net/remote.html`,
});
await client.isReady();
await login(client, {
username: 'admin',
password: 'password',
});
await installPlugin(client, {
// Resources can only be used with JSON Blueprints.
// If you use functions, you must provide the resolved
// file.
pluginData: await fetch(pluginUrl),
});
Para mais informações e exemplos interativos, consulte a página de etapas de Blueprints.