@@ -33,6 +33,79 @@ def __str__(self):
3333 .format (self .user .screen_name , self .actions , self .team .name )
3434
3535
36+ class TeamResourceIDs :
37+ """
38+ A Citrine Team Resource IDs class.
39+
40+ This class is used to list the unique IDs for specific resource
41+ types published in a single team and therefore available to be pulled
42+ in by all projects.
43+
44+ Parameters
45+ ----------
46+ team_id: str or uuid
47+ ID of the team.
48+ resource_type: str
49+ The resource type to list, one of DATASET/MODULE/TABLE/TABLE_DEFINITION
50+
51+ """
52+
53+ _api_version = "v3"
54+
55+ def __init__ (self ,
56+ session : Session ,
57+ team_id : Union [str , UUID ],
58+ resource_type : str ) -> None :
59+ self .session = session
60+ self .team_id = team_id
61+ self .resource_type = resource_type
62+
63+ def _path (self ) -> str :
64+ return format_escaped_url (f'/teams/{ self .team_id } ' )
65+
66+ def _list_ids (self , action : str ) -> List [str ]:
67+ query_params = {"domain" : self ._path (), "action" : action }
68+ return self .session .get_resource (f"/{ self .resource_type } /authorized-ids" ,
69+ params = query_params ,
70+ version = self ._api_version )['ids' ]
71+
72+ def list_readable (self ):
73+ """
74+ List IDs of the published resources with READ access.
75+
76+ Returns
77+ -------
78+ List[str]
79+ Returns a list of string UUIDs for each resource
80+
81+ """
82+ return self ._list_ids (action = READ )
83+
84+ def list_writeable (self ):
85+ """
86+ List IDs of the published resources with WRITE access.
87+
88+ Returns
89+ -------
90+ List[str]
91+ Returns a list of string UUIDs for each resource
92+
93+ """
94+ return self ._list_ids (action = WRITE )
95+
96+ def list_shareable (self ):
97+ """
98+ List IDs of the published resources with SHARE access.
99+
100+ Returns
101+ -------
102+ List[str]
103+ Returns a list of string UUIDs for each resource
104+
105+ """
106+ return self ._list_ids (action = SHARE )
107+
108+
36109class Team (Resource ['Team' ]):
37110 """
38111 A Citrine Team.
@@ -292,6 +365,34 @@ def projects(self) -> ProjectCollection:
292365 """Return a resource representing all visible projects in this team."""
293366 return ProjectCollection (self .session , team_id = self .uid )
294367
368+ @property
369+ def dataset_ids (self ) -> TeamResourceIDs :
370+ """Return a TeamResourceIDs instance for listing published dataset IDs."""
371+ return TeamResourceIDs (session = self .session ,
372+ team_id = self .uid ,
373+ resource_type = ResourceTypeEnum .DATASET .value )
374+
375+ @property
376+ def module_ids (self ) -> TeamResourceIDs :
377+ """Return a TeamResourceIDs instance for listing published module IDs."""
378+ return TeamResourceIDs (session = self .session ,
379+ team_id = self .uid ,
380+ resource_type = ResourceTypeEnum .MODULE .value )
381+
382+ @property
383+ def table_ids (self ) -> TeamResourceIDs :
384+ """Return a TeamResourceIDs instance for listing published table IDs."""
385+ return TeamResourceIDs (session = self .session ,
386+ team_id = self .uid ,
387+ resource_type = ResourceTypeEnum .TABLE .value )
388+
389+ @property
390+ def table_definition_ids (self ) -> TeamResourceIDs :
391+ """Return a TeamResourceIDs instance for listing published table definition IDs."""
392+ return TeamResourceIDs (session = self .session ,
393+ team_id = self .uid ,
394+ resource_type = ResourceTypeEnum .TABLE_DEFINITION .value )
395+
295396
296397class TeamCollection (Collection [Team ]):
297398 """
0 commit comments