Skip to main content

GraphQLConfig

GraphQLConfig is a ScriptableObject that stores the GraphQL API reference. It is the single point for user accessing GraphQL API in the form of a config file. You may create one through Create/Portkey/GraphQL/API Reference.

You may learn more about GraphQL here: https://graphql.org/learn/

GetQueryByName(string queryName)

Description: For getting a GraphQL query by name.

Parameters:

  • queryName (string): The name of the query.

Returns: GraphQLQuery object corresponding to the queryName.

Example:

//getting the query object by name
GraphQLQuery query = graphQLConfig.GetQueryByName("MyGraphQLInfo");

Query<T>(GraphQLQuery query, SuccessCallback<T> successCallback, ErrorCallback errorCallback)

Description: For making a GraphQL query.

Parameters:

  • query (GraphQLQuery): The query to call in object form.
  • successCallback (SuccessCallback<T>): Callback function when post of query is successful.
  • errorCallback (ErrorCallback): Callback function when error occurs.

Generic:

  • T: The GraphQL return query type.

Example:

var query = GetQueryByName("MyGraphQLInfo");

StartCoroutine(graphQLConfig.Query<GraphQLCodeGen.Types.Query\>(query, SuccessCallback, ErrorCallback));