File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { getAccessToken } from "./utils/auth-utils.js";
88import { createFunctionsModule } from "./modules/functions.js" ;
99import { createAgentsModule } from "./modules/agents.js" ;
1010import { createAppLogsModule } from "./modules/app-logs.js" ;
11+ import { createUsersModule } from "./modules/users.js" ;
1112import { RoomsSocket , RoomsSocketConfig } from "./utils/socket-utils.js" ;
1213
1314export type CreateClientOptions = {
@@ -119,6 +120,7 @@ export function createClient(config: {
119120 token,
120121 } ) ,
121122 appLogs : createAppLogsModule ( axiosClient , appId ) ,
123+ users : createUsersModule ( axiosClient , appId ) ,
122124 cleanup : ( ) => {
123125 socket . disconnect ( ) ;
124126 } ,
Original file line number Diff line number Diff line change 1+ import { AxiosInstance } from "axios" ;
2+
3+ /**
4+ * Creates the users module for the Base44 SDK
5+ * @param {AxiosInstance } axios - Axios instance
6+ * @param {string } appId - Application ID
7+ * @returns {Object } Users module
8+ */
9+ export function createUsersModule ( axios : AxiosInstance , appId : string ) {
10+ return {
11+ /**
12+ * Invite a user to the application
13+ * @param {string } user_email - User's email address
14+ * @param {'user'|'admin' } role - User's role (user or admin)
15+ * @returns {Promise<any> }
16+ */
17+ async inviteUser ( user_email : string , role : "user" | "admin" ) : Promise < any > {
18+ if ( role !== "user" && role !== "admin" ) {
19+ throw new Error (
20+ `Invalid role: "${ role } ". Role must be either "user" or "admin".`
21+ ) ;
22+ }
23+
24+ const response = await axios . post ( `/apps/${ appId } /runtime/users/invite-user` , { user_email, role } ) ;
25+ return response ;
26+ } ,
27+ } ;
28+ }
You can’t perform that action at this time.
0 commit comments