get_teams_in_workspace
去拿回公司看板裡面的「團隊」列表def get_teams_in_workspace(self, workspace_gid=None):
try:
# create an instance of the API class
api_instance = asana.TeamsApi(self.client)
if workspace_gid is None:
# workspace_gid = self.workspaces[0]
workspace_gid = self.default['my_workspace_gid']
# Get multiple teams
api_response = api_instance.get_teams_for_workspace(workspace_gid)
data = api_response.to_dict()['data']
# self.teams = [ d['gid'] for d in data ]
self.teams = {}
for d in data:
self.teams[d['gid']] = d['name']
except ApiException as e:
print("Exception when calling TeamsApi->get_teams_for_workspace: %s\n" % e)
get_projects_in_team
def get_projects_in_team(self, team_gid=None):
try:
# create an instance of the API class
api_instance = asana.ProjectsApi(self.client)
if team_gid is None:
team_gid = self.default['my_team_gid']
# Get multiple projects
api_response = api_instance.get_projects_for_team(team_gid)
data = api_response.to_dict()['data']
# self.projects = [ d['gid'] for d in data ]
self.projects = {}
for d in data:
self.projects[d['gid']] = d['name']
except ApiException as e:
print("Exception when calling ProjectsApi->get_projects_in_team: %s\n" % e)
只有一項 workspace 和 一項 team 跟我有關