예제 #1
0
        public IntentExportResponse GetIntent(string workspaceId, string intent, bool?export = null)
        {
            if (string.IsNullOrEmpty(workspaceId))
            {
                throw new ArgumentNullException(nameof(workspaceId));
            }
            if (string.IsNullOrEmpty(intent))
            {
                throw new ArgumentNullException(nameof(intent));
            }

            if (string.IsNullOrEmpty(VersionDate))
            {
                throw new ArgumentNullException("versionDate cannot be null. Use 'CONVERSATION_VERSION_DATE_2017_05_26'");
            }

            IntentExportResponse result = null;

            try
            {
                result = this.Client.WithAuthentication(this.UserName, this.Password)
                         .GetAsync($"{this.Endpoint}/v1/workspaces/{workspaceId}/intents/{intent}")
                         .WithArgument("version", VersionDate)
                         .WithArgument("export", export)
                         .As <IntentExportResponse>()
                         .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
예제 #2
0
        public IntentExportResponse GetIntent(string workspaceId, string intent, bool export = false)
        {
            IntentExportResponse result = null;

            if (string.IsNullOrEmpty(workspaceId))
            {
                throw new ArgumentNullException("parameter: workspaceId");
            }
            if (string.IsNullOrEmpty(intent))
            {
                throw new ArgumentNullException("parameter: intent");
            }

            try
            {
                result =
                    this.Client.WithAuthentication(this.UserName, this.Password)
                    .GetAsync($"{this.Endpoint}{PATH_CONVERSATION}/{workspaceId}/intents/{intent}")
                    .WithArgument("version", VERSION_DATE_2017_05_26)
                    .WithArgument("export", export)
                    .WithHeader("accept", HttpMediaType.APPLICATION_JSON)
                    .As <IntentExportResponse>()
                    .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }