Exemple #1
0
        public RecognizeStatus GetSessionStatus(string sessionId)
        {
            RecognizeStatus result = null;

            if (string.IsNullOrEmpty(sessionId))
            {
                throw new ArgumentNullException("session id can not be null or empty");
            }

            try
            {
                result =
                    this.Client.WithAuthentication(this.UserName, this.Password)
                    .GetAsync($"{this.Endpoint}{string.Format(PATH_SESSION_RECOGNIZE, sessionId)}")
                    .WithHeader("Cookie", sessionId)
                    .WithHeader("accept", HttpMediaType.APPLICATION_JSON)
                    .As <RecognizeStatus>()
                    .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.InnerException as ServiceResponseException;
            }

            return(result);
        }
Exemple #2
0
        public RecognizeStatus GetSessionStatus(string sessionId)
        {
            RecognizeStatus result = null;

            try
            {
                result =
                    this.Client.WithAuthentication(this.UserName, this.Password)
                    .GetAsync($"{RELATIVE_PATH}{string.Format(PATH_SESSION_RECOGNIZE, sessionId)}")
                    .WithHeader("Cookie", sessionId)
                    .WithHeader("accept", HttpMediaType.APPLICATION_JSON)
                    .As <RecognizeStatus>()
                    .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }