MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / get_by_api_key

Method get_by_api_key

app/api/agentops/opsboard/models.py:659–670  ·  view source on GitHub ↗

Get a project by API key with org and necessary relationships preloaded.

(cls, orm: orm.Session, api_key: str | UUID)

Source from the content-addressed store, hash-verified

657
658 @classmethod
659 def get_by_api_key(cls, orm: orm.Session, api_key: str | UUID) -> Optional['ProjectModel']:
660 """Get a project by API key with org and necessary relationships preloaded."""
661 return (
662 orm.query(cls)
663 .filter(cls.api_key == normalize_uuid(api_key))
664 .options(
665 joinedload(cls.org).joinedload(OrgModel.users),
666 joinedload(cls.org).joinedload(OrgModel.invites),
667 joinedload(cls.org).joinedload(OrgModel.projects),
668 )
669 .first()
670 )
671
672 @classmethod
673 def get_all_for_user(cls, orm: orm.Session, user_id: str | UUID) -> list['ProjectModel']:

Callers 4

get_projectMethod · 0.80
get_projectMethod · 0.80
get_hosted_projectMethod · 0.80
get_tokenFunction · 0.80

Calls 2

normalize_uuidFunction · 0.70
filterMethod · 0.45

Tested by

no test coverage detected