IafProj
Use the IafProject API to manage project resources in the Passport, Item, File, and Graphics services.
addFileBrowser#
Adds file features to your project when you pass the project's id. This method adds a root container folder, which you can upload files or subcontainer folders to. The method sets the project as the as the current working project in the session.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
NamedFileCollection - A root container object of type NamedFileCollection
const projectWithFileBrowser = await IafProj.addFileBrowser(project._id);addFileBrowserToProject#
Adds file features to your project when you pass a Project object. This method adds a root container folder, which you can upload files or subcontainer folders to. The method sets the project as the as the current working project in the session.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
NamedFileCollection - A root container object of type NamedFileCollection
const projectWithFileBrowser = await IafProj.addFileBrowserToProject(project, ctx);addPermissionsOnColl#
Adds permissions to one or more user groups for a collection.
| Parameter | Required | Type | Description |
|---|---|---|---|
| userGroups | Yes | Array<UserGroup> | Pass an array of UserGroup objects that you want to assign permissions to. |
| coll | Yes | NamedUserCollection | Pass the NamedUserCollection object you want to grant permissions to. |
| permArray | Yes | Array<Permission> | The permissions you want to assign to the user groups. Pass an array of Permission objects. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
CreatePermissionsResponse - A CreatePermissionsResponse object that contains the successful and failed permissions.
//create an array and add Permission objects to it
const permissions = [ { _namespace : "building_1", _user : "service_person", _actions : ["READ"], }, { _namespace : "building_2", _user : "building_manager", _actions : ["READ", "WRITE"], }];
//call the method to add the permissionsconst newCollectionPerms = await IafProj.addPermissionsOnColl(userGroups, collection, permissions);addScript#
Adds a Script class object to a Project.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object. |
| script | Yes | Script | Script object. |
| ctx | No | ctx | Context, such as namespaces or authentication token information. |
Script - The created script object, which stores as a related item to the project.
//Create scriptconst script = { _name: "Project setup script", _shortName: "prjSetup", _userType: "project_setup_script". _version:{ _userData: "[{$defscript: {}}]" }}
const addedScript = await IafProj.addScript(project, script);addScriptToProject#
Adds a Script class object to a Project when you pass a project's id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| script | Yes | Script | The Script class object. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Script - Created script
//Create scriptconst script = { _name: "Project setup script", _shortName: "prjSetup", _userType: "project_setup_script". _version: { _userData: "[{$defscript: {}}]"}}
const script = await IafProj.addScriptToProject(project.id, script);addUserConfig#
Adds a user config to a project when you pass a Project object and UserConfig object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object. |
| userConfig | Yes | UserConfig | To create a userConfig, pass a JSON object with properties of type UserConfig. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfig - Created UserConfig object
//Define user configconst userConfig = { _name: "Project setup config", _shortName: "prjSetupConfig", _userType: "project_setup_config". _version:{ _userData: { handlers: { } } }};
const userconfig = await IafProj.addUserConfig(project, userConfig);addUserConfigToProject#
Adds a UserConfig to a project when you pass a Project id and UserConfig object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| userConfig | Yes | UserConfig | Define a UserConfig class object. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfig - Created UserConfig
//Define user configconst userconfig = { _name: "Project setup config", _shortName: "prjSetupConfig", _userType: "project_setup_config". _version:{ _userData: { handlers: { } } }};
const userconfig = await IafProj.addUserConfigToProject(project._id, userconfig);addUserGroups#
Creates UserGroup class objects for a Project when you pass a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| userGroups | Yes | Array<UserGroupDescriptor> | Pass the array of UserGroup objects you want to create. |
| ctx | No | Ctx | Context - Context, such as namespaces or authentication token information. |
any - Array - An array of created UserGroup objects. The method returns void if any of the user groups already exist in the project object. The _shortName property is used for this check.
const userGroups = [ {_name: "proj_1_admin", _userType: "proj_1_usergroup", "permissions":{accessAll:true}}, {_name: "proj_1_devs", _userType: "proj_1_usergroup", "permissions":{namedUserItems:[{ actions: ["READ", "EDIT"] }], files: [{ actions: ["READ", "EDIT"] }] }}, {_name: "proj_1_visitor", _userType: "proj_1_usergroup","permissions":{namedUserItems:[{ actions: ["READ", "EDIT"] }], files: [{ actions: ["READ", "EDIT"] }] }}];
const userGroups = await IafProj.addUserGroups(project, userGroups);addUserGroupsToProject#
Creates UserGroups for a project when you pass the Project's id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The project's id |
| userGroups | Yes | Array<UserGroup> | Pass the array of UserGroup objects you want to create. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array - An array of created user groups. The method returns void if any of the usergroup already exist in the project.The _shortName property is used for this check.
let userGroups = [ {_name: "proj_1_devs", _namespaces: ["3_jtOxaGwR"], _userType: "proj_1_usergroup"}, {_name: "proj_1_eng", _namespaces: ["3_jtOxaGwR"], _userType: "proj_1_usergroup"}, {_name: "proj_1_data", _namespaces: ["3_jtOxaGwR"], _userType: "proj_1_usergroup"} ];
await IafProj.addUserGroupsToProject(project._id, userGroups);create#
Creates a Project object on the platform with a JSON object you pass with properties of type Project.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Pass a JSON object with properties of type Project and the values you want to define the project. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
// Create a new project object with properties of type Projectconst project = { _description: "account workspace", _name: "Account Workspace", _shortName: "aw",};
const project = await IafProj.create(project);createOrUpdatePerms#
Creates or updates permissions for a UserGroup in a project namespace.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| userGroup | Yes | UserGroup | UserGroup object |
| permissions | Yes | Array<IafPermissionDescriptor> | Pass an array of IafPermissionDescriptor objects with the permissions you want to create or update. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
void -
//An array of permissions you already definedconst developerPerms = [itemServicePerm, scriptPerm, dataPerm];
await IafProj.createOrUpdatePerms(projectObj, userGroupObj, developerPerms)createOrUpdatePermsForUserGroup#
Creates or updates permissions for a UserGroup in a project namespace when you pass Project and UserGroup ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| userGroupId | Yes | String | The UserGroup's id |
| permissions | Yes | Array<IafPermissionDescriptor> | Pass an array of IafPermissionDescriptor objects with the permissions you want to create or update. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
void -
//create permissions for a usergroup for differnt resources in the Platformconst permissions = { namedUserColls: [ { actions: ["READ"] }], files: [ { actions: ["READ"] }]}; await IafProj.createOrUpdatePermsForUserGroup(project._id, userGroup._id, permissions);createProject#
Converts an object you define to a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Pass an object with the Project type properties you want to create your project. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
// Create a new projectconst projectObj = { _description: "account workspace", _name: "Account Workspace", _shortName: "aw", _userAttributes: { "usergroups":[] }}
const project = await IafProj.createProject(projectObj, ctx);delete#
Soft deletes a project when you pass a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
await IafProj.delete(project);deletePerms#
Deletes permissions for a UserGroup in a project namespace.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| userGroup | Yes | UserGroup | Pass the UserGroup object you want to remove permissions from. |
| permissions | Yes | Array<IafPermissionDescriptor> | Pass an array of IafPermissionDescriptor objects with the permissions you want to delete from the user group. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
void -
//An array of permissions you already definedconst developerPerms = [itemServicePerm, scriptPerm, dataPerm];
//call the method on the project, user group, and the developerPerms array of IafPermissionDescriptor objectsawait IafProj.deletePerms(projectObj, userGroupObj, developerPerms);deleteProjectById#
Soft deletes a Project when you pass the project's id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | The Project's id. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
await IafProj.deleteProjectById(projectId);deleteScript#
Deletes a project script when you pass Project and Script objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | The Project object that contains the script. |
| script | Yes | Script | The Script object you want to delete. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
await IafProj.deleteScript(projectObj, scriptObj);deleteScriptInProject#
Deletes a project Script when you pass the Project and Script ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | Project | The Project's id |
| scriptId | Yes | Script | The id of the Script you want to delete |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
await IafProj.deleteScriptInProject(project._id, script._id);deleteUserConfig#
Deletes a UserConfig from a project when you pass Project and UserConfig ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | The Project object that contains the user config you want to delete. |
| userConfig | Yes | UserConfig | The UserConfig object you want to delete. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
await IafProj.deleteUserConfig(project, userConfig);deleteUserConfigInProject#
Deletes a UserConfig from a project when you pass project and user config ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| userConfigId | Yes | String | The UserConfig's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
String - 'ok: 204'
const response = await IafProj.deleteUserConfigInProject(project._id, userConfig._id);deleteUserGroup#
Deletes a UserGroup and removes it from a project when you pass Project and UserGroup objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | The Project object |
| userGroup | Yes | UserGroup | The UserGroup object |
| ctx | Yes | Ctx | Context, such as namespaces or authentication token information. |
Project - The Project object without the user group
const updatedProj = await IafProj.deleteUserGroup(project, userGroup);deleteUserGroupFromProject#
Deletes a UserGroup and removes it from a Project when you pass Project and UserGroup ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| userGroupId | Yes | String | The UserGroup's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The Project object without the UserGroup
await IafProj.deleteUserGroupFromProject(project._id, usergroup._id);getById#
Gets a Project class object when you pass its id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | The Project's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The project object
getCurrent#
Gets the current Project from the browser's session storage or based on a parameter you pass as the ctx parameter.
| Parameter | Required | Type | Description |
|---|---|---|---|
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The Project object
//Get the current project from the browser's session storageconst currentProject = await IafProj.getCurrent();getFileContainers#
Gets a Project's FileContainer class objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The project's id |
| query | Yes | JSON | To filter the response, pass an object with a simple query using fields such as _id - The NamedUserItem's database id, _name - A readable, long-form name, _shortName - Shorter abbreviation of the NamedUserItem name that is used for reference, _userType - A user-given name to identify a NamedUserItem. This userType is helpful for queries to find a unique item with a unique userType or NamedUserItems that share a userType. _userItemId - A unique id value generated by the Item Service. _itemClass - It defines the of the Named User Item will be on of them (NamedUserCollection, NamedTelemetryCollection, NamedFileCollection, Script, UserConfig and NamedCompositeItem). The query follows mongoDB syntaxes and should be build using these fields. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
| options | Yes | NamedUserItemCriteriaOptions | Pass a NamedUserItemCriteriaOptions object with your response options, such as "_pageSize" and "_offset". |
any - Array An array of containers
const fileContainers = IafProj.getFileContainers( project._id, { _version: 1 }, ctx, { _pageSize: 100 });getModels#
Gets all of a Project's imported models by passing in the Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| criteria | Yes | NamedUserItemCriteria | Pass a NamedUserItemCriteria object with your simple query. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
| options | Yes | NamedUserItemCriteriaOptions | Pass an object with one or more response options, such as _offset and _pageSize, as a JSON object. |
Array - An array of models
getModelsWithPagination#
Gets all the models imported to a Project with full pagination metadata directly from the Item Service.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| criteria | Yes | NamedUserItemCriteria | To filter the response, pass a NamedUserItemCriteria object with a simple query. |
| ctx | No | ctx | Context, such as namespaces and authentication token information. |
| options | Yes | NamedUserItemCriteriaOptions | Pass an object with one or more response options, such as _offset and _pageSize, as a JSON object. |
Page<Array> - Page object with array of models
getPermissions#
Gets a user's permissions for a project when you pass User object with id and Project objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| user | Yes | User | The User object having id. |
| project | Yes | Project | The Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
PermissionOperation - A PermissionOperation object with permission operations for the User.
const userPerms = await getPermissions(currentUser._id, project);getPermissionsOnColl#
Gets a user's permissions for a NamedUserCollection.
| Parameter | Required | Type | Description |
|---|---|---|---|
| user | Yes | User | User object |
| coll | Yes | NamedUserCollection | For the collection, pass a NamedUserCollection object. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Array<PermissionOperation> - Returns the user's permissions for the collection as an array of PermissionOperation objects.
const collectionPermissions = await IafProj.getPermissionsOnColl(user, coll);getProjectModels#
Gets a stored Project's imported models by resolving the Project from its id and then delegating to the paginated model query.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project’s id |
| criteria | Yes | NamedUserItemCriteria | Pass a NamedUserItemCriteria object with your simple query. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
| options | Yes | NamedUserItemCriteriaOptions | Pass an object with one or more response options, such as _offset and _pageSize, as a JSON object. |
Page<Array> - A page object containing an array of models
getProjects#
Gets all the Project class objects for the session user with the option to filter by project criteria.
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | No | ProjectCriteria | Pass an object with the Project type properties you want to filter your search. If you do not pass criteria, all the user's projects return. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
| options | No | WorkspaceCriteriaOptions | Pass an object with one or more Page type properties, such as "_offset" and "_pageSize". The default value for _offset is 0 and for _pageSize is 10. |
Array<Project> - An array of Project objects.
// Retrieves by project name. const projects = await IafProj.getProjects({ _name:'test-project' }, ctx);
//Retrieves with particular offset and pageSizelet options = { _offset: 10, _pageSize: 50 }const projects = await IafProj.getProjects({ _name: 'test-project' }, options);getProjectsWithPagination#
Gets all the projects with pagination for a session user with the option to filter by project criteria.
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | No | ProjectCriteria | Pass an object with the Project type properties you want to filter your search. If you do not pass criteria, all the user's projects return. |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
| options | No | WorkspaceCriteriaOptions | Pass an object with one or more Page type properties, such as "_offset" and "_pageSize". The default value for _offset is 0 and for _pageSize is 10. |
Page<Array<Project>> - An array of Project objects with pagination in a Page object
// Retrieves by project name. const projects = await IafProj.getProjects({ _name:'test-project' }, ctx);
//Retrieves with particular offset and pageSizeconst options = { _offset: 10, _pageSize: 50 }const projects = await IafProj.getProjects({ _name: 'test-project' }, options);getProjectUserGroupsForCurrentUser#
Get a User's UserGroups by passing Project id for a stored Project that the user has permissions for.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | Project id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array - An array of the User's associated UserGroups for the stored Project
const projUserGroups = await getProjectUserGroupsForCurrentUser(project._id);getScripts#
Gets all of a project's Script objects or gets the scripts that match a query you pass.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| filters | Yes | NamedUserItemCriteria | To get all scripts, pass an empty object: {}. To filter the scripts, in the object, pass a simple query. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Array<Script> - An array of Script objects
// Get scripts without filterconst scripts = IafProj.getScripts(project, {}, ctx);
// Get scripts with filter, refer {NamedUserItemCriteria} for more examplesconst filters = { query: { _userType: "cde_script" } };const scripts = await IafProj.getScripts(project, filters);getScriptsByProjectId#
Gets the Script objects for project when you pass the Project's id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Array<Script> - An array of Script objects
const scripts = await IafProj.getScripts(project._id);getUserConfigs#
Gets all of a project's user configs or gets the user configs that match a query you pass.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| filters | Yes | NamedUserItemCriteria | To get all user configs, pass an empty object: {}. To filter the user configs, in the object, pass a simple query. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array<UserConfig} - An array of UserConfig objects
// Get user configs without filterconst userconfigs = IafProj.getUserConfigs(project, {}, ctx);
// Get user configs with filter. For more examples, refer NamedUserItemCriteria on the Types page. const filters = { query: { _userType: "cde_user_config" } };
const userconfigs = await IafProj.getUserConfigs(project, filters);getUserConfigsWithPagination#
Gets all of a project's UserConfig objects with pagination or gets the user configs that match a query you pass.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| filters | Yes | NamedUserItemCriteria | To get all user configs, pass an empty object: {}. To filter the user configs, in the object, pass a simple query. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array<UserConfig} - An array of UserConfig objects
// Get user configs without filter
const userconfigs = await IafProj.getUserConfigs(project, {}, ctx);
// Get user configs with filter, refer to NamedUserItemCriteria class for more examples
const filters = { query: { _userType: "cde_user_config" } }const userconfigs = await IafProj.getUserConfigs(project, filters, ctx);getUserGroups#
Gets the UserGroup objects associated with a project that the current user can access.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array{UserGroup} - An array of UserGroup objects
const userGroups = await IafProj.getUserGroups(project);getUserGroupsForCurrentUser#
Gets the current User's UserGroups by using project object for a Project that the User has permissions for.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information. |
any - Array - An array of the current User's associated UserGroups for the Project object
const userGroups = await getUserGroupsForCurrentUser(project, ctx);getUserGroupsForUser#
Get a User's UserGroups for a Project when you pass User and Project objects. Only the UserGroups that the user has permissions for return.
| Parameter | Required | Type | Description |
|---|---|---|---|
| user | Yes | User | The User object |
| project | Yes | Project | The Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
any - Array - An array of UserGroup objects associated with the User for the Project.
const userUserGroups = await getUserGroupsForUser(currentUser, project);getUserPermissions#
Get a User's permissions for a Project when you pass the User id and Project id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| userId | Yes | String | The User's id |
| projectId | Yes | String | The Project's id |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
PermissionOperation - A PermissionOperation object with the permission operations for the User.
const userPerms = await IafProj.getUserPermissions(currentUser._id, project._id);getUsers#
Gets all users from the user groups associated with a project when you pass a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| query | Yes | UserCriteria | //TODO: apply query |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Array<User> - An array of User objects
const projectUsers = await IafProj.getUsersInProject(project);getUsersInProject#
Gets all Users from the UserGroups associated with a Project when you pass the project's id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| query | Yes | UserCriteria | //TODO: apply query |
| ctx | Yes | Ctx | Context, such as namespaces or authentication token information - Optional |
Array<User> - An array of User objects
const projectUsers = await IafProj.getUsersInProject(project._id);purgeProject#
Hard deletes a Project and its contents when you pass a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | The Project object |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
void -
await IafProj.purgeProject(project, ctx);purgeProjectById#
Hard deletes a stored Project and its contents when you pass its id.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| ctx | No | Ctx | Context, such as namespaces and authentication token information. |
void -
await IafProj.purgeProjectById(project._id, ctx);setupCurrent#
Sets a Project as the current session project. Use this method to set up namespaces, switch projects, and more.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The Project object and its root container reference
const project = await IafProj.setupCurrent(project);switchProject#
Sets a Project as the current project in session storage or based on a parameter you pass as the ctx parameter.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | The Project's id. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The Project object
const currentProj = await IafProj.switchProject(proj._id);update#
Updates a Project object.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | The Project object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Project - The updated Project object
project._name = "updated-proj-name";const updatedProj = await IafProj.update(project);updateProjectScript#
Updates a project script when you pass the Project's id and the updated Script object. To update script content, use the updateProjectScriptVersion method.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| script | Yes | Script | Your updated Script object. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
Script - Updated Script object
//Update scriptscript._name = "updated script name";
const script = await IafProj.updateProjectScript(project._id, script, ctx);updateScript#
Updates a project script when you pass a Project object and the updated Script object. To update script content, use the updateProjectScriptVersion method.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| script | Yes | Script | Your updated Script object |
| ctx | No | ctx | Context, such as namespaces or authentication token information. |
Script - Updated script object
//Update scriptscript._name = "updated script name";
const updatedScript = await IafProj.updateScript(project, script, ctx);updateScriptVersion#
Updates an existing script version's content when you pass Script and ScriptVersion objects.
| Parameter | Required | Type | Description |
|---|---|---|---|
| script | Yes | Script | Script object |
| version | Yes | ScriptVersion | Pass a ScriptVersion object with your updates. |
| ctx | No | ctx | Context, such as namespaces or authentication token information. |
ScriptVersion - The updated ScriptVersion object
//Update script versionscript._versions[2]._name = "updated script name";
const scriptVersion = await IafProj.updateScriptVersion(script, script._versions[2], ctx);updateScriptVersionById#
Updates an existing ScriptVersion when you pass Project and Script ids.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| scriptId | Yes | String | The Script's id. |
| version | Yes | ScriptVersion | Pass the updated ScriptVersion object. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
ScriptVersion - Updated ScriptVersion object
//Update script versionscript._versions[2]._name = "updated script name";
const updatedScriptVersion = await IafProj.updateScriptVersion(project._id, script._id, script._versions[2], ctx);updateUserConfig#
Updates a UserConfig object in a project when you pass the Project and UserConfig objects. To update user config content, use updateUserConfigVersion.
| Parameter | Required | Type | Description |
|---|---|---|---|
| project | Yes | Project | Project object |
| userConfig | Yes | UserConfig | The updated UserConfig class object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfig - Updated UserConfig object
// Update user configuserConfig._name = "updated name";
const userconfig = await IafProj.updateUserConfig(project, userConfig);updateUserConfigInProject#
Updates a UserConfig object in a project when you pass the project id and a UserConfig object. To update user config content, use updateUserConfigVersionInProject.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id. |
| userConfig | Yes | UserConfig | The updated UserConfig class object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfig - Updated UserConfig object
// Update user configuserConfig._name = "updated name";
const userconfig = await IafProj.updateUserConfig(project._id, userConfig);updateUserConfigVersion#
Updates the content of a UserConfigVersion.
| Parameter | Required | Type | Description |
|---|---|---|---|
| userConfig | Yes | UserConfig | UserConfig object |
| version | Yes | UserConfigVersion | The updated UserConfigVersion object |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfigVersion - Updated UserConfigVersion object
userConfig._versions[2]._name = "updated user config name";
const userConfigVersion = await IafProj.updateUserConfigVersion(userConfig, userConfig._versions[2]);updateUserConfigVersionInProject#
Updates the content of a UserConfigVersion in a specific project.
| Parameter | Required | Type | Description |
|---|---|---|---|
| projectId | Yes | String | The Project's id |
| userConfigId | Yes | String | The UserConfig's id |
| version | Yes | UserConfigVersion | To update user config version content, pass a JSON object with properties of type UserConfigVersion. |
| ctx | No | Ctx | Context, such as namespaces or authentication token information. |
UserConfigVersion - Updated UserConfigVersion object
userConfig._versions[2]._name = "updated user config name";
const userConfigVersion = await IafProj.updateUserConfigVersion(project._id, userConfig._id, userConfig._versions[2]);