public IntentCollectionResponse ListIntents(string workspaceId, bool?export = null, long?pageLimit = null, bool?includeCount = null, string sort = null, string cursor = null)
        {
            if (string.IsNullOrEmpty(workspaceId))
            {
                throw new ArgumentNullException(nameof(workspaceId));
            }

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

            IntentCollectionResponse result = null;

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

            return(result);
        }
Beispiel #2
0
        public IntentCollectionResponse ListIntents(string workspaceId, bool export = false)
        {
            IntentCollectionResponse result = null;

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

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

            return(result);
        }