puter.apps.list()Returns an array of all apps belonging to the user and that this app has access to. If the user has no apps, the array will be empty.
puter.apps.list();
puter.apps.list(options);
options (optional)
An object containing the following properties:
stats_period (optional): A string representing the period for which to get the user and open count. Possible values are today, yesterday, 7d, 30d, this_month, last_month, this_year, last_year, month_to_date, year_to_date, last_12_months. Default is all (all time).
icon_size (optional): An integer representing the size of the icons to return. Possible values are null, 16, 32, 64, 128, 256, and 512. Default is null (the original size).
A Promise that will resolve to an array of all App objects belonging to the user that this app has access to.
Create 3 random apps and then list them
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
(async () => {
// (1) Generate 3 random app names
let appName_1 = puter.randName();
let appName_2 = puter.randName();
let appName_3 = puter.randName();
// (2) Create 3 apps
await puter.apps.create(appName_1, 'https://example.com');
await puter.apps.create(appName_2, 'https://example.com');
await puter.apps.create(appName_3, 'https://example.com');
// (3) Get all apps (list)
let apps = await puter.apps.list();
// (4) Display the names of the apps
puter.print(JSON.stringify(apps.map(app => app.name)));
// (5) Delete the 3 apps we created earlier (cleanup)
await puter.apps.delete(appName_1);
await puter.apps.delete(appName_2);
await puter.apps.delete(appName_3);
})();
</script>
</body>
</html>