From 04bf0ee26216879e0daa89e133ab10da14dd90e1 Mon Sep 17 00:00:00 2001 From: Reynaldi Chernando Date: Fri, 19 Dec 2025 23:18:14 +0700 Subject: [PATCH] Adjust formatting app methods --- src/Objects/app.md | 92 ++++++++++++++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 31 deletions(-) diff --git a/src/Objects/app.md b/src/Objects/app.md index 1a9b990..da5f627 100755 --- a/src/Objects/app.md +++ b/src/Objects/app.md @@ -59,46 +59,76 @@ A number containing the number of users that have access to the app. If the `sta An object containing custom metadata for the app. This can be used to store arbitrary key-value pairs associated with the app. -#### `users()` (Async Iteratable) +## Methods + +### `users()` + +Iterates over all users of the apps. + +__Syntax__ -Iterates over all users of the apps. Each user is represented by an object which contains {username, user_uuid}. ```js -for await (const user of (await puter.apps.get("your-app-name")).users()) { - console.log(user) -} +app.users() ``` -Prints: -``` ->> { - "user": "user1", - "user_uuid": "b206196e-22eb-40bd-8d50-015239b7cd11" - } - ->> { - "user": "user2", - "user_uuid": "b206196e-22eb-40bd-8d50-015239b7cd11" - } +__Parameters__ + +None. + +__Return value__ + +Iterable objects each containing `{username, user_uuid}`. + +__Example__ + +```html + + + + + + ``` -#### `getUsers({limit?: number, offset?: number})` (Async Function) +### `getUsers()` + +Retrieves list of users one page at a time as defined by limit and offset. -Retrieves list of users one page at a time as defined by limit and offset. Default limit is 100, default offset is 0. Return's an array of users represented by an object which contains {username, user_uuid}. +__Syntax__ ```js -const users = await (await puter.apps.get("your-app-name")).getUsers({limit: 2, offset: 0}); +app.getUsers({ limit, offset }) ``` -Returns: -``` -[ - { - "user": "user1", - "user_uuid": "b206196e-22eb-40bd-8d50-015239b7cd11" - }, - { - "user": "user2", - "user_uuid": "b206196e-22eb-40bd-8d50-015239b7cd11" - } -] +__Parameters__ + +- `limit` (Number) (optional): The number of users to retrieve. Default is 100. +- `offset` (Number) (optional): The offset to start retrieving users from. Default is 0. + +__Return value__ + +An array of objects each containing `{username, user_uuid}`. + +__Example__ + +```html + + + + + + ```