public static WatsonCustomModelStatus CreateInstance(LexiconWorkspace workspace)
        {
            WatsonCustomModelStatus instance = CreateInstance <WatsonCustomModelStatus>();

            instance.workspace = workspace;
            return(instance);
        }
        void HandleSuccessCallback(IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.Customization response, Dictionary <string, object> customData)
        {
            if (response != null)
            {
                string status = response.status;
                if (status.Length > 0)
                {
                    status = status.Substring(0, 1).ToUpper() + status.Substring(1);
                }

                workspace.WatsonSpeechToTextManager.SyncStatus = status;

                Debug.Log("Response progress: " + response.progress);

                // TODO: Use retry here.
                if (response.progress < 100)
                {
                    queue.Insert(TimerSyncAction.CreateInstance(5), 0);
                    queue.Insert(WatsonCustomModelStatus.CreateInstance(workspace), 1);
                }

                succeeded = true;
                isDone    = true;
                return;
            }

            succeeded = false;
            isDone    = true;
        }
        public void MonitorWatsonSpeechToTextTraining(LexiconWorkspace workspace)
        {
            workspace.WatsonSpeechToTextManager.IsTraining = true;

            WatsonSyncQueue syncQueue = ScriptableObject.CreateInstance <WatsonSyncQueue>();

            syncQueue.workspace = workspace;

            syncQueue.Enqueue(WatsonCustomModelStatus.CreateInstance(workspace));
            syncQueue.Enqueue(WatsonCustomWordsGet.CreateInstance(workspace));

            syncQueue.OnCompleteAction = WatsonCompleteSpeechToTextTraining.CreateInstance(workspace);
            syncQueue.OnQueueFinished += CleanUp;

            syncQueue.Process();

            watsonSpeechToTextSyncQueues.Add(syncQueue);
        }