No description
Find a file
2023-09-15 00:17:37 -05:00
htmldocs chore: fix docs 2023-09-15 00:17:37 -05:00
src chore: fix docs 2023-09-15 00:17:37 -05:00
tests move: rebrand to zuhyo 2023-09-14 23:52:21 -05:00
LICENSE chore: add license 2023-09-14 23:06:48 -05:00
nimble.lock chore: create lockfile 2023-09-14 23:07:28 -05:00
README.md move: rebrand to zuhyo 2023-09-14 23:52:21 -05:00
zuhyo.nimble move: rebrand to zuhyo 2023-09-14 23:52:21 -05:00

Zuhyo (図表)

The easiest way to interact with a graphql api

Features

  • Fast as fuck
  • No need for openssl or other ssl libraries when compiling

Installation

Zuhyo can be installed through nimble (coming soon)

nimble install zuhyo

or through git

nimble install https://github.com/arashi-software/zuhyo

Usage

GraphQL query from a file

let 
  api = zuhyo.newClient("https://graphql.anilist.co") # Create a new zuhyo client; Pass in the api endpoint
  query = "tests/test.gql".readQuery(vars {"id": "15125"}) # Read a file to create a query and pass in variables using the vars function
  req = api.request(query) # Finally request from the api using the graphql query we just created

echo req.code # Response code of the request
echo req.headers # Headers returned in the request
echo req.body # Actual json

GraphQL query from text

let 
  api = zuhyo.newClient("https://graphql.anilist.co") # Create a new zuhyo client; Pass in the api endpoint
  query = """
query ($id: Int) { # Define which variables will be used in the query (id)
  Media (id: $id, type: ANIME) { # Insert our variables into the query arguments (id) (type: ANIME is hard-coded in the query)
    id
    title {
      romaji
      english
      native
    }
  }
}
""".newQuery(vars {"id": "15125"}) # Read a file to create a query and pass in variables using the vars function
  req = api.request(query) # Finally request from the api using the graphql query we just created

echo req.code # Response code of the request
echo req.headers # Headers returned in the request
echo req.body # Actual json