Exemple #1
0
        /// <summary>
        /// This might not work
        /// </summary>
        /// <param name="url"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public virtual int Delete(string url, ICreateFormData obj)
        {
            UnityWebRequest www = UnityWebRequest.Put(url, JsonUtility.ToJson(obj));

            www.method = UnityWebRequest.kHttpVerbDELETE;
            www.SetRequestHeader("Content-Type", "application/json");
            www.SendWebRequest();
            while (!www.isDone)
            {
                if (www.downloadProgress < threshold)
                {
                    Thread.Sleep(sleepTime);
                }
            }

            int outputInt;

            if (int.TryParse(www.downloadHandler.text, out outputInt))
            {
                return(outputInt);//output the parsed integer
            }
            else
            {
                Debug.Log("Error From Delete API return type was not int:\n" + www.downloadHandler.text);
                return(-1);//output error message
            }
        }
Exemple #2
0
 public int Delete(ICreateFormData obj, bool removeAll = false)
 {
     if (removeAll)
     {
         Temp temp = new Temp();
         temp.aList = obj.CreateForm();
         temp.aList.Add(new MultipartFormDataSection("Remove_All", true.ToString()));
         return(base.Delete(URLConfig.BASEURL + baseTable, temp));
     }
     else
     {
         return(base.Delete(URLConfig.BASEURL + baseTable, obj));
     }
 }
Exemple #3
0
        /// <summary>
        /// This might not work
        /// </summary>
        /// <param name="url"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public virtual string Put(string url, ICreateFormData obj)
        {
            UnityWebRequest www = UnityWebRequest.Put(url, JsonUtility.ToJson(obj));

            www.method = "PUT";
            www.SetRequestHeader("Content-Type", "application/json");
            www.SendWebRequest();
            while (!www.isDone)
            {
                if (www.downloadProgress < threshold)
                {
                    Thread.Sleep(sleepTime);
                }
            }
            return(www.downloadHandler.text);
        }
 public Association Put(ICreateFormData obj)
 {
     return(JsonUtility.FromJson <Association>(base.Put(URLConfig.BASEURL + baseTable, obj)));
 }
 public Association Post(ICreateFormData formData)
 {
     return(JsonUtility.FromJson <Association>(base.Post(URLConfig.BASEURL + baseTable, formData)));
 }
Exemple #6
0
 /// <summary>
 /// Deletes the given yarn from the database. Note this will cascade and delete the references in the YarnLine table associated with this yarn id
 /// </summary>
 /// <param name="yarn">The yarn to be deleted</param>
 public override int Delete(string url, ICreateFormData obj)
 {
     return(base.Delete(URLConfig.BASEURL + baseTable, obj));
 }
 public int Delete(ICreateFormData obj)
 {
     return(base.Delete(URLConfig.BASEURL + baseTable, obj));
 }
 public YarnLineUpdate Put(ICreateFormData obj)
 {
     return(JsonUtility.FromJson <YarnLineUpdate>(base.Put(URLConfig.BASEURL + baseTable, obj)));
 }
 public YarnLine Post(ICreateFormData formData)
 {
     return(JsonUtility.FromJson <YarnLine>(base.Post(URLConfig.BASEURL + baseTable, formData)));
 }
Exemple #10
0
 /// <summary>
 /// Posts a Tag to the DB
 /// </summary>
 /// <param name="tag">Tag to be posted</param>
 /// <returns>TODO: Currently posts true always!</returns>
 public Tag Post(ICreateFormData obj)
 {
     return(JsonUtility.FromJson <Tag>(base.Post(URLConfig.BASEURL + baseTable, obj)));
 }
Exemple #11
0
 public Board Put(ICreateFormData obj)
 {
     return(JsonUtility.FromJson <Board>(base.Put(URLConfig.BASEURL + baseTable, obj)));
 }
Exemple #12
0
 public Board Post(ICreateFormData formData)
 {
     return(JsonUtility.FromJson <Board>(base.Post(URLConfig.BASEURL + baseTable, formData)));
 }
Exemple #13
0
 public Snippet Put(ICreateFormData obj)
 {
     return(JsonUtility.FromJson <Snippet>(base.Put(URLConfig.BASEURL + baseTable, obj)));
 }
Exemple #14
0
 public Snippet Post(ICreateFormData formData)
 {
     return(JsonUtility.FromJson <Snippet>(base.Post(URLConfig.BASEURL + baseTable, formData)));
 }
Exemple #15
0
 public new string Delete(string url, ICreateFormData obj)
 {
     throw new NotImplementedException();
 }