src/asana_client.py
def projects_in_portfolio_by_custom_field(
        self, portfolio_gid: str, custom_field_gid: str
    ) -> Dict[str, AsanaProject]:
        """Get all projects in portfolio with a Linear URL custom field"""

        projects = {}

        current_app.logger.debug(f"getting projects in portfolio {portfolio_gid}")
        items = self.client.portfolios.get_items_for_portfolio(
            portfolio_gid, opt_fields=["gid", "name", "resource_type", "custom_fields"]
        )

        for item in items:
            if item["resource_type"] != AsanaResourceType.PROJECT:
                continue

            for custom_field in item["custom_fields"]:
                if not (custom_field["gid"] == custom_field_gid and custom_field["text_value"]):
                    continue

                projects[custom_field["text_value"]] = item
                break
        return projects
Get all projects in portfolio with a Linear URL custom field
Get all projects in portfolio with a Linear URL custom field
Get all projects in portfolio with a Linear URL custom field
def projects_in_portfolio_by_custom_field(
        self, portfolio_gid: str, custom_field_gid: str
    ) -> Dict[str, AsanaProject]:
        projects = {}
        current_app.logger.debug(f"getting projects in portfolio {portfolio_gid}")
        items = self.client.portfolios.get_items_for_portfolio(
            portfolio_gid, opt_fields=["gid", "name", "resource_type", "custom_fields"]
        )
        for item in items:
            if item["resource_type"] != AsanaResourceType.PROJECT:
                continue
            for custom_field in item["custom_fields"]:
                if not (custom_field["gid"] == custom_field_gid and custom_field["text_value"]):
                    continue
                projects[custom_field["text_value"]] = item
                break
        return projects
def projects_in_portfolio_by_custom_field ( self , portfolio_gid : str , custom_field_gid : str ) -> Dict [ str , AsanaProject ] : projects = { } current_app . logger . debug ( f"getting projects in portfolio {portfolio_gid}" ) items = self . client . portfolios . get_items_for_portfolio ( portfolio_gid , opt_fields = [ "gid" , "name" , "resource_type" , "custom_fields" ] ) for item in items : if item [ "resource_type" ] != AsanaResourceType . PROJECT : continue for custom_field in item [ "custom_fields" ] : if not ( custom_field [ "gid" ] == custom_field_gid and custom_field [ "text_value" ] ) : continue projects [ custom_field [ "text_value" ] ] = item break return projects
Get all projects in portfolio with a Linear URL custom field
Get all projects in portfolio with a Linear URL custom field
"""Get all projects in portfolio with a Linear URL custom field"""
self
portfolio_gid
str
custom_field_gid
str