public bool Equals(GraphQLResponse <T>?other)
 {
     if (other == null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (!EqualityComparer <T> .Default.Equals(this.Data, other.Data))
     {
         return(false);
     }
     {
         if (this.Errors != null && other.Errors != null)
         {
             if (!Enumerable.SequenceEqual(this.Errors, other.Errors))
             {
                 return(false);
             }
         }
         else if (this.Errors != null && other.Errors == null)
         {
             return(false);
         }
         else if (this.Errors == null && other.Errors != null)
         {
             return(false);
         }
     }
     return(true);
 }
Example #2
0
        private IEnumerator SendRequest(string query, object variables    = null,
                                        Action <GraphQLResponse> callback = null,
                                        string token = null)
        {
            var request = QueryRequest(query, variables, token);

            using (UnityWebRequest www = request) {
                yield return(www.Send());

                if (www.isNetworkError)
                {
                    if (callback != null)
                    {
                        callback(new GraphQLResponse("", www.error));
                    }
                    yield break;
                }

                string responseString = www.downloadHandler.text;

                var result = new GraphQLResponse(responseString);

                if (callback != null)
                {
                    callback(result);
                }
            }

            request.Dispose();
        }
Example #3
0
        private IEnumerator SendRequest(string query, object variables = null, Action <GraphQLResponse> callback = null)
        {
            var request = QueryRequest(query, variables);

            using (UnityWebRequest www = request) {
                yield return(www.SendWebRequest());

                if (www.isNetworkError)
                {
                    if (callback != null)
                    {
                        callback(new GraphQLResponse(null, www.error));
                    }
                    yield break;
                }

                string responseString = www.downloadHandler.text;
                responseString = CloudSaveSettings.Encrypted ? RC4.Decrypt(Convert.FromBase64String(responseString)) : responseString;

                var result = new GraphQLResponse(responseString);

                if (callback != null)
                {
                    callback(result);
                }
            }

            request.Dispose();
        }