'How to use graphql in Unity3D proyecto26 library?
I implemented GraphQL on my API, however I don't know how to execute it on the libray I am using.
using UnityEngine;
using UnityEditor;
using Models;
using Proyecto26;
using System.Collections.Generic;
using UnityEngine.Networking;
using UnityEngine.UI;
public class AuthController : MonoBehaviour {
private readonly string basePath = "http://localhost:1337";
public void Get(){
currentRequest = new RequestHelper {
Uri = basePath + "/graphql",
Method = "GET",
BodyString = "query {users {_id username email}}" //Use it instead of 'Body' to serialize using other tools
};
RestClient.Get<Auth>(currentRequest).Then(
res => {
string encodedString =JsonUtility.ToJson(res, true);
JSONObject jar = new JSONObject(encodedString);
Debug.Log(jar);
});
}
}
It just returns error. It might be the "BodyString" but I am not really sure. Since this is my first time using GraphQl in Unity project. Please help me how to properly query this using Proyecto26.
Solution 1:[1]
I have solve this by using this library Gazuntype/graphQL it is more convenient to use GraphQL now on my project. This solves my problem. It also uses simpleJSON to deserialized the response.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | andymyst |
