IafApplication
Use the IafApplication API to manage applications and application users on the platform.
getAppAdminsUserGroup
| Parameter | Required | Type | Description |
|---|---|---|---|
| ctx | Yes | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
await IafApplication.getAppAdminsUserGroup(ctx);
getAppDeveloperUserGroup
Gets the App Developer platform-role user group for the application.
| Parameter | Required | Type | Description |
|---|---|---|---|
| ctx | Yes | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
Promise<UserGroup> - Resolves with the App Developer UserGroup when it exists; returns undefined when the group has not been provisioned.
const developerGroup = await IafApplication.getAppDeveloperUserGroup(ctx);
getApplications
Gets the session user's Application class objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | Yes | Application | Application criteria. Currently not supported. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
| options | No | Options | Pass an Options class object with one or more response pagination parameters, such as _offset and _pageSize. The default value for _offset is 0 and for _pageSize is 10. |
Array<Application> - An array of Application class objects
let options = {
_offset: 3,
_pageSize: 15
};
const userApps = await IafApplication.getApplications(ctx, options);
getAppOwnerUserGroup
Gets the App Owner platform-role user group for the application.
| Parameter | Required | Type | Description |
|---|---|---|---|
| ctx | Yes | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
Promise<UserGroup> - Resolves with the App Owner UserGroup when it exists; returns undefined when the group has not been provisioned.
const ownerGroup = await IafApplication.getAppOwnerUserGroup(ctx);
getById
Gets an Application class object when you pass its id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | Pass the application's id. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
| options | No | Options | Pass an Options class object. |
Promise<Application> - Application, 404 response if not found
let options = {
withConfigs: true
};
promoteUserAsAppOwner
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | String | Pass the Application class object's id. |
| userId | Yes | String | The User class object's id. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
await IafApplication.promoteUserAsAppOwner(appId, userId);
revokeAppOwner
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | String | Pass the application's id. |
| userId | Yes | String | Pass the user's id. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
await IafApplication.revokeAppOwner(appId, userId);
switchApplication
Sets your Application class object as the current application in ctx storage.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | Pass the app's UUID. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
Promise -
const res = await IafApplication.switchApplication(app._id, ctx);
updateApplication
Updates an Application class object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| app | Yes | Application | Pass an Application class object with updated properties or values. |
| ctx | No | Ctx | Context storage that contains data, such as authorization token requirements, namespaces, or session storage. |
Promise<Application> - Returns the updated Application object or a 404 response if the application is not found.
app._name = "new_app_name";
const updatedApp = await IafApplication.updateApplication(app);