Skip to content

Project

Importing the necessary modules

Then you need to import project to proceed with the next steps.

from aiaengine.api import project

Creating a project

Now you can create a new project within an organization by specifying a project name, some description and the org id.

create_project_response = client.projects.CreateProject(
    project.CreateProjectRequest(
        name='Project Name',
        description='What is this project about',
        org_id='id_of_org_where_this_project_is_included'
    )
)

project_id = create_project_response.id

Once created, the project is assigned to a unique id which is frequently used in other functions.

Retrieving information of a project

You can get information about a project by providing the project id.

client.projects.GetProject(
    project.GetProjectRequest(
        id='id_of_project'
    )
)

Updating a project

You can modify the name and description of an existing project by specifying the project id.

client.projects.UpdateProject(
    project.UpdateProjectRequest(
        id='id_of_updated_project',
        name='Updated Project',
        description='This project has been updated'
    )
)

Deleting a project

You can also remove a project which is no longer needed by giving the project id.

client.projects.DeleteProject(
    project.DeleteProjectRequest(
        id='id_of_deleted_project'
    )
)

Listing projects in an organization

You can list all the projects within an organization by providing the organization id.

client.projects.ListOrgProjects(
    project.ListOrgProjectsRequest(
        org_id='id_of_org_where_projects_are_included'
    )
)

Listing projects that belong to a user

Similarly you can inspect all the projects that can be accessed by the current user.

client.projects.ListUserProjects(
    project.ListUserProjectsRequest()
)

Here if user_id is omitted or set to None, the above code returns the list of projects associated with the current user.

Listing users that can access a project

You can also list all the users who have access to a particular project by providing the project id.

client.projects.ListProjectUsers(
    project.ListProjectUsersRequest(
        id='id_of_project_that_listed_users_can_access'
    )
)

Adding a user to a project

You can add an existing user of the platform to a project by specifying the project id, the user id and the role of the user (project-viewer, project-owner, project-editor).

client.projects.CreateProjectUser(
    project.CreateProjectUserRequest(
        id='id_of_project',
        user_id='id_of_added_user',
        role_id='project-editor'
    )
)

Deleting a user from a project

Once a user is no longer interested in a project, you can remove the user with input of the project id and user id.

client.projects.DeleteProjectUser(
    project.DeleteProjectUserRequest(
        id='id_of_project_that_user_can_access',
        user_id='id_of_user_whose_access_to_project_is_deleted'
    )
)