public IEnumerator SendReportRoutine(TrelloCard card) { yield return(trello.UploadCardRoutine(card)); // Wait for one extra second to let the player read that his isssue is being processed yield return(new WaitForSeconds(1)); }
public Coroutine SendReport(string title, string description, string listName) { // if both the title and description are empty show error message to avoid spam if (title == "" || description == "") { return(null); } TrelloCard card = trello.NewCard(title, description, listName); return(StartCoroutine(SendReportRoutine(card))); }
/// <summary> /// Makes a new Trello card object. /// </summary> /// <returns>The card object.</returns> /// <param name="listName">Name of the trello list to which the card will belong.</param> public TrelloCard NewCard(string listName) { string currentListId = ""; if (IsListCached(listName)) { currentListId = cachedLists[listName]; } else { throw new TrelloException("List specified not found."); } var card = new TrelloCard(); card.idList = currentListId; return(card); }
/// <summary> /// Given an exception object, a TrelloCard is created and populated with the relevant information from the exception. This is then uploaded to the Trello server. /// </summary> /// <returns>The exception card.</returns> /// <param name="e">E.</param> //public TrelloCard uploadExceptionCard(Exception e) //{ // var card = newCard(); // card.name = e.GetType().ToString(); // card.desc = e.Message; // return uploadCard(card); //} /// <summary> /// Async uploads a given TrelloCard object to the Trello servers. /// </summary> /// <returns>Your card ID.</returns> /// <param name="card">the card to upload.</param> public IEnumerator UploadCardRoutine(TrelloCard card) { WWWForm post = new WWWForm(); post.AddField("name", card.name); post.AddField("desc", card.desc); post.AddField("pos", card.pos); post.AddField("due", card.due); post.AddField("idList", card.idList); WWW www = new WWW(cardBaseUrl + "?" + "key=" + key + "&token=" + token, post); yield return(www); CheckWwwStatus("Could not upload new card to Trello", www); var dict = Json.Deserialize(www.text) as Dictionary <string, object>; yield return((string)dict["id"]); }