A Python GraphQL client library for interacting with the Synmetrix API.
- Fully typed async GraphQL client
- Automatic query generation
- WebSocket subscription support
- Comprehensive API documentation
pip install synmetrix-graphql-client
poetry add synmetrix-graphql-client
import asyncio
import jwt
from synmetrix_graphql_client import Client
# Decode JWT token to get user_id
access_token = "your_access_token"
jwt_payload = jwt.decode(access_token, options={"verify_signature": False})
user_id = jwt_payload.get("hasura", {}).get("x-hasura-user-id")
# Initialize client
client = Client(
url="https://api.synmetrix.org/v1/graphql",
headers={"Authorization": f"Bearer {access_token}"},
)
async def get_current_user():
# Query current user
current_user = await client.current_user(id=user_id)
print(f"User: {current_user.users_by_pk.display_name}")
# Subscribe to user updates
async for update in client.sub_current_user(id=user_id):
print(f"Update received: {update.users_by_pk.display_name}")
# Run the example
asyncio.run(get_current_user())
-
async def current_user(id: Any) -> CurrentUser
Get current user information -
async def sub_current_user(id: Any) -> AsyncIterator[SubCurrentUser]
Subscribe to user updates
-
async def create_team(name: str) -> CreateTeam
Create a new team -
async def current_team(id: Any) -> CurrentTeam
Get current team information -
async def team_data(team_id: Any) -> TeamData
Get detailed team data
-
async def create_data_source(object: datasources_insert_input) -> CreateDataSource
Create a new data source -
async def current_data_source(id: Any) -> CurrentDataSource
Get current data source information -
async def check_connection(id: Any) -> CheckConnection
Check data source connection
-
async def create_access_list(object: access_lists_insert_input) -> CreateAccessList
Create new access list -
async def update_access_list(pk_columns, set) -> UpdateAccessList
Update existing access list
For the complete API reference, see API Reference.
- Python 3.9+
- Poetry (Python package manager)
- Clone the repository:
git clone https://github.com/synmetrix/synmetrix-graphql-client.git
cd synmetrix-graphql-client
- Install dependencies:
poetry install
- Activate the virtual environment:
poetry shell
poetry run pytest
./scripts/generate_api_docs.py
- Test PyPI release:
./scripts/push_to_testpypi.sh
- Production PyPI release:
./scripts/push_to_pypi.sh
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Open an issue in the GitHub repository
- Contact us at support@synmetrix.org
- Visit our documentation at https://docs.synmetrix.org
For complete working examples of client usage, check the examples/
directory in the repository.