Unofficial API for Wombo Dream
❤ Feel free to contribute to the project ❤
Used by
- NFT minting
- change of password/username/email/profile picture
- ability to browse other users' profiles
- Refactoring
- Documentation updated
- API testing
- Can now fetch tasks shop url
- Can now save, fetch, fetch all and delete tasks in the gallery
- Throw error when task generation fails
- uploaded images MUST be jpg/jpeg
- Using typedoc to generate Documentation
- Updating Documentation
npm install wombo-dream-api
Please read the Documentation to learn more about the api.
const { buildDefaultInstance } = require('wombo-dream-api');
const fs = require('fs');
(async () => {
try {
const credentials = {
email: 'mysuperemail@gmail.com',
password: 'mypassword',
};
// signin is automatically done when you interract with the api if you pass credentials
const wombo = buildDefaultInstance(credentials);
// if you want to sign up as new user:
// await wombo.authentifier.signUp(credentials);
// fetch all styles
const styles = await wombo.fetchStyles();
console.log(styles.map((style) => `[${style.id}] ${style.name}`));
// upload image [ONLY JPEG SUPPORTED]
const uploadedImage = await wombo.uploadImage(
fs.readFileSync('./image.jpeg')
);
// generate picture from image
const generatedTask = await wombo.generatePicture(
'mountain',
styles[0].id,
(taskInProgress) => {
console.log(
`[${taskInProgress.id}]: ${taskInProgress.state} | step: ${taskInProgress.photo_url_list.length}`
);
},
{ mediastore_id: uploadedImage.id, weight: 'HIGH' }
);
console.log(
`[${generatedTask.id}]: ${generatedTask.state} | final url: ${generatedTask.result?.final}`
);
// to interract with the gallery, YOU NEED TO HAVE A USERNAME!
// if you just created the account and it doesn't have a username, set it with:
// await wombo.setUsername('myusername');
// save an image in the gallery
const savedTask = await wombo.saveTaskToGallery(
generatedTask.id,
'my wonderful creation',
true,
true
);
console.log('image saved!');
// obtain gallery tasks
const galleryTasks = await wombo.fetchGalleryTasks();
console.log(galleryTasks);
} catch (error) {
console.error(error);
}
})();
More examples can be found in the Documentation