|
1 | 1 | from typing import Any, Dict, List |
2 | 2 |
|
3 | | -from labelbox.schema.invite import Invite, InviteLimit, UserLimit |
4 | | -from labelbox.schema.role import Role |
5 | 3 | from labelbox.exceptions import LabelboxError |
6 | 4 | from labelbox import utils |
7 | 5 | from labelbox.pagination import PaginatedCollection |
8 | 6 | from labelbox.orm.db_object import DbObject |
9 | 7 | from labelbox.orm.model import Field, Relationship |
| 8 | +from labelbox.schema.invite import Invite, InviteLimit, UserLimit, ProjectRole |
10 | 9 | from labelbox.schema.user import User |
11 | | -from labelbox.schema.role import Role, ProjectRole |
| 10 | +from labelbox.schema.role import Role |
12 | 11 |
|
13 | 12 |
|
14 | 13 | class Organization(DbObject): |
@@ -76,18 +75,19 @@ def _assign_user_role(self, email: str, role: Role, |
76 | 75 | query_str = """mutation createInvitesPyApi($data: [CreateInviteInput!]){ |
77 | 76 | createInvites(data: $data){ invite { id createdAt organizationRoleName inviteeEmail}}}""" |
78 | 77 |
|
79 | | - project_roles = [{ |
| 78 | + projects = [{ |
80 | 79 | "projectId": x.project.uid, |
81 | 80 | "projectRoleId": x.role.uid |
82 | 81 | } for x in project_roles] |
| 82 | + |
83 | 83 | res = self.client.execute( |
84 | 84 | query_str, { |
85 | 85 | 'data': [{ |
86 | 86 | "inviterId": self.client.get_user().uid, |
87 | 87 | "inviteeEmail": email, |
88 | 88 | "organizationId": self.uid, |
89 | 89 | "organizationRoleId": role.uid, |
90 | | - "projects": project_roles |
| 90 | + "projects": projects |
91 | 91 | }] |
92 | 92 | }, |
93 | 93 | experimental=True) # We prob want to return an invite |
|
0 commit comments