gazuntype / graphql-client-unity Goto Github PK
View Code? Open in Web Editor NEWThis repository houses a unitypackage that can be included in your Unity Project to enable it communicate with a graphQL server.
License: Apache License 2.0
This repository houses a unitypackage that can be included in your Unity Project to enable it communicate with a graphQL server.
License: Apache License 2.0
I'm not 100% sure what is going on here, but I have been debugging for quite a while - was hoping to be able to submit a PR, but I hit a deadend.
Using SetArgs(object o)
function, the Json conversation works fine (even with Enum), but then when JsonToArgument runs, and the following error happens:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Based on the debugger, it seems that indexes has a Length(Count) of 1 here:
if (jsonChar[i] == ':'){
jsonChar[indexes[0]] = ' ';
jsonChar[indexes[1]] = ' ';
}
but it isn't clear exactly why. I added a check to make sure index[1] exists before running that second call to jsonChar[indexes[1]], but it results in a malformed query.
I made an isolated example on Repl.it if it is any help: https://repl.it/repls/AbleVerticalMaps
The input to the function is a direct copy of what is received after string json = JsonConvert.SerializeObject(inputObject, new EnumInputConverter());
. In my schema I have an enum like AssetType:
enum AssetType {
DRESSING
GLOBAL
MAP
PLAYERHANDOUT
TOKEN
OTHER
}
and then in my local code:
enum AssetType {
DRESSING
GLOBAL
MAP
PLAYERHANDOUT
TOKEN
OTHER
}
I thought the enum might be the problem, because I have other queries that do work just fine. But I don't think AssetType enum is the problem here.
Code from Repl.it if it helps:
using System;
using System.Collections;
using System.Collections.Generic;
class MainClass {
private static string JsonToArgument(string jsonInput){
char[] jsonChar = jsonInput.ToCharArray();
List<int> indexes = new List<int>();
jsonChar[0] = ' ';
jsonChar[jsonChar.Length - 1] = ' ';
for (int i = 0; i < jsonChar.Length; i++){
if (jsonChar[i] == '\"'){
if (indexes.Count == 2)
indexes = new List<int>();
indexes.Add(i);
}
if (jsonChar[i] == ':'){
jsonChar[indexes[0]] = ' ';
jsonChar[indexes[1]] = ' ';
}
}
string result = new string(jsonChar);
return result;
}
public static void Main (string[] args) {
JsonToArgument("{\"input\":{\"adventureId\":null,\"assetSubType\":null,\"assetType\":Map,\"campaignId\":null,\"contentPackageId\":null,\"description\":\"A wonderful place to go!\",\"encounterId\":null,\"name\":\"Abandoned House\",\"originalImageUrl\":\"https://i0.wp.com/www.fantasticmaps.com/wp-content/uploads/2010/06/Attachment-1.jpeg\",\"s3ImageUrl\":\"https://omitted.s3.amazonaws.com/08d7fa90-a716-4083-8fd6-41d21e317fe3/Attachment-1.47c282ef-8c42-4c29-8321-80360a2eaa36.jpeg\",\"userId\":\"08d7fa90-a716-4083-8fd6-41d21e317fe3\"}}");
}
}
Having struggled with exporting to WebGL, I've hit a roadblock with getting the .SetArgs function to work properly for adding arguments to both queries and mutations.
In editor, everything works fine, however when exporting to WebGL (with code stripping set to high) I've narrowed the debugging down to the string json = JsonConvert.SerializeObject(inputObject, new EnumInputConverter());
returning an empty string.
I suspect this is not strictly related to this repo but the newtonsoft library in general. However, it would be nice to get some insight.
I've tried using a link.xml and different "dont strip this" attributes to no avail. If anyone has an idea what is being stripped here that causes this behaviour, please let me know! (It works with stripping disabled)
Hi! Great work by the way!
It would be just a perfect feature, if we could setup and update your solution as a package via unity
"package manager" just by link to the git
It's not so hard to setup i guess, here is the info
https://docs.unity3d.com/Manual/upm-git.html
Thank you!
Can a version using co-routines be added?
Hi, after trying to add your package to unity, I get this error:
Failed to load 'E:/My Unity games/Api - unity test 2020.1.8f1/Assets/graphQL-client-unity-master/ProjectSettings/XRSettings.asset'. File may be corrupted or was serialized with a newer version of Unity.
I tried multiple projects and unity versions. Someone any idea?
I have a query like GetUsers which is set to return user
, but after I introspect, return type changes to character
. Once this happens, when you click "add field", it causes all the values to be from the character
schema instead.
I was able to "solve" this by deleting the query and making the exact same thing again - then the return type becomes correct.
Additionally, when you start building up these deep resolvers, you can imagine that re-creating these every time becomes a huge pain.
Is there no way to create the queries as text in files rather than this cumbersome tree UI?
Thanks!
The subscription query throws error can't connect to the remote server while other queries are working properly. I am following the official tutorial from the following link.
I tried all possible ways including recreating the table, recreating a subscription query in the graph client but nothing worked! Subscription is working fine in the graphql editor but throws an error in Unity. I have attached an editor logs just for reference.
If you will need a project please let me know I will share it with you.
First: Thanks for building this!
I was having inconsistencies when using the latest pull. I realized it was related to two issues:
First: the try/catch blocks in httpHandler are actually consuming the exception and acting like everything is fine. An example proposed structure would look something closer to
public static async Task<UnityWebRequest> GetAsync(string url, string authToken = null){
UnityWebRequest request = UnityWebRequest.Get(url);
if (!String.IsNullOrEmpty(authToken))
request.SetRequestHeader("Authorization", "Bearer " + authToken);
OnRequestBegin requestBegin = new OnRequestBegin();
requestBegin.FireEvent();
try{
await request.SendWebRequest();
OnRequestEnded requestSucceeded = new OnRequestEnded(request.downloadHandler.text);
requestSucceeded.FireEvent();
return request;
}
catch(Exception e){
Debug.Log("Testing exceptions");
OnRequestEnded requestEnded = new OnRequestEnded(e);
requestEnded.FireEvent();
throw;
}
}
Also your async/await library has a nullref bug in it....somewhere. Rather than debugging it - I tried using an extension method I found somewhere that's been super stable (been using it for years). Everything started showing up just fine after that. Feel free to steal it if you like:
public class UnityWebRequestAwaiter : INotifyCompletion
{
private UnityWebRequestAsyncOperation asyncOp;
private Action continuation;
public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp)
{
this.asyncOp = asyncOp;
asyncOp.completed += OnRequestCompleted;
}
public bool IsCompleted { get { return asyncOp.isDone; } }
public void GetResult() { }
public void OnCompleted(Action continuation)
{
this.continuation = continuation;
}
private void OnRequestCompleted(AsyncOperation obj)
{
continuation();
}
}
public static class ExtensionMethods
{
public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOp)
{
return new UnityWebRequestAwaiter(asyncOp);
}
}
cheers!
I'm using bitquery to get some blockchain data and they said all I need is the X-API-KEY in the headers but I'm having trouble with the syntax. What am I doing wrong?
bqRef.SetAuthToken(@"""X-API-KEY"":""asdf1234""");
I'm getting this error "401 Authorization Required"
I've been playing around with the Enjin Unity SDK (https://github.com/twglhk/Enjin-Unity-sample). The Enjin ecosystem uses GraphQL and, as you would expect, the Unity SDK is in large part centered around sending queries via web request to their graphql endpoints.
However, the SDK is kind of a mess. They are building a lot of their queries / injecting variables via string manipulation which is error prone and a security vulnerability. Given that, I have been exploring other, hopefully better options / tools for creating, serializing, sending, GraphQL queries (and receiving responses). This client looks awesome / like just what I need in many ways!
Unfortunately, I haven't been able to get it working yet!
The issue here / how to reproduce:
Any help would be greatly appreciated! Happy to provide more info if I missed something too!
Thanks for all of your hard work!
-Drake
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow,noarchive" />
<title>An Error Occurred: Method Not Allowed</title>
<style>body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
.container { margin: 30px; max-width: 600px; }
h1 { color: #dc3545; font-size: 24px; }
h2 { font-size: 18px; }</style>
</head>
<body>
<div class="container">
<h1>Oops! An Error Occurred</h1>
<h2>The server returned a "405 Method Not Allowed".</h2>
<p>
Something is broken. Please let us know what you were doing when this error occurred.
We will fix it as soon as possible. Sorry for any inconvenience caused.
</p>
</div>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"rayId":"6af15ca98d5319fb","token":"90b9898d975549fc99f35b663f8cf1e4","version":"2021.11.0","si":100}' crossorigin="anonymous"></script>
</body>
</html>
UnityEngine.Debug:Log (object)
GraphQlClient.Core.HttpHandler/<PostAsync>d__0:MoveNext () (at Assets/Plugins/graphQl-client/Scripts/Core/HttpHandler.cs:36)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
GraphQlClient.Core.UnityWebRequestAwaiter:OnRequestCompleted (UnityEngine.AsyncOperation) (at Assets/Plugins/graphQl-client/Scripts/Extensions/UnityWebRequestExtensions.cs:30)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()
JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Newtonsoft.Json.JsonTextReader.ParseValue () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonTextReader.Read () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonReader.ReadAndMoveToContent () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
GraphQlClient.Core.GraphApi.HandleIntrospection () (at Assets/Plugins/graphQl-client/Scripts/Core/GraphApi.cs:137)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <2cd7ebc9c2ef4276a8edbc7de85c89ce>:0)
Hello Guys, need a help with the mutation.
Here mutation:
mutation insert_user_assessment( $objects:
[user_assessment_insert_input!]!) {
insert_user_assessment(objects: $objects) {
returning {
id
}
}
}
This above mutation. Passing correct objects value as argument and access token given. I am executing. But have this error : {"errors":[{"message":"Internal server error","extensions":{"code":"INTERNAL_SERVER_ERROR"}}]}
Anyone have a solution or idea for this?
Due to GUI bugs referred to here
#6
and here
#10
I have a GUI version working on another machine but it doesn't work on my machine. The Api reference GUI crashes all the time on my machine and sometimes on another machine.
I attempted to create a non-GUI script but failed. Do you have a non-GUI script-only version available? Happy to compensate with some $.
The current Unity AWS drivers don't support AppSync. Any plans to enable graphQL-client-unity to access AWS graphql?
So with "API.myApiGraph.Set.AuthToken("myAuthToken") I can set my AccessToken as the Token used in the header when communicating with the server. Problem is when I log out and want to log in again the AuthToken is still set to the Access token so my Authentication process won't work anymore.
I tried setting it to "" or even to null but both doesn't seem to fully reset the header. Is there any way to reset it completely without restarting the App?
Hi. I'm new to GraphQl. I want to do some fetch from https://axieinfinity.com/graphql-server/graphql, but whatever variation of the url i do (without https://, without the last graphql, with a / at the end, etc), i always get this:
JsonReaderException: Error parsing NaN value. Path '', line 1, position 1.
It must be something simple but i really wanna try this out...
Cheers
edit:
I'm now getting the same as the last post in here #6
The ScriptableObject UI is not showing, and the console spams NullRef in Assets/graphQl-client/Scripts/Core/GraphApi.cs:153
Restarting Unity doesn't help, the spam continues
I'm getting this NullReferenceException every time after I play the unity editor and then click Create Field, also it makes the Create Field button in the inspector not visible. I'm using Unity 2019.3.3f1 version.
NullReferenceException: Object reference not set to an instance of an object
GraphQlClient.Core.GraphApi.AddField (GraphQlClient.Core.GraphApi+Query query, System.String typeName, GraphQlClient.Core.GraphApi+Field parent) (at Assets/graphQl-client/Scripts/Core/GraphApi.cs:240)
GraphQlClient.Editor.GraphApiEditor.DisplayFields (GraphQlClient.Core.GraphApi graph, System.Collections.Generic.List`1[T] queryList, System.String type) (at Assets/graphQl-client/Scripts/Editor/GraphApiEditor.cs:112)
GraphQlClient.Editor.GraphApiEditor.OnInspectorGUI () (at Assets/graphQl-client/Scripts/Editor/GraphApiEditor.cs:59)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.b__0 () (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Queries made under GraphiQL editor throws error while trying to introspect. The error is:
JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Why does this happen?
Receiving ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
when I do the following:
int selectedStoreId = 0;
string createdDate;
...
object args = new {input = new{created = createdDate, store = new{id = selectedStoreId}}};
mutation.SetArgs(args);
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <437ba245d8404784b9fbab9b439ac908>:0)
GraphQlClient.Core.GraphApi.JsonToArgument (System.String jsonInput) (at Assets/graphQl-client/Scripts/Core/GraphApi.cs:110)
GraphQlClient.Core.GraphApi+Query.SetArgs (System.Object inputObject) (at Assets/graphQl-client/Scripts/Core/GraphApi.cs:342)
CreateRecipt+<CreateNewRecipt>d__9.MoveNext () (at Assets/Resources/Scripts/CreateRecipt.cs:60)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /home/builduser/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /home/builduser/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
Looking into this issue!
Hi, thanks for sharing this code. I'm looking for a GraphQL client with subscription support. Does this client support subscriptions? If not, do you have plans to support them?
First off, kick ass package! This is absolutely amazing, phenominal work!! 🎉
I would like to request the ability to add what type of Auth is used when making requests. I noticed you've been using Bearer
, however for the GraphQL APIs I'm using, the method we use is JWT
.
It would be great if there was a AuthConstants.cs
file, containing say
# AuthConstants.cs
public class AuthMethod {
public const string BEARER = "Bearer";
public const string JWT = "JWT";
...
}
and you could reference the Auth method you wished when setting the auth token, i.e.
myGraphQLReference.SetAuthToken(AuthMethod.BEARER, myToken);
Just a thought! Might save some others time who maybe aren't using Bearer
as their source of API auth.
Thanks!!
I am making a multiplayer game with Mirror, need to load several states for player with graph api.The local graphql URL is http://localhost:4000/graphql.It works smoothly in Unity Editor, but when I run a build locally as client , the api doesn't work.Even after I sign in build as host, it doesn't work either.I am not sure if i need modify the url when running on build.I tried many other ways, none works out.
As title, or how to implement by c#,any body know?🥴
for instance
query paginateProducts {
site {
products (first: 3) {
(etc.)
defaultImage{
url(width: 200, height: 200)
}
}
}
passing args like this is pretty common in business oriented schema and I can't find info on doing this with this project.
Thanks
dont work, if i click on create i dont get a button for graphql to include the api reference
unity 2021.03.21f1
Hello, I am getting a NullReferenceException: Object reference not set to an instance of an object
GraphQlClient.Core.GraphApi.HandleIntrospection () (at Assets/graphQl-client/Scripts/Core/GraphApi.cs:134) When I try to Introspect the url.
I inputted my key in the line below:
public void SetAuthToken(string auth){ authToken = "Mi_api_key";
I am getting that error, could it be because the URL I am trying to connect to requires for me to authenticate using my API key and API secret? They recommended using BasicAuth on their website.
How should I approach this?
From your example looks like after I call Subscribe its its returning ClientWebSocket. So if I have 10 subscriptions running simultaneously does that mean am opening 10 websocket to the server? From apollo docs looks like they open one websocket and all subscriptions are handled using that one websocket https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md . Can you please clarify?
Is there a way to configure this package to work on a WebGL build? I need to perform GraphQL Queries, Mutation and Subscriptions all with Authorization Header on a WebGL application.
After entering a valid GraphQL URL, whilst Introspection
How to get a pokemon of 'givenName' using getPokemon method?
Query.getPokemon: Pokemon!
Gets details on a single Pokémon based on species name You can provide "takeFlavorTexts" to limit the amount of flavour texts to return, set the offset of where to start with "offsetFlavorTexts", and reverse the entire array with "reverseFlavorTexts". Reversal is applied before pagination!
I have modified this code to try to work with an authenticated server, but am having no luck passing the token, I keep getting a 401. What do you think I may be missing? See below:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using SimpleJSON;
using UnityEngine;
using UnityEngine.Networking;
namespace graphQLClient
{
public class GraphQuery : MonoBehaviour
{
public static GraphQuery instance = null;
[Tooltip("The url of the node endpoint of the graphQL server being queried")]
public static string url;
public delegate void QueryComplete();
public static event QueryComplete onQueryComplete;
public enum Status { Neutral, Loading, Complete, Error };
public static Status queryStatus;
public static string queryReturn;
string authURL;
public static string LoginToken;
public class Query
{
public string query;
}
public void Awake()
{
if (instance == null)
{
instance = this;
}
else if (instance != this)
{
Destroy(gameObject);
}
DontDestroyOnLoad(gameObject);
StartCoroutine("PostLogin");
}
private void Start()
{
LoginToken = "";
}
public static Dictionary<string, string> variable = new Dictionary<string, string>();
public static Dictionary<string, string[]> array = new Dictionary<string, string[]>();
// Use this for initialization
// SMT Authentication to ELP
// SMT Needed for Authentication--- if (token != null) request.SetRequestHeader("Authorization", "Bearer " + token);
//POST https://myapp/login
//In the request body: {email: string, password: string}
//You’ll either get a 401 with an empty response or 201 with {token: string, user: object}
IEnumerator PostLogin()//logs in to system
{
Debug.Log("Logging in...");
string authURL = "myapp.com/login";
string loginBody = "{\"email\":\"mylogin\",\"password\":\"mypasswor\"}";
var request = new UnityWebRequest(authURL, "POST");
byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(loginBody);
request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
{
Debug.Log("Login error!");
foreach (KeyValuePair<string, string> entry in request.GetResponseHeaders())
{
Debug.Log(entry.Value + "=" + entry.Key);
}
Debug.Log(request.error);
}
else
{
Debug.Log("Login complete!");
//Debug.Log(request.downloadHandler.text);
LoginToken = request.downloadHandler.text;
Debug.Log(LoginToken);
}
}
public static WWW POST(string details)//Supposed to after logging in to system, add token to body and then makes query
{
//var request = new UnityWebRequest(url, "POST");
details = QuerySorter(details);
Query query = new Query();
string jsonData = "";
WWWForm form = new WWWForm();
query = new Query { query = details };
jsonData = JsonUtility.ToJson(query);
byte[] postData = Encoding.ASCII.GetBytes(jsonData);
Dictionary<string, string> postHeader = form.headers;
//postHeader["Authorization"] = "Bearer " + downloadHandler.Token;
if (postHeader.ContainsKey("Content-Type"))
//postHeader["Content-Type"] = "application/json";
postHeader.Add("Authorization", "Bearer " + LoginToken);
else
postHeader.Add("Content-Type", "application/json");
WWW www = new WWW(url, postData, postHeader);
instance.StartCoroutine(WaitForRequest(www));
queryStatus = Status.Loading;
return www;
}
static IEnumerator WaitForRequest(WWW data)
{
yield return data; // Wait until the download is done
if (data.error != null)
{
Debug.Log("There was an error sending request: " + data.error);
queryStatus = Status.Error;
}
else
{
queryReturn = data.text;
queryStatus = Status.Complete;
}
onQueryComplete();
}
public static string QuerySorter(string query)
{
string finalString;
string[] splitString;
string[] separators = { "$", "^" };
splitString = query.Split(separators, StringSplitOptions.RemoveEmptyEntries);
finalString = splitString[0];
for (int i = 1; i < splitString.Length; i++)
{
if (i % 2 == 0)
{
finalString += splitString[i];
}
else
{
if (!splitString[i].Contains("[]"))
{
finalString += variable[splitString[i]];
}
else
{
finalString += ArraySorter(splitString[i]);
}
}
}
return finalString;
}
public static string ArraySorter(string theArray)
{
string[] anArray;
string solution;
anArray = array[theArray];
solution = "[";
foreach (string a in anArray)
{
}
for (int i = 0; i < anArray.Length; i++)
{
solution += anArray[i].Trim(new Char[] { '"' });
if (i < anArray.Length - 1)
solution += ",";
}
solution += "]";
Debug.Log("This is solution " + solution);
return solution;
}
}
}
I have a query in the format:
{
System(ID: "1") {
model {
type {
SystemModel{
CreationModel(isModelCreated: true) {
name
}
}
}
}
}
}
And my Unity code is:
query.SetArgs (new { ID= "1", isModelCreated = true });
So in SetArgs, I have to provide a list of arguments, for example ID: "1" and isModelCreated: true. I am able to provide the first argument, but unfortunately the nested query's argument - isModelCreated is not getting recognized.
Do we need to implement Authentication Bearer, or this part of the lib?
Hello,upon importing graphQL into Unity,i got error regarding this line
After that,i check out the demo,hitting the introspect link on both pokemon and user.Both get stuck on " API is being introspect, please wait"
I even test it on a working project link and the bug remain
What should I do ?
Hi! Our backend team create schema with mutation
--data '{"query":"mutation Login { login(input: { email: "[email protected]", password: "aasdasd" })
{ __typename, ...on LoginAuthToken { accessToken refreshToken }, ...on InvalidCredentials
{ message } }}"}'
In unity inspector it look like
When I try to execute query i have error
GraphApi.Query query = _requests.GetQueryByName("Login", GraphApi.Query.Type.Mutation);
var result = await _requests.Post(query);
Debug.Log(result.downloadHandler.text);
{"errors":[{"message":"Field "login" of type "LoginUserResult!" must have a selection of subfields. Did you mean "login { ... }"?","extensions":{"code":"GRAPHQL_VALIDATION_FAILED","exception":{"stacktrace":["GraphQLError: Field "login" of
type "LoginUserResult!" must have a selection of subfields. Did you mean "login { ... }"?","
at Object.Field (/app/node_modules/graphql/validation/rules/ScalarLeafsRule.js:40:31)","
at Object.enter (/app/node_modules/graphql/language/visitor.js:323:29)","
at Object.enter (/app/node_modules/graphql/utilities/TypeInfo.js:370:25)","
at visit (/app/node_modules/graphql/language/visitor.js:243:26)","
at validate (/app/node_modules/graphql/validation/validate.js:69:24)","
at validate (/app/node_modules/apollo-server-core/dist/requestPipeline.js:187:39)","
at processGraphQLRequest (/app/node_modules/apollo-server-core/dist/requestPipeline.js:90:34)","
at runMicrotasks ()"," at processTicksAndRejections (node:internal/process/task_queues:96:5)","
at async processHTTPRequest (/app/node_modules/apollo-server-core/dist/runHttpQuery.js:187:30)"]}}}]}
Can you help me?
I think it just need this issue to be fixed to be able to send and retrieve jsonB parameters.
Also just saying, for something quoted on the Hasura website, it lacks basic features hasura have (JSONB, Where, Order By, Group By etc)
I've got problems pushing Strings including special characters to our server. Special chars like "Ä" simply convert to "?" when pushing a mutation. Our server uses UTF-8 so the problem must occure on the serialization process of the client or something.
I'd like to include UTF-8, characters. Is there any fix to this? Thanks in advance.
When I opened the demo project I get three errors from the HttpHandler... here are all three:
1.Assets\graphQl-client\Scripts\Core\HttpHandler.cs(31,17): error CS1061: 'UnityWebRequestAsyncOperation' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'UnityWebRequestAsyncOperation' could be found (are you missing a using directive or an assembly reference?)
2.Assets\graphQl-client\Scripts\Core\HttpHandler.cs(53,5): error CS1061: 'UnityWebRequestAsyncOperation' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'UnityWebRequestAsyncOperation' could be found (are you missing a using directive or an assembly reference?)
3.Assets\graphQl-client\Scripts\Core\HttpHandler.cs(75,17): error CS1061: 'UnityWebRequestAsyncOperation' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'UnityWebRequestAsyncOperation' could be found (are you missing a using directive or an assembly reference?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.