def getAllProjects(con: Connection) -> List['Project']: """ Get all existing projects in Knora :param con: Connection instance :return: """ result = con.get('/admin/projects') if 'projects' not in result: raise BaseError("Request got no projects!") return list( map(lambda a: Project.fromJsonObj(con, a), result['projects']))
def getAllUsers(con: Connection) -> List[Any]: """ Get a list of all users (static method) :param con: Connection instance :return: List of users """ result = con.get('/admin/users') if 'users' not in result: raise BaseError("Request got no users!") return list(map(lambda a: User.fromJsonObj(con, a), result['users']))
def getAllLists(con: Connection, project_iri: str) -> List['ListNode']: """ Get all lists of the specified project :param con: Connection instance :param project_iri: Iri/id of project :return: list of ListNodes """ result = con.get('/admin/lists?projectIri=' + quote_plus(project_iri)) if 'lists' not in result: raise BaseError("Request got no lists!") return list(map(lambda a: ListNode.fromJsonObj(con, a), result['lists']))
def getAllGroups(con: Connection) -> List['Group']: result = con.get('/admin/groups') if 'groups' not in result: raise BaseError("Request got no groups!") return list(map(lambda a: Group.fromJsonObj(con, a), result['groups']))
def getProjectOntologies(con: Connection, project_id: str) -> List['Ontology']: if project_id is None: raise BaseError('Project ID must be defined!') result = con.get('/v2/ontologies/metadata/' + quote_plus(project_id)) return Ontology.allOntologiesFromJsonObj(con, result)