Skip to main content

A Python client for Saola's GraphQL API

Project description

Saola GraphQL API client

This is a GraphQL client for Python based on the ariadne-codegen pip package. It is used to access the API at app.saola.sg.

The client provides a convenient way to interact with the Saola GraphQL API, allowing you to perform various queries and mutations related to users, connections, workspaces, chats, and sources.

To add more queries and mutations, you can create new files with the .graphql extension in the saola_graphql_client/graphql directory. Once you have added your new GraphQL files, run the ./saola_graphql_client/run-codegen.sh script to generate the necessary client code.

Installation

pip install saola-graphql-client

Usage

To use the client, you can import the generated client class and use it to perform queries and mutations. Here is an example:

import asyncio
import jwt
from saola_graphql_client.graphql_client import Client as SaolaGraphQLClient

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")

client = SaolaGraphQLClient(
    url="https://app.saola.sg/v1/graphql",
    headers={"Authorization": f"Bearer {access_token}"},
)


async def get_and_print_current_user(client, user_id):
    current_user = await client.get_user(id=user_id)
    print(current_user)


asyncio.run(get_and_print_current_user(client, user_id))

Check examples/ for more examples.

Available methods

Check saola_graphql_client/graphql_client/client.py for the available methods.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saola_graphql_client-0.0.6.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saola_graphql_client-0.0.6-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file saola_graphql_client-0.0.6.tar.gz.

File metadata

  • Download URL: saola_graphql_client-0.0.6.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for saola_graphql_client-0.0.6.tar.gz
Algorithm Hash digest
SHA256 dab9ad874c9fc56bc771abfbb2dfb260ac74d61ef67d9a76b141e95a210774e0
MD5 7b92249179d1ea03c1b495b0761d8e2c
BLAKE2b-256 5ba6047b7438b4c05d54f7f4d38c97e092eb1284b9f9884b8a7795729d9f8f5a

See more details on using hashes here.

File details

Details for the file saola_graphql_client-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for saola_graphql_client-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b8263a1fbed64581b03af204f0c6144ae860e7aeba4c55c70db03f983f870ed9
MD5 547d7c02770eaed9695d07cc0c80c01d
BLAKE2b-256 7387f8b48451e7c7dadbfd05a88b457800390b9b56ce0d34cc4da3643b39d3a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page