コード例 #1
0
ファイル: ReadFromTrello.cs プロジェクト: SyJuly/WorkAR
    IEnumerator GetBoardCards(int statusIndex)
    {
        UnityWebRequest BoardCardsRequest = trelloAPI.GetAllCardsHTTPRequest();

        BoardCardsRequest.chunkedTransfer = false;
        BoardCardsRequest.timeout         = 100000;

        yield return(BoardCardsRequest.SendWebRequest());

        if (BoardCardsRequest.isNetworkError || BoardCardsRequest.isHttpError)
        {
            Debug.Log("An error occured receiving events: " + BoardCardsRequest.responseCode);
        }
        else
        {
            string       responseToJSON          = "{\"cards\":" + BoardCardsRequest.downloadHandler.text + "}";
            TrelloCards  trelloCardsResponse     = JsonUtility.FromJson <TrelloCards>(responseToJSON);
            TrelloCard[] cardsWithAttachmentData = trelloCardsResponse.cards;
            foreach (TrelloCard card in cardsWithAttachmentData)
            {
                if (card.idAttachmentCover != null && card.idAttachmentCover != "")
                {
                    yield return(Utility.Instance.StartCoroutine(GetCardAttachment(card)));
                }
            }
            allCards      = cardsWithAttachmentData;
            areCardsReady = true;
        }
    }
コード例 #2
0
    IEnumerator GetModellCard(System.Action <string> urlAction)
    {
        UnityWebRequest ModellCardRequest = trelloAPI.GetModellCardHTTPRequest();

        ModellCardRequest.chunkedTransfer = false;
        ModellCardRequest.timeout         = 100000;

        yield return(ModellCardRequest.SendWebRequest());

        if (ModellCardRequest.isNetworkError || ModellCardRequest.isHttpError)
        {
            Debug.Log("An error occured receiving modell card: " + ModellCardRequest.responseCode);
        }
        else
        {
            string      responseToJSON      = "{\"cards\":" + ModellCardRequest.downloadHandler.text + "}";
            TrelloCards trelloCardsResponse = JsonUtility.FromJson <TrelloCards>(responseToJSON);
            TrelloCard  card = trelloCardsResponse.cards[0];
            yield return(Utility.Instance.StartCoroutine(GetModellLinkAttachment(card, urlAction)));
        }
    }