Querying Clients
This section will take you through setting a client and querying it.
In order to query data, this package must have access to a valid GraphQL client. By default, this client is the gateway (https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet). However, you can change the client to another.
julia> client!("mynewclient.com/endpoint")TheGraphData.client! — Functionclient!(u::AbstractString; introspect=false)
client!(c::GraphQLClient.Client)Set the provided url (u) or client (c) as the new global client.
By default, we decide to not introspect as its much slower to do so if you don't need to. However, if your use-case could benefit from introspection, you should set it to true. If you're unsure, benchmark both approaches in the context of your code and see what works.
This sets the global client, so all subsequent calls to querying function do not need you to track and pass the client around.
After ensuring that you've correctly set the client, you can now query the client for data.
julia> qvalue = "subgraphDeployments"
julia> qargs = Dict("first" => 1000)
julia> qfields = ["ipfsHash"]
julia> paginated_query(qvalue, qargs, qfields)TheGraphData.paginated_query — Functionpaginated_query(
v::AbstractString, a::Dict, f::AbstractVector{S}
) where {S<:AbstractString}Query the client using comparator-based pagination.
By default, the client is the gateway. This function returns a vector of dictionaries. Unless you know what you're doing, you should probably prefer this function to query.
TheGraphData.query — Functionquery(
v::AbstractString, a::Dict, f::AbstractVector{S}
) where {S<:AbstractString}Query the client for value v with arguments a and fields f.
By default, the client is the gateway. This function returns a vector of dictionaries. Unless you know what you're doing, you should probably prefer paginated_query to this function.