gamesheet_sdk.admin.shared.jsonapi module¶
JSON: API parsing utilities.
- gamesheet_sdk.admin.shared.jsonapi.extract_relationship_id(item, relationship_name, default='')[source]¶
Safely extract ID from JSON:API relationship.
JSON: API relationships follow the structure:
{ "relationships": { "parent": { "data": {"id": "123", "type": "associations"} } } }
- gamesheet_sdk.admin.shared.jsonapi.parse_jsonapi_resource(item, relationship_map=None)[source]¶
Parse a JSON:API resource into a flat dictionary.
Flattens a JSON:API resource object into a simple dict by merging the id, attributes, and optionally extracting relationship IDs.
JSON:API structure:
{ "id": "123", "type": "leagues", "attributes": {"title": "NHL", ...}, "relationships": {"association": {"data": {"id": "456"}}} }
Result:
{"id": "123", "title": "NHL", "association_id": "456"}
- Parameters:
- Returns:
dict[str, Any] – Flattened dict with id + attributes + relationship IDs.
- Return type:
- gamesheet_sdk.admin.shared.jsonapi.build_invitation_code_lookup(body)[source]¶
Build invitation code lookup from JSON:API included resources.
Parses the included section of a JSON:API response to extract invitation codes keyed by invitation ID.