Esempio n. 1
0
        protected IEnumerator _GetAllCases(string applicationName, string stateName, string searchString, bool getArtifacts, Action <CaseInfoWrapper> onComplete)
        {
            var routine = GetApplicationInfo(applicationName);

            yield return(StartCoroutine(routine));

            ApplicationInfo application = (ApplicationInfo)(routine.Current);

            try
            {
                applicationsMap.Add(applicationName, application);
            }
            catch (ArgumentException) { }


            routine = _GetApplicationCases(application, stateName, searchString);
            yield return(StartCoroutine(routine));

            var cases = (CaseInfoWrapper)routine.Current;

            cases.applicationName = applicationName; // add the name to help the callback to handle the data
            if (getArtifacts == true)
            {
                foreach (CaseInfo item in cases.items)
                {
                    // Debug.Log("case data " + item.casedata );
                    //ElementData runner = JsonUtility.FromJson<ElementData>(item.casedata);

                    // Get All Runners
                    routine = GetCaseArtifacts(item.caseReference);
                    yield return(StartCoroutine(routine));

                    ArtifactInfoWrapper docList = (ArtifactInfoWrapper)(routine.Current);

                    Debug.Log("docList for case  " + JsonUtility.ToJson(docList, true));
                    item.documents = docList.items;

                    foreach (ArtifactInfo doc in docList.items)
                    {
                        Debug.Log("doc case  " + doc.mimeType);
                        if (doc.mimeType.StartsWith("image"))
                        {
                            routine = GetArtifactAsTexture(item.caseReference, doc);
                            yield return(StartCoroutine(routine));
                        }
                        item.images.Add((UnityEngine.Texture2D)(routine.Current));
                    }
                }
            }
            if (onComplete != null)
            {
                onComplete(cases);
            }
            // OnCaseData(cases); // CaseInfoWrapper type
        }
Esempio n. 2
0
        protected IEnumerator GetCaseArtifacts(string caseReference)
        {
            Debug.Log("LiveApps Get Folder Artifacts for a case reference " + caseReference);
            // well retireve 100 first, not the All Cases !
            ArtifactInfoWrapper artifactList = null;

            string          CASES_URL = string.Format("https://{0}.cloud.tibco.com/webresource/caseFolders/{1}/artifacts?$sandbox={2}", apiDomain, caseReference, sandboxId);
            UnityWebRequest uwr       = UnityWebRequest.Get(CASES_URL);

            if (method == "password")
            {
                uwr.SetRequestHeader("Cookie", tsc);
                uwr.SetRequestHeader("Cookie", domain);
            }
            else
            {
                uwr.SetRequestHeader("Authorization", "Bearer " + oauth);
            }
            yield return(uwr.SendWebRequest());

            string resultString = uwr.downloadHandler.text;

            Debug.Log("artifact response : " + resultString);
            if (!resultString.Contains("errorCode"))
            {
                try
                {
                    artifactList = JsonUtility.FromJson <ArtifactInfoWrapper>("{ \"items\" :" + resultString + "}");
                }
                catch (System.Exception err)
                {
                    Debug.Log(err);
                }
            }

            yield return(artifactList);
        }