From a03b4a7c1a273ab3bd97a2e627577a36d01d6b38 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Tue, 24 Sep 2019 14:34:54 +0000 Subject: [PATCH] Generated from d3a4f2d1674a63bc9a4a57015f956833c7d40f7b Update LUIS-Authoring.json fix semantic bugs --- .../luis/authoring/authoringapi/models.go | 33 + .../luis/authoring/models.go | 495 + .../v3.0/luis/authoring/apps.go | 1650 ++++ .../luis/authoring/authoringapi/interfaces.go | 253 + .../v3.0/luis/authoring/azureaccounts.go | 352 + .../v3.0/luis/authoring/client.go | 44 + .../v3.0/luis/authoring/examples.go | 375 + .../v3.0/luis/authoring/features.go | 969 ++ .../v3.0/luis/authoring/model.go | 8420 +++++++++++++++++ .../v3.0/luis/authoring/models.go | 2180 +++++ .../v3.0/luis/authoring/pattern.go | 723 ++ .../v3.0/luis/authoring/permissions.go | 337 + .../v3.0/luis/authoring/settings.go | 195 + .../v3.0/luis/authoring/train.go | 191 + .../v3.0/luis/authoring/version.go | 30 + .../v3.0/luis/authoring/versions.go | 674 ++ 16 files changed, 16921 insertions(+) create mode 100644 profiles/preview/preview/cognitiveservices/luis/authoring/authoringapi/models.go create mode 100644 profiles/preview/preview/cognitiveservices/luis/authoring/models.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/apps.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/azureaccounts.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/client.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/examples.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/features.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/model.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/models.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/pattern.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/permissions.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/settings.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/train.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/version.go create mode 100644 services/preview/cognitiveservices/v3.0/luis/authoring/versions.go diff --git a/profiles/preview/preview/cognitiveservices/luis/authoring/authoringapi/models.go b/profiles/preview/preview/cognitiveservices/luis/authoring/authoringapi/models.go new file mode 100644 index 000000000000..a7c3942ad949 --- /dev/null +++ b/profiles/preview/preview/cognitiveservices/luis/authoring/authoringapi/models.go @@ -0,0 +1,33 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package authoringapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi" + +type AppsClientAPI = original.AppsClientAPI +type AzureAccountsClientAPI = original.AzureAccountsClientAPI +type ExamplesClientAPI = original.ExamplesClientAPI +type FeaturesClientAPI = original.FeaturesClientAPI +type ModelClientAPI = original.ModelClientAPI +type PatternClientAPI = original.PatternClientAPI +type PermissionsClientAPI = original.PermissionsClientAPI +type SettingsClientAPI = original.SettingsClientAPI +type TrainClientAPI = original.TrainClientAPI +type VersionsClientAPI = original.VersionsClientAPI diff --git a/profiles/preview/preview/cognitiveservices/luis/authoring/models.go b/profiles/preview/preview/cognitiveservices/luis/authoring/models.go new file mode 100644 index 000000000000..adbce417b2c5 --- /dev/null +++ b/profiles/preview/preview/cognitiveservices/luis/authoring/models.go @@ -0,0 +1,495 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package authoring + +import original "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring" + +type OperationStatusType = original.OperationStatusType + +const ( + Failed OperationStatusType = original.Failed + FAILED OperationStatusType = original.FAILED + Success OperationStatusType = original.Success +) + +type ReadableType = original.ReadableType + +const ( + ReadableTypeChildEntityExtractor ReadableType = original.ReadableTypeChildEntityExtractor + ReadableTypeClosedListEntityExtractor ReadableType = original.ReadableTypeClosedListEntityExtractor + ReadableTypeCompositeEntityExtractor ReadableType = original.ReadableTypeCompositeEntityExtractor + ReadableTypeEntityExtractor ReadableType = original.ReadableTypeEntityExtractor + ReadableTypeHierarchicalChildEntityExtractor ReadableType = original.ReadableTypeHierarchicalChildEntityExtractor + ReadableTypeHierarchicalEntityExtractor ReadableType = original.ReadableTypeHierarchicalEntityExtractor + ReadableTypeIntentClassifier ReadableType = original.ReadableTypeIntentClassifier + ReadableTypeListEntityExtractor ReadableType = original.ReadableTypeListEntityExtractor + ReadableTypePatternAnyEntityExtractor ReadableType = original.ReadableTypePatternAnyEntityExtractor + ReadableTypePrebuiltEntityExtractor ReadableType = original.ReadableTypePrebuiltEntityExtractor + ReadableTypeRegexEntityExtractor ReadableType = original.ReadableTypeRegexEntityExtractor +) + +type ReadableType1 = original.ReadableType1 + +const ( + ReadableType1ChildEntityExtractor ReadableType1 = original.ReadableType1ChildEntityExtractor + ReadableType1ClosedListEntityExtractor ReadableType1 = original.ReadableType1ClosedListEntityExtractor + ReadableType1CompositeEntityExtractor ReadableType1 = original.ReadableType1CompositeEntityExtractor + ReadableType1EntityExtractor ReadableType1 = original.ReadableType1EntityExtractor + ReadableType1HierarchicalChildEntityExtractor ReadableType1 = original.ReadableType1HierarchicalChildEntityExtractor + ReadableType1HierarchicalEntityExtractor ReadableType1 = original.ReadableType1HierarchicalEntityExtractor + ReadableType1IntentClassifier ReadableType1 = original.ReadableType1IntentClassifier + ReadableType1ListEntityExtractor ReadableType1 = original.ReadableType1ListEntityExtractor + ReadableType1PatternAnyEntityExtractor ReadableType1 = original.ReadableType1PatternAnyEntityExtractor + ReadableType1PrebuiltEntityExtractor ReadableType1 = original.ReadableType1PrebuiltEntityExtractor + ReadableType1RegexEntityExtractor ReadableType1 = original.ReadableType1RegexEntityExtractor +) + +type ReadableType10 = original.ReadableType10 + +const ( + ReadableType10ChildEntityExtractor ReadableType10 = original.ReadableType10ChildEntityExtractor + ReadableType10ClosedListEntityExtractor ReadableType10 = original.ReadableType10ClosedListEntityExtractor + ReadableType10CompositeEntityExtractor ReadableType10 = original.ReadableType10CompositeEntityExtractor + ReadableType10EntityExtractor ReadableType10 = original.ReadableType10EntityExtractor + ReadableType10HierarchicalChildEntityExtractor ReadableType10 = original.ReadableType10HierarchicalChildEntityExtractor + ReadableType10HierarchicalEntityExtractor ReadableType10 = original.ReadableType10HierarchicalEntityExtractor + ReadableType10IntentClassifier ReadableType10 = original.ReadableType10IntentClassifier + ReadableType10ListEntityExtractor ReadableType10 = original.ReadableType10ListEntityExtractor + ReadableType10PatternAnyEntityExtractor ReadableType10 = original.ReadableType10PatternAnyEntityExtractor + ReadableType10PrebuiltEntityExtractor ReadableType10 = original.ReadableType10PrebuiltEntityExtractor + ReadableType10RegexEntityExtractor ReadableType10 = original.ReadableType10RegexEntityExtractor +) + +type ReadableType11 = original.ReadableType11 + +const ( + ReadableType11ChildEntityExtractor ReadableType11 = original.ReadableType11ChildEntityExtractor + ReadableType11ClosedListEntityExtractor ReadableType11 = original.ReadableType11ClosedListEntityExtractor + ReadableType11CompositeEntityExtractor ReadableType11 = original.ReadableType11CompositeEntityExtractor + ReadableType11EntityExtractor ReadableType11 = original.ReadableType11EntityExtractor + ReadableType11HierarchicalChildEntityExtractor ReadableType11 = original.ReadableType11HierarchicalChildEntityExtractor + ReadableType11HierarchicalEntityExtractor ReadableType11 = original.ReadableType11HierarchicalEntityExtractor + ReadableType11IntentClassifier ReadableType11 = original.ReadableType11IntentClassifier + ReadableType11ListEntityExtractor ReadableType11 = original.ReadableType11ListEntityExtractor + ReadableType11PatternAnyEntityExtractor ReadableType11 = original.ReadableType11PatternAnyEntityExtractor + ReadableType11PrebuiltEntityExtractor ReadableType11 = original.ReadableType11PrebuiltEntityExtractor + ReadableType11RegexEntityExtractor ReadableType11 = original.ReadableType11RegexEntityExtractor +) + +type ReadableType2 = original.ReadableType2 + +const ( + ReadableType2ChildEntityExtractor ReadableType2 = original.ReadableType2ChildEntityExtractor + ReadableType2ClosedListEntityExtractor ReadableType2 = original.ReadableType2ClosedListEntityExtractor + ReadableType2CompositeEntityExtractor ReadableType2 = original.ReadableType2CompositeEntityExtractor + ReadableType2EntityExtractor ReadableType2 = original.ReadableType2EntityExtractor + ReadableType2HierarchicalChildEntityExtractor ReadableType2 = original.ReadableType2HierarchicalChildEntityExtractor + ReadableType2HierarchicalEntityExtractor ReadableType2 = original.ReadableType2HierarchicalEntityExtractor + ReadableType2IntentClassifier ReadableType2 = original.ReadableType2IntentClassifier + ReadableType2ListEntityExtractor ReadableType2 = original.ReadableType2ListEntityExtractor + ReadableType2PatternAnyEntityExtractor ReadableType2 = original.ReadableType2PatternAnyEntityExtractor + ReadableType2PrebuiltEntityExtractor ReadableType2 = original.ReadableType2PrebuiltEntityExtractor + ReadableType2RegexEntityExtractor ReadableType2 = original.ReadableType2RegexEntityExtractor +) + +type ReadableType3 = original.ReadableType3 + +const ( + ReadableType3ChildEntityExtractor ReadableType3 = original.ReadableType3ChildEntityExtractor + ReadableType3ClosedListEntityExtractor ReadableType3 = original.ReadableType3ClosedListEntityExtractor + ReadableType3CompositeEntityExtractor ReadableType3 = original.ReadableType3CompositeEntityExtractor + ReadableType3EntityExtractor ReadableType3 = original.ReadableType3EntityExtractor + ReadableType3HierarchicalChildEntityExtractor ReadableType3 = original.ReadableType3HierarchicalChildEntityExtractor + ReadableType3HierarchicalEntityExtractor ReadableType3 = original.ReadableType3HierarchicalEntityExtractor + ReadableType3IntentClassifier ReadableType3 = original.ReadableType3IntentClassifier + ReadableType3ListEntityExtractor ReadableType3 = original.ReadableType3ListEntityExtractor + ReadableType3PatternAnyEntityExtractor ReadableType3 = original.ReadableType3PatternAnyEntityExtractor + ReadableType3PrebuiltEntityExtractor ReadableType3 = original.ReadableType3PrebuiltEntityExtractor + ReadableType3RegexEntityExtractor ReadableType3 = original.ReadableType3RegexEntityExtractor +) + +type ReadableType4 = original.ReadableType4 + +const ( + ReadableType4ChildEntityExtractor ReadableType4 = original.ReadableType4ChildEntityExtractor + ReadableType4ClosedListEntityExtractor ReadableType4 = original.ReadableType4ClosedListEntityExtractor + ReadableType4CompositeEntityExtractor ReadableType4 = original.ReadableType4CompositeEntityExtractor + ReadableType4EntityExtractor ReadableType4 = original.ReadableType4EntityExtractor + ReadableType4HierarchicalChildEntityExtractor ReadableType4 = original.ReadableType4HierarchicalChildEntityExtractor + ReadableType4HierarchicalEntityExtractor ReadableType4 = original.ReadableType4HierarchicalEntityExtractor + ReadableType4IntentClassifier ReadableType4 = original.ReadableType4IntentClassifier + ReadableType4ListEntityExtractor ReadableType4 = original.ReadableType4ListEntityExtractor + ReadableType4PatternAnyEntityExtractor ReadableType4 = original.ReadableType4PatternAnyEntityExtractor + ReadableType4PrebuiltEntityExtractor ReadableType4 = original.ReadableType4PrebuiltEntityExtractor + ReadableType4RegexEntityExtractor ReadableType4 = original.ReadableType4RegexEntityExtractor +) + +type ReadableType5 = original.ReadableType5 + +const ( + ReadableType5ChildEntityExtractor ReadableType5 = original.ReadableType5ChildEntityExtractor + ReadableType5ClosedListEntityExtractor ReadableType5 = original.ReadableType5ClosedListEntityExtractor + ReadableType5CompositeEntityExtractor ReadableType5 = original.ReadableType5CompositeEntityExtractor + ReadableType5EntityExtractor ReadableType5 = original.ReadableType5EntityExtractor + ReadableType5HierarchicalChildEntityExtractor ReadableType5 = original.ReadableType5HierarchicalChildEntityExtractor + ReadableType5HierarchicalEntityExtractor ReadableType5 = original.ReadableType5HierarchicalEntityExtractor + ReadableType5IntentClassifier ReadableType5 = original.ReadableType5IntentClassifier + ReadableType5ListEntityExtractor ReadableType5 = original.ReadableType5ListEntityExtractor + ReadableType5PatternAnyEntityExtractor ReadableType5 = original.ReadableType5PatternAnyEntityExtractor + ReadableType5PrebuiltEntityExtractor ReadableType5 = original.ReadableType5PrebuiltEntityExtractor + ReadableType5RegexEntityExtractor ReadableType5 = original.ReadableType5RegexEntityExtractor +) + +type ReadableType6 = original.ReadableType6 + +const ( + ReadableType6ChildEntityExtractor ReadableType6 = original.ReadableType6ChildEntityExtractor + ReadableType6ClosedListEntityExtractor ReadableType6 = original.ReadableType6ClosedListEntityExtractor + ReadableType6CompositeEntityExtractor ReadableType6 = original.ReadableType6CompositeEntityExtractor + ReadableType6EntityExtractor ReadableType6 = original.ReadableType6EntityExtractor + ReadableType6HierarchicalChildEntityExtractor ReadableType6 = original.ReadableType6HierarchicalChildEntityExtractor + ReadableType6HierarchicalEntityExtractor ReadableType6 = original.ReadableType6HierarchicalEntityExtractor + ReadableType6IntentClassifier ReadableType6 = original.ReadableType6IntentClassifier + ReadableType6ListEntityExtractor ReadableType6 = original.ReadableType6ListEntityExtractor + ReadableType6PatternAnyEntityExtractor ReadableType6 = original.ReadableType6PatternAnyEntityExtractor + ReadableType6PrebuiltEntityExtractor ReadableType6 = original.ReadableType6PrebuiltEntityExtractor + ReadableType6RegexEntityExtractor ReadableType6 = original.ReadableType6RegexEntityExtractor +) + +type ReadableType7 = original.ReadableType7 + +const ( + ReadableType7ChildEntityExtractor ReadableType7 = original.ReadableType7ChildEntityExtractor + ReadableType7ClosedListEntityExtractor ReadableType7 = original.ReadableType7ClosedListEntityExtractor + ReadableType7CompositeEntityExtractor ReadableType7 = original.ReadableType7CompositeEntityExtractor + ReadableType7EntityExtractor ReadableType7 = original.ReadableType7EntityExtractor + ReadableType7HierarchicalChildEntityExtractor ReadableType7 = original.ReadableType7HierarchicalChildEntityExtractor + ReadableType7HierarchicalEntityExtractor ReadableType7 = original.ReadableType7HierarchicalEntityExtractor + ReadableType7IntentClassifier ReadableType7 = original.ReadableType7IntentClassifier + ReadableType7ListEntityExtractor ReadableType7 = original.ReadableType7ListEntityExtractor + ReadableType7PatternAnyEntityExtractor ReadableType7 = original.ReadableType7PatternAnyEntityExtractor + ReadableType7PrebuiltEntityExtractor ReadableType7 = original.ReadableType7PrebuiltEntityExtractor + ReadableType7RegexEntityExtractor ReadableType7 = original.ReadableType7RegexEntityExtractor +) + +type ReadableType8 = original.ReadableType8 + +const ( + ReadableType8ChildEntityExtractor ReadableType8 = original.ReadableType8ChildEntityExtractor + ReadableType8ClosedListEntityExtractor ReadableType8 = original.ReadableType8ClosedListEntityExtractor + ReadableType8CompositeEntityExtractor ReadableType8 = original.ReadableType8CompositeEntityExtractor + ReadableType8EntityExtractor ReadableType8 = original.ReadableType8EntityExtractor + ReadableType8HierarchicalChildEntityExtractor ReadableType8 = original.ReadableType8HierarchicalChildEntityExtractor + ReadableType8HierarchicalEntityExtractor ReadableType8 = original.ReadableType8HierarchicalEntityExtractor + ReadableType8IntentClassifier ReadableType8 = original.ReadableType8IntentClassifier + ReadableType8ListEntityExtractor ReadableType8 = original.ReadableType8ListEntityExtractor + ReadableType8PatternAnyEntityExtractor ReadableType8 = original.ReadableType8PatternAnyEntityExtractor + ReadableType8PrebuiltEntityExtractor ReadableType8 = original.ReadableType8PrebuiltEntityExtractor + ReadableType8RegexEntityExtractor ReadableType8 = original.ReadableType8RegexEntityExtractor +) + +type ReadableType9 = original.ReadableType9 + +const ( + ReadableType9ChildEntityExtractor ReadableType9 = original.ReadableType9ChildEntityExtractor + ReadableType9ClosedListEntityExtractor ReadableType9 = original.ReadableType9ClosedListEntityExtractor + ReadableType9CompositeEntityExtractor ReadableType9 = original.ReadableType9CompositeEntityExtractor + ReadableType9EntityExtractor ReadableType9 = original.ReadableType9EntityExtractor + ReadableType9HierarchicalChildEntityExtractor ReadableType9 = original.ReadableType9HierarchicalChildEntityExtractor + ReadableType9HierarchicalEntityExtractor ReadableType9 = original.ReadableType9HierarchicalEntityExtractor + ReadableType9IntentClassifier ReadableType9 = original.ReadableType9IntentClassifier + ReadableType9ListEntityExtractor ReadableType9 = original.ReadableType9ListEntityExtractor + ReadableType9PatternAnyEntityExtractor ReadableType9 = original.ReadableType9PatternAnyEntityExtractor + ReadableType9PrebuiltEntityExtractor ReadableType9 = original.ReadableType9PrebuiltEntityExtractor + ReadableType9RegexEntityExtractor ReadableType9 = original.ReadableType9RegexEntityExtractor +) + +type Status = original.Status + +const ( + StatusFail Status = original.StatusFail + StatusInProgress Status = original.StatusInProgress + StatusQueued Status = original.StatusQueued + StatusSuccess Status = original.StatusSuccess + StatusUpToDate Status = original.StatusUpToDate +) + +type Status1 = original.Status1 + +const ( + Status1Fail Status1 = original.Status1Fail + Status1InProgress Status1 = original.Status1InProgress + Status1Queued Status1 = original.Status1Queued + Status1Success Status1 = original.Status1Success + Status1UpToDate Status1 = original.Status1UpToDate +) + +type TrainingStatus = original.TrainingStatus + +const ( + InProgress TrainingStatus = original.InProgress + NeedsTraining TrainingStatus = original.NeedsTraining + Trained TrainingStatus = original.Trained +) + +type AppVersionSettingObject = original.AppVersionSettingObject +type ApplicationCreateObject = original.ApplicationCreateObject +type ApplicationInfoResponse = original.ApplicationInfoResponse +type ApplicationPublishObject = original.ApplicationPublishObject +type ApplicationSettingUpdateObject = original.ApplicationSettingUpdateObject +type ApplicationSettings = original.ApplicationSettings +type ApplicationUpdateObject = original.ApplicationUpdateObject +type AppsClient = original.AppsClient +type AvailableCulture = original.AvailableCulture +type AvailablePrebuiltEntityModel = original.AvailablePrebuiltEntityModel +type AzureAccountInfoObject = original.AzureAccountInfoObject +type AzureAccountsClient = original.AzureAccountsClient +type BaseClient = original.BaseClient +type BatchLabelExample = original.BatchLabelExample +type ChildEntity = original.ChildEntity +type ChildEntityModelCreateObject = original.ChildEntityModelCreateObject +type ClosedList = original.ClosedList +type ClosedListEntityExtractor = original.ClosedListEntityExtractor +type ClosedListModelCreateObject = original.ClosedListModelCreateObject +type ClosedListModelPatchObject = original.ClosedListModelPatchObject +type ClosedListModelUpdateObject = original.ClosedListModelUpdateObject +type CollaboratorsArray = original.CollaboratorsArray +type CompositeChildModelCreateObject = original.CompositeChildModelCreateObject +type CompositeEntityExtractor = original.CompositeEntityExtractor +type CompositeEntityModel = original.CompositeEntityModel +type CustomPrebuiltModel = original.CustomPrebuiltModel +type EndpointInfo = original.EndpointInfo +type EnqueueTrainingResponse = original.EnqueueTrainingResponse +type EntitiesSuggestionExample = original.EntitiesSuggestionExample +type EntityExtractor = original.EntityExtractor +type EntityLabel = original.EntityLabel +type EntityLabelObject = original.EntityLabelObject +type EntityModelCreateObject = original.EntityModelCreateObject +type EntityModelInfo = original.EntityModelInfo +type EntityModelUpdateObject = original.EntityModelUpdateObject +type EntityPrediction = original.EntityPrediction +type EntityRole = original.EntityRole +type EntityRoleCreateObject = original.EntityRoleCreateObject +type EntityRoleUpdateObject = original.EntityRoleUpdateObject +type ErrorResponse = original.ErrorResponse +type ExampleLabelObject = original.ExampleLabelObject +type ExamplesClient = original.ExamplesClient +type ExplicitListItem = original.ExplicitListItem +type ExplicitListItemCreateObject = original.ExplicitListItemCreateObject +type ExplicitListItemUpdateObject = original.ExplicitListItemUpdateObject +type FeatureInfoObject = original.FeatureInfoObject +type FeaturesClient = original.FeaturesClient +type FeaturesResponseObject = original.FeaturesResponseObject +type HierarchicalChildEntity = original.HierarchicalChildEntity +type HierarchicalChildModelUpdateObject = original.HierarchicalChildModelUpdateObject +type HierarchicalEntityExtractor = original.HierarchicalEntityExtractor +type HierarchicalModel = original.HierarchicalModel +type Int32 = original.Int32 +type Int64 = original.Int64 +type IntentClassifier = original.IntentClassifier +type IntentPrediction = original.IntentPrediction +type IntentsSuggestionExample = original.IntentsSuggestionExample +type JSONEntity = original.JSONEntity +type JSONModelFeature = original.JSONModelFeature +type JSONRegexFeature = original.JSONRegexFeature +type JSONUtterance = original.JSONUtterance +type LabelExampleResponse = original.LabelExampleResponse +type LabelTextObject = original.LabelTextObject +type LabeledUtterance = original.LabeledUtterance +type ListAppVersionSettingObject = original.ListAppVersionSettingObject +type ListApplicationInfoResponse = original.ListApplicationInfoResponse +type ListAvailableCulture = original.ListAvailableCulture +type ListAvailablePrebuiltEntityModel = original.ListAvailablePrebuiltEntityModel +type ListAzureAccountInfoObject = original.ListAzureAccountInfoObject +type ListBatchLabelExample = original.ListBatchLabelExample +type ListClosedListEntityExtractor = original.ListClosedListEntityExtractor +type ListCompositeEntityExtractor = original.ListCompositeEntityExtractor +type ListCustomPrebuiltModel = original.ListCustomPrebuiltModel +type ListEntitiesSuggestionExample = original.ListEntitiesSuggestionExample +type ListEntityExtractor = original.ListEntityExtractor +type ListEntityRole = original.ListEntityRole +type ListExplicitListItem = original.ListExplicitListItem +type ListHierarchicalEntityExtractor = original.ListHierarchicalEntityExtractor +type ListIntentClassifier = original.ListIntentClassifier +type ListIntentsSuggestionExample = original.ListIntentsSuggestionExample +type ListLabelTextObject = original.ListLabelTextObject +type ListLabeledUtterance = original.ListLabeledUtterance +type ListModelInfoResponse = original.ListModelInfoResponse +type ListModelTrainingInfo = original.ListModelTrainingInfo +type ListNDepthEntityExtractor = original.ListNDepthEntityExtractor +type ListPatternAnyEntityExtractor = original.ListPatternAnyEntityExtractor +type ListPatternFeatureInfo = original.ListPatternFeatureInfo +type ListPatternRuleInfo = original.ListPatternRuleInfo +type ListPhraseListFeatureInfo = original.ListPhraseListFeatureInfo +type ListPrebuiltDomain = original.ListPrebuiltDomain +type ListPrebuiltEntityExtractor = original.ListPrebuiltEntityExtractor +type ListRegexEntityExtractor = original.ListRegexEntityExtractor +type ListString = original.ListString +type ListUUID = original.ListUUID +type ListVersionInfo = original.ListVersionInfo +type LuisApp = original.LuisApp +type ModelClient = original.ModelClient +type ModelCreateObject = original.ModelCreateObject +type ModelInfo = original.ModelInfo +type ModelInfoResponse = original.ModelInfoResponse +type ModelTrainingDetails = original.ModelTrainingDetails +type ModelTrainingInfo = original.ModelTrainingInfo +type ModelUpdateObject = original.ModelUpdateObject +type NDepthEntityExtractor = original.NDepthEntityExtractor +type OperationError = original.OperationError +type OperationStatus = original.OperationStatus +type PatternAny = original.PatternAny +type PatternAnyEntityExtractor = original.PatternAnyEntityExtractor +type PatternAnyModelCreateObject = original.PatternAnyModelCreateObject +type PatternAnyModelUpdateObject = original.PatternAnyModelUpdateObject +type PatternClient = original.PatternClient +type PatternCreateObject = original.PatternCreateObject +type PatternFeatureInfo = original.PatternFeatureInfo +type PatternRule = original.PatternRule +type PatternRuleCreateObject = original.PatternRuleCreateObject +type PatternRuleInfo = original.PatternRuleInfo +type PatternRuleUpdateObject = original.PatternRuleUpdateObject +type PatternUpdateObject = original.PatternUpdateObject +type PermissionsClient = original.PermissionsClient +type PersonalAssistantsResponse = original.PersonalAssistantsResponse +type PhraseListFeatureInfo = original.PhraseListFeatureInfo +type PhraselistCreateObject = original.PhraselistCreateObject +type PhraselistUpdateObject = original.PhraselistUpdateObject +type PrebuiltDomain = original.PrebuiltDomain +type PrebuiltDomainCreateBaseObject = original.PrebuiltDomainCreateBaseObject +type PrebuiltDomainCreateObject = original.PrebuiltDomainCreateObject +type PrebuiltDomainItem = original.PrebuiltDomainItem +type PrebuiltDomainModelCreateObject = original.PrebuiltDomainModelCreateObject +type PrebuiltDomainObject = original.PrebuiltDomainObject +type PrebuiltEntity = original.PrebuiltEntity +type PrebuiltEntityExtractor = original.PrebuiltEntityExtractor +type ProductionOrStagingEndpointInfo = original.ProductionOrStagingEndpointInfo +type PublishSettingUpdateObject = original.PublishSettingUpdateObject +type PublishSettings = original.PublishSettings +type ReadCloser = original.ReadCloser +type RegexEntity = original.RegexEntity +type RegexEntityExtractor = original.RegexEntityExtractor +type RegexModelCreateObject = original.RegexModelCreateObject +type RegexModelUpdateObject = original.RegexModelUpdateObject +type SetString = original.SetString +type SettingsClient = original.SettingsClient +type String = original.String +type SubClosedList = original.SubClosedList +type SubClosedListResponse = original.SubClosedListResponse +type TaskUpdateObject = original.TaskUpdateObject +type TrainClient = original.TrainClient +type UUID = original.UUID +type UserAccessList = original.UserAccessList +type UserCollaborator = original.UserCollaborator +type VersionInfo = original.VersionInfo +type VersionsClient = original.VersionsClient +type WordListBaseUpdateObject = original.WordListBaseUpdateObject +type WordListObject = original.WordListObject + +func New(endpoint string) BaseClient { + return original.New(endpoint) +} +func NewAppsClient(endpoint string) AppsClient { + return original.NewAppsClient(endpoint) +} +func NewAzureAccountsClient(endpoint string) AzureAccountsClient { + return original.NewAzureAccountsClient(endpoint) +} +func NewExamplesClient(endpoint string) ExamplesClient { + return original.NewExamplesClient(endpoint) +} +func NewFeaturesClient(endpoint string) FeaturesClient { + return original.NewFeaturesClient(endpoint) +} +func NewModelClient(endpoint string) ModelClient { + return original.NewModelClient(endpoint) +} +func NewPatternClient(endpoint string) PatternClient { + return original.NewPatternClient(endpoint) +} +func NewPermissionsClient(endpoint string) PermissionsClient { + return original.NewPermissionsClient(endpoint) +} +func NewSettingsClient(endpoint string) SettingsClient { + return original.NewSettingsClient(endpoint) +} +func NewTrainClient(endpoint string) TrainClient { + return original.NewTrainClient(endpoint) +} +func NewVersionsClient(endpoint string) VersionsClient { + return original.NewVersionsClient(endpoint) +} +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) +} +func PossibleOperationStatusTypeValues() []OperationStatusType { + return original.PossibleOperationStatusTypeValues() +} +func PossibleReadableType10Values() []ReadableType10 { + return original.PossibleReadableType10Values() +} +func PossibleReadableType11Values() []ReadableType11 { + return original.PossibleReadableType11Values() +} +func PossibleReadableType1Values() []ReadableType1 { + return original.PossibleReadableType1Values() +} +func PossibleReadableType2Values() []ReadableType2 { + return original.PossibleReadableType2Values() +} +func PossibleReadableType3Values() []ReadableType3 { + return original.PossibleReadableType3Values() +} +func PossibleReadableType4Values() []ReadableType4 { + return original.PossibleReadableType4Values() +} +func PossibleReadableType5Values() []ReadableType5 { + return original.PossibleReadableType5Values() +} +func PossibleReadableType6Values() []ReadableType6 { + return original.PossibleReadableType6Values() +} +func PossibleReadableType7Values() []ReadableType7 { + return original.PossibleReadableType7Values() +} +func PossibleReadableType8Values() []ReadableType8 { + return original.PossibleReadableType8Values() +} +func PossibleReadableType9Values() []ReadableType9 { + return original.PossibleReadableType9Values() +} +func PossibleReadableTypeValues() []ReadableType { + return original.PossibleReadableTypeValues() +} +func PossibleStatus1Values() []Status1 { + return original.PossibleStatus1Values() +} +func PossibleStatusValues() []Status { + return original.PossibleStatusValues() +} +func PossibleTrainingStatusValues() []TrainingStatus { + return original.PossibleTrainingStatusValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/apps.go b/services/preview/cognitiveservices/v3.0/luis/authoring/apps.go new file mode 100644 index 000000000000..13de58e56cf0 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/apps.go @@ -0,0 +1,1650 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// AppsClient is the client for the Apps methods of the Authoring service. +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(endpoint string) AppsClient { + return AppsClient{New(endpoint)} +} + +// Add creates a new LUIS app. +// Parameters: +// applicationCreateObject - an application containing Name, Description (optional), Culture, Usage Scenario +// (optional), Domain (optional) and initial version ID (optional) of the application. Default value for the +// version ID is "0.1". Note: the culture cannot be changed after the app is created. +func (client AppsClient) Add(ctx context.Context, applicationCreateObject ApplicationCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Add") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: applicationCreateObject, + Constraints: []validation.Constraint{{Target: "applicationCreateObject.Culture", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "applicationCreateObject.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.AppsClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, applicationCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client AppsClient) AddPreparer(ctx context.Context, applicationCreateObject ApplicationCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/"), + autorest.WithJSON(applicationCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client AppsClient) AddResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddCustomPrebuiltDomain adds a prebuilt domain along with its intent and entity models as a new application. +// Parameters: +// prebuiltDomainCreateObject - a prebuilt domain create object containing the name and culture of the domain. +func (client AppsClient) AddCustomPrebuiltDomain(ctx context.Context, prebuiltDomainCreateObject PrebuiltDomainCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AddCustomPrebuiltDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddCustomPrebuiltDomainPreparer(ctx, prebuiltDomainCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", nil, "Failure preparing request") + return + } + + resp, err := client.AddCustomPrebuiltDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", resp, "Failure responding to request") + } + + return +} + +// AddCustomPrebuiltDomainPreparer prepares the AddCustomPrebuiltDomain request. +func (client AppsClient) AddCustomPrebuiltDomainPreparer(ctx context.Context, prebuiltDomainCreateObject PrebuiltDomainCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/customprebuiltdomains"), + autorest.WithJSON(prebuiltDomainCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCustomPrebuiltDomainSender sends the AddCustomPrebuiltDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddCustomPrebuiltDomainSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddCustomPrebuiltDomainResponder handles the response to the AddCustomPrebuiltDomain request. The method always +// closes the http.Response Body. +func (client AppsClient) AddCustomPrebuiltDomainResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application. +// Parameters: +// appID - the application ID. +// force - a flag to indicate whether to force an operation. +func (client AppsClient) Delete(ctx context.Context, appID uuid.UUID, force *bool) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, appID, force) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, force *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + queryParameters := map[string]interface{}{} + if force != nil { + queryParameters["force"] = autorest.Encode("query", *force) + } else { + queryParameters["force"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DownloadQueryLogs gets the logs of the past month's endpoint queries for the application. +// Parameters: +// appID - the application ID. +func (client AppsClient) DownloadQueryLogs(ctx context.Context, appID uuid.UUID) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DownloadQueryLogs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DownloadQueryLogsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", nil, "Failure preparing request") + return + } + + resp, err := client.DownloadQueryLogsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", resp, "Failure sending request") + return + } + + result, err = client.DownloadQueryLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", resp, "Failure responding to request") + } + + return +} + +// DownloadQueryLogsPreparer prepares the DownloadQueryLogs request. +func (client AppsClient) DownloadQueryLogsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/querylogs", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DownloadQueryLogsSender sends the DownloadQueryLogs request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DownloadQueryLogsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DownloadQueryLogsResponder handles the response to the DownloadQueryLogs request. The method always +// closes the http.Response Body. +func (client AppsClient) DownloadQueryLogsResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the application info. +// Parameters: +// appID - the application ID. +func (client AppsClient) Get(ctx context.Context, appID uuid.UUID) (result ApplicationInfoResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result ApplicationInfoResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublishSettings get the application publish settings including 'UseAllTrainingData'. +// Parameters: +// appID - the application ID. +func (client AppsClient) GetPublishSettings(ctx context.Context, appID uuid.UUID) (result PublishSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPublishSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPublishSettingsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublishSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", resp, "Failure sending request") + return + } + + result, err = client.GetPublishSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", resp, "Failure responding to request") + } + + return +} + +// GetPublishSettingsPreparer prepares the GetPublishSettings request. +func (client AppsClient) GetPublishSettingsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/publishsettings", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPublishSettingsSender sends the GetPublishSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPublishSettingsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPublishSettingsResponder handles the response to the GetPublishSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPublishSettingsResponder(resp *http.Response) (result PublishSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSettings get the application settings including 'UseAllTrainingData'. +// Parameters: +// appID - the application ID. +func (client AppsClient) GetSettings(ctx context.Context, appID uuid.UUID) (result ApplicationSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSettingsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", resp, "Failure sending request") + return + } + + result, err = client.GetSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", resp, "Failure responding to request") + } + + return +} + +// GetSettingsPreparer prepares the GetSettings request. +func (client AppsClient) GetSettingsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/settings", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSettingsSender sends the GetSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSettingsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetSettingsResponder handles the response to the GetSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSettingsResponder(resp *http.Response) (result ApplicationSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Import imports an application to LUIS, the application's structure is included in the request body. +// Parameters: +// luisApp - a LUIS application structure. +// appName - the application name to create. If not specified, the application name will be read from the +// imported object. If the application name already exists, an error is returned. +func (client AppsClient) Import(ctx context.Context, luisApp LuisApp, appName string) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Import") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ImportPreparer(ctx, luisApp, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", nil, "Failure preparing request") + return + } + + resp, err := client.ImportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", resp, "Failure sending request") + return + } + + result, err = client.ImportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", resp, "Failure responding to request") + } + + return +} + +// ImportPreparer prepares the Import request. +func (client AppsClient) ImportPreparer(ctx context.Context, luisApp LuisApp, appName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + queryParameters := map[string]interface{}{} + if len(appName) > 0 { + queryParameters["appName"] = autorest.Encode("query", appName) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/import"), + autorest.WithJSON(luisApp), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportSender sends the Import request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ImportSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ImportResponder handles the response to the Import request. The method always +// closes the http.Response Body. +func (client AppsClient) ImportResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the user's applications. +// Parameters: +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client AppsClient) List(ctx context.Context, skip *int32, take *int32) (result ListApplicationInfoResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.AppsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result ListApplicationInfoResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableCustomPrebuiltDomains gets all the available custom prebuilt domains for all cultures. +func (client AppsClient) ListAvailableCustomPrebuiltDomains(ctx context.Context) (result ListPrebuiltDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAvailableCustomPrebuiltDomains") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableCustomPrebuiltDomainsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableCustomPrebuiltDomainsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableCustomPrebuiltDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", resp, "Failure responding to request") + } + + return +} + +// ListAvailableCustomPrebuiltDomainsPreparer prepares the ListAvailableCustomPrebuiltDomains request. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/customprebuiltdomains")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableCustomPrebuiltDomainsSender sends the ListAvailableCustomPrebuiltDomains request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListAvailableCustomPrebuiltDomainsResponder handles the response to the ListAvailableCustomPrebuiltDomains request. The method always +// closes the http.Response Body. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsResponder(resp *http.Response) (result ListPrebuiltDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableCustomPrebuiltDomainsForCulture gets all the available prebuilt domains for a specific culture. +// Parameters: +// culture - culture. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCulture(ctx context.Context, culture string) (result ListPrebuiltDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAvailableCustomPrebuiltDomainsForCulture") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableCustomPrebuiltDomainsForCulturePreparer(ctx, culture) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableCustomPrebuiltDomainsForCultureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableCustomPrebuiltDomainsForCultureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", resp, "Failure responding to request") + } + + return +} + +// ListAvailableCustomPrebuiltDomainsForCulturePreparer prepares the ListAvailableCustomPrebuiltDomainsForCulture request. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCulturePreparer(ctx context.Context, culture string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "culture": autorest.Encode("path", culture), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/customprebuiltdomains/{culture}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableCustomPrebuiltDomainsForCultureSender sends the ListAvailableCustomPrebuiltDomainsForCulture request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCultureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListAvailableCustomPrebuiltDomainsForCultureResponder handles the response to the ListAvailableCustomPrebuiltDomainsForCulture request. The method always +// closes the http.Response Body. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCultureResponder(resp *http.Response) (result ListPrebuiltDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCortanaEndpoints gets the endpoint URLs for the prebuilt Cortana applications. +func (client AppsClient) ListCortanaEndpoints(ctx context.Context) (result PersonalAssistantsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListCortanaEndpoints") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCortanaEndpointsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListCortanaEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListCortanaEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", resp, "Failure responding to request") + } + + return +} + +// ListCortanaEndpointsPreparer prepares the ListCortanaEndpoints request. +func (client AppsClient) ListCortanaEndpointsPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/assistants")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCortanaEndpointsSender sends the ListCortanaEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListCortanaEndpointsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCortanaEndpointsResponder handles the response to the ListCortanaEndpoints request. The method always +// closes the http.Response Body. +func (client AppsClient) ListCortanaEndpointsResponder(resp *http.Response) (result PersonalAssistantsResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDomains gets the available application domains. +func (client AppsClient) ListDomains(ctx context.Context) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomains") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListDomainsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", nil, "Failure preparing request") + return + } + + resp, err := client.ListDomainsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", resp, "Failure sending request") + return + } + + result, err = client.ListDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", resp, "Failure responding to request") + } + + return +} + +// ListDomainsPreparer prepares the ListDomains request. +func (client AppsClient) ListDomainsPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/domains")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDomainsSender sends the ListDomains request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListDomainsResponder handles the response to the ListDomains request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainsResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEndpoints returns the available endpoint deployment regions and URLs. +// Parameters: +// appID - the application ID. +func (client AppsClient) ListEndpoints(ctx context.Context, appID uuid.UUID) (result SetString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListEndpoints") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEndpointsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", resp, "Failure responding to request") + } + + return +} + +// ListEndpointsPreparer prepares the ListEndpoints request. +func (client AppsClient) ListEndpointsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/endpoints", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEndpointsSender sends the ListEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListEndpointsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListEndpointsResponder handles the response to the ListEndpoints request. The method always +// closes the http.Response Body. +func (client AppsClient) ListEndpointsResponder(resp *http.Response) (result SetString, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSupportedCultures gets a list of supported cultures. Cultures are equivalent to the written language and locale. +// For example,"en-us" represents the U.S. variation of English. +func (client AppsClient) ListSupportedCultures(ctx context.Context) (result ListAvailableCulture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSupportedCultures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSupportedCulturesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedCulturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedCulturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", resp, "Failure responding to request") + } + + return +} + +// ListSupportedCulturesPreparer prepares the ListSupportedCultures request. +func (client AppsClient) ListSupportedCulturesPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/cultures")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedCulturesSender sends the ListSupportedCultures request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSupportedCulturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListSupportedCulturesResponder handles the response to the ListSupportedCultures request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSupportedCulturesResponder(resp *http.Response) (result ListAvailableCulture, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsageScenarios gets the application available usage scenarios. +func (client AppsClient) ListUsageScenarios(ctx context.Context) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsageScenarios") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListUsageScenariosPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsageScenariosSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", resp, "Failure sending request") + return + } + + result, err = client.ListUsageScenariosResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", resp, "Failure responding to request") + } + + return +} + +// ListUsageScenariosPreparer prepares the ListUsageScenarios request. +func (client AppsClient) ListUsageScenariosPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/apps/usagescenarios")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsageScenariosSender sends the ListUsageScenarios request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsageScenariosSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListUsageScenariosResponder handles the response to the ListUsageScenarios request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsageScenariosResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PackagePublishedApplicationAsGzip packages a published LUIS application as a GZip file to be used in the LUIS +// container. +// Parameters: +// appID - the application ID. +// slotName - the publishing slot name. +func (client AppsClient) PackagePublishedApplicationAsGzip(ctx context.Context, appID uuid.UUID, slotName string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PackagePublishedApplicationAsGzip") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PackagePublishedApplicationAsGzipPreparer(ctx, appID, slotName) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", nil, "Failure preparing request") + return + } + + resp, err := client.PackagePublishedApplicationAsGzipSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", resp, "Failure sending request") + return + } + + result, err = client.PackagePublishedApplicationAsGzipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", resp, "Failure responding to request") + } + + return +} + +// PackagePublishedApplicationAsGzipPreparer prepares the PackagePublishedApplicationAsGzip request. +func (client AppsClient) PackagePublishedApplicationAsGzipPreparer(ctx context.Context, appID uuid.UUID, slotName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "slotName": autorest.Encode("path", slotName), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/package/{appId}/slot/{slotName}/gzip", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PackagePublishedApplicationAsGzipSender sends the PackagePublishedApplicationAsGzip request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) PackagePublishedApplicationAsGzipSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// PackagePublishedApplicationAsGzipResponder handles the response to the PackagePublishedApplicationAsGzip request. The method always +// closes the http.Response Body. +func (client AppsClient) PackagePublishedApplicationAsGzipResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// PackageTrainedApplicationAsGzip packages trained LUIS application as GZip file to be used in the LUIS container. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client AppsClient) PackageTrainedApplicationAsGzip(ctx context.Context, appID uuid.UUID, versionID string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PackageTrainedApplicationAsGzip") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PackageTrainedApplicationAsGzipPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", nil, "Failure preparing request") + return + } + + resp, err := client.PackageTrainedApplicationAsGzipSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", resp, "Failure sending request") + return + } + + result, err = client.PackageTrainedApplicationAsGzipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", resp, "Failure responding to request") + } + + return +} + +// PackageTrainedApplicationAsGzipPreparer prepares the PackageTrainedApplicationAsGzip request. +func (client AppsClient) PackageTrainedApplicationAsGzipPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/package/{appId}/versions/{versionId}/gzip", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PackageTrainedApplicationAsGzipSender sends the PackageTrainedApplicationAsGzip request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) PackageTrainedApplicationAsGzipSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// PackageTrainedApplicationAsGzipResponder handles the response to the PackageTrainedApplicationAsGzip request. The method always +// closes the http.Response Body. +func (client AppsClient) PackageTrainedApplicationAsGzipResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// Publish publishes a specific version of the application. +// Parameters: +// appID - the application ID. +// applicationPublishObject - the application publish object. The region is the target region that the +// application is published to. +func (client AppsClient) Publish(ctx context.Context, appID uuid.UUID, applicationPublishObject ApplicationPublishObject) (result ProductionOrStagingEndpointInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Publish") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PublishPreparer(ctx, appID, applicationPublishObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", nil, "Failure preparing request") + return + } + + resp, err := client.PublishSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", resp, "Failure sending request") + return + } + + result, err = client.PublishResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", resp, "Failure responding to request") + } + + return +} + +// PublishPreparer prepares the Publish request. +func (client AppsClient) PublishPreparer(ctx context.Context, appID uuid.UUID, applicationPublishObject ApplicationPublishObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/publish", pathParameters), + autorest.WithJSON(applicationPublishObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PublishSender sends the Publish request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) PublishSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// PublishResponder handles the response to the Publish request. The method always +// closes the http.Response Body. +func (client AppsClient) PublishResponder(resp *http.Response) (result ProductionOrStagingEndpointInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusMultiStatus), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the name or description of the application. +// Parameters: +// appID - the application ID. +// applicationUpdateObject - a model containing Name and Description of the application. +func (client AppsClient) Update(ctx context.Context, appID uuid.UUID, applicationUpdateObject ApplicationUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, appID, applicationUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, applicationUpdateObject ApplicationUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}", pathParameters), + autorest.WithJSON(applicationUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePublishSettings updates the application publish settings including 'UseAllTrainingData'. +// Parameters: +// appID - the application ID. +// publishSettingUpdateObject - an object containing the new publish application settings. +func (client AppsClient) UpdatePublishSettings(ctx context.Context, appID uuid.UUID, publishSettingUpdateObject PublishSettingUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdatePublishSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePublishSettingsPreparer(ctx, appID, publishSettingUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePublishSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdatePublishSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", resp, "Failure responding to request") + } + + return +} + +// UpdatePublishSettingsPreparer prepares the UpdatePublishSettings request. +func (client AppsClient) UpdatePublishSettingsPreparer(ctx context.Context, appID uuid.UUID, publishSettingUpdateObject PublishSettingUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/publishsettings", pathParameters), + autorest.WithJSON(publishSettingUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePublishSettingsSender sends the UpdatePublishSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdatePublishSettingsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePublishSettingsResponder handles the response to the UpdatePublishSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdatePublishSettingsResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSettings updates the application settings including 'UseAllTrainingData'. +// Parameters: +// appID - the application ID. +// applicationSettingUpdateObject - an object containing the new application settings. +func (client AppsClient) UpdateSettings(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject ApplicationSettingUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateSettingsPreparer(ctx, appID, applicationSettingUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateSettingsPreparer prepares the UpdateSettings request. +func (client AppsClient) UpdateSettingsPreparer(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject ApplicationSettingUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/settings", pathParameters), + autorest.WithJSON(applicationSettingUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSettingsSender sends the UpdateSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSettingsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateSettingsResponder handles the response to the UpdateSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSettingsResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go b/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go new file mode 100644 index 000000000000..e5c24dda3a5e --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go @@ -0,0 +1,253 @@ +package authoringapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring" + "github.com/satori/go.uuid" +) + +// FeaturesClientAPI contains the set of methods on the FeaturesClient type. +type FeaturesClientAPI interface { + AddPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject authoring.PhraselistCreateObject) (result authoring.Int32, err error) + CreatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject authoring.PatternCreateObject) (result authoring.Int32, err error) + DeletePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result authoring.OperationStatus, err error) + DeletePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result authoring.OperationStatus, err error) + GetPatternFeatureInfo(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result authoring.PatternFeatureInfo, err error) + GetPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result authoring.PhraseListFeatureInfo, err error) + List(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.FeaturesResponseObject, err error) + ListApplicationVersionPatternFeatures(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPatternFeatureInfo, err error) + ListPhraseLists(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPhraseListFeatureInfo, err error) + UpdatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject authoring.PatternUpdateObject) (result authoring.OperationStatus, err error) + UpdatePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32, phraselistUpdateObject *authoring.PhraselistUpdateObject) (result authoring.OperationStatus, err error) +} + +var _ FeaturesClientAPI = (*authoring.FeaturesClient)(nil) + +// ExamplesClientAPI contains the set of methods on the ExamplesClient type. +type ExamplesClientAPI interface { + Add(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObject authoring.ExampleLabelObject) (result authoring.LabelExampleResponse, err error) + Batch(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObjectArray []authoring.ExampleLabelObject) (result authoring.ListBatchLabelExample, err error) + Delete(ctx context.Context, appID uuid.UUID, versionID string, exampleID int32) (result authoring.OperationStatus, err error) + List(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListLabeledUtterance, err error) +} + +var _ ExamplesClientAPI = (*authoring.ExamplesClient)(nil) + +// ModelClientAPI contains the set of methods on the ModelClient type. +type ModelClientAPI interface { + AddClosedList(ctx context.Context, appID uuid.UUID, versionID string, closedListModelCreateObject authoring.ClosedListModelCreateObject) (result authoring.UUID, err error) + AddCompositeEntityChild(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeChildModelCreateObject authoring.CompositeChildModelCreateObject) (result authoring.UUID, err error) + AddCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainObject authoring.PrebuiltDomainCreateBaseObject) (result authoring.ListUUID, err error) + AddCustomPrebuiltEntity(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject authoring.PrebuiltDomainModelCreateObject) (result authoring.UUID, err error) + AddCustomPrebuiltIntent(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject authoring.PrebuiltDomainModelCreateObject) (result authoring.UUID, err error) + AddEntity(ctx context.Context, appID uuid.UUID, versionID string, entityModelCreateObject authoring.EntityModelCreateObject) (result authoring.UUID, err error) + AddEntityChild(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, childEntityModelCreateObject authoring.ChildEntityModelCreateObject) (result authoring.UUID, err error) + AddExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, item authoring.ExplicitListItemCreateObject) (result authoring.Int32, err error) + AddIntent(ctx context.Context, appID uuid.UUID, versionID string, intentCreateObject authoring.ModelCreateObject) (result authoring.UUID, err error) + AddPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltExtractorNames []string) (result authoring.ListPrebuiltEntityExtractor, err error) + AddSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, wordListCreateObject authoring.WordListObject) (result authoring.Int64, err error) + CreateClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreateCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreateCustomPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreateEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreateHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreatePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, extractorCreateObject authoring.PatternAnyModelCreateObject) (result authoring.UUID, err error) + CreatePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreatePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + CreateRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityExtractorCreateObj authoring.RegexModelCreateObject) (result authoring.UUID, err error) + CreateRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject authoring.EntityRoleCreateObject) (result authoring.UUID, err error) + DeleteClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteCompositeEntityChild(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, cChildID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, domainName string) (result authoring.OperationStatus, err error) + DeleteEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result authoring.OperationStatus, err error) + DeleteHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, deleteUtterances *bool) (result authoring.OperationStatus, err error) + DeletePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.OperationStatus, err error) + DeletePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeletePrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result authoring.OperationStatus, err error) + DeletePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64) (result authoring.OperationStatus, err error) + ExamplesMethod(ctx context.Context, appID uuid.UUID, versionID string, modelID string, skip *int32, take *int32) (result authoring.ListLabelTextObject, err error) + GetClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result authoring.ClosedListEntityExtractor, err error) + GetClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result authoring.CompositeEntityExtractor, err error) + GetCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.NDepthEntityExtractor, err error) + GetEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetExplicitList(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListExplicitListItem, err error) + GetExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result authoring.ExplicitListItem, err error) + GetHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result authoring.HierarchicalEntityExtractor, err error) + GetHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result authoring.HierarchicalChildEntity, err error) + GetHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result authoring.IntentClassifier, err error) + GetPatternAnyEntityInfo(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.PatternAnyEntityExtractor, err error) + GetPatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result authoring.PrebuiltEntityExtractor, err error) + GetPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + GetRegexEntityEntityInfo(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (result authoring.RegexEntityExtractor, err error) + GetRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) + ListClosedListEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListClosedLists(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListClosedListEntityExtractor, err error) + ListCompositeEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListCompositeEntityExtractor, err error) + ListCompositeEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListCustomPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListEntityExtractor, err error) + ListCustomPrebuiltEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListCustomPrebuiltIntents(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListIntentClassifier, err error) + ListCustomPrebuiltModels(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListCustomPrebuiltModel, err error) + ListEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListNDepthEntityExtractor, err error) + ListEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListEntitySuggestions(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, take *int32) (result authoring.ListEntitiesSuggestionExample, err error) + ListHierarchicalEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListHierarchicalEntityExtractor, err error) + ListHierarchicalEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListIntents(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListIntentClassifier, err error) + ListIntentSuggestions(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, take *int32) (result authoring.ListIntentsSuggestionExample, err error) + ListModels(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListModelInfoResponse, err error) + ListPatternAnyEntityInfos(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPatternAnyEntityExtractor, err error) + ListPatternAnyEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListAvailablePrebuiltEntityModel, err error) + ListPrebuiltEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + ListPrebuilts(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPrebuiltEntityExtractor, err error) + ListRegexEntityInfos(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListRegexEntityExtractor, err error) + ListRegexEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) + PatchClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelPatchObject authoring.ClosedListModelPatchObject) (result authoring.OperationStatus, err error) + UpdateClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelUpdateObject authoring.ClosedListModelUpdateObject) (result authoring.OperationStatus, err error) + UpdateClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeModelUpdateObject authoring.CompositeEntityModel) (result authoring.OperationStatus, err error) + UpdateCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateCustomPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateEntityChild(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityModelUpdateObject authoring.EntityModelUpdateObject) (result authoring.OperationStatus, err error) + UpdateEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64, item authoring.ExplicitListItemUpdateObject) (result authoring.OperationStatus, err error) + UpdateHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, modelUpdateObject authoring.ModelUpdateObject) (result authoring.OperationStatus, err error) + UpdateHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID, hierarchicalChildModelUpdateObject authoring.HierarchicalChildModelUpdateObject) (result authoring.OperationStatus, err error) + UpdateHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, modelUpdateObject authoring.ModelUpdateObject) (result authoring.OperationStatus, err error) + UpdatePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, patternAnyUpdateObject authoring.PatternAnyModelUpdateObject) (result authoring.OperationStatus, err error) + UpdatePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdatePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID, regexEntityUpdateObject authoring.RegexModelUpdateObject) (result authoring.OperationStatus, err error) + UpdateRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) + UpdateSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64, wordListBaseUpdateObject authoring.WordListBaseUpdateObject) (result authoring.OperationStatus, err error) +} + +var _ ModelClientAPI = (*authoring.ModelClient)(nil) + +// AppsClientAPI contains the set of methods on the AppsClient type. +type AppsClientAPI interface { + Add(ctx context.Context, applicationCreateObject authoring.ApplicationCreateObject) (result authoring.UUID, err error) + AddCustomPrebuiltDomain(ctx context.Context, prebuiltDomainCreateObject authoring.PrebuiltDomainCreateObject) (result authoring.UUID, err error) + Delete(ctx context.Context, appID uuid.UUID, force *bool) (result authoring.OperationStatus, err error) + DownloadQueryLogs(ctx context.Context, appID uuid.UUID) (result authoring.ReadCloser, err error) + Get(ctx context.Context, appID uuid.UUID) (result authoring.ApplicationInfoResponse, err error) + GetPublishSettings(ctx context.Context, appID uuid.UUID) (result authoring.PublishSettings, err error) + GetSettings(ctx context.Context, appID uuid.UUID) (result authoring.ApplicationSettings, err error) + Import(ctx context.Context, luisApp authoring.LuisApp, appName string) (result authoring.UUID, err error) + List(ctx context.Context, skip *int32, take *int32) (result authoring.ListApplicationInfoResponse, err error) + ListAvailableCustomPrebuiltDomains(ctx context.Context) (result authoring.ListPrebuiltDomain, err error) + ListAvailableCustomPrebuiltDomainsForCulture(ctx context.Context, culture string) (result authoring.ListPrebuiltDomain, err error) + ListCortanaEndpoints(ctx context.Context) (result authoring.PersonalAssistantsResponse, err error) + ListDomains(ctx context.Context) (result authoring.ListString, err error) + ListEndpoints(ctx context.Context, appID uuid.UUID) (result authoring.SetString, err error) + ListSupportedCultures(ctx context.Context) (result authoring.ListAvailableCulture, err error) + ListUsageScenarios(ctx context.Context) (result authoring.ListString, err error) + PackagePublishedApplicationAsGzip(ctx context.Context, appID uuid.UUID, slotName string) (result authoring.ReadCloser, err error) + PackageTrainedApplicationAsGzip(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ReadCloser, err error) + Publish(ctx context.Context, appID uuid.UUID, applicationPublishObject authoring.ApplicationPublishObject) (result authoring.ProductionOrStagingEndpointInfo, err error) + Update(ctx context.Context, appID uuid.UUID, applicationUpdateObject authoring.ApplicationUpdateObject) (result authoring.OperationStatus, err error) + UpdatePublishSettings(ctx context.Context, appID uuid.UUID, publishSettingUpdateObject authoring.PublishSettingUpdateObject) (result authoring.OperationStatus, err error) + UpdateSettings(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject authoring.ApplicationSettingUpdateObject) (result authoring.OperationStatus, err error) +} + +var _ AppsClientAPI = (*authoring.AppsClient)(nil) + +// VersionsClientAPI contains the set of methods on the VersionsClient type. +type VersionsClientAPI interface { + Clone(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject authoring.TaskUpdateObject) (result authoring.String, err error) + Delete(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.OperationStatus, err error) + DeleteUnlabelledUtterance(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (result authoring.OperationStatus, err error) + Export(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.LuisApp, err error) + Get(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.VersionInfo, err error) + Import(ctx context.Context, appID uuid.UUID, luisApp authoring.LuisApp, versionID string) (result authoring.String, err error) + List(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (result authoring.ListVersionInfo, err error) + Update(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject authoring.TaskUpdateObject) (result authoring.OperationStatus, err error) +} + +var _ VersionsClientAPI = (*authoring.VersionsClient)(nil) + +// TrainClientAPI contains the set of methods on the TrainClient type. +type TrainClientAPI interface { + GetStatus(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListModelTrainingInfo, err error) + TrainVersion(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.EnqueueTrainingResponse, err error) +} + +var _ TrainClientAPI = (*authoring.TrainClient)(nil) + +// PermissionsClientAPI contains the set of methods on the PermissionsClient type. +type PermissionsClientAPI interface { + Add(ctx context.Context, appID uuid.UUID, userToAdd authoring.UserCollaborator) (result authoring.OperationStatus, err error) + Delete(ctx context.Context, appID uuid.UUID, userToDelete authoring.UserCollaborator) (result authoring.OperationStatus, err error) + List(ctx context.Context, appID uuid.UUID) (result authoring.UserAccessList, err error) + Update(ctx context.Context, appID uuid.UUID, collaborators authoring.CollaboratorsArray) (result authoring.OperationStatus, err error) +} + +var _ PermissionsClientAPI = (*authoring.PermissionsClient)(nil) + +// PatternClientAPI contains the set of methods on the PatternClient type. +type PatternClientAPI interface { + AddPattern(ctx context.Context, appID uuid.UUID, versionID string, pattern authoring.PatternRuleCreateObject) (result authoring.PatternRuleInfo, err error) + BatchAddPatterns(ctx context.Context, appID uuid.UUID, versionID string, patterns []authoring.PatternRuleCreateObject) (result authoring.ListPatternRuleInfo, err error) + DeletePattern(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID) (result authoring.OperationStatus, err error) + DeletePatterns(ctx context.Context, appID uuid.UUID, versionID string, patternIds []uuid.UUID) (result authoring.OperationStatus, err error) + ListIntentPatterns(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, skip *int32, take *int32) (result authoring.ListPatternRuleInfo, err error) + ListPatterns(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPatternRuleInfo, err error) + UpdatePattern(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID, pattern authoring.PatternRuleUpdateObject) (result authoring.PatternRuleInfo, err error) + UpdatePatterns(ctx context.Context, appID uuid.UUID, versionID string, patterns []authoring.PatternRuleUpdateObject) (result authoring.ListPatternRuleInfo, err error) +} + +var _ PatternClientAPI = (*authoring.PatternClient)(nil) + +// SettingsClientAPI contains the set of methods on the SettingsClient type. +type SettingsClientAPI interface { + List(ctx context.Context, appID uuid.UUID, versionID string) (result authoring.ListAppVersionSettingObject, err error) + Update(ctx context.Context, appID uuid.UUID, versionID string, listOfAppVersionSettingObject []authoring.AppVersionSettingObject) (result authoring.OperationStatus, err error) +} + +var _ SettingsClientAPI = (*authoring.SettingsClient)(nil) + +// AzureAccountsClientAPI contains the set of methods on the AzureAccountsClient type. +type AzureAccountsClientAPI interface { + AssignToApp(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *authoring.AzureAccountInfoObject) (result authoring.OperationStatus, err error) + GetAssigned(ctx context.Context, appID uuid.UUID) (result authoring.ListAzureAccountInfoObject, err error) + ListUserLUISAccounts(ctx context.Context) (result authoring.ListAzureAccountInfoObject, err error) + RemoveFromApp(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *authoring.AzureAccountInfoObject) (result authoring.OperationStatus, err error) +} + +var _ AzureAccountsClientAPI = (*authoring.AzureAccountsClient)(nil) diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/azureaccounts.go b/services/preview/cognitiveservices/v3.0/luis/authoring/azureaccounts.go new file mode 100644 index 000000000000..0839f2f501f3 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/azureaccounts.go @@ -0,0 +1,352 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// AzureAccountsClient is the client for the AzureAccounts methods of the Authoring service. +type AzureAccountsClient struct { + BaseClient +} + +// NewAzureAccountsClient creates an instance of the AzureAccountsClient client. +func NewAzureAccountsClient(endpoint string) AzureAccountsClient { + return AzureAccountsClient{New(endpoint)} +} + +// AssignToApp assigns an Azure account to the application. +// Parameters: +// appID - the application ID. +// azureAccountInfoObject - the Azure account information object. +func (client AzureAccountsClient) AssignToApp(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *AzureAccountInfoObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureAccountsClient.AssignToApp") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: azureAccountInfoObject, + Constraints: []validation.Constraint{{Target: "azureAccountInfoObject", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "azureAccountInfoObject.AzureSubscriptionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "azureAccountInfoObject.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "azureAccountInfoObject.AccountName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.AzureAccountsClient", "AssignToApp", err.Error()) + } + + req, err := client.AssignToAppPreparer(ctx, appID, azureAccountInfoObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "AssignToApp", nil, "Failure preparing request") + return + } + + resp, err := client.AssignToAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "AssignToApp", resp, "Failure sending request") + return + } + + result, err = client.AssignToAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "AssignToApp", resp, "Failure responding to request") + } + + return +} + +// AssignToAppPreparer prepares the AssignToApp request. +func (client AzureAccountsClient) AssignToAppPreparer(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *AzureAccountInfoObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/azureaccounts", pathParameters)) + if azureAccountInfoObject != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(azureAccountInfoObject)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AssignToAppSender sends the AssignToApp request. The method will close the +// http.Response Body if it receives an error. +func (client AzureAccountsClient) AssignToAppSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AssignToAppResponder handles the response to the AssignToApp request. The method always +// closes the http.Response Body. +func (client AzureAccountsClient) AssignToAppResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAssigned gets the LUIS Azure accounts assigned to the application for the user using his ARM token. +// Parameters: +// appID - the application ID. +func (client AzureAccountsClient) GetAssigned(ctx context.Context, appID uuid.UUID) (result ListAzureAccountInfoObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureAccountsClient.GetAssigned") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAssignedPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "GetAssigned", nil, "Failure preparing request") + return + } + + resp, err := client.GetAssignedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "GetAssigned", resp, "Failure sending request") + return + } + + result, err = client.GetAssignedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "GetAssigned", resp, "Failure responding to request") + } + + return +} + +// GetAssignedPreparer prepares the GetAssigned request. +func (client AzureAccountsClient) GetAssignedPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/azureaccounts", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAssignedSender sends the GetAssigned request. The method will close the +// http.Response Body if it receives an error. +func (client AzureAccountsClient) GetAssignedSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetAssignedResponder handles the response to the GetAssigned request. The method always +// closes the http.Response Body. +func (client AzureAccountsClient) GetAssignedResponder(resp *http.Response) (result ListAzureAccountInfoObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUserLUISAccounts gets the LUIS Azure accounts for the user using his ARM token. +func (client AzureAccountsClient) ListUserLUISAccounts(ctx context.Context) (result ListAzureAccountInfoObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureAccountsClient.ListUserLUISAccounts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListUserLUISAccountsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "ListUserLUISAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListUserLUISAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "ListUserLUISAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListUserLUISAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "ListUserLUISAccounts", resp, "Failure responding to request") + } + + return +} + +// ListUserLUISAccountsPreparer prepares the ListUserLUISAccounts request. +func (client AzureAccountsClient) ListUserLUISAccountsPreparer(ctx context.Context) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPath("/azureaccounts")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUserLUISAccountsSender sends the ListUserLUISAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client AzureAccountsClient) ListUserLUISAccountsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListUserLUISAccountsResponder handles the response to the ListUserLUISAccounts request. The method always +// closes the http.Response Body. +func (client AzureAccountsClient) ListUserLUISAccountsResponder(resp *http.Response) (result ListAzureAccountInfoObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RemoveFromApp removes assigned Azure account from the application. +// Parameters: +// appID - the application ID. +// azureAccountInfoObject - the Azure account information object. +func (client AzureAccountsClient) RemoveFromApp(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *AzureAccountInfoObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureAccountsClient.RemoveFromApp") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: azureAccountInfoObject, + Constraints: []validation.Constraint{{Target: "azureAccountInfoObject", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "azureAccountInfoObject.AzureSubscriptionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "azureAccountInfoObject.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "azureAccountInfoObject.AccountName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.AzureAccountsClient", "RemoveFromApp", err.Error()) + } + + req, err := client.RemoveFromAppPreparer(ctx, appID, azureAccountInfoObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "RemoveFromApp", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveFromAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "RemoveFromApp", resp, "Failure sending request") + return + } + + result, err = client.RemoveFromAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.AzureAccountsClient", "RemoveFromApp", resp, "Failure responding to request") + } + + return +} + +// RemoveFromAppPreparer prepares the RemoveFromApp request. +func (client AzureAccountsClient) RemoveFromAppPreparer(ctx context.Context, appID uuid.UUID, azureAccountInfoObject *AzureAccountInfoObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/azureaccounts", pathParameters)) + if azureAccountInfoObject != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(azureAccountInfoObject)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RemoveFromAppSender sends the RemoveFromApp request. The method will close the +// http.Response Body if it receives an error. +func (client AzureAccountsClient) RemoveFromAppSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// RemoveFromAppResponder handles the response to the RemoveFromApp request. The method always +// closes the http.Response Body. +func (client AzureAccountsClient) RemoveFromAppResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/client.go b/services/preview/cognitiveservices/v3.0/luis/authoring/client.go new file mode 100644 index 000000000000..52070803a823 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/client.go @@ -0,0 +1,44 @@ +// Package authoring implements the Azure ARM Authoring service API version 3.0-preview. +// +// +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// BaseClient is the base client for Authoring. +type BaseClient struct { + autorest.Client + Endpoint string +} + +// New creates an instance of the BaseClient client. +func New(endpoint string) BaseClient { + return NewWithoutDefaults(endpoint) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(endpoint string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, + } +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/examples.go b/services/preview/cognitiveservices/v3.0/luis/authoring/examples.go new file mode 100644 index 000000000000..8fe2b086e25c --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/examples.go @@ -0,0 +1,375 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// ExamplesClient is the client for the Examples methods of the Authoring service. +type ExamplesClient struct { + BaseClient +} + +// NewExamplesClient creates an instance of the ExamplesClient client. +func NewExamplesClient(endpoint string) ExamplesClient { + return ExamplesClient{New(endpoint)} +} + +// Add adds a labeled example utterance in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// exampleLabelObject - a labeled example utterance with the expected intent and entities. +func (client ExamplesClient) Add(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObject ExampleLabelObject) (result LabelExampleResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExamplesClient.Add") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddPreparer(ctx, appID, versionID, exampleLabelObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client ExamplesClient) AddPreparer(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObject ExampleLabelObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/example", pathParameters), + autorest.WithJSON(exampleLabelObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client ExamplesClient) AddSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client ExamplesClient) AddResponder(resp *http.Response) (result LabelExampleResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Batch adds a batch of labeled example utterances to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// exampleLabelObjectArray - array of example utterances. +func (client ExamplesClient) Batch(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObjectArray []ExampleLabelObject) (result ListBatchLabelExample, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExamplesClient.Batch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: exampleLabelObjectArray, + Constraints: []validation.Constraint{{Target: "exampleLabelObjectArray", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.ExamplesClient", "Batch", err.Error()) + } + + req, err := client.BatchPreparer(ctx, appID, versionID, exampleLabelObjectArray) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Batch", nil, "Failure preparing request") + return + } + + resp, err := client.BatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Batch", resp, "Failure sending request") + return + } + + result, err = client.BatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Batch", resp, "Failure responding to request") + } + + return +} + +// BatchPreparer prepares the Batch request. +func (client ExamplesClient) BatchPreparer(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObjectArray []ExampleLabelObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/examples", pathParameters), + autorest.WithJSON(exampleLabelObjectArray)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BatchSender sends the Batch request. The method will close the +// http.Response Body if it receives an error. +func (client ExamplesClient) BatchSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// BatchResponder handles the response to the Batch request. The method always +// closes the http.Response Body. +func (client ExamplesClient) BatchResponder(resp *http.Response) (result ListBatchLabelExample, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusMultiStatus), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the labeled example utterances with the specified ID from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// exampleID - the example ID. +func (client ExamplesClient) Delete(ctx context.Context, appID uuid.UUID, versionID string, exampleID int32) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExamplesClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, appID, versionID, exampleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExamplesClient) DeletePreparer(ctx context.Context, appID uuid.UUID, versionID string, exampleID int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "exampleId": autorest.Encode("path", exampleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/examples/{exampleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExamplesClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExamplesClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns example utterances to be reviewed from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ExamplesClient) List(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListLabeledUtterance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExamplesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ExamplesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ExamplesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExamplesClient) ListPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/examples", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExamplesClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExamplesClient) ListResponder(resp *http.Response) (result ListLabeledUtterance, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/features.go b/services/preview/cognitiveservices/v3.0/luis/authoring/features.go new file mode 100644 index 000000000000..23015f60839d --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/features.go @@ -0,0 +1,969 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// FeaturesClient is the client for the Features methods of the Authoring service. +type FeaturesClient struct { + BaseClient +} + +// NewFeaturesClient creates an instance of the FeaturesClient client. +func NewFeaturesClient(endpoint string) FeaturesClient { + return FeaturesClient{New(endpoint)} +} + +// AddPhraseList creates a new phraselist feature in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// phraselistCreateObject - a Phraselist object containing Name, comma-separated Phrases and the isExchangeable +// boolean. Default value for isExchangeable is true. +func (client FeaturesClient) AddPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject PhraselistCreateObject) (result Int32, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.AddPhraseList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddPhraseListPreparer(ctx, appID, versionID, phraselistCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", nil, "Failure preparing request") + return + } + + resp, err := client.AddPhraseListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure sending request") + return + } + + result, err = client.AddPhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure responding to request") + } + + return +} + +// AddPhraseListPreparer prepares the AddPhraseList request. +func (client FeaturesClient) AddPhraseListPreparer(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject PhraselistCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists", pathParameters), + autorest.WithJSON(phraselistCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPhraseListSender sends the AddPhraseList request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) AddPhraseListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddPhraseListResponder handles the response to the AddPhraseList request. The method always +// closes the http.Response Body. +func (client FeaturesClient) AddPhraseListResponder(resp *http.Response) (result Int32, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreatePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Creates a new pattern feature in a +// version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternCreateObject - the Name and Pattern of the feature. +func (client FeaturesClient) CreatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject PatternCreateObject) (result Int32, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.CreatePatternFeature") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePatternFeaturePreparer(ctx, appID, versionID, patternCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", nil, "Failure preparing request") + return + } + + resp, err := client.CreatePatternFeatureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", resp, "Failure sending request") + return + } + + result, err = client.CreatePatternFeatureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", resp, "Failure responding to request") + } + + return +} + +// CreatePatternFeaturePreparer prepares the CreatePatternFeature request. +func (client FeaturesClient) CreatePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject PatternCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns", pathParameters), + autorest.WithJSON(patternCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreatePatternFeatureSender sends the CreatePatternFeature request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) CreatePatternFeatureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreatePatternFeatureResponder handles the response to the CreatePatternFeature request. The method always +// closes the http.Response Body. +func (client FeaturesClient) CreatePatternFeatureResponder(resp *http.Response) (result Int32, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Deletes a pattern feature in a version +// of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternID - the pattern feature ID. +func (client FeaturesClient) DeletePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.DeletePatternFeature") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePatternFeaturePreparer(ctx, appID, versionID, patternID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePatternFeatureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", resp, "Failure sending request") + return + } + + result, err = client.DeletePatternFeatureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", resp, "Failure responding to request") + } + + return +} + +// DeletePatternFeaturePreparer prepares the DeletePatternFeature request. +func (client FeaturesClient) DeletePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "patternId": autorest.Encode("path", patternID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePatternFeatureSender sends the DeletePatternFeature request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) DeletePatternFeatureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePatternFeatureResponder handles the response to the DeletePatternFeature request. The method always +// closes the http.Response Body. +func (client FeaturesClient) DeletePatternFeatureResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePhraseList deletes a phraselist feature from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// phraselistID - the ID of the feature to be deleted. +func (client FeaturesClient) DeletePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.DeletePhraseList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePhraseListPreparer(ctx, appID, versionID, phraselistID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePhraseList", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePhraseListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePhraseList", resp, "Failure sending request") + return + } + + result, err = client.DeletePhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePhraseList", resp, "Failure responding to request") + } + + return +} + +// DeletePhraseListPreparer prepares the DeletePhraseList request. +func (client FeaturesClient) DeletePhraseListPreparer(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "phraselistId": autorest.Encode("path", phraselistID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists/{phraselistId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePhraseListSender sends the DeletePhraseList request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) DeletePhraseListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePhraseListResponder handles the response to the DeletePhraseList request. The method always +// closes the http.Response Body. +func (client FeaturesClient) DeletePhraseListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPatternFeatureInfo [DEPRECATED NOTICE: This operation will soon be removed] Gets the specified pattern feature's +// info in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternID - the pattern feature ID. +func (client FeaturesClient) GetPatternFeatureInfo(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result PatternFeatureInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.GetPatternFeatureInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPatternFeatureInfoPreparer(ctx, appID, versionID, patternID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetPatternFeatureInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", resp, "Failure sending request") + return + } + + result, err = client.GetPatternFeatureInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", resp, "Failure responding to request") + } + + return +} + +// GetPatternFeatureInfoPreparer prepares the GetPatternFeatureInfo request. +func (client FeaturesClient) GetPatternFeatureInfoPreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "patternId": autorest.Encode("path", patternID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPatternFeatureInfoSender sends the GetPatternFeatureInfo request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) GetPatternFeatureInfoSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPatternFeatureInfoResponder handles the response to the GetPatternFeatureInfo request. The method always +// closes the http.Response Body. +func (client FeaturesClient) GetPatternFeatureInfoResponder(resp *http.Response) (result PatternFeatureInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPhraseList gets phraselist feature info in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// phraselistID - the ID of the feature to be retrieved. +func (client FeaturesClient) GetPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result PhraseListFeatureInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.GetPhraseList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPhraseListPreparer(ctx, appID, versionID, phraselistID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPhraseList", nil, "Failure preparing request") + return + } + + resp, err := client.GetPhraseListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPhraseList", resp, "Failure sending request") + return + } + + result, err = client.GetPhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPhraseList", resp, "Failure responding to request") + } + + return +} + +// GetPhraseListPreparer prepares the GetPhraseList request. +func (client FeaturesClient) GetPhraseListPreparer(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "phraselistId": autorest.Encode("path", phraselistID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists/{phraselistId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPhraseListSender sends the GetPhraseList request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) GetPhraseListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPhraseListResponder handles the response to the GetPhraseList request. The method always +// closes the http.Response Body. +func (client FeaturesClient) GetPhraseListResponder(resp *http.Response) (result PhraseListFeatureInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the extraction phraselist and pattern features in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client FeaturesClient) List(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result FeaturesResponseObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.FeaturesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FeaturesClient) ListPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/features", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FeaturesClient) ListResponder(resp *http.Response) (result FeaturesResponseObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListApplicationVersionPatternFeatures [DEPRECATED NOTICE: This operation will soon be removed] Gets all the pattern +// features. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client FeaturesClient) ListApplicationVersionPatternFeatures(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPatternFeatureInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.ListApplicationVersionPatternFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", err.Error()) + } + + req, err := client.ListApplicationVersionPatternFeaturesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicationVersionPatternFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", resp, "Failure sending request") + return + } + + result, err = client.ListApplicationVersionPatternFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", resp, "Failure responding to request") + } + + return +} + +// ListApplicationVersionPatternFeaturesPreparer prepares the ListApplicationVersionPatternFeatures request. +func (client FeaturesClient) ListApplicationVersionPatternFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListApplicationVersionPatternFeaturesSender sends the ListApplicationVersionPatternFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) ListApplicationVersionPatternFeaturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListApplicationVersionPatternFeaturesResponder handles the response to the ListApplicationVersionPatternFeatures request. The method always +// closes the http.Response Body. +func (client FeaturesClient) ListApplicationVersionPatternFeaturesResponder(resp *http.Response) (result ListPatternFeatureInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPhraseLists gets all the phraselist features in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client FeaturesClient) ListPhraseLists(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPhraseListFeatureInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.ListPhraseLists") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.FeaturesClient", "ListPhraseLists", err.Error()) + } + + req, err := client.ListPhraseListsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListPhraseLists", nil, "Failure preparing request") + return + } + + resp, err := client.ListPhraseListsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListPhraseLists", resp, "Failure sending request") + return + } + + result, err = client.ListPhraseListsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListPhraseLists", resp, "Failure responding to request") + } + + return +} + +// ListPhraseListsPreparer prepares the ListPhraseLists request. +func (client FeaturesClient) ListPhraseListsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPhraseListsSender sends the ListPhraseLists request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) ListPhraseListsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPhraseListsResponder handles the response to the ListPhraseLists request. The method always +// closes the http.Response Body. +func (client FeaturesClient) ListPhraseListsResponder(resp *http.Response) (result ListPhraseListFeatureInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Updates the pattern, the name and the +// state of the pattern feature in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternID - the pattern feature ID. +// patternUpdateObject - the new values for: - Just a boolean called IsActive, in which case the status of the +// feature will be changed. - Name, Pattern and a boolean called IsActive to update the feature. +func (client FeaturesClient) UpdatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject PatternUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.UpdatePatternFeature") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePatternFeaturePreparer(ctx, appID, versionID, patternID, patternUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePatternFeatureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", resp, "Failure sending request") + return + } + + result, err = client.UpdatePatternFeatureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", resp, "Failure responding to request") + } + + return +} + +// UpdatePatternFeaturePreparer prepares the UpdatePatternFeature request. +func (client FeaturesClient) UpdatePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject PatternUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "patternId": autorest.Encode("path", patternID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters), + autorest.WithJSON(patternUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatternFeatureSender sends the UpdatePatternFeature request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) UpdatePatternFeatureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePatternFeatureResponder handles the response to the UpdatePatternFeature request. The method always +// closes the http.Response Body. +func (client FeaturesClient) UpdatePatternFeatureResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePhraseList updates the phrases, the state and the name of the phraselist feature in a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// phraselistID - the ID of the feature to be updated. +// phraselistUpdateObject - the new values for: - Just a boolean called IsActive, in which case the status of +// the feature will be changed. - Name, Pattern, Mode, and a boolean called IsActive to update the feature. +func (client FeaturesClient) UpdatePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32, phraselistUpdateObject *PhraselistUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.UpdatePhraseList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePhraseListPreparer(ctx, appID, versionID, phraselistID, phraselistUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePhraseList", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePhraseListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePhraseList", resp, "Failure sending request") + return + } + + result, err = client.UpdatePhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePhraseList", resp, "Failure responding to request") + } + + return +} + +// UpdatePhraseListPreparer prepares the UpdatePhraseList request. +func (client FeaturesClient) UpdatePhraseListPreparer(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32, phraselistUpdateObject *PhraselistUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "phraselistId": autorest.Encode("path", phraselistID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists/{phraselistId}", pathParameters)) + if phraselistUpdateObject != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(phraselistUpdateObject)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePhraseListSender sends the UpdatePhraseList request. The method will close the +// http.Response Body if it receives an error. +func (client FeaturesClient) UpdatePhraseListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePhraseListResponder handles the response to the UpdatePhraseList request. The method always +// closes the http.Response Body. +func (client FeaturesClient) UpdatePhraseListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/model.go b/services/preview/cognitiveservices/v3.0/luis/authoring/model.go new file mode 100644 index 000000000000..5799f5189ad8 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/model.go @@ -0,0 +1,8420 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// ModelClient is the client for the Model methods of the Authoring service. +type ModelClient struct { + BaseClient +} + +// NewModelClient creates an instance of the ModelClient client. +func NewModelClient(endpoint string) ModelClient { + return ModelClient{New(endpoint)} +} + +// AddClosedList adds a list entity model to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// closedListModelCreateObject - a model containing the name and words for the new list entity extractor. +func (client ModelClient) AddClosedList(ctx context.Context, appID uuid.UUID, versionID string, closedListModelCreateObject ClosedListModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddClosedList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddClosedListPreparer(ctx, appID, versionID, closedListModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddClosedList", nil, "Failure preparing request") + return + } + + resp, err := client.AddClosedListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddClosedList", resp, "Failure sending request") + return + } + + result, err = client.AddClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddClosedList", resp, "Failure responding to request") + } + + return +} + +// AddClosedListPreparer prepares the AddClosedList request. +func (client ModelClient) AddClosedListPreparer(ctx context.Context, appID uuid.UUID, versionID string, closedListModelCreateObject ClosedListModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists", pathParameters), + autorest.WithJSON(closedListModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddClosedListSender sends the AddClosedList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddClosedListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddClosedListResponder handles the response to the AddClosedList request. The method always +// closes the http.Response Body. +func (client ModelClient) AddClosedListResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddCompositeEntityChild creates a single child in an existing composite entity model in a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// compositeChildModelCreateObject - a model object containing the name of the new composite child model. +func (client ModelClient) AddCompositeEntityChild(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeChildModelCreateObject CompositeChildModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddCompositeEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddCompositeEntityChildPreparer(ctx, appID, versionID, cEntityID, compositeChildModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCompositeEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.AddCompositeEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCompositeEntityChild", resp, "Failure sending request") + return + } + + result, err = client.AddCompositeEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCompositeEntityChild", resp, "Failure responding to request") + } + + return +} + +// AddCompositeEntityChildPreparer prepares the AddCompositeEntityChild request. +func (client ModelClient) AddCompositeEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeChildModelCreateObject CompositeChildModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/children", pathParameters), + autorest.WithJSON(compositeChildModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCompositeEntityChildSender sends the AddCompositeEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddCompositeEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddCompositeEntityChildResponder handles the response to the AddCompositeEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) AddCompositeEntityChildResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddCustomPrebuiltDomain adds a customizable prebuilt domain along with all of its intent and entity models in a +// version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltDomainObject - a prebuilt domain create object containing the name of the domain. +func (client ModelClient) AddCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainObject PrebuiltDomainCreateBaseObject) (result ListUUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddCustomPrebuiltDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddCustomPrebuiltDomainPreparer(ctx, appID, versionID, prebuiltDomainObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltDomain", nil, "Failure preparing request") + return + } + + resp, err := client.AddCustomPrebuiltDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltDomain", resp, "Failure responding to request") + } + + return +} + +// AddCustomPrebuiltDomainPreparer prepares the AddCustomPrebuiltDomain request. +func (client ModelClient) AddCustomPrebuiltDomainPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainObject PrebuiltDomainCreateBaseObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltdomains", pathParameters), + autorest.WithJSON(prebuiltDomainObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCustomPrebuiltDomainSender sends the AddCustomPrebuiltDomain request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddCustomPrebuiltDomainSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddCustomPrebuiltDomainResponder handles the response to the AddCustomPrebuiltDomain request. The method always +// closes the http.Response Body. +func (client ModelClient) AddCustomPrebuiltDomainResponder(resp *http.Response) (result ListUUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddCustomPrebuiltEntity adds a prebuilt entity model to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltDomainModelCreateObject - a model object containing the name of the prebuilt entity and the name of +// the domain to which this model belongs. +func (client ModelClient) AddCustomPrebuiltEntity(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject PrebuiltDomainModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddCustomPrebuiltEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddCustomPrebuiltEntityPreparer(ctx, appID, versionID, prebuiltDomainModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltEntity", nil, "Failure preparing request") + return + } + + resp, err := client.AddCustomPrebuiltEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltEntity", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltEntity", resp, "Failure responding to request") + } + + return +} + +// AddCustomPrebuiltEntityPreparer prepares the AddCustomPrebuiltEntity request. +func (client ModelClient) AddCustomPrebuiltEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject PrebuiltDomainModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities", pathParameters), + autorest.WithJSON(prebuiltDomainModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCustomPrebuiltEntitySender sends the AddCustomPrebuiltEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddCustomPrebuiltEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddCustomPrebuiltEntityResponder handles the response to the AddCustomPrebuiltEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) AddCustomPrebuiltEntityResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddCustomPrebuiltIntent adds a customizable prebuilt intent model to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltDomainModelCreateObject - a model object containing the name of the customizable prebuilt intent and +// the name of the domain to which this model belongs. +func (client ModelClient) AddCustomPrebuiltIntent(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject PrebuiltDomainModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddCustomPrebuiltIntent") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddCustomPrebuiltIntentPreparer(ctx, appID, versionID, prebuiltDomainModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltIntent", nil, "Failure preparing request") + return + } + + resp, err := client.AddCustomPrebuiltIntentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltIntent", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddCustomPrebuiltIntent", resp, "Failure responding to request") + } + + return +} + +// AddCustomPrebuiltIntentPreparer prepares the AddCustomPrebuiltIntent request. +func (client ModelClient) AddCustomPrebuiltIntentPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltDomainModelCreateObject PrebuiltDomainModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltintents", pathParameters), + autorest.WithJSON(prebuiltDomainModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCustomPrebuiltIntentSender sends the AddCustomPrebuiltIntent request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddCustomPrebuiltIntentSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddCustomPrebuiltIntentResponder handles the response to the AddCustomPrebuiltIntent request. The method always +// closes the http.Response Body. +func (client ModelClient) AddCustomPrebuiltIntentResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddEntity adds an entity extractor to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityModelCreateObject - a model object containing the name of the new entity extractor and its children. +func (client ModelClient) AddEntity(ctx context.Context, appID uuid.UUID, versionID string, entityModelCreateObject EntityModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddEntityPreparer(ctx, appID, versionID, entityModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntity", nil, "Failure preparing request") + return + } + + resp, err := client.AddEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntity", resp, "Failure sending request") + return + } + + result, err = client.AddEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntity", resp, "Failure responding to request") + } + + return +} + +// AddEntityPreparer prepares the AddEntity request. +func (client ModelClient) AddEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityModelCreateObject EntityModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities", pathParameters), + autorest.WithJSON(entityModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddEntitySender sends the AddEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddEntityResponder handles the response to the AddEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) AddEntityResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddEntityChild creates a single child in an existing entity model hierarchy in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +// childEntityModelCreateObject - a model object containing the name of the new child model and its children. +func (client ModelClient) AddEntityChild(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, childEntityModelCreateObject ChildEntityModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddEntityChildPreparer(ctx, appID, versionID, entityID, childEntityModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.AddEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntityChild", resp, "Failure sending request") + return + } + + result, err = client.AddEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddEntityChild", resp, "Failure responding to request") + } + + return +} + +// AddEntityChildPreparer prepares the AddEntityChild request. +func (client ModelClient) AddEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, childEntityModelCreateObject ChildEntityModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/children", pathParameters), + autorest.WithJSON(childEntityModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddEntityChildSender sends the AddEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddEntityChildResponder handles the response to the AddEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) AddEntityChildResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddExplicitListItem sends the add explicit list item request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity extractor ID. +// item - the new explicit list item. +func (client ModelClient) AddExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, item ExplicitListItemCreateObject) (result Int32, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddExplicitListItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddExplicitListItemPreparer(ctx, appID, versionID, entityID, item) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddExplicitListItem", nil, "Failure preparing request") + return + } + + resp, err := client.AddExplicitListItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddExplicitListItem", resp, "Failure sending request") + return + } + + result, err = client.AddExplicitListItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddExplicitListItem", resp, "Failure responding to request") + } + + return +} + +// AddExplicitListItemPreparer prepares the AddExplicitListItem request. +func (client ModelClient) AddExplicitListItemPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, item ExplicitListItemCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist", pathParameters), + autorest.WithJSON(item)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddExplicitListItemSender sends the AddExplicitListItem request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddExplicitListItemSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddExplicitListItemResponder handles the response to the AddExplicitListItem request. The method always +// closes the http.Response Body. +func (client ModelClient) AddExplicitListItemResponder(resp *http.Response) (result Int32, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddIntent adds an intent to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentCreateObject - a model object containing the name of the new intent. +func (client ModelClient) AddIntent(ctx context.Context, appID uuid.UUID, versionID string, intentCreateObject ModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddIntent") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddIntentPreparer(ctx, appID, versionID, intentCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddIntent", nil, "Failure preparing request") + return + } + + resp, err := client.AddIntentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddIntent", resp, "Failure sending request") + return + } + + result, err = client.AddIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddIntent", resp, "Failure responding to request") + } + + return +} + +// AddIntentPreparer prepares the AddIntent request. +func (client ModelClient) AddIntentPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentCreateObject ModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents", pathParameters), + autorest.WithJSON(intentCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddIntentSender sends the AddIntent request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddIntentSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddIntentResponder handles the response to the AddIntent request. The method always +// closes the http.Response Body. +func (client ModelClient) AddIntentResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddPrebuilt adds a list of prebuilt entities to a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltExtractorNames - an array of prebuilt entity extractor names. +func (client ModelClient) AddPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltExtractorNames []string) (result ListPrebuiltEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddPrebuilt") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: prebuiltExtractorNames, + Constraints: []validation.Constraint{{Target: "prebuiltExtractorNames", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "AddPrebuilt", err.Error()) + } + + req, err := client.AddPrebuiltPreparer(ctx, appID, versionID, prebuiltExtractorNames) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddPrebuilt", nil, "Failure preparing request") + return + } + + resp, err := client.AddPrebuiltSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddPrebuilt", resp, "Failure sending request") + return + } + + result, err = client.AddPrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddPrebuilt", resp, "Failure responding to request") + } + + return +} + +// AddPrebuiltPreparer prepares the AddPrebuilt request. +func (client ModelClient) AddPrebuiltPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltExtractorNames []string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts", pathParameters), + autorest.WithJSON(prebuiltExtractorNames)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPrebuiltSender sends the AddPrebuilt request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddPrebuiltSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddPrebuiltResponder handles the response to the AddPrebuilt request. The method always +// closes the http.Response Body. +func (client ModelClient) AddPrebuiltResponder(resp *http.Response) (result ListPrebuiltEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddSubList adds a sublist to an existing list entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list entity extractor ID. +// wordListCreateObject - words list. +func (client ModelClient) AddSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, wordListCreateObject WordListObject) (result Int64, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.AddSubList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddSubListPreparer(ctx, appID, versionID, clEntityID, wordListCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddSubList", nil, "Failure preparing request") + return + } + + resp, err := client.AddSubListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddSubList", resp, "Failure sending request") + return + } + + result, err = client.AddSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "AddSubList", resp, "Failure responding to request") + } + + return +} + +// AddSubListPreparer prepares the AddSubList request. +func (client ModelClient) AddSubListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, wordListCreateObject WordListObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists", pathParameters), + autorest.WithJSON(wordListCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSubListSender sends the AddSubList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddSubListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddSubListResponder handles the response to the AddSubList request. The method always +// closes the http.Response Body. +func (client ModelClient) AddSubListResponder(resp *http.Response) (result Int64, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateClosedListEntityRole sends the create closed list entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateClosedListEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateClosedListEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateClosedListEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateClosedListEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateClosedListEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateClosedListEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateClosedListEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateClosedListEntityRolePreparer prepares the CreateClosedListEntityRole request. +func (client ModelClient) CreateClosedListEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateClosedListEntityRoleSender sends the CreateClosedListEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateClosedListEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateClosedListEntityRoleResponder handles the response to the CreateClosedListEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateClosedListEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateCompositeEntityRole sends the create composite entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateCompositeEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateCompositeEntityRolePreparer(ctx, appID, versionID, cEntityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCompositeEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateCompositeEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCompositeEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateCompositeEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCompositeEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateCompositeEntityRolePreparer prepares the CreateCompositeEntityRole request. +func (client ModelClient) CreateCompositeEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateCompositeEntityRoleSender sends the CreateCompositeEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateCompositeEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateCompositeEntityRoleResponder handles the response to the CreateCompositeEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateCompositeEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateCustomPrebuiltEntityRole sends the create custom prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateCustomPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateCustomPrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateCustomPrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCustomPrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateCustomPrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCustomPrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateCustomPrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateCustomPrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateCustomPrebuiltEntityRolePreparer prepares the CreateCustomPrebuiltEntityRole request. +func (client ModelClient) CreateCustomPrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateCustomPrebuiltEntityRoleSender sends the CreateCustomPrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateCustomPrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateCustomPrebuiltEntityRoleResponder handles the response to the CreateCustomPrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateCustomPrebuiltEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateEntityRole sends the create entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateEntityRolePreparer prepares the CreateEntityRole request. +func (client ModelClient) CreateEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateEntityRoleSender sends the CreateEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateEntityRoleResponder handles the response to the CreateEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateHierarchicalEntityRole sends the create hierarchical entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateHierarchicalEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateHierarchicalEntityRolePreparer(ctx, appID, versionID, hEntityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateHierarchicalEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateHierarchicalEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateHierarchicalEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateHierarchicalEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateHierarchicalEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateHierarchicalEntityRolePreparer prepares the CreateHierarchicalEntityRole request. +func (client ModelClient) CreateHierarchicalEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateHierarchicalEntityRoleSender sends the CreateHierarchicalEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateHierarchicalEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateHierarchicalEntityRoleResponder handles the response to the CreateHierarchicalEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateHierarchicalEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreatePatternAnyEntityModel sends the create pattern any entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// extractorCreateObject - a model object containing the name and explicit list for the new Pattern.Any entity +// extractor. +func (client ModelClient) CreatePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, extractorCreateObject PatternAnyModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreatePatternAnyEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePatternAnyEntityModelPreparer(ctx, appID, versionID, extractorCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.CreatePatternAnyEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityModel", resp, "Failure sending request") + return + } + + result, err = client.CreatePatternAnyEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityModel", resp, "Failure responding to request") + } + + return +} + +// CreatePatternAnyEntityModelPreparer prepares the CreatePatternAnyEntityModel request. +func (client ModelClient) CreatePatternAnyEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, extractorCreateObject PatternAnyModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities", pathParameters), + autorest.WithJSON(extractorCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreatePatternAnyEntityModelSender sends the CreatePatternAnyEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreatePatternAnyEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreatePatternAnyEntityModelResponder handles the response to the CreatePatternAnyEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) CreatePatternAnyEntityModelResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreatePatternAnyEntityRole sends the create pattern any entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreatePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreatePatternAnyEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePatternAnyEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreatePatternAnyEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreatePatternAnyEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePatternAnyEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreatePatternAnyEntityRolePreparer prepares the CreatePatternAnyEntityRole request. +func (client ModelClient) CreatePatternAnyEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreatePatternAnyEntityRoleSender sends the CreatePatternAnyEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreatePatternAnyEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreatePatternAnyEntityRoleResponder handles the response to the CreatePatternAnyEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreatePatternAnyEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreatePrebuiltEntityRole sends the create prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreatePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreatePrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreatePrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreatePrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreatePrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreatePrebuiltEntityRolePreparer prepares the CreatePrebuiltEntityRole request. +func (client ModelClient) CreatePrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreatePrebuiltEntityRoleSender sends the CreatePrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreatePrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreatePrebuiltEntityRoleResponder handles the response to the CreatePrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreatePrebuiltEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateRegexEntityModel sends the create regex entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// regexEntityExtractorCreateObj - a model object containing the name and regex pattern for the new regular +// expression entity extractor. +func (client ModelClient) CreateRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityExtractorCreateObj RegexModelCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateRegexEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateRegexEntityModelPreparer(ctx, appID, versionID, regexEntityExtractorCreateObj) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.CreateRegexEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityModel", resp, "Failure sending request") + return + } + + result, err = client.CreateRegexEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityModel", resp, "Failure responding to request") + } + + return +} + +// CreateRegexEntityModelPreparer prepares the CreateRegexEntityModel request. +func (client ModelClient) CreateRegexEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, regexEntityExtractorCreateObj RegexModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities", pathParameters), + autorest.WithJSON(regexEntityExtractorCreateObj)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateRegexEntityModelSender sends the CreateRegexEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateRegexEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateRegexEntityModelResponder handles the response to the CreateRegexEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateRegexEntityModelResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateRegexEntityRole sends the create regex entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity model ID. +// entityRoleCreateObject - an entity role object containing the name of role. +func (client ModelClient) CreateRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (result UUID, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.CreateRegexEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateRegexEntityRolePreparer(ctx, appID, versionID, entityID, entityRoleCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.CreateRegexEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityRole", resp, "Failure sending request") + return + } + + result, err = client.CreateRegexEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "CreateRegexEntityRole", resp, "Failure responding to request") + } + + return +} + +// CreateRegexEntityRolePreparer prepares the CreateRegexEntityRole request. +func (client ModelClient) CreateRegexEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityRoleCreateObject EntityRoleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles", pathParameters), + autorest.WithJSON(entityRoleCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateRegexEntityRoleSender sends the CreateRegexEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) CreateRegexEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateRegexEntityRoleResponder handles the response to the CreateRegexEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) CreateRegexEntityRoleResponder(resp *http.Response) (result UUID, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteClosedList deletes a list entity model from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list entity model ID. +func (client ModelClient) DeleteClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteClosedList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteClosedListPreparer(ctx, appID, versionID, clEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedList", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteClosedListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedList", resp, "Failure sending request") + return + } + + result, err = client.DeleteClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedList", resp, "Failure responding to request") + } + + return +} + +// DeleteClosedListPreparer prepares the DeleteClosedList request. +func (client ModelClient) DeleteClosedListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteClosedListSender sends the DeleteClosedList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteClosedListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteClosedListResponder handles the response to the DeleteClosedList request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteClosedListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteClosedListEntityRole sends the delete closed list entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteClosedListEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteClosedListEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedListEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteClosedListEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedListEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteClosedListEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteClosedListEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteClosedListEntityRolePreparer prepares the DeleteClosedListEntityRole request. +func (client ModelClient) DeleteClosedListEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteClosedListEntityRoleSender sends the DeleteClosedListEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteClosedListEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteClosedListEntityRoleResponder handles the response to the DeleteClosedListEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteClosedListEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCompositeEntity deletes a composite entity from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +func (client ModelClient) DeleteCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteCompositeEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteCompositeEntityPreparer(ctx, appID, versionID, cEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntity", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCompositeEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntity", resp, "Failure responding to request") + } + + return +} + +// DeleteCompositeEntityPreparer prepares the DeleteCompositeEntity request. +func (client ModelClient) DeleteCompositeEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCompositeEntitySender sends the DeleteCompositeEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteCompositeEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteCompositeEntityResponder handles the response to the DeleteCompositeEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteCompositeEntityResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCompositeEntityChild deletes a composite entity extractor child from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// cChildID - the hierarchical entity extractor child ID. +func (client ModelClient) DeleteCompositeEntityChild(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, cChildID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteCompositeEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteCompositeEntityChildPreparer(ctx, appID, versionID, cEntityID, cChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCompositeEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityChild", resp, "Failure sending request") + return + } + + result, err = client.DeleteCompositeEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityChild", resp, "Failure responding to request") + } + + return +} + +// DeleteCompositeEntityChildPreparer prepares the DeleteCompositeEntityChild request. +func (client ModelClient) DeleteCompositeEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, cChildID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cChildId": autorest.Encode("path", cChildID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/children/{cChildId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCompositeEntityChildSender sends the DeleteCompositeEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteCompositeEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteCompositeEntityChildResponder handles the response to the DeleteCompositeEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteCompositeEntityChildResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCompositeEntityRole sends the delete composite entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteCompositeEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteCompositeEntityRolePreparer(ctx, appID, versionID, cEntityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCompositeEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteCompositeEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCompositeEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteCompositeEntityRolePreparer prepares the DeleteCompositeEntityRole request. +func (client ModelClient) DeleteCompositeEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCompositeEntityRoleSender sends the DeleteCompositeEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteCompositeEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteCompositeEntityRoleResponder handles the response to the DeleteCompositeEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteCompositeEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCustomEntityRole sends the delete custom entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteCustomEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteCustomEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCustomEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteCustomEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteCustomEntityRolePreparer prepares the DeleteCustomEntityRole request. +func (client ModelClient) DeleteCustomEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCustomEntityRoleSender sends the DeleteCustomEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteCustomEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteCustomEntityRoleResponder handles the response to the DeleteCustomEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteCustomEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCustomPrebuiltDomain deletes a prebuilt domain's models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// domainName - domain name. +func (client ModelClient) DeleteCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, domainName string) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteCustomPrebuiltDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteCustomPrebuiltDomainPreparer(ctx, appID, versionID, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomPrebuiltDomain", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCustomPrebuiltDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.DeleteCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteCustomPrebuiltDomain", resp, "Failure responding to request") + } + + return +} + +// DeleteCustomPrebuiltDomainPreparer prepares the DeleteCustomPrebuiltDomain request. +func (client ModelClient) DeleteCustomPrebuiltDomainPreparer(ctx context.Context, appID uuid.UUID, versionID string, domainName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "domainName": autorest.Encode("path", domainName), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltdomains/{domainName}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCustomPrebuiltDomainSender sends the DeleteCustomPrebuiltDomain request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteCustomPrebuiltDomainSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteCustomPrebuiltDomainResponder handles the response to the DeleteCustomPrebuiltDomain request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteCustomPrebuiltDomainResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteEntity deletes an entity or a child from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor or the child entity extractor ID. +func (client ModelClient) DeleteEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteEntityPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntity", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntity", resp, "Failure responding to request") + } + + return +} + +// DeleteEntityPreparer prepares the DeleteEntity request. +func (client ModelClient) DeleteEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteEntitySender sends the DeleteEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteEntityResponder handles the response to the DeleteEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteEntityResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteEntityRole sends the delete entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteEntityRolePreparer prepares the DeleteEntityRole request. +func (client ModelClient) DeleteEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteEntityRoleSender sends the DeleteEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteEntityRoleResponder handles the response to the DeleteEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteExplicitListItem sends the delete explicit list item request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the pattern.any entity id. +// itemID - the explicit list item which will be deleted. +func (client ModelClient) DeleteExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteExplicitListItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteExplicitListItemPreparer(ctx, appID, versionID, entityID, itemID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteExplicitListItem", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteExplicitListItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteExplicitListItem", resp, "Failure sending request") + return + } + + result, err = client.DeleteExplicitListItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteExplicitListItem", resp, "Failure responding to request") + } + + return +} + +// DeleteExplicitListItemPreparer prepares the DeleteExplicitListItem request. +func (client ModelClient) DeleteExplicitListItemPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "itemId": autorest.Encode("path", itemID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteExplicitListItemSender sends the DeleteExplicitListItem request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteExplicitListItemSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteExplicitListItemResponder handles the response to the DeleteExplicitListItem request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteExplicitListItemResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteHierarchicalEntity deletes a hierarchical entity from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +func (client ModelClient) DeleteHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteHierarchicalEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntity", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHierarchicalEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntity", resp, "Failure responding to request") + } + + return +} + +// DeleteHierarchicalEntityPreparer prepares the DeleteHierarchicalEntity request. +func (client ModelClient) DeleteHierarchicalEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHierarchicalEntitySender sends the DeleteHierarchicalEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteHierarchicalEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteHierarchicalEntityResponder handles the response to the DeleteHierarchicalEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteHierarchicalEntityResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteHierarchicalEntityChild deletes a hierarchical entity extractor child in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// hChildID - the hierarchical entity extractor child ID. +func (client ModelClient) DeleteHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteHierarchicalEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHierarchicalEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.DeleteHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityChild", resp, "Failure responding to request") + } + + return +} + +// DeleteHierarchicalEntityChildPreparer prepares the DeleteHierarchicalEntityChild request. +func (client ModelClient) DeleteHierarchicalEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hChildId": autorest.Encode("path", hChildID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHierarchicalEntityChildSender sends the DeleteHierarchicalEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteHierarchicalEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteHierarchicalEntityChildResponder handles the response to the DeleteHierarchicalEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteHierarchicalEntityChildResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteHierarchicalEntityRole sends the delete hierarchical entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteHierarchicalEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteHierarchicalEntityRolePreparer(ctx, appID, versionID, hEntityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHierarchicalEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteHierarchicalEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteHierarchicalEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteHierarchicalEntityRolePreparer prepares the DeleteHierarchicalEntityRole request. +func (client ModelClient) DeleteHierarchicalEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHierarchicalEntityRoleSender sends the DeleteHierarchicalEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteHierarchicalEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteHierarchicalEntityRoleResponder handles the response to the DeleteHierarchicalEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteHierarchicalEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteIntent deletes an intent from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// deleteUtterances - if true, deletes the intent's example utterances. If false, moves the example utterances +// to the None intent. The default value is false. +func (client ModelClient) DeleteIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, deleteUtterances *bool) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteIntent") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteIntentPreparer(ctx, appID, versionID, intentID, deleteUtterances) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntent", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteIntentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntent", resp, "Failure sending request") + return + } + + result, err = client.DeleteIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntent", resp, "Failure responding to request") + } + + return +} + +// DeleteIntentPreparer prepares the DeleteIntent request. +func (client ModelClient) DeleteIntentPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, deleteUtterances *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if deleteUtterances != nil { + queryParameters["deleteUtterances"] = autorest.Encode("query", *deleteUtterances) + } else { + queryParameters["deleteUtterances"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteIntentSender sends the DeleteIntent request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteIntentSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteIntentResponder handles the response to the DeleteIntent request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteIntentResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePatternAnyEntityModel sends the delete pattern any entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity extractor ID. +func (client ModelClient) DeletePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeletePatternAnyEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePatternAnyEntityModelPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePatternAnyEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityModel", resp, "Failure sending request") + return + } + + result, err = client.DeletePatternAnyEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityModel", resp, "Failure responding to request") + } + + return +} + +// DeletePatternAnyEntityModelPreparer prepares the DeletePatternAnyEntityModel request. +func (client ModelClient) DeletePatternAnyEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePatternAnyEntityModelSender sends the DeletePatternAnyEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeletePatternAnyEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePatternAnyEntityModelResponder handles the response to the DeletePatternAnyEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) DeletePatternAnyEntityModelResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePatternAnyEntityRole sends the delete pattern any entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeletePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeletePatternAnyEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePatternAnyEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePatternAnyEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeletePatternAnyEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePatternAnyEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeletePatternAnyEntityRolePreparer prepares the DeletePatternAnyEntityRole request. +func (client ModelClient) DeletePatternAnyEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePatternAnyEntityRoleSender sends the DeletePatternAnyEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeletePatternAnyEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePatternAnyEntityRoleResponder handles the response to the DeletePatternAnyEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeletePatternAnyEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePrebuilt deletes a prebuilt entity extractor from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltID - the prebuilt entity extractor ID. +func (client ModelClient) DeletePrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeletePrebuilt") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePrebuiltPreparer(ctx, appID, versionID, prebuiltID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuilt", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePrebuiltSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuilt", resp, "Failure sending request") + return + } + + result, err = client.DeletePrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuilt", resp, "Failure responding to request") + } + + return +} + +// DeletePrebuiltPreparer prepares the DeletePrebuilt request. +func (client ModelClient) DeletePrebuiltPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "prebuiltId": autorest.Encode("path", prebuiltID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{prebuiltId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrebuiltSender sends the DeletePrebuilt request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeletePrebuiltSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePrebuiltResponder handles the response to the DeletePrebuilt request. The method always +// closes the http.Response Body. +func (client ModelClient) DeletePrebuiltResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePrebuiltEntityRole sends the delete prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeletePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeletePrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeletePrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeletePrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeletePrebuiltEntityRolePreparer prepares the DeletePrebuiltEntityRole request. +func (client ModelClient) DeletePrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrebuiltEntityRoleSender sends the DeletePrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeletePrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePrebuiltEntityRoleResponder handles the response to the DeletePrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeletePrebuiltEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteRegexEntityModel sends the delete regex entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// regexEntityID - the regular expression entity extractor ID. +func (client ModelClient) DeleteRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteRegexEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteRegexEntityModelPreparer(ctx, appID, versionID, regexEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRegexEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityModel", resp, "Failure sending request") + return + } + + result, err = client.DeleteRegexEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityModel", resp, "Failure responding to request") + } + + return +} + +// DeleteRegexEntityModelPreparer prepares the DeleteRegexEntityModel request. +func (client ModelClient) DeleteRegexEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "regexEntityId": autorest.Encode("path", regexEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteRegexEntityModelSender sends the DeleteRegexEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteRegexEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteRegexEntityModelResponder handles the response to the DeleteRegexEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteRegexEntityModelResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteRegexEntityRole sends the delete regex entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role Id. +func (client ModelClient) DeleteRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteRegexEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteRegexEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRegexEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityRole", resp, "Failure sending request") + return + } + + result, err = client.DeleteRegexEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteRegexEntityRole", resp, "Failure responding to request") + } + + return +} + +// DeleteRegexEntityRolePreparer prepares the DeleteRegexEntityRole request. +func (client ModelClient) DeleteRegexEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteRegexEntityRoleSender sends the DeleteRegexEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteRegexEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteRegexEntityRoleResponder handles the response to the DeleteRegexEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteRegexEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteSubList deletes a sublist of a specific list entity model from a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list entity extractor ID. +// subListID - the sublist ID. +func (client ModelClient) DeleteSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteSubList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteSubListPreparer(ctx, appID, versionID, clEntityID, subListID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteSubList", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSubListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteSubList", resp, "Failure sending request") + return + } + + result, err = client.DeleteSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteSubList", resp, "Failure responding to request") + } + + return +} + +// DeleteSubListPreparer prepares the DeleteSubList request. +func (client ModelClient) DeleteSubListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "subListId": autorest.Encode("path", subListID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists/{subListId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSubListSender sends the DeleteSubList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteSubListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteSubListResponder handles the response to the DeleteSubList request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteSubListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExamplesMethod gets the example utterances for the given intent or entity model in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// modelID - the ID (GUID) of the model. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ExamplesMethod(ctx context.Context, appID uuid.UUID, versionID string, modelID string, skip *int32, take *int32) (result ListLabelTextObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ExamplesMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ExamplesMethod", err.Error()) + } + + req, err := client.ExamplesMethodPreparer(ctx, appID, versionID, modelID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ExamplesMethod", nil, "Failure preparing request") + return + } + + resp, err := client.ExamplesMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ExamplesMethod", resp, "Failure sending request") + return + } + + result, err = client.ExamplesMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ExamplesMethod", resp, "Failure responding to request") + } + + return +} + +// ExamplesMethodPreparer prepares the ExamplesMethod request. +func (client ModelClient) ExamplesMethodPreparer(ctx context.Context, appID uuid.UUID, versionID string, modelID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "modelId": autorest.Encode("path", modelID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/models/{modelId}/examples", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExamplesMethodSender sends the ExamplesMethod request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ExamplesMethodSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ExamplesMethodResponder handles the response to the ExamplesMethod request. The method always +// closes the http.Response Body. +func (client ModelClient) ExamplesMethodResponder(resp *http.Response) (result ListLabelTextObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetClosedList gets information about a list entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list model ID. +func (client ModelClient) GetClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result ClosedListEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetClosedList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetClosedListPreparer(ctx, appID, versionID, clEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedList", nil, "Failure preparing request") + return + } + + resp, err := client.GetClosedListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedList", resp, "Failure sending request") + return + } + + result, err = client.GetClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedList", resp, "Failure responding to request") + } + + return +} + +// GetClosedListPreparer prepares the GetClosedList request. +func (client ModelClient) GetClosedListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetClosedListSender sends the GetClosedList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetClosedListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetClosedListResponder handles the response to the GetClosedList request. The method always +// closes the http.Response Body. +func (client ModelClient) GetClosedListResponder(resp *http.Response) (result ClosedListEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetClosedListEntityRole sends the get closed list entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetClosedListEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetClosedListEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedListEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetClosedListEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedListEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetClosedListEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetClosedListEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetClosedListEntityRolePreparer prepares the GetClosedListEntityRole request. +func (client ModelClient) GetClosedListEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetClosedListEntityRoleSender sends the GetClosedListEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetClosedListEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetClosedListEntityRoleResponder handles the response to the GetClosedListEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetClosedListEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCompositeEntity gets information about a composite entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +func (client ModelClient) GetCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result CompositeEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetCompositeEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCompositeEntityPreparer(ctx, appID, versionID, cEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntity", nil, "Failure preparing request") + return + } + + resp, err := client.GetCompositeEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.GetCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntity", resp, "Failure responding to request") + } + + return +} + +// GetCompositeEntityPreparer prepares the GetCompositeEntity request. +func (client ModelClient) GetCompositeEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCompositeEntitySender sends the GetCompositeEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetCompositeEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetCompositeEntityResponder handles the response to the GetCompositeEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) GetCompositeEntityResponder(resp *http.Response) (result CompositeEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCompositeEntityRole sends the get composite entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// roleID - entity role ID. +func (client ModelClient) GetCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetCompositeEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCompositeEntityRolePreparer(ctx, appID, versionID, cEntityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetCompositeEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetCompositeEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCompositeEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetCompositeEntityRolePreparer prepares the GetCompositeEntityRole request. +func (client ModelClient) GetCompositeEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCompositeEntityRoleSender sends the GetCompositeEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetCompositeEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetCompositeEntityRoleResponder handles the response to the GetCompositeEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetCompositeEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCustomEntityRole sends the get custom entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetCustomEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCustomEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCustomEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetCustomEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCustomEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetCustomEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetCustomEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetCustomEntityRolePreparer prepares the GetCustomEntityRole request. +func (client ModelClient) GetCustomEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCustomEntityRoleSender sends the GetCustomEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetCustomEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetCustomEntityRoleResponder handles the response to the GetCustomEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetCustomEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEntity gets information about an entity model in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +func (client ModelClient) GetEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result NDepthEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEntityPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntity", nil, "Failure preparing request") + return + } + + resp, err := client.GetEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntity", resp, "Failure sending request") + return + } + + result, err = client.GetEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntity", resp, "Failure responding to request") + } + + return +} + +// GetEntityPreparer prepares the GetEntity request. +func (client ModelClient) GetEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEntitySender sends the GetEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetEntityResponder handles the response to the GetEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) GetEntityResponder(resp *http.Response) (result NDepthEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEntityRole sends the get entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetEntityRolePreparer prepares the GetEntityRole request. +func (client ModelClient) GetEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEntityRoleSender sends the GetEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetEntityRoleResponder handles the response to the GetEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetExplicitList sends the get explicit list request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity id. +func (client ModelClient) GetExplicitList(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListExplicitListItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetExplicitList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetExplicitListPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitList", nil, "Failure preparing request") + return + } + + resp, err := client.GetExplicitListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitList", resp, "Failure sending request") + return + } + + result, err = client.GetExplicitListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitList", resp, "Failure responding to request") + } + + return +} + +// GetExplicitListPreparer prepares the GetExplicitList request. +func (client ModelClient) GetExplicitListPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetExplicitListSender sends the GetExplicitList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetExplicitListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetExplicitListResponder handles the response to the GetExplicitList request. The method always +// closes the http.Response Body. +func (client ModelClient) GetExplicitListResponder(resp *http.Response) (result ListExplicitListItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetExplicitListItem sends the get explicit list item request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity Id. +// itemID - the explicit list item Id. +func (client ModelClient) GetExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result ExplicitListItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetExplicitListItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetExplicitListItemPreparer(ctx, appID, versionID, entityID, itemID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitListItem", nil, "Failure preparing request") + return + } + + resp, err := client.GetExplicitListItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitListItem", resp, "Failure sending request") + return + } + + result, err = client.GetExplicitListItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetExplicitListItem", resp, "Failure responding to request") + } + + return +} + +// GetExplicitListItemPreparer prepares the GetExplicitListItem request. +func (client ModelClient) GetExplicitListItemPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "itemId": autorest.Encode("path", itemID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetExplicitListItemSender sends the GetExplicitListItem request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetExplicitListItemSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetExplicitListItemResponder handles the response to the GetExplicitListItem request. The method always +// closes the http.Response Body. +func (client ModelClient) GetExplicitListItemResponder(resp *http.Response) (result ExplicitListItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHierarchicalEntity gets information about a hierarchical entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +func (client ModelClient) GetHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result HierarchicalEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetHierarchicalEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntity", nil, "Failure preparing request") + return + } + + resp, err := client.GetHierarchicalEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.GetHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntity", resp, "Failure responding to request") + } + + return +} + +// GetHierarchicalEntityPreparer prepares the GetHierarchicalEntity request. +func (client ModelClient) GetHierarchicalEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHierarchicalEntitySender sends the GetHierarchicalEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetHierarchicalEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetHierarchicalEntityResponder handles the response to the GetHierarchicalEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) GetHierarchicalEntityResponder(resp *http.Response) (result HierarchicalEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHierarchicalEntityChild gets information about the child's model contained in an hierarchical entity child model +// in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// hChildID - the hierarchical entity extractor child ID. +func (client ModelClient) GetHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result HierarchicalChildEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetHierarchicalEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.GetHierarchicalEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.GetHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityChild", resp, "Failure responding to request") + } + + return +} + +// GetHierarchicalEntityChildPreparer prepares the GetHierarchicalEntityChild request. +func (client ModelClient) GetHierarchicalEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hChildId": autorest.Encode("path", hChildID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHierarchicalEntityChildSender sends the GetHierarchicalEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetHierarchicalEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetHierarchicalEntityChildResponder handles the response to the GetHierarchicalEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) GetHierarchicalEntityChildResponder(resp *http.Response) (result HierarchicalChildEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHierarchicalEntityRole sends the get hierarchical entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// roleID - entity role ID. +func (client ModelClient) GetHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetHierarchicalEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetHierarchicalEntityRolePreparer(ctx, appID, versionID, hEntityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetHierarchicalEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetHierarchicalEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetHierarchicalEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetHierarchicalEntityRolePreparer prepares the GetHierarchicalEntityRole request. +func (client ModelClient) GetHierarchicalEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHierarchicalEntityRoleSender sends the GetHierarchicalEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetHierarchicalEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetHierarchicalEntityRoleResponder handles the response to the GetHierarchicalEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetHierarchicalEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetIntent gets information about the intent model in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +func (client ModelClient) GetIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result IntentClassifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetIntent") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetIntentPreparer(ctx, appID, versionID, intentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntent", nil, "Failure preparing request") + return + } + + resp, err := client.GetIntentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntent", resp, "Failure sending request") + return + } + + result, err = client.GetIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntent", resp, "Failure responding to request") + } + + return +} + +// GetIntentPreparer prepares the GetIntent request. +func (client ModelClient) GetIntentPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIntentSender sends the GetIntent request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetIntentSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetIntentResponder handles the response to the GetIntent request. The method always +// closes the http.Response Body. +func (client ModelClient) GetIntentResponder(resp *http.Response) (result IntentClassifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPatternAnyEntityInfo sends the get pattern any entity info request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +func (client ModelClient) GetPatternAnyEntityInfo(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result PatternAnyEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetPatternAnyEntityInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPatternAnyEntityInfoPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetPatternAnyEntityInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityInfo", resp, "Failure sending request") + return + } + + result, err = client.GetPatternAnyEntityInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityInfo", resp, "Failure responding to request") + } + + return +} + +// GetPatternAnyEntityInfoPreparer prepares the GetPatternAnyEntityInfo request. +func (client ModelClient) GetPatternAnyEntityInfoPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPatternAnyEntityInfoSender sends the GetPatternAnyEntityInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetPatternAnyEntityInfoSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPatternAnyEntityInfoResponder handles the response to the GetPatternAnyEntityInfo request. The method always +// closes the http.Response Body. +func (client ModelClient) GetPatternAnyEntityInfoResponder(resp *http.Response) (result PatternAnyEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPatternAnyEntityRole sends the get pattern any entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetPatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetPatternAnyEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPatternAnyEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetPatternAnyEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetPatternAnyEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPatternAnyEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetPatternAnyEntityRolePreparer prepares the GetPatternAnyEntityRole request. +func (client ModelClient) GetPatternAnyEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPatternAnyEntityRoleSender sends the GetPatternAnyEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetPatternAnyEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPatternAnyEntityRoleResponder handles the response to the GetPatternAnyEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetPatternAnyEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrebuilt gets information about a prebuilt entity model in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// prebuiltID - the prebuilt entity extractor ID. +func (client ModelClient) GetPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result PrebuiltEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetPrebuilt") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPrebuiltPreparer(ctx, appID, versionID, prebuiltID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuilt", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrebuiltSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuilt", resp, "Failure sending request") + return + } + + result, err = client.GetPrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuilt", resp, "Failure responding to request") + } + + return +} + +// GetPrebuiltPreparer prepares the GetPrebuilt request. +func (client ModelClient) GetPrebuiltPreparer(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "prebuiltId": autorest.Encode("path", prebuiltID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{prebuiltId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrebuiltSender sends the GetPrebuilt request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetPrebuiltSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPrebuiltResponder handles the response to the GetPrebuilt request. The method always +// closes the http.Response Body. +func (client ModelClient) GetPrebuiltResponder(resp *http.Response) (result PrebuiltEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrebuiltEntityRole sends the get prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetPrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetPrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetPrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetPrebuiltEntityRolePreparer prepares the GetPrebuiltEntityRole request. +func (client ModelClient) GetPrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrebuiltEntityRoleSender sends the GetPrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetPrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetPrebuiltEntityRoleResponder handles the response to the GetPrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetPrebuiltEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRegexEntityEntityInfo sends the get regex entity entity info request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// regexEntityID - the regular expression entity model ID. +func (client ModelClient) GetRegexEntityEntityInfo(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (result RegexEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetRegexEntityEntityInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetRegexEntityEntityInfoPreparer(ctx, appID, versionID, regexEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityEntityInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetRegexEntityEntityInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityEntityInfo", resp, "Failure sending request") + return + } + + result, err = client.GetRegexEntityEntityInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityEntityInfo", resp, "Failure responding to request") + } + + return +} + +// GetRegexEntityEntityInfoPreparer prepares the GetRegexEntityEntityInfo request. +func (client ModelClient) GetRegexEntityEntityInfoPreparer(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "regexEntityId": autorest.Encode("path", regexEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRegexEntityEntityInfoSender sends the GetRegexEntityEntityInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetRegexEntityEntityInfoSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetRegexEntityEntityInfoResponder handles the response to the GetRegexEntityEntityInfo request. The method always +// closes the http.Response Body. +func (client ModelClient) GetRegexEntityEntityInfoResponder(resp *http.Response) (result RegexEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRegexEntityRole sends the get regex entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity ID. +// roleID - entity role ID. +func (client ModelClient) GetRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result EntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetRegexEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetRegexEntityRolePreparer(ctx, appID, versionID, entityID, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.GetRegexEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityRole", resp, "Failure sending request") + return + } + + result, err = client.GetRegexEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetRegexEntityRole", resp, "Failure responding to request") + } + + return +} + +// GetRegexEntityRolePreparer prepares the GetRegexEntityRole request. +func (client ModelClient) GetRegexEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRegexEntityRoleSender sends the GetRegexEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetRegexEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetRegexEntityRoleResponder handles the response to the GetRegexEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) GetRegexEntityRoleResponder(resp *http.Response) (result EntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClosedListEntityRoles sends the list closed list entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListClosedListEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListClosedListEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListClosedListEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedListEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListClosedListEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedListEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListClosedListEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedListEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListClosedListEntityRolesPreparer prepares the ListClosedListEntityRoles request. +func (client ModelClient) ListClosedListEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClosedListEntityRolesSender sends the ListClosedListEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListClosedListEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListClosedListEntityRolesResponder handles the response to the ListClosedListEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListClosedListEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClosedLists gets information about all the list entity models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListClosedLists(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListClosedListEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListClosedLists") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListClosedLists", err.Error()) + } + + req, err := client.ListClosedListsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedLists", nil, "Failure preparing request") + return + } + + resp, err := client.ListClosedListsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedLists", resp, "Failure sending request") + return + } + + result, err = client.ListClosedListsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListClosedLists", resp, "Failure responding to request") + } + + return +} + +// ListClosedListsPreparer prepares the ListClosedLists request. +func (client ModelClient) ListClosedListsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClosedListsSender sends the ListClosedLists request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListClosedListsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListClosedListsResponder handles the response to the ListClosedLists request. The method always +// closes the http.Response Body. +func (client ModelClient) ListClosedListsResponder(resp *http.Response) (result ListClosedListEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCompositeEntities gets information about all the composite entity models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListCompositeEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListCompositeEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCompositeEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListCompositeEntities", err.Error()) + } + + req, err := client.ListCompositeEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCompositeEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntities", resp, "Failure sending request") + return + } + + result, err = client.ListCompositeEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntities", resp, "Failure responding to request") + } + + return +} + +// ListCompositeEntitiesPreparer prepares the ListCompositeEntities request. +func (client ModelClient) ListCompositeEntitiesPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCompositeEntitiesSender sends the ListCompositeEntities request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCompositeEntitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCompositeEntitiesResponder handles the response to the ListCompositeEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCompositeEntitiesResponder(resp *http.Response) (result ListCompositeEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCompositeEntityRoles sends the list composite entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +func (client ModelClient) ListCompositeEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCompositeEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCompositeEntityRolesPreparer(ctx, appID, versionID, cEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListCompositeEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListCompositeEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCompositeEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListCompositeEntityRolesPreparer prepares the ListCompositeEntityRoles request. +func (client ModelClient) ListCompositeEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCompositeEntityRolesSender sends the ListCompositeEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCompositeEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCompositeEntityRolesResponder handles the response to the ListCompositeEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCompositeEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCustomPrebuiltEntities gets all prebuilt entities used in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client ModelClient) ListCustomPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result ListEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCustomPrebuiltEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCustomPrebuiltEntitiesPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCustomPrebuiltEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntities", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntities", resp, "Failure responding to request") + } + + return +} + +// ListCustomPrebuiltEntitiesPreparer prepares the ListCustomPrebuiltEntities request. +func (client ModelClient) ListCustomPrebuiltEntitiesPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCustomPrebuiltEntitiesSender sends the ListCustomPrebuiltEntities request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCustomPrebuiltEntitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCustomPrebuiltEntitiesResponder handles the response to the ListCustomPrebuiltEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCustomPrebuiltEntitiesResponder(resp *http.Response) (result ListEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCustomPrebuiltEntityRoles sends the list custom prebuilt entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListCustomPrebuiltEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCustomPrebuiltEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCustomPrebuiltEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListCustomPrebuiltEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListCustomPrebuiltEntityRolesPreparer prepares the ListCustomPrebuiltEntityRoles request. +func (client ModelClient) ListCustomPrebuiltEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCustomPrebuiltEntityRolesSender sends the ListCustomPrebuiltEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCustomPrebuiltEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCustomPrebuiltEntityRolesResponder handles the response to the ListCustomPrebuiltEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCustomPrebuiltEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCustomPrebuiltIntents gets information about customizable prebuilt intents added to a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client ModelClient) ListCustomPrebuiltIntents(ctx context.Context, appID uuid.UUID, versionID string) (result ListIntentClassifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCustomPrebuiltIntents") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCustomPrebuiltIntentsPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltIntents", nil, "Failure preparing request") + return + } + + resp, err := client.ListCustomPrebuiltIntentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltIntents", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltIntentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltIntents", resp, "Failure responding to request") + } + + return +} + +// ListCustomPrebuiltIntentsPreparer prepares the ListCustomPrebuiltIntents request. +func (client ModelClient) ListCustomPrebuiltIntentsPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltintents", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCustomPrebuiltIntentsSender sends the ListCustomPrebuiltIntents request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCustomPrebuiltIntentsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCustomPrebuiltIntentsResponder handles the response to the ListCustomPrebuiltIntents request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCustomPrebuiltIntentsResponder(resp *http.Response) (result ListIntentClassifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCustomPrebuiltModels gets all prebuilt intent and entity model information used in a version of this +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client ModelClient) ListCustomPrebuiltModels(ctx context.Context, appID uuid.UUID, versionID string) (result ListCustomPrebuiltModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListCustomPrebuiltModels") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCustomPrebuiltModelsPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltModels", nil, "Failure preparing request") + return + } + + resp, err := client.ListCustomPrebuiltModelsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltModels", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltModelsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListCustomPrebuiltModels", resp, "Failure responding to request") + } + + return +} + +// ListCustomPrebuiltModelsPreparer prepares the ListCustomPrebuiltModels request. +func (client ModelClient) ListCustomPrebuiltModelsPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltmodels", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCustomPrebuiltModelsSender sends the ListCustomPrebuiltModels request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListCustomPrebuiltModelsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListCustomPrebuiltModelsResponder handles the response to the ListCustomPrebuiltModels request. The method always +// closes the http.Response Body. +func (client ModelClient) ListCustomPrebuiltModelsResponder(resp *http.Response) (result ListCustomPrebuiltModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEntities gets information about all the simple entity models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListNDepthEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListEntities", err.Error()) + } + + req, err := client.ListEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntities", resp, "Failure sending request") + return + } + + result, err = client.ListEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntities", resp, "Failure responding to request") + } + + return +} + +// ListEntitiesPreparer prepares the ListEntities request. +func (client ModelClient) ListEntitiesPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEntitiesSender sends the ListEntities request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListEntitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListEntitiesResponder handles the response to the ListEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListEntitiesResponder(resp *http.Response) (result ListNDepthEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEntityRoles sends the list entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListEntityRolesPreparer prepares the ListEntityRoles request. +func (client ModelClient) ListEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEntityRolesSender sends the ListEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListEntityRolesResponder handles the response to the ListEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEntitySuggestions get suggested example utterances that would improve the accuracy of the entity model in a +// version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the target entity extractor model to enhance. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListEntitySuggestions(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, take *int32) (result ListEntitiesSuggestionExample, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListEntitySuggestions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListEntitySuggestions", err.Error()) + } + + req, err := client.ListEntitySuggestionsPreparer(ctx, appID, versionID, entityID, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntitySuggestions", nil, "Failure preparing request") + return + } + + resp, err := client.ListEntitySuggestionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntitySuggestions", resp, "Failure sending request") + return + } + + result, err = client.ListEntitySuggestionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListEntitySuggestions", resp, "Failure responding to request") + } + + return +} + +// ListEntitySuggestionsPreparer prepares the ListEntitySuggestions request. +func (client ModelClient) ListEntitySuggestionsPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/suggest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEntitySuggestionsSender sends the ListEntitySuggestions request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListEntitySuggestionsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListEntitySuggestionsResponder handles the response to the ListEntitySuggestions request. The method always +// closes the http.Response Body. +func (client ModelClient) ListEntitySuggestionsResponder(resp *http.Response) (result ListEntitiesSuggestionExample, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHierarchicalEntities gets information about all the hierarchical entity models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListHierarchicalEntities(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListHierarchicalEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListHierarchicalEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListHierarchicalEntities", err.Error()) + } + + req, err := client.ListHierarchicalEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListHierarchicalEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntities", resp, "Failure sending request") + return + } + + result, err = client.ListHierarchicalEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntities", resp, "Failure responding to request") + } + + return +} + +// ListHierarchicalEntitiesPreparer prepares the ListHierarchicalEntities request. +func (client ModelClient) ListHierarchicalEntitiesPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHierarchicalEntitiesSender sends the ListHierarchicalEntities request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListHierarchicalEntitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListHierarchicalEntitiesResponder handles the response to the ListHierarchicalEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListHierarchicalEntitiesResponder(resp *http.Response) (result ListHierarchicalEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHierarchicalEntityRoles sends the list hierarchical entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +func (client ModelClient) ListHierarchicalEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListHierarchicalEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListHierarchicalEntityRolesPreparer(ctx, appID, versionID, hEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListHierarchicalEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListHierarchicalEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListHierarchicalEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListHierarchicalEntityRolesPreparer prepares the ListHierarchicalEntityRoles request. +func (client ModelClient) ListHierarchicalEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHierarchicalEntityRolesSender sends the ListHierarchicalEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListHierarchicalEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListHierarchicalEntityRolesResponder handles the response to the ListHierarchicalEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListHierarchicalEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListIntents gets information about the intent models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListIntents(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListIntentClassifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListIntents") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListIntents", err.Error()) + } + + req, err := client.ListIntentsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntents", nil, "Failure preparing request") + return + } + + resp, err := client.ListIntentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntents", resp, "Failure sending request") + return + } + + result, err = client.ListIntentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntents", resp, "Failure responding to request") + } + + return +} + +// ListIntentsPreparer prepares the ListIntents request. +func (client ModelClient) ListIntentsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListIntentsSender sends the ListIntents request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListIntentsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListIntentsResponder handles the response to the ListIntents request. The method always +// closes the http.Response Body. +func (client ModelClient) ListIntentsResponder(resp *http.Response) (result ListIntentClassifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListIntentSuggestions suggests example utterances that would improve the accuracy of the intent model in a version +// of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListIntentSuggestions(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, take *int32) (result ListIntentsSuggestionExample, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListIntentSuggestions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListIntentSuggestions", err.Error()) + } + + req, err := client.ListIntentSuggestionsPreparer(ctx, appID, versionID, intentID, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntentSuggestions", nil, "Failure preparing request") + return + } + + resp, err := client.ListIntentSuggestionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntentSuggestions", resp, "Failure sending request") + return + } + + result, err = client.ListIntentSuggestionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListIntentSuggestions", resp, "Failure responding to request") + } + + return +} + +// ListIntentSuggestionsPreparer prepares the ListIntentSuggestions request. +func (client ModelClient) ListIntentSuggestionsPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/suggest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListIntentSuggestionsSender sends the ListIntentSuggestions request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListIntentSuggestionsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListIntentSuggestionsResponder handles the response to the ListIntentSuggestions request. The method always +// closes the http.Response Body. +func (client ModelClient) ListIntentSuggestionsResponder(resp *http.Response) (result ListIntentsSuggestionExample, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListModels gets information about all the intent and entity models in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListModels(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListModelInfoResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListModels") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListModels", err.Error()) + } + + req, err := client.ListModelsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListModels", nil, "Failure preparing request") + return + } + + resp, err := client.ListModelsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListModels", resp, "Failure sending request") + return + } + + result, err = client.ListModelsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListModels", resp, "Failure responding to request") + } + + return +} + +// ListModelsPreparer prepares the ListModels request. +func (client ModelClient) ListModelsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/models", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListModelsSender sends the ListModels request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListModelsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListModelsResponder handles the response to the ListModels request. The method always +// closes the http.Response Body. +func (client ModelClient) ListModelsResponder(resp *http.Response) (result ListModelInfoResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPatternAnyEntityInfos sends the list pattern any entity infos request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListPatternAnyEntityInfos(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPatternAnyEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListPatternAnyEntityInfos") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListPatternAnyEntityInfos", err.Error()) + } + + req, err := client.ListPatternAnyEntityInfosPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityInfos", nil, "Failure preparing request") + return + } + + resp, err := client.ListPatternAnyEntityInfosSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityInfos", resp, "Failure sending request") + return + } + + result, err = client.ListPatternAnyEntityInfosResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityInfos", resp, "Failure responding to request") + } + + return +} + +// ListPatternAnyEntityInfosPreparer prepares the ListPatternAnyEntityInfos request. +func (client ModelClient) ListPatternAnyEntityInfosPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPatternAnyEntityInfosSender sends the ListPatternAnyEntityInfos request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListPatternAnyEntityInfosSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPatternAnyEntityInfosResponder handles the response to the ListPatternAnyEntityInfos request. The method always +// closes the http.Response Body. +func (client ModelClient) ListPatternAnyEntityInfosResponder(resp *http.Response) (result ListPatternAnyEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPatternAnyEntityRoles sends the list pattern any entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListPatternAnyEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListPatternAnyEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPatternAnyEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListPatternAnyEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListPatternAnyEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPatternAnyEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListPatternAnyEntityRolesPreparer prepares the ListPatternAnyEntityRoles request. +func (client ModelClient) ListPatternAnyEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPatternAnyEntityRolesSender sends the ListPatternAnyEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListPatternAnyEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPatternAnyEntityRolesResponder handles the response to the ListPatternAnyEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListPatternAnyEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPrebuiltEntities gets all the available prebuilt entities in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client ModelClient) ListPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result ListAvailablePrebuiltEntityModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListPrebuiltEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPrebuiltEntitiesPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrebuiltEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntities", resp, "Failure sending request") + return + } + + result, err = client.ListPrebuiltEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntities", resp, "Failure responding to request") + } + + return +} + +// ListPrebuiltEntitiesPreparer prepares the ListPrebuiltEntities request. +func (client ModelClient) ListPrebuiltEntitiesPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/listprebuilts", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrebuiltEntitiesSender sends the ListPrebuiltEntities request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListPrebuiltEntitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPrebuiltEntitiesResponder handles the response to the ListPrebuiltEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListPrebuiltEntitiesResponder(resp *http.Response) (result ListAvailablePrebuiltEntityModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPrebuiltEntityRoles sends the list prebuilt entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListPrebuiltEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListPrebuiltEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPrebuiltEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrebuiltEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListPrebuiltEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuiltEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListPrebuiltEntityRolesPreparer prepares the ListPrebuiltEntityRoles request. +func (client ModelClient) ListPrebuiltEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrebuiltEntityRolesSender sends the ListPrebuiltEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListPrebuiltEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPrebuiltEntityRolesResponder handles the response to the ListPrebuiltEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListPrebuiltEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPrebuilts gets information about all the prebuilt entities in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListPrebuilts(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPrebuiltEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListPrebuilts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListPrebuilts", err.Error()) + } + + req, err := client.ListPrebuiltsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuilts", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrebuiltsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuilts", resp, "Failure sending request") + return + } + + result, err = client.ListPrebuiltsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListPrebuilts", resp, "Failure responding to request") + } + + return +} + +// ListPrebuiltsPreparer prepares the ListPrebuilts request. +func (client ModelClient) ListPrebuiltsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrebuiltsSender sends the ListPrebuilts request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListPrebuiltsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPrebuiltsResponder handles the response to the ListPrebuilts request. The method always +// closes the http.Response Body. +func (client ModelClient) ListPrebuiltsResponder(resp *http.Response) (result ListPrebuiltEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRegexEntityInfos sends the list regex entity infos request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) ListRegexEntityInfos(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListRegexEntityExtractor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListRegexEntityInfos") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ListRegexEntityInfos", err.Error()) + } + + req, err := client.ListRegexEntityInfosPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityInfos", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegexEntityInfosSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityInfos", resp, "Failure sending request") + return + } + + result, err = client.ListRegexEntityInfosResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityInfos", resp, "Failure responding to request") + } + + return +} + +// ListRegexEntityInfosPreparer prepares the ListRegexEntityInfos request. +func (client ModelClient) ListRegexEntityInfosPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegexEntityInfosSender sends the ListRegexEntityInfos request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListRegexEntityInfosSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListRegexEntityInfosResponder handles the response to the ListRegexEntityInfos request. The method always +// closes the http.Response Body. +func (client ModelClient) ListRegexEntityInfosResponder(resp *http.Response) (result ListRegexEntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRegexEntityRoles sends the list regex entity roles request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - entity Id +func (client ModelClient) ListRegexEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListEntityRole, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ListRegexEntityRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRegexEntityRolesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegexEntityRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityRoles", resp, "Failure sending request") + return + } + + result, err = client.ListRegexEntityRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ListRegexEntityRoles", resp, "Failure responding to request") + } + + return +} + +// ListRegexEntityRolesPreparer prepares the ListRegexEntityRoles request. +func (client ModelClient) ListRegexEntityRolesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegexEntityRolesSender sends the ListRegexEntityRoles request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ListRegexEntityRolesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListRegexEntityRolesResponder handles the response to the ListRegexEntityRoles request. The method always +// closes the http.Response Body. +func (client ModelClient) ListRegexEntityRolesResponder(resp *http.Response) (result ListEntityRole, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PatchClosedList adds a batch of sublists to an existing list entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list entity model ID. +// closedListModelPatchObject - a words list batch. +func (client ModelClient) PatchClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelPatchObject ClosedListModelPatchObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.PatchClosedList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchClosedListPreparer(ctx, appID, versionID, clEntityID, closedListModelPatchObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "PatchClosedList", nil, "Failure preparing request") + return + } + + resp, err := client.PatchClosedListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "PatchClosedList", resp, "Failure sending request") + return + } + + result, err = client.PatchClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "PatchClosedList", resp, "Failure responding to request") + } + + return +} + +// PatchClosedListPreparer prepares the PatchClosedList request. +func (client ModelClient) PatchClosedListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelPatchObject ClosedListModelPatchObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}", pathParameters), + autorest.WithJSON(closedListModelPatchObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchClosedListSender sends the PatchClosedList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) PatchClosedListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// PatchClosedListResponder handles the response to the PatchClosedList request. The method always +// closes the http.Response Body. +func (client ModelClient) PatchClosedListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateClosedList updates the list entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list model ID. +// closedListModelUpdateObject - the new list entity name and words list. +func (client ModelClient) UpdateClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelUpdateObject ClosedListModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateClosedList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateClosedListPreparer(ctx, appID, versionID, clEntityID, closedListModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedList", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateClosedListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedList", resp, "Failure sending request") + return + } + + result, err = client.UpdateClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedList", resp, "Failure responding to request") + } + + return +} + +// UpdateClosedListPreparer prepares the UpdateClosedList request. +func (client ModelClient) UpdateClosedListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelUpdateObject ClosedListModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}", pathParameters), + autorest.WithJSON(closedListModelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateClosedListSender sends the UpdateClosedList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateClosedListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateClosedListResponder handles the response to the UpdateClosedList request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateClosedListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateClosedListEntityRole sends the update closed list entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateClosedListEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateClosedListEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedListEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateClosedListEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedListEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateClosedListEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateClosedListEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateClosedListEntityRolePreparer prepares the UpdateClosedListEntityRole request. +func (client ModelClient) UpdateClosedListEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateClosedListEntityRoleSender sends the UpdateClosedListEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateClosedListEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateClosedListEntityRoleResponder handles the response to the UpdateClosedListEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateClosedListEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCompositeEntity updates a composite entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// compositeModelUpdateObject - a model object containing the new entity extractor name and children. +func (client ModelClient) UpdateCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeModelUpdateObject CompositeEntityModel) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateCompositeEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateCompositeEntityPreparer(ctx, appID, versionID, cEntityID, compositeModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntity", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCompositeEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.UpdateCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntity", resp, "Failure responding to request") + } + + return +} + +// UpdateCompositeEntityPreparer prepares the UpdateCompositeEntity request. +func (client ModelClient) UpdateCompositeEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeModelUpdateObject CompositeEntityModel) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}", pathParameters), + autorest.WithJSON(compositeModelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCompositeEntitySender sends the UpdateCompositeEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateCompositeEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateCompositeEntityResponder handles the response to the UpdateCompositeEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateCompositeEntityResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCompositeEntityRole sends the update composite entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// cEntityID - the composite entity extractor ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateCompositeEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateCompositeEntityRolePreparer(ctx, appID, versionID, cEntityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCompositeEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateCompositeEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCompositeEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateCompositeEntityRolePreparer prepares the UpdateCompositeEntityRole request. +func (client ModelClient) UpdateCompositeEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCompositeEntityRoleSender sends the UpdateCompositeEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateCompositeEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateCompositeEntityRoleResponder handles the response to the UpdateCompositeEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateCompositeEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCustomPrebuiltEntityRole sends the update custom prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateCustomPrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateCustomPrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateCustomPrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCustomPrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCustomPrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCustomPrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateCustomPrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateCustomPrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateCustomPrebuiltEntityRolePreparer prepares the UpdateCustomPrebuiltEntityRole request. +func (client ModelClient) UpdateCustomPrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCustomPrebuiltEntityRoleSender sends the UpdateCustomPrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateCustomPrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateCustomPrebuiltEntityRoleResponder handles the response to the UpdateCustomPrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateCustomPrebuiltEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateEntityChild updates the name of an entity extractor or the name and instanceOf model of a child entity +// extractor. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor or the child entity extractor ID. +// entityModelUpdateObject - a model object containing the name new entity extractor or the name and instance +// of model of a child entity extractor +func (client ModelClient) UpdateEntityChild(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityModelUpdateObject EntityModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateEntityChildPreparer(ctx, appID, versionID, entityID, entityModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityChild", resp, "Failure sending request") + return + } + + result, err = client.UpdateEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityChild", resp, "Failure responding to request") + } + + return +} + +// UpdateEntityChildPreparer prepares the UpdateEntityChild request. +func (client ModelClient) UpdateEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, entityModelUpdateObject EntityModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}", pathParameters), + autorest.WithJSON(entityModelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateEntityChildSender sends the UpdateEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateEntityChildResponder handles the response to the UpdateEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateEntityChildResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateEntityRole sends the update entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateEntityRolePreparer prepares the UpdateEntityRole request. +func (client ModelClient) UpdateEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateEntityRoleSender sends the UpdateEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateEntityRoleResponder handles the response to the UpdateEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateExplicitListItem sends the update explicit list item request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity extractor ID. +// itemID - the explicit list item ID. +// item - the new explicit list item. +func (client ModelClient) UpdateExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64, item ExplicitListItemUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateExplicitListItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateExplicitListItemPreparer(ctx, appID, versionID, entityID, itemID, item) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateExplicitListItem", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateExplicitListItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateExplicitListItem", resp, "Failure sending request") + return + } + + result, err = client.UpdateExplicitListItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateExplicitListItem", resp, "Failure responding to request") + } + + return +} + +// UpdateExplicitListItemPreparer prepares the UpdateExplicitListItem request. +func (client ModelClient) UpdateExplicitListItemPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64, item ExplicitListItemUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "itemId": autorest.Encode("path", itemID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}", pathParameters), + autorest.WithJSON(item)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateExplicitListItemSender sends the UpdateExplicitListItem request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateExplicitListItemSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateExplicitListItemResponder handles the response to the UpdateExplicitListItem request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateExplicitListItemResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHierarchicalEntity updates the name of a hierarchical entity model in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// modelUpdateObject - model containing names of the hierarchical entity. +func (client ModelClient) UpdateHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, modelUpdateObject ModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateHierarchicalEntity") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID, modelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntity", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHierarchicalEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.UpdateHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntity", resp, "Failure responding to request") + } + + return +} + +// UpdateHierarchicalEntityPreparer prepares the UpdateHierarchicalEntity request. +func (client ModelClient) UpdateHierarchicalEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, modelUpdateObject ModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}", pathParameters), + autorest.WithJSON(modelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHierarchicalEntitySender sends the UpdateHierarchicalEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateHierarchicalEntitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateHierarchicalEntityResponder handles the response to the UpdateHierarchicalEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateHierarchicalEntityResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHierarchicalEntityChild renames a single child in an existing hierarchical entity model in a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// hChildID - the hierarchical entity extractor child ID. +// hierarchicalChildModelUpdateObject - model object containing new name of the hierarchical entity child. +func (client ModelClient) UpdateHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID, hierarchicalChildModelUpdateObject HierarchicalChildModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateHierarchicalEntityChild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID, hierarchicalChildModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHierarchicalEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.UpdateHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityChild", resp, "Failure responding to request") + } + + return +} + +// UpdateHierarchicalEntityChildPreparer prepares the UpdateHierarchicalEntityChild request. +func (client ModelClient) UpdateHierarchicalEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID, hierarchicalChildModelUpdateObject HierarchicalChildModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hChildId": autorest.Encode("path", hChildID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}", pathParameters), + autorest.WithJSON(hierarchicalChildModelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHierarchicalEntityChildSender sends the UpdateHierarchicalEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateHierarchicalEntityChildSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateHierarchicalEntityChildResponder handles the response to the UpdateHierarchicalEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateHierarchicalEntityChildResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHierarchicalEntityRole sends the update hierarchical entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// hEntityID - the hierarchical entity extractor ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateHierarchicalEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateHierarchicalEntityRolePreparer(ctx, appID, versionID, hEntityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHierarchicalEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateHierarchicalEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateHierarchicalEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateHierarchicalEntityRolePreparer prepares the UpdateHierarchicalEntityRole request. +func (client ModelClient) UpdateHierarchicalEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHierarchicalEntityRoleSender sends the UpdateHierarchicalEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateHierarchicalEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateHierarchicalEntityRoleResponder handles the response to the UpdateHierarchicalEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateHierarchicalEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateIntent updates the name of an intent in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// modelUpdateObject - a model object containing the new intent name. +func (client ModelClient) UpdateIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, modelUpdateObject ModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateIntent") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateIntentPreparer(ctx, appID, versionID, intentID, modelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateIntent", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateIntentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateIntent", resp, "Failure sending request") + return + } + + result, err = client.UpdateIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateIntent", resp, "Failure responding to request") + } + + return +} + +// UpdateIntentPreparer prepares the UpdateIntent request. +func (client ModelClient) UpdateIntentPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, modelUpdateObject ModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}", pathParameters), + autorest.WithJSON(modelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateIntentSender sends the UpdateIntent request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateIntentSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateIntentResponder handles the response to the UpdateIntent request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateIntentResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatternAnyEntityModel sends the update pattern any entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the Pattern.Any entity extractor ID. +// patternAnyUpdateObject - an object containing the explicit list of the Pattern.Any entity. +func (client ModelClient) UpdatePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, patternAnyUpdateObject PatternAnyModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdatePatternAnyEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePatternAnyEntityModelPreparer(ctx, appID, versionID, entityID, patternAnyUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePatternAnyEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityModel", resp, "Failure sending request") + return + } + + result, err = client.UpdatePatternAnyEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityModel", resp, "Failure responding to request") + } + + return +} + +// UpdatePatternAnyEntityModelPreparer prepares the UpdatePatternAnyEntityModel request. +func (client ModelClient) UpdatePatternAnyEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, patternAnyUpdateObject PatternAnyModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}", pathParameters), + autorest.WithJSON(patternAnyUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatternAnyEntityModelSender sends the UpdatePatternAnyEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdatePatternAnyEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePatternAnyEntityModelResponder handles the response to the UpdatePatternAnyEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdatePatternAnyEntityModelResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatternAnyEntityRole sends the update pattern any entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdatePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdatePatternAnyEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePatternAnyEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePatternAnyEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdatePatternAnyEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePatternAnyEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdatePatternAnyEntityRolePreparer prepares the UpdatePatternAnyEntityRole request. +func (client ModelClient) UpdatePatternAnyEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatternAnyEntityRoleSender sends the UpdatePatternAnyEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdatePatternAnyEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePatternAnyEntityRoleResponder handles the response to the UpdatePatternAnyEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdatePatternAnyEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePrebuiltEntityRole sends the update prebuilt entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdatePrebuiltEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdatePrebuiltEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePrebuiltEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePrebuiltEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePrebuiltEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePrebuiltEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdatePrebuiltEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdatePrebuiltEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdatePrebuiltEntityRolePreparer prepares the UpdatePrebuiltEntityRole request. +func (client ModelClient) UpdatePrebuiltEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePrebuiltEntityRoleSender sends the UpdatePrebuiltEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdatePrebuiltEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePrebuiltEntityRoleResponder handles the response to the UpdatePrebuiltEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdatePrebuiltEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRegexEntityModel sends the update regex entity model request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// regexEntityID - the regular expression entity extractor ID. +// regexEntityUpdateObject - an object containing the new entity name and regex pattern. +func (client ModelClient) UpdateRegexEntityModel(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID, regexEntityUpdateObject RegexModelUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateRegexEntityModel") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateRegexEntityModelPreparer(ctx, appID, versionID, regexEntityID, regexEntityUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityModel", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRegexEntityModelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityModel", resp, "Failure sending request") + return + } + + result, err = client.UpdateRegexEntityModelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityModel", resp, "Failure responding to request") + } + + return +} + +// UpdateRegexEntityModelPreparer prepares the UpdateRegexEntityModel request. +func (client ModelClient) UpdateRegexEntityModelPreparer(ctx context.Context, appID uuid.UUID, versionID string, regexEntityID uuid.UUID, regexEntityUpdateObject RegexModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "regexEntityId": autorest.Encode("path", regexEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}", pathParameters), + autorest.WithJSON(regexEntityUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateRegexEntityModelSender sends the UpdateRegexEntityModel request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateRegexEntityModelSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateRegexEntityModelResponder handles the response to the UpdateRegexEntityModel request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateRegexEntityModelResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRegexEntityRole sends the update regex entity role request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity ID. +// roleID - the entity role ID. +// entityRoleUpdateObject - the new entity role. +func (client ModelClient) UpdateRegexEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateRegexEntityRole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateRegexEntityRolePreparer(ctx, appID, versionID, entityID, roleID, entityRoleUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityRole", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRegexEntityRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityRole", resp, "Failure sending request") + return + } + + result, err = client.UpdateRegexEntityRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateRegexEntityRole", resp, "Failure responding to request") + } + + return +} + +// UpdateRegexEntityRolePreparer prepares the UpdateRegexEntityRole request. +func (client ModelClient) UpdateRegexEntityRolePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject EntityRoleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "roleId": autorest.Encode("path", roleID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}", pathParameters), + autorest.WithJSON(entityRoleUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateRegexEntityRoleSender sends the UpdateRegexEntityRole request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateRegexEntityRoleSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateRegexEntityRoleResponder handles the response to the UpdateRegexEntityRole request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateRegexEntityRoleResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSubList updates one of the list entity's sublists in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// clEntityID - the list entity extractor ID. +// subListID - the sublist ID. +// wordListBaseUpdateObject - a sublist update object containing the new canonical form and the list of words. +func (client ModelClient) UpdateSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64, wordListBaseUpdateObject WordListBaseUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.UpdateSubList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateSubListPreparer(ctx, appID, versionID, clEntityID, subListID, wordListBaseUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateSubList", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSubListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateSubList", resp, "Failure sending request") + return + } + + result, err = client.UpdateSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "UpdateSubList", resp, "Failure responding to request") + } + + return +} + +// UpdateSubListPreparer prepares the UpdateSubList request. +func (client ModelClient) UpdateSubListPreparer(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int64, wordListBaseUpdateObject WordListBaseUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "subListId": autorest.Encode("path", subListID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists/{subListId}", pathParameters), + autorest.WithJSON(wordListBaseUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSubListSender sends the UpdateSubList request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateSubListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateSubListResponder handles the response to the UpdateSubList request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateSubListResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/models.go b/services/preview/cognitiveservices/v3.0/luis/authoring/models.go new file mode 100644 index 000000000000..4bb36f436ce5 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/models.go @@ -0,0 +1,2180 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/satori/go.uuid" + "io" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring" + +// OperationStatusType enumerates the values for operation status type. +type OperationStatusType string + +const ( + // Failed ... + Failed OperationStatusType = "Failed" + // FAILED ... + FAILED OperationStatusType = "FAILED" + // Success ... + Success OperationStatusType = "Success" +) + +// PossibleOperationStatusTypeValues returns an array of possible values for the OperationStatusType const type. +func PossibleOperationStatusTypeValues() []OperationStatusType { + return []OperationStatusType{Failed, FAILED, Success} +} + +// ReadableType enumerates the values for readable type. +type ReadableType string + +const ( + // ReadableTypeChildEntityExtractor ... + ReadableTypeChildEntityExtractor ReadableType = "Child Entity Extractor" + // ReadableTypeClosedListEntityExtractor ... + ReadableTypeClosedListEntityExtractor ReadableType = "Closed List Entity Extractor" + // ReadableTypeCompositeEntityExtractor ... + ReadableTypeCompositeEntityExtractor ReadableType = "Composite Entity Extractor" + // ReadableTypeEntityExtractor ... + ReadableTypeEntityExtractor ReadableType = "Entity Extractor" + // ReadableTypeHierarchicalChildEntityExtractor ... + ReadableTypeHierarchicalChildEntityExtractor ReadableType = "Hierarchical Child Entity Extractor" + // ReadableTypeHierarchicalEntityExtractor ... + ReadableTypeHierarchicalEntityExtractor ReadableType = "Hierarchical Entity Extractor" + // ReadableTypeIntentClassifier ... + ReadableTypeIntentClassifier ReadableType = "Intent Classifier" + // ReadableTypeListEntityExtractor ... + ReadableTypeListEntityExtractor ReadableType = "List Entity Extractor" + // ReadableTypePatternAnyEntityExtractor ... + ReadableTypePatternAnyEntityExtractor ReadableType = "Pattern.Any Entity Extractor" + // ReadableTypePrebuiltEntityExtractor ... + ReadableTypePrebuiltEntityExtractor ReadableType = "Prebuilt Entity Extractor" + // ReadableTypeRegexEntityExtractor ... + ReadableTypeRegexEntityExtractor ReadableType = "Regex Entity Extractor" +) + +// PossibleReadableTypeValues returns an array of possible values for the ReadableType const type. +func PossibleReadableTypeValues() []ReadableType { + return []ReadableType{ReadableTypeChildEntityExtractor, ReadableTypeClosedListEntityExtractor, ReadableTypeCompositeEntityExtractor, ReadableTypeEntityExtractor, ReadableTypeHierarchicalChildEntityExtractor, ReadableTypeHierarchicalEntityExtractor, ReadableTypeIntentClassifier, ReadableTypeListEntityExtractor, ReadableTypePatternAnyEntityExtractor, ReadableTypePrebuiltEntityExtractor, ReadableTypeRegexEntityExtractor} +} + +// ReadableType1 enumerates the values for readable type 1. +type ReadableType1 string + +const ( + // ReadableType1ChildEntityExtractor ... + ReadableType1ChildEntityExtractor ReadableType1 = "Child Entity Extractor" + // ReadableType1ClosedListEntityExtractor ... + ReadableType1ClosedListEntityExtractor ReadableType1 = "Closed List Entity Extractor" + // ReadableType1CompositeEntityExtractor ... + ReadableType1CompositeEntityExtractor ReadableType1 = "Composite Entity Extractor" + // ReadableType1EntityExtractor ... + ReadableType1EntityExtractor ReadableType1 = "Entity Extractor" + // ReadableType1HierarchicalChildEntityExtractor ... + ReadableType1HierarchicalChildEntityExtractor ReadableType1 = "Hierarchical Child Entity Extractor" + // ReadableType1HierarchicalEntityExtractor ... + ReadableType1HierarchicalEntityExtractor ReadableType1 = "Hierarchical Entity Extractor" + // ReadableType1IntentClassifier ... + ReadableType1IntentClassifier ReadableType1 = "Intent Classifier" + // ReadableType1ListEntityExtractor ... + ReadableType1ListEntityExtractor ReadableType1 = "List Entity Extractor" + // ReadableType1PatternAnyEntityExtractor ... + ReadableType1PatternAnyEntityExtractor ReadableType1 = "Pattern.Any Entity Extractor" + // ReadableType1PrebuiltEntityExtractor ... + ReadableType1PrebuiltEntityExtractor ReadableType1 = "Prebuilt Entity Extractor" + // ReadableType1RegexEntityExtractor ... + ReadableType1RegexEntityExtractor ReadableType1 = "Regex Entity Extractor" +) + +// PossibleReadableType1Values returns an array of possible values for the ReadableType1 const type. +func PossibleReadableType1Values() []ReadableType1 { + return []ReadableType1{ReadableType1ChildEntityExtractor, ReadableType1ClosedListEntityExtractor, ReadableType1CompositeEntityExtractor, ReadableType1EntityExtractor, ReadableType1HierarchicalChildEntityExtractor, ReadableType1HierarchicalEntityExtractor, ReadableType1IntentClassifier, ReadableType1ListEntityExtractor, ReadableType1PatternAnyEntityExtractor, ReadableType1PrebuiltEntityExtractor, ReadableType1RegexEntityExtractor} +} + +// ReadableType10 enumerates the values for readable type 10. +type ReadableType10 string + +const ( + // ReadableType10ChildEntityExtractor ... + ReadableType10ChildEntityExtractor ReadableType10 = "Child Entity Extractor" + // ReadableType10ClosedListEntityExtractor ... + ReadableType10ClosedListEntityExtractor ReadableType10 = "Closed List Entity Extractor" + // ReadableType10CompositeEntityExtractor ... + ReadableType10CompositeEntityExtractor ReadableType10 = "Composite Entity Extractor" + // ReadableType10EntityExtractor ... + ReadableType10EntityExtractor ReadableType10 = "Entity Extractor" + // ReadableType10HierarchicalChildEntityExtractor ... + ReadableType10HierarchicalChildEntityExtractor ReadableType10 = "Hierarchical Child Entity Extractor" + // ReadableType10HierarchicalEntityExtractor ... + ReadableType10HierarchicalEntityExtractor ReadableType10 = "Hierarchical Entity Extractor" + // ReadableType10IntentClassifier ... + ReadableType10IntentClassifier ReadableType10 = "Intent Classifier" + // ReadableType10ListEntityExtractor ... + ReadableType10ListEntityExtractor ReadableType10 = "List Entity Extractor" + // ReadableType10PatternAnyEntityExtractor ... + ReadableType10PatternAnyEntityExtractor ReadableType10 = "Pattern.Any Entity Extractor" + // ReadableType10PrebuiltEntityExtractor ... + ReadableType10PrebuiltEntityExtractor ReadableType10 = "Prebuilt Entity Extractor" + // ReadableType10RegexEntityExtractor ... + ReadableType10RegexEntityExtractor ReadableType10 = "Regex Entity Extractor" +) + +// PossibleReadableType10Values returns an array of possible values for the ReadableType10 const type. +func PossibleReadableType10Values() []ReadableType10 { + return []ReadableType10{ReadableType10ChildEntityExtractor, ReadableType10ClosedListEntityExtractor, ReadableType10CompositeEntityExtractor, ReadableType10EntityExtractor, ReadableType10HierarchicalChildEntityExtractor, ReadableType10HierarchicalEntityExtractor, ReadableType10IntentClassifier, ReadableType10ListEntityExtractor, ReadableType10PatternAnyEntityExtractor, ReadableType10PrebuiltEntityExtractor, ReadableType10RegexEntityExtractor} +} + +// ReadableType11 enumerates the values for readable type 11. +type ReadableType11 string + +const ( + // ReadableType11ChildEntityExtractor ... + ReadableType11ChildEntityExtractor ReadableType11 = "Child Entity Extractor" + // ReadableType11ClosedListEntityExtractor ... + ReadableType11ClosedListEntityExtractor ReadableType11 = "Closed List Entity Extractor" + // ReadableType11CompositeEntityExtractor ... + ReadableType11CompositeEntityExtractor ReadableType11 = "Composite Entity Extractor" + // ReadableType11EntityExtractor ... + ReadableType11EntityExtractor ReadableType11 = "Entity Extractor" + // ReadableType11HierarchicalChildEntityExtractor ... + ReadableType11HierarchicalChildEntityExtractor ReadableType11 = "Hierarchical Child Entity Extractor" + // ReadableType11HierarchicalEntityExtractor ... + ReadableType11HierarchicalEntityExtractor ReadableType11 = "Hierarchical Entity Extractor" + // ReadableType11IntentClassifier ... + ReadableType11IntentClassifier ReadableType11 = "Intent Classifier" + // ReadableType11ListEntityExtractor ... + ReadableType11ListEntityExtractor ReadableType11 = "List Entity Extractor" + // ReadableType11PatternAnyEntityExtractor ... + ReadableType11PatternAnyEntityExtractor ReadableType11 = "Pattern.Any Entity Extractor" + // ReadableType11PrebuiltEntityExtractor ... + ReadableType11PrebuiltEntityExtractor ReadableType11 = "Prebuilt Entity Extractor" + // ReadableType11RegexEntityExtractor ... + ReadableType11RegexEntityExtractor ReadableType11 = "Regex Entity Extractor" +) + +// PossibleReadableType11Values returns an array of possible values for the ReadableType11 const type. +func PossibleReadableType11Values() []ReadableType11 { + return []ReadableType11{ReadableType11ChildEntityExtractor, ReadableType11ClosedListEntityExtractor, ReadableType11CompositeEntityExtractor, ReadableType11EntityExtractor, ReadableType11HierarchicalChildEntityExtractor, ReadableType11HierarchicalEntityExtractor, ReadableType11IntentClassifier, ReadableType11ListEntityExtractor, ReadableType11PatternAnyEntityExtractor, ReadableType11PrebuiltEntityExtractor, ReadableType11RegexEntityExtractor} +} + +// ReadableType2 enumerates the values for readable type 2. +type ReadableType2 string + +const ( + // ReadableType2ChildEntityExtractor ... + ReadableType2ChildEntityExtractor ReadableType2 = "Child Entity Extractor" + // ReadableType2ClosedListEntityExtractor ... + ReadableType2ClosedListEntityExtractor ReadableType2 = "Closed List Entity Extractor" + // ReadableType2CompositeEntityExtractor ... + ReadableType2CompositeEntityExtractor ReadableType2 = "Composite Entity Extractor" + // ReadableType2EntityExtractor ... + ReadableType2EntityExtractor ReadableType2 = "Entity Extractor" + // ReadableType2HierarchicalChildEntityExtractor ... + ReadableType2HierarchicalChildEntityExtractor ReadableType2 = "Hierarchical Child Entity Extractor" + // ReadableType2HierarchicalEntityExtractor ... + ReadableType2HierarchicalEntityExtractor ReadableType2 = "Hierarchical Entity Extractor" + // ReadableType2IntentClassifier ... + ReadableType2IntentClassifier ReadableType2 = "Intent Classifier" + // ReadableType2ListEntityExtractor ... + ReadableType2ListEntityExtractor ReadableType2 = "List Entity Extractor" + // ReadableType2PatternAnyEntityExtractor ... + ReadableType2PatternAnyEntityExtractor ReadableType2 = "Pattern.Any Entity Extractor" + // ReadableType2PrebuiltEntityExtractor ... + ReadableType2PrebuiltEntityExtractor ReadableType2 = "Prebuilt Entity Extractor" + // ReadableType2RegexEntityExtractor ... + ReadableType2RegexEntityExtractor ReadableType2 = "Regex Entity Extractor" +) + +// PossibleReadableType2Values returns an array of possible values for the ReadableType2 const type. +func PossibleReadableType2Values() []ReadableType2 { + return []ReadableType2{ReadableType2ChildEntityExtractor, ReadableType2ClosedListEntityExtractor, ReadableType2CompositeEntityExtractor, ReadableType2EntityExtractor, ReadableType2HierarchicalChildEntityExtractor, ReadableType2HierarchicalEntityExtractor, ReadableType2IntentClassifier, ReadableType2ListEntityExtractor, ReadableType2PatternAnyEntityExtractor, ReadableType2PrebuiltEntityExtractor, ReadableType2RegexEntityExtractor} +} + +// ReadableType3 enumerates the values for readable type 3. +type ReadableType3 string + +const ( + // ReadableType3ChildEntityExtractor ... + ReadableType3ChildEntityExtractor ReadableType3 = "Child Entity Extractor" + // ReadableType3ClosedListEntityExtractor ... + ReadableType3ClosedListEntityExtractor ReadableType3 = "Closed List Entity Extractor" + // ReadableType3CompositeEntityExtractor ... + ReadableType3CompositeEntityExtractor ReadableType3 = "Composite Entity Extractor" + // ReadableType3EntityExtractor ... + ReadableType3EntityExtractor ReadableType3 = "Entity Extractor" + // ReadableType3HierarchicalChildEntityExtractor ... + ReadableType3HierarchicalChildEntityExtractor ReadableType3 = "Hierarchical Child Entity Extractor" + // ReadableType3HierarchicalEntityExtractor ... + ReadableType3HierarchicalEntityExtractor ReadableType3 = "Hierarchical Entity Extractor" + // ReadableType3IntentClassifier ... + ReadableType3IntentClassifier ReadableType3 = "Intent Classifier" + // ReadableType3ListEntityExtractor ... + ReadableType3ListEntityExtractor ReadableType3 = "List Entity Extractor" + // ReadableType3PatternAnyEntityExtractor ... + ReadableType3PatternAnyEntityExtractor ReadableType3 = "Pattern.Any Entity Extractor" + // ReadableType3PrebuiltEntityExtractor ... + ReadableType3PrebuiltEntityExtractor ReadableType3 = "Prebuilt Entity Extractor" + // ReadableType3RegexEntityExtractor ... + ReadableType3RegexEntityExtractor ReadableType3 = "Regex Entity Extractor" +) + +// PossibleReadableType3Values returns an array of possible values for the ReadableType3 const type. +func PossibleReadableType3Values() []ReadableType3 { + return []ReadableType3{ReadableType3ChildEntityExtractor, ReadableType3ClosedListEntityExtractor, ReadableType3CompositeEntityExtractor, ReadableType3EntityExtractor, ReadableType3HierarchicalChildEntityExtractor, ReadableType3HierarchicalEntityExtractor, ReadableType3IntentClassifier, ReadableType3ListEntityExtractor, ReadableType3PatternAnyEntityExtractor, ReadableType3PrebuiltEntityExtractor, ReadableType3RegexEntityExtractor} +} + +// ReadableType4 enumerates the values for readable type 4. +type ReadableType4 string + +const ( + // ReadableType4ChildEntityExtractor ... + ReadableType4ChildEntityExtractor ReadableType4 = "Child Entity Extractor" + // ReadableType4ClosedListEntityExtractor ... + ReadableType4ClosedListEntityExtractor ReadableType4 = "Closed List Entity Extractor" + // ReadableType4CompositeEntityExtractor ... + ReadableType4CompositeEntityExtractor ReadableType4 = "Composite Entity Extractor" + // ReadableType4EntityExtractor ... + ReadableType4EntityExtractor ReadableType4 = "Entity Extractor" + // ReadableType4HierarchicalChildEntityExtractor ... + ReadableType4HierarchicalChildEntityExtractor ReadableType4 = "Hierarchical Child Entity Extractor" + // ReadableType4HierarchicalEntityExtractor ... + ReadableType4HierarchicalEntityExtractor ReadableType4 = "Hierarchical Entity Extractor" + // ReadableType4IntentClassifier ... + ReadableType4IntentClassifier ReadableType4 = "Intent Classifier" + // ReadableType4ListEntityExtractor ... + ReadableType4ListEntityExtractor ReadableType4 = "List Entity Extractor" + // ReadableType4PatternAnyEntityExtractor ... + ReadableType4PatternAnyEntityExtractor ReadableType4 = "Pattern.Any Entity Extractor" + // ReadableType4PrebuiltEntityExtractor ... + ReadableType4PrebuiltEntityExtractor ReadableType4 = "Prebuilt Entity Extractor" + // ReadableType4RegexEntityExtractor ... + ReadableType4RegexEntityExtractor ReadableType4 = "Regex Entity Extractor" +) + +// PossibleReadableType4Values returns an array of possible values for the ReadableType4 const type. +func PossibleReadableType4Values() []ReadableType4 { + return []ReadableType4{ReadableType4ChildEntityExtractor, ReadableType4ClosedListEntityExtractor, ReadableType4CompositeEntityExtractor, ReadableType4EntityExtractor, ReadableType4HierarchicalChildEntityExtractor, ReadableType4HierarchicalEntityExtractor, ReadableType4IntentClassifier, ReadableType4ListEntityExtractor, ReadableType4PatternAnyEntityExtractor, ReadableType4PrebuiltEntityExtractor, ReadableType4RegexEntityExtractor} +} + +// ReadableType5 enumerates the values for readable type 5. +type ReadableType5 string + +const ( + // ReadableType5ChildEntityExtractor ... + ReadableType5ChildEntityExtractor ReadableType5 = "Child Entity Extractor" + // ReadableType5ClosedListEntityExtractor ... + ReadableType5ClosedListEntityExtractor ReadableType5 = "Closed List Entity Extractor" + // ReadableType5CompositeEntityExtractor ... + ReadableType5CompositeEntityExtractor ReadableType5 = "Composite Entity Extractor" + // ReadableType5EntityExtractor ... + ReadableType5EntityExtractor ReadableType5 = "Entity Extractor" + // ReadableType5HierarchicalChildEntityExtractor ... + ReadableType5HierarchicalChildEntityExtractor ReadableType5 = "Hierarchical Child Entity Extractor" + // ReadableType5HierarchicalEntityExtractor ... + ReadableType5HierarchicalEntityExtractor ReadableType5 = "Hierarchical Entity Extractor" + // ReadableType5IntentClassifier ... + ReadableType5IntentClassifier ReadableType5 = "Intent Classifier" + // ReadableType5ListEntityExtractor ... + ReadableType5ListEntityExtractor ReadableType5 = "List Entity Extractor" + // ReadableType5PatternAnyEntityExtractor ... + ReadableType5PatternAnyEntityExtractor ReadableType5 = "Pattern.Any Entity Extractor" + // ReadableType5PrebuiltEntityExtractor ... + ReadableType5PrebuiltEntityExtractor ReadableType5 = "Prebuilt Entity Extractor" + // ReadableType5RegexEntityExtractor ... + ReadableType5RegexEntityExtractor ReadableType5 = "Regex Entity Extractor" +) + +// PossibleReadableType5Values returns an array of possible values for the ReadableType5 const type. +func PossibleReadableType5Values() []ReadableType5 { + return []ReadableType5{ReadableType5ChildEntityExtractor, ReadableType5ClosedListEntityExtractor, ReadableType5CompositeEntityExtractor, ReadableType5EntityExtractor, ReadableType5HierarchicalChildEntityExtractor, ReadableType5HierarchicalEntityExtractor, ReadableType5IntentClassifier, ReadableType5ListEntityExtractor, ReadableType5PatternAnyEntityExtractor, ReadableType5PrebuiltEntityExtractor, ReadableType5RegexEntityExtractor} +} + +// ReadableType6 enumerates the values for readable type 6. +type ReadableType6 string + +const ( + // ReadableType6ChildEntityExtractor ... + ReadableType6ChildEntityExtractor ReadableType6 = "Child Entity Extractor" + // ReadableType6ClosedListEntityExtractor ... + ReadableType6ClosedListEntityExtractor ReadableType6 = "Closed List Entity Extractor" + // ReadableType6CompositeEntityExtractor ... + ReadableType6CompositeEntityExtractor ReadableType6 = "Composite Entity Extractor" + // ReadableType6EntityExtractor ... + ReadableType6EntityExtractor ReadableType6 = "Entity Extractor" + // ReadableType6HierarchicalChildEntityExtractor ... + ReadableType6HierarchicalChildEntityExtractor ReadableType6 = "Hierarchical Child Entity Extractor" + // ReadableType6HierarchicalEntityExtractor ... + ReadableType6HierarchicalEntityExtractor ReadableType6 = "Hierarchical Entity Extractor" + // ReadableType6IntentClassifier ... + ReadableType6IntentClassifier ReadableType6 = "Intent Classifier" + // ReadableType6ListEntityExtractor ... + ReadableType6ListEntityExtractor ReadableType6 = "List Entity Extractor" + // ReadableType6PatternAnyEntityExtractor ... + ReadableType6PatternAnyEntityExtractor ReadableType6 = "Pattern.Any Entity Extractor" + // ReadableType6PrebuiltEntityExtractor ... + ReadableType6PrebuiltEntityExtractor ReadableType6 = "Prebuilt Entity Extractor" + // ReadableType6RegexEntityExtractor ... + ReadableType6RegexEntityExtractor ReadableType6 = "Regex Entity Extractor" +) + +// PossibleReadableType6Values returns an array of possible values for the ReadableType6 const type. +func PossibleReadableType6Values() []ReadableType6 { + return []ReadableType6{ReadableType6ChildEntityExtractor, ReadableType6ClosedListEntityExtractor, ReadableType6CompositeEntityExtractor, ReadableType6EntityExtractor, ReadableType6HierarchicalChildEntityExtractor, ReadableType6HierarchicalEntityExtractor, ReadableType6IntentClassifier, ReadableType6ListEntityExtractor, ReadableType6PatternAnyEntityExtractor, ReadableType6PrebuiltEntityExtractor, ReadableType6RegexEntityExtractor} +} + +// ReadableType7 enumerates the values for readable type 7. +type ReadableType7 string + +const ( + // ReadableType7ChildEntityExtractor ... + ReadableType7ChildEntityExtractor ReadableType7 = "Child Entity Extractor" + // ReadableType7ClosedListEntityExtractor ... + ReadableType7ClosedListEntityExtractor ReadableType7 = "Closed List Entity Extractor" + // ReadableType7CompositeEntityExtractor ... + ReadableType7CompositeEntityExtractor ReadableType7 = "Composite Entity Extractor" + // ReadableType7EntityExtractor ... + ReadableType7EntityExtractor ReadableType7 = "Entity Extractor" + // ReadableType7HierarchicalChildEntityExtractor ... + ReadableType7HierarchicalChildEntityExtractor ReadableType7 = "Hierarchical Child Entity Extractor" + // ReadableType7HierarchicalEntityExtractor ... + ReadableType7HierarchicalEntityExtractor ReadableType7 = "Hierarchical Entity Extractor" + // ReadableType7IntentClassifier ... + ReadableType7IntentClassifier ReadableType7 = "Intent Classifier" + // ReadableType7ListEntityExtractor ... + ReadableType7ListEntityExtractor ReadableType7 = "List Entity Extractor" + // ReadableType7PatternAnyEntityExtractor ... + ReadableType7PatternAnyEntityExtractor ReadableType7 = "Pattern.Any Entity Extractor" + // ReadableType7PrebuiltEntityExtractor ... + ReadableType7PrebuiltEntityExtractor ReadableType7 = "Prebuilt Entity Extractor" + // ReadableType7RegexEntityExtractor ... + ReadableType7RegexEntityExtractor ReadableType7 = "Regex Entity Extractor" +) + +// PossibleReadableType7Values returns an array of possible values for the ReadableType7 const type. +func PossibleReadableType7Values() []ReadableType7 { + return []ReadableType7{ReadableType7ChildEntityExtractor, ReadableType7ClosedListEntityExtractor, ReadableType7CompositeEntityExtractor, ReadableType7EntityExtractor, ReadableType7HierarchicalChildEntityExtractor, ReadableType7HierarchicalEntityExtractor, ReadableType7IntentClassifier, ReadableType7ListEntityExtractor, ReadableType7PatternAnyEntityExtractor, ReadableType7PrebuiltEntityExtractor, ReadableType7RegexEntityExtractor} +} + +// ReadableType8 enumerates the values for readable type 8. +type ReadableType8 string + +const ( + // ReadableType8ChildEntityExtractor ... + ReadableType8ChildEntityExtractor ReadableType8 = "Child Entity Extractor" + // ReadableType8ClosedListEntityExtractor ... + ReadableType8ClosedListEntityExtractor ReadableType8 = "Closed List Entity Extractor" + // ReadableType8CompositeEntityExtractor ... + ReadableType8CompositeEntityExtractor ReadableType8 = "Composite Entity Extractor" + // ReadableType8EntityExtractor ... + ReadableType8EntityExtractor ReadableType8 = "Entity Extractor" + // ReadableType8HierarchicalChildEntityExtractor ... + ReadableType8HierarchicalChildEntityExtractor ReadableType8 = "Hierarchical Child Entity Extractor" + // ReadableType8HierarchicalEntityExtractor ... + ReadableType8HierarchicalEntityExtractor ReadableType8 = "Hierarchical Entity Extractor" + // ReadableType8IntentClassifier ... + ReadableType8IntentClassifier ReadableType8 = "Intent Classifier" + // ReadableType8ListEntityExtractor ... + ReadableType8ListEntityExtractor ReadableType8 = "List Entity Extractor" + // ReadableType8PatternAnyEntityExtractor ... + ReadableType8PatternAnyEntityExtractor ReadableType8 = "Pattern.Any Entity Extractor" + // ReadableType8PrebuiltEntityExtractor ... + ReadableType8PrebuiltEntityExtractor ReadableType8 = "Prebuilt Entity Extractor" + // ReadableType8RegexEntityExtractor ... + ReadableType8RegexEntityExtractor ReadableType8 = "Regex Entity Extractor" +) + +// PossibleReadableType8Values returns an array of possible values for the ReadableType8 const type. +func PossibleReadableType8Values() []ReadableType8 { + return []ReadableType8{ReadableType8ChildEntityExtractor, ReadableType8ClosedListEntityExtractor, ReadableType8CompositeEntityExtractor, ReadableType8EntityExtractor, ReadableType8HierarchicalChildEntityExtractor, ReadableType8HierarchicalEntityExtractor, ReadableType8IntentClassifier, ReadableType8ListEntityExtractor, ReadableType8PatternAnyEntityExtractor, ReadableType8PrebuiltEntityExtractor, ReadableType8RegexEntityExtractor} +} + +// ReadableType9 enumerates the values for readable type 9. +type ReadableType9 string + +const ( + // ReadableType9ChildEntityExtractor ... + ReadableType9ChildEntityExtractor ReadableType9 = "Child Entity Extractor" + // ReadableType9ClosedListEntityExtractor ... + ReadableType9ClosedListEntityExtractor ReadableType9 = "Closed List Entity Extractor" + // ReadableType9CompositeEntityExtractor ... + ReadableType9CompositeEntityExtractor ReadableType9 = "Composite Entity Extractor" + // ReadableType9EntityExtractor ... + ReadableType9EntityExtractor ReadableType9 = "Entity Extractor" + // ReadableType9HierarchicalChildEntityExtractor ... + ReadableType9HierarchicalChildEntityExtractor ReadableType9 = "Hierarchical Child Entity Extractor" + // ReadableType9HierarchicalEntityExtractor ... + ReadableType9HierarchicalEntityExtractor ReadableType9 = "Hierarchical Entity Extractor" + // ReadableType9IntentClassifier ... + ReadableType9IntentClassifier ReadableType9 = "Intent Classifier" + // ReadableType9ListEntityExtractor ... + ReadableType9ListEntityExtractor ReadableType9 = "List Entity Extractor" + // ReadableType9PatternAnyEntityExtractor ... + ReadableType9PatternAnyEntityExtractor ReadableType9 = "Pattern.Any Entity Extractor" + // ReadableType9PrebuiltEntityExtractor ... + ReadableType9PrebuiltEntityExtractor ReadableType9 = "Prebuilt Entity Extractor" + // ReadableType9RegexEntityExtractor ... + ReadableType9RegexEntityExtractor ReadableType9 = "Regex Entity Extractor" +) + +// PossibleReadableType9Values returns an array of possible values for the ReadableType9 const type. +func PossibleReadableType9Values() []ReadableType9 { + return []ReadableType9{ReadableType9ChildEntityExtractor, ReadableType9ClosedListEntityExtractor, ReadableType9CompositeEntityExtractor, ReadableType9EntityExtractor, ReadableType9HierarchicalChildEntityExtractor, ReadableType9HierarchicalEntityExtractor, ReadableType9IntentClassifier, ReadableType9ListEntityExtractor, ReadableType9PatternAnyEntityExtractor, ReadableType9PrebuiltEntityExtractor, ReadableType9RegexEntityExtractor} +} + +// Status enumerates the values for status. +type Status string + +const ( + // StatusFail ... + StatusFail Status = "Fail" + // StatusInProgress ... + StatusInProgress Status = "InProgress" + // StatusQueued ... + StatusQueued Status = "Queued" + // StatusSuccess ... + StatusSuccess Status = "Success" + // StatusUpToDate ... + StatusUpToDate Status = "UpToDate" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusFail, StatusInProgress, StatusQueued, StatusSuccess, StatusUpToDate} +} + +// Status1 enumerates the values for status 1. +type Status1 string + +const ( + // Status1Fail ... + Status1Fail Status1 = "Fail" + // Status1InProgress ... + Status1InProgress Status1 = "InProgress" + // Status1Queued ... + Status1Queued Status1 = "Queued" + // Status1Success ... + Status1Success Status1 = "Success" + // Status1UpToDate ... + Status1UpToDate Status1 = "UpToDate" +) + +// PossibleStatus1Values returns an array of possible values for the Status1 const type. +func PossibleStatus1Values() []Status1 { + return []Status1{Status1Fail, Status1InProgress, Status1Queued, Status1Success, Status1UpToDate} +} + +// TrainingStatus enumerates the values for training status. +type TrainingStatus string + +const ( + // InProgress ... + InProgress TrainingStatus = "InProgress" + // NeedsTraining ... + NeedsTraining TrainingStatus = "NeedsTraining" + // Trained ... + Trained TrainingStatus = "Trained" +) + +// PossibleTrainingStatusValues returns an array of possible values for the TrainingStatus const type. +func PossibleTrainingStatusValues() []TrainingStatus { + return []TrainingStatus{InProgress, NeedsTraining, Trained} +} + +// ApplicationCreateObject properties for creating a new LUIS Application +type ApplicationCreateObject struct { + // Culture - The culture for the new application. It is the language that your app understands and speaks. E.g.: "en-us". Note: the culture cannot be changed after the app is created. + Culture *string `json:"culture,omitempty"` + // Domain - The domain for the new application. Optional. E.g.: Comics. + Domain *string `json:"domain,omitempty"` + // Description - Description of the new application. Optional. + Description *string `json:"description,omitempty"` + // InitialVersionID - The initial version ID. Optional. Default value is: "0.1" + InitialVersionID *string `json:"initialVersionId,omitempty"` + // UsageScenario - Defines the scenario for the new application. Optional. E.g.: IoT. + UsageScenario *string `json:"usageScenario,omitempty"` + // Name - The name for the new application. + Name *string `json:"name,omitempty"` +} + +// ApplicationInfoResponse response containing the Application Info. +type ApplicationInfoResponse struct { + autorest.Response `json:"-"` + // ID - The ID (GUID) of the application. + ID *uuid.UUID `json:"id,omitempty"` + // Name - The name of the application. + Name *string `json:"name,omitempty"` + // Description - The description of the application. + Description *string `json:"description,omitempty"` + // Culture - The culture of the application. For example, "en-us". + Culture *string `json:"culture,omitempty"` + // UsageScenario - Defines the scenario for the new application. Optional. For example, IoT. + UsageScenario *string `json:"usageScenario,omitempty"` + // Domain - The domain for the new application. Optional. For example, Comics. + Domain *string `json:"domain,omitempty"` + // VersionsCount - Amount of model versions within the application. + VersionsCount *int32 `json:"versionsCount,omitempty"` + // CreatedDateTime - The version's creation timestamp. + CreatedDateTime *string `json:"createdDateTime,omitempty"` + // Endpoints - The Runtime endpoint URL for this model version. + Endpoints interface{} `json:"endpoints,omitempty"` + // EndpointHitsCount - Number of calls made to this endpoint. + EndpointHitsCount *int32 `json:"endpointHitsCount,omitempty"` + // ActiveVersion - The version ID currently marked as active. + ActiveVersion *string `json:"activeVersion,omitempty"` +} + +// ApplicationPublishObject object model for publishing a specific application version. +type ApplicationPublishObject struct { + // VersionID - The version ID to publish. + VersionID *string `json:"versionId,omitempty"` + // IsStaging - Indicates if the staging slot should be used, instead of the Production one. + IsStaging *bool `json:"isStaging,omitempty"` +} + +// ApplicationSettings the application settings. +type ApplicationSettings struct { + autorest.Response `json:"-"` + // ID - The application ID. + ID *uuid.UUID `json:"id,omitempty"` + // IsPublic - Setting your application as public allows other people to use your application's endpoint using their own keys for billing purposes. + IsPublic *bool `json:"public,omitempty"` +} + +// ApplicationSettingUpdateObject object model for updating an application's settings. +type ApplicationSettingUpdateObject struct { + // IsPublic - Setting your application as public allows other people to use your application's endpoint using their own keys. + IsPublic *bool `json:"public,omitempty"` +} + +// ApplicationUpdateObject object model for updating the name or description of an application. +type ApplicationUpdateObject struct { + // Name - The application's new name. + Name *string `json:"name,omitempty"` + // Description - The application's new description. + Description *string `json:"description,omitempty"` +} + +// AppVersionSettingObject object model of an application version setting. +type AppVersionSettingObject struct { + // Name - The application version setting name. + Name *string `json:"name,omitempty"` + // Value - The application version setting value. + Value *string `json:"value,omitempty"` +} + +// AvailableCulture available culture for using in a new application. +type AvailableCulture struct { + // Name - The language name. + Name *string `json:"name,omitempty"` + // Code - The ISO value for the language. + Code *string `json:"code,omitempty"` +} + +// AvailablePrebuiltEntityModel available Prebuilt entity model for using in an application. +type AvailablePrebuiltEntityModel struct { + // Name - The entity name. + Name *string `json:"name,omitempty"` + // Description - The entity description and usage information. + Description *string `json:"description,omitempty"` + // Examples - Usage examples. + Examples *string `json:"examples,omitempty"` +} + +// AzureAccountInfoObject defines the Azure account information object. +type AzureAccountInfoObject struct { + // AzureSubscriptionID - The id for the Azure subscription. + AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` + // ResourceGroup - The Azure resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // AccountName - The Azure account name. + AccountName *string `json:"accountName,omitempty"` +} + +// BatchLabelExample response when adding a batch of labeled example utterances. +type BatchLabelExample struct { + Value *LabelExampleResponse `json:"value,omitempty"` + HasError *bool `json:"hasError,omitempty"` + Error *OperationStatus `json:"error,omitempty"` +} + +// ChildEntity the base child entity type. +type ChildEntity struct { + // ID - The ID (GUID) belonging to a child entity. + ID *uuid.UUID `json:"id,omitempty"` + // Name - The name of a child entity. + Name *string `json:"name,omitempty"` + // InstanceOf - Instance of Model. + InstanceOf *string `json:"instanceOf,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType1EntityExtractor', 'ReadableType1ChildEntityExtractor', 'ReadableType1HierarchicalEntityExtractor', 'ReadableType1HierarchicalChildEntityExtractor', 'ReadableType1CompositeEntityExtractor', 'ReadableType1ListEntityExtractor', 'ReadableType1PrebuiltEntityExtractor', 'ReadableType1IntentClassifier', 'ReadableType1PatternAnyEntityExtractor', 'ReadableType1ClosedListEntityExtractor', 'ReadableType1RegexEntityExtractor' + ReadableType ReadableType1 `json:"readableType,omitempty"` + // Children - List of children + Children *[]ChildEntity `json:"children,omitempty"` +} + +// ChildEntityModelCreateObject a child entity extractor create object. +type ChildEntityModelCreateObject struct { + // Children - Child entities. + Children *[]ChildEntityModelCreateObject `json:"children,omitempty"` + // Name - Entity name. + Name *string `json:"name,omitempty"` + // InstanceOf - The instance of model name + InstanceOf *string `json:"instanceOf,omitempty"` +} + +// ClosedList exported Model - A list entity. +type ClosedList struct { + // Name - Name of the list entity. + Name *string `json:"name,omitempty"` + // SubLists - Sublists for the list entity. + SubLists *[]SubClosedList `json:"subLists,omitempty"` + Roles *[]string `json:"roles,omitempty"` +} + +// ClosedListEntityExtractor list Entity Extractor. +type ClosedListEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType5EntityExtractor', 'ReadableType5ChildEntityExtractor', 'ReadableType5HierarchicalEntityExtractor', 'ReadableType5HierarchicalChildEntityExtractor', 'ReadableType5CompositeEntityExtractor', 'ReadableType5ListEntityExtractor', 'ReadableType5PrebuiltEntityExtractor', 'ReadableType5IntentClassifier', 'ReadableType5PatternAnyEntityExtractor', 'ReadableType5ClosedListEntityExtractor', 'ReadableType5RegexEntityExtractor' + ReadableType ReadableType5 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // SubLists - List of sublists. + SubLists *[]SubClosedListResponse `json:"subLists,omitempty"` +} + +// ClosedListModelCreateObject object model for creating a list entity. +type ClosedListModelCreateObject struct { + // SubLists - Sublists for the feature. + SubLists *[]WordListObject `json:"subLists,omitempty"` + // Name - Name of the list entity. + Name *string `json:"name,omitempty"` +} + +// ClosedListModelPatchObject object model for adding a batch of sublists to an existing list entity. +type ClosedListModelPatchObject struct { + // SubLists - Sublists to add. + SubLists *[]WordListObject `json:"subLists,omitempty"` +} + +// ClosedListModelUpdateObject object model for updating a list entity. +type ClosedListModelUpdateObject struct { + // SubLists - The new sublists for the feature. + SubLists *[]WordListObject `json:"subLists,omitempty"` + // Name - The new name of the list entity. + Name *string `json:"name,omitempty"` +} + +// CollaboratorsArray ... +type CollaboratorsArray struct { + // Emails - The email address of the users. + Emails *[]string `json:"emails,omitempty"` +} + +// CompositeChildModelCreateObject ... +type CompositeChildModelCreateObject struct { + Name *string `json:"name,omitempty"` +} + +// CompositeEntityExtractor a Composite Entity Extractor. +type CompositeEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType4EntityExtractor', 'ReadableType4ChildEntityExtractor', 'ReadableType4HierarchicalEntityExtractor', 'ReadableType4HierarchicalChildEntityExtractor', 'ReadableType4CompositeEntityExtractor', 'ReadableType4ListEntityExtractor', 'ReadableType4PrebuiltEntityExtractor', 'ReadableType4IntentClassifier', 'ReadableType4PatternAnyEntityExtractor', 'ReadableType4ClosedListEntityExtractor', 'ReadableType4RegexEntityExtractor' + ReadableType ReadableType4 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // Children - List of child entities. + Children *[]ChildEntity `json:"children,omitempty"` +} + +// CompositeEntityModel a composite entity extractor. +type CompositeEntityModel struct { + // Children - Child entities. + Children *[]string `json:"children,omitempty"` + // Name - Entity name. + Name *string `json:"name,omitempty"` +} + +// CustomPrebuiltModel a Custom Prebuilt model. +type CustomPrebuiltModel struct { + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType7EntityExtractor', 'ReadableType7ChildEntityExtractor', 'ReadableType7HierarchicalEntityExtractor', 'ReadableType7HierarchicalChildEntityExtractor', 'ReadableType7CompositeEntityExtractor', 'ReadableType7ListEntityExtractor', 'ReadableType7PrebuiltEntityExtractor', 'ReadableType7IntentClassifier', 'ReadableType7PatternAnyEntityExtractor', 'ReadableType7ClosedListEntityExtractor', 'ReadableType7RegexEntityExtractor' + ReadableType ReadableType7 `json:"readableType,omitempty"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` +} + +// EndpointInfo the base class "ProductionOrStagingEndpointInfo" inherits from. +type EndpointInfo struct { + // VersionID - The version ID to publish. + VersionID *string `json:"versionId,omitempty"` + // IsStaging - Indicates if the staging slot should be used, instead of the Production one. + IsStaging *bool `json:"isStaging,omitempty"` + // EndpointURL - The Runtime endpoint URL for this model version. + EndpointURL *string `json:"endpointUrl,omitempty"` + // Region - The target region that the application is published to. + Region *string `json:"region,omitempty"` + // AssignedEndpointKey - The endpoint key. + AssignedEndpointKey *string `json:"assignedEndpointKey,omitempty"` + // EndpointRegion - The endpoint's region. + EndpointRegion *string `json:"endpointRegion,omitempty"` + // FailedRegions - Regions where publishing failed. + FailedRegions *string `json:"failedRegions,omitempty"` + // PublishedDateTime - Timestamp when was last published. + PublishedDateTime *string `json:"publishedDateTime,omitempty"` +} + +// EnqueueTrainingResponse response model when requesting to train the model. +type EnqueueTrainingResponse struct { + autorest.Response `json:"-"` + // StatusID - The train request status ID. + StatusID *int32 `json:"statusId,omitempty"` + // Status - Possible values include: 'StatusQueued', 'StatusInProgress', 'StatusUpToDate', 'StatusFail', 'StatusSuccess' + Status Status `json:"status,omitempty"` +} + +// EntitiesSuggestionExample predicted/suggested entity. +type EntitiesSuggestionExample struct { + // Text - The utterance. For example, "What's the weather like in seattle?" + Text *string `json:"text,omitempty"` + // TokenizedText - The utterance tokenized. + TokenizedText *[]string `json:"tokenizedText,omitempty"` + // IntentPredictions - Predicted/suggested intents. + IntentPredictions *[]IntentPrediction `json:"intentPredictions,omitempty"` + // EntityPredictions - Predicted/suggested entities. + EntityPredictions *[]EntityPrediction `json:"entityPredictions,omitempty"` +} + +// EntityExtractor entity Extractor. +type EntityExtractor struct { + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType8EntityExtractor', 'ReadableType8ChildEntityExtractor', 'ReadableType8HierarchicalEntityExtractor', 'ReadableType8HierarchicalChildEntityExtractor', 'ReadableType8CompositeEntityExtractor', 'ReadableType8ListEntityExtractor', 'ReadableType8PrebuiltEntityExtractor', 'ReadableType8IntentClassifier', 'ReadableType8PatternAnyEntityExtractor', 'ReadableType8ClosedListEntityExtractor', 'ReadableType8RegexEntityExtractor' + ReadableType ReadableType8 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,omitempty"` +} + +// EntityLabel defines the entity type and position of the extracted entity within the example. +type EntityLabel struct { + // EntityName - The entity type. + EntityName *string `json:"entityName,omitempty"` + // StartTokenIndex - The index within the utterance where the extracted entity starts. + StartTokenIndex *int32 `json:"startTokenIndex,omitempty"` + // EndTokenIndex - The index within the utterance where the extracted entity ends. + EndTokenIndex *int32 `json:"endTokenIndex,omitempty"` + // Role - The role of the predicted entity. + Role *string `json:"role,omitempty"` + // RoleID - The role id for the predicted entity. + RoleID *uuid.UUID `json:"roleId,omitempty"` +} + +// EntityLabelObject defines the entity type and position of the extracted entity within the example. +type EntityLabelObject struct { + // EntityName - The entity type. + EntityName *string `json:"entityName,omitempty"` + // StartCharIndex - The index within the utterance where the extracted entity starts. + StartCharIndex *int32 `json:"startCharIndex,omitempty"` + // EndCharIndex - The index within the utterance where the extracted entity ends. + EndCharIndex *int32 `json:"endCharIndex,omitempty"` + // Role - The role the entity plays in the utterance. + Role *string `json:"role,omitempty"` +} + +// EntityModelCreateObject an entity extractor create object. +type EntityModelCreateObject struct { + // Children - Child entities. + Children *[]ChildEntityModelCreateObject `json:"children,omitempty"` + // Name - Entity name. + Name *string `json:"name,omitempty"` +} + +// EntityModelInfo an Entity Extractor model info. +type EntityModelInfo struct { + Roles *[]EntityRole `json:"roles,omitempty"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableTypeEntityExtractor', 'ReadableTypeChildEntityExtractor', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier', 'ReadableTypePatternAnyEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypeRegexEntityExtractor' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// EntityModelUpdateObject an entity extractor update object. +type EntityModelUpdateObject struct { + // Name - Entity name. + Name *string `json:"name,omitempty"` + // InstanceOf - The instance of model name + InstanceOf *string `json:"instanceOf,omitempty"` +} + +// EntityPrediction a suggested entity. +type EntityPrediction struct { + // EntityName - The entity's name + EntityName *string `json:"entityName,omitempty"` + // StartTokenIndex - The index within the utterance where the extracted entity starts. + StartTokenIndex *int32 `json:"startTokenIndex,omitempty"` + // EndTokenIndex - The index within the utterance where the extracted entity ends. + EndTokenIndex *int32 `json:"endTokenIndex,omitempty"` + // Phrase - The actual token(s) that comprise the entity. + Phrase *string `json:"phrase,omitempty"` +} + +// EntityRole entity extractor role +type EntityRole struct { + autorest.Response `json:"-"` + // ID - The entity role ID. + ID *uuid.UUID `json:"id,omitempty"` + // Name - The entity role name. + Name *string `json:"name,omitempty"` +} + +// EntityRoleCreateObject object model for creating an entity role. +type EntityRoleCreateObject struct { + // Name - The entity role name. + Name *string `json:"name,omitempty"` +} + +// EntityRoleUpdateObject object model for updating an entity role. +type EntityRoleUpdateObject struct { + // Name - The entity role name. + Name *string `json:"name,omitempty"` +} + +// ErrorResponse error response when invoking an operation on the API. +type ErrorResponse struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + ErrorType *string `json:"errorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.ErrorType != nil { + objectMap["errorType"] = er.ErrorType + } + for k, v := range er.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. +func (er *ErrorResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if er.AdditionalProperties == nil { + er.AdditionalProperties = make(map[string]interface{}) + } + er.AdditionalProperties[k] = additionalProperties + } + case "errorType": + if v != nil { + var errorType string + err = json.Unmarshal(*v, &errorType) + if err != nil { + return err + } + er.ErrorType = &errorType + } + } + } + + return nil +} + +// ExampleLabelObject a labeled example utterance. +type ExampleLabelObject struct { + // Text - The example utterance. + Text *string `json:"text,omitempty"` + // EntityLabels - The identified entities within the example utterance. + EntityLabels *[]EntityLabelObject `json:"entityLabels,omitempty"` + // IntentName - The identified intent representing the example utterance. + IntentName *string `json:"intentName,omitempty"` +} + +// ExplicitListItem explicit (exception) list item +type ExplicitListItem struct { + autorest.Response `json:"-"` + // ID - The explicit list item ID. + ID *int64 `json:"id,omitempty"` + // ExplicitListItem - The explicit list item value. + ExplicitListItem *string `json:"explicitListItem,omitempty"` +} + +// ExplicitListItemCreateObject object model for creating an explicit (exception) list item. +type ExplicitListItemCreateObject struct { + // ExplicitListItem - The explicit list item. + ExplicitListItem *string `json:"explicitListItem,omitempty"` +} + +// ExplicitListItemUpdateObject model object for updating an explicit (exception) list item. +type ExplicitListItemUpdateObject struct { + // ExplicitListItem - The explicit list item. + ExplicitListItem *string `json:"explicitListItem,omitempty"` +} + +// FeatureInfoObject the base class Features-related response objects inherit from. +type FeatureInfoObject struct { + // ID - A six-digit ID used for Features. + ID *int32 `json:"id,omitempty"` + // Name - The name of the Feature. + Name *string `json:"name,omitempty"` + // IsActive - Indicates if the feature is enabled. + IsActive *bool `json:"isActive,omitempty"` +} + +// FeaturesResponseObject model Features, including Patterns and Phraselists. +type FeaturesResponseObject struct { + autorest.Response `json:"-"` + PhraselistFeatures *[]PhraseListFeatureInfo `json:"phraselistFeatures,omitempty"` + PatternFeatures *[]PatternFeatureInfo `json:"patternFeatures,omitempty"` +} + +// HierarchicalChildEntity a Hierarchical Child Entity. +type HierarchicalChildEntity struct { + autorest.Response `json:"-"` + // ID - The ID (GUID) belonging to a child entity. + ID *uuid.UUID `json:"id,omitempty"` + // Name - The name of a child entity. + Name *string `json:"name,omitempty"` + // InstanceOf - Instance of Model. + InstanceOf *string `json:"instanceOf,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType1EntityExtractor', 'ReadableType1ChildEntityExtractor', 'ReadableType1HierarchicalEntityExtractor', 'ReadableType1HierarchicalChildEntityExtractor', 'ReadableType1CompositeEntityExtractor', 'ReadableType1ListEntityExtractor', 'ReadableType1PrebuiltEntityExtractor', 'ReadableType1IntentClassifier', 'ReadableType1PatternAnyEntityExtractor', 'ReadableType1ClosedListEntityExtractor', 'ReadableType1RegexEntityExtractor' + ReadableType ReadableType1 `json:"readableType,omitempty"` + // Children - List of children + Children *[]ChildEntity `json:"children,omitempty"` +} + +// HierarchicalChildModelUpdateObject ... +type HierarchicalChildModelUpdateObject struct { + Name *string `json:"name,omitempty"` +} + +// HierarchicalEntityExtractor hierarchical Entity Extractor. +type HierarchicalEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType3EntityExtractor', 'ReadableType3ChildEntityExtractor', 'ReadableType3HierarchicalEntityExtractor', 'ReadableType3HierarchicalChildEntityExtractor', 'ReadableType3CompositeEntityExtractor', 'ReadableType3ListEntityExtractor', 'ReadableType3PrebuiltEntityExtractor', 'ReadableType3IntentClassifier', 'ReadableType3PatternAnyEntityExtractor', 'ReadableType3ClosedListEntityExtractor', 'ReadableType3RegexEntityExtractor' + ReadableType ReadableType3 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // Children - List of child entities. + Children *[]ChildEntity `json:"children,omitempty"` +} + +// HierarchicalModel ... +type HierarchicalModel struct { + Name *string `json:"name,omitempty"` + Children *[]string `json:"children,omitempty"` + Inherits *PrebuiltDomainObject `json:"inherits,omitempty"` + Roles *[]string `json:"roles,omitempty"` +} + +// Int32 ... +type Int32 struct { + autorest.Response `json:"-"` + Value *int32 `json:"value,omitempty"` +} + +// Int64 ... +type Int64 struct { + autorest.Response `json:"-"` + Value *int64 `json:"value,omitempty"` +} + +// IntentClassifier intent Classifier. +type IntentClassifier struct { + autorest.Response `json:"-"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,omitempty"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableTypeEntityExtractor', 'ReadableTypeChildEntityExtractor', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier', 'ReadableTypePatternAnyEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypeRegexEntityExtractor' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// IntentPrediction a suggested intent. +type IntentPrediction struct { + // Name - The intent's name + Name *string `json:"name,omitempty"` + // Score - The intent's score, based on the prediction model. + Score *float64 `json:"score,omitempty"` +} + +// IntentsSuggestionExample predicted/suggested intent. +type IntentsSuggestionExample struct { + // Text - The utterance. For example, "What's the weather like in seattle?" + Text *string `json:"text,omitempty"` + // TokenizedText - The tokenized utterance. + TokenizedText *[]string `json:"tokenizedText,omitempty"` + // IntentPredictions - Predicted/suggested intents. + IntentPredictions *[]IntentPrediction `json:"intentPredictions,omitempty"` + // EntityPredictions - Predicted/suggested entities. + EntityPredictions *[]EntityPrediction `json:"entityPredictions,omitempty"` +} + +// JSONEntity exported Model - Extracted Entity from utterance. +type JSONEntity struct { + // StartPos - The index within the utterance where the extracted entity starts. + StartPos *int32 `json:"startPos,omitempty"` + // EndPos - The index within the utterance where the extracted entity ends. + EndPos *int32 `json:"endPos,omitempty"` + // Entity - The entity name. + Entity *string `json:"entity,omitempty"` + // Role - The role the entity plays in the utterance. + Role *string `json:"role,omitempty"` +} + +// JSONModelFeature exported Model - Phraselist Model Feature. +type JSONModelFeature struct { + // Activated - Indicates if the feature is enabled. + Activated *bool `json:"activated,omitempty"` + // Name - The Phraselist name. + Name *string `json:"name,omitempty"` + // Words - List of comma-separated phrases that represent the Phraselist. + Words *string `json:"words,omitempty"` + // Mode - An interchangeable phrase list feature serves as a list of synonyms for training. A non-exchangeable phrase list serves as separate features for training. So, if your non-interchangeable phrase list contains 5 phrases, they will be mapped to 5 separate features. You can think of the non-interchangeable phrase list as an additional bag of words to add to LUIS existing vocabulary features. It is used as a lexicon lookup feature where its value is 1 if the lexicon contains a given word or 0 if it doesn’t. Default value is true. + Mode *bool `json:"mode,omitempty"` +} + +// JSONRegexFeature exported Model - A Pattern feature. +type JSONRegexFeature struct { + // Pattern - The Regular Expression to match. + Pattern *string `json:"pattern,omitempty"` + // Activated - Indicates if the Pattern feature is enabled. + Activated *bool `json:"activated,omitempty"` + // Name - Name of the feature. + Name *string `json:"name,omitempty"` +} + +// JSONUtterance exported Model - Utterance that was used to train the model. +type JSONUtterance struct { + // Text - The utterance. + Text *string `json:"text,omitempty"` + // Intent - The matched intent. + Intent *string `json:"intent,omitempty"` + // Entities - The matched entities. + Entities *[]JSONEntity `json:"entities,omitempty"` +} + +// LabeledUtterance a prediction and label pair of an example. +type LabeledUtterance struct { + // ID - ID of Labeled Utterance. + ID *int32 `json:"id,omitempty"` + // Text - The utterance. For example, "What's the weather like in seattle?" + Text *string `json:"text,omitempty"` + // TokenizedText - The utterance tokenized. + TokenizedText *[]string `json:"tokenizedText,omitempty"` + // IntentLabel - The intent matching the example. + IntentLabel *string `json:"intentLabel,omitempty"` + // EntityLabels - The entities matching the example. + EntityLabels *[]EntityLabel `json:"entityLabels,omitempty"` + // IntentPredictions - List of suggested intents. + IntentPredictions *[]IntentPrediction `json:"intentPredictions,omitempty"` + // EntityPredictions - List of suggested entities. + EntityPredictions *[]EntityPrediction `json:"entityPredictions,omitempty"` +} + +// LabelExampleResponse response when adding a labeled example utterance. +type LabelExampleResponse struct { + autorest.Response `json:"-"` + // UtteranceText - The example utterance. + UtteranceText *string `json:"UtteranceText,omitempty"` + // ExampleID - The newly created sample ID. + ExampleID *int32 `json:"ExampleId,omitempty"` +} + +// LabelTextObject an object containing the example utterance's text. +type LabelTextObject struct { + // ID - The ID of the Label. + ID *int32 `json:"id,omitempty"` + // Text - The text of the label. + Text *string `json:"text,omitempty"` +} + +// ListApplicationInfoResponse ... +type ListApplicationInfoResponse struct { + autorest.Response `json:"-"` + Value *[]ApplicationInfoResponse `json:"value,omitempty"` +} + +// ListAppVersionSettingObject ... +type ListAppVersionSettingObject struct { + autorest.Response `json:"-"` + Value *[]AppVersionSettingObject `json:"value,omitempty"` +} + +// ListAvailableCulture ... +type ListAvailableCulture struct { + autorest.Response `json:"-"` + Value *[]AvailableCulture `json:"value,omitempty"` +} + +// ListAvailablePrebuiltEntityModel ... +type ListAvailablePrebuiltEntityModel struct { + autorest.Response `json:"-"` + Value *[]AvailablePrebuiltEntityModel `json:"value,omitempty"` +} + +// ListAzureAccountInfoObject ... +type ListAzureAccountInfoObject struct { + autorest.Response `json:"-"` + Value *[]AzureAccountInfoObject `json:"value,omitempty"` +} + +// ListBatchLabelExample ... +type ListBatchLabelExample struct { + autorest.Response `json:"-"` + Value *[]BatchLabelExample `json:"value,omitempty"` +} + +// ListClosedListEntityExtractor ... +type ListClosedListEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]ClosedListEntityExtractor `json:"value,omitempty"` +} + +// ListCompositeEntityExtractor ... +type ListCompositeEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]CompositeEntityExtractor `json:"value,omitempty"` +} + +// ListCustomPrebuiltModel ... +type ListCustomPrebuiltModel struct { + autorest.Response `json:"-"` + Value *[]CustomPrebuiltModel `json:"value,omitempty"` +} + +// ListEntitiesSuggestionExample ... +type ListEntitiesSuggestionExample struct { + autorest.Response `json:"-"` + Value *[]EntitiesSuggestionExample `json:"value,omitempty"` +} + +// ListEntityExtractor ... +type ListEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]EntityExtractor `json:"value,omitempty"` +} + +// ListEntityRole ... +type ListEntityRole struct { + autorest.Response `json:"-"` + Value *[]EntityRole `json:"value,omitempty"` +} + +// ListExplicitListItem ... +type ListExplicitListItem struct { + autorest.Response `json:"-"` + Value *[]ExplicitListItem `json:"value,omitempty"` +} + +// ListHierarchicalEntityExtractor ... +type ListHierarchicalEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]HierarchicalEntityExtractor `json:"value,omitempty"` +} + +// ListIntentClassifier ... +type ListIntentClassifier struct { + autorest.Response `json:"-"` + Value *[]IntentClassifier `json:"value,omitempty"` +} + +// ListIntentsSuggestionExample ... +type ListIntentsSuggestionExample struct { + autorest.Response `json:"-"` + Value *[]IntentsSuggestionExample `json:"value,omitempty"` +} + +// ListLabeledUtterance ... +type ListLabeledUtterance struct { + autorest.Response `json:"-"` + Value *[]LabeledUtterance `json:"value,omitempty"` +} + +// ListLabelTextObject ... +type ListLabelTextObject struct { + autorest.Response `json:"-"` + Value *[]LabelTextObject `json:"value,omitempty"` +} + +// ListModelInfoResponse ... +type ListModelInfoResponse struct { + autorest.Response `json:"-"` + Value *[]ModelInfoResponse `json:"value,omitempty"` +} + +// ListModelTrainingInfo ... +type ListModelTrainingInfo struct { + autorest.Response `json:"-"` + Value *[]ModelTrainingInfo `json:"value,omitempty"` +} + +// ListNDepthEntityExtractor ... +type ListNDepthEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]NDepthEntityExtractor `json:"value,omitempty"` +} + +// ListPatternAnyEntityExtractor ... +type ListPatternAnyEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]PatternAnyEntityExtractor `json:"value,omitempty"` +} + +// ListPatternFeatureInfo ... +type ListPatternFeatureInfo struct { + autorest.Response `json:"-"` + Value *[]PatternFeatureInfo `json:"value,omitempty"` +} + +// ListPatternRuleInfo ... +type ListPatternRuleInfo struct { + autorest.Response `json:"-"` + Value *[]PatternRuleInfo `json:"value,omitempty"` +} + +// ListPhraseListFeatureInfo ... +type ListPhraseListFeatureInfo struct { + autorest.Response `json:"-"` + Value *[]PhraseListFeatureInfo `json:"value,omitempty"` +} + +// ListPrebuiltDomain ... +type ListPrebuiltDomain struct { + autorest.Response `json:"-"` + Value *[]PrebuiltDomain `json:"value,omitempty"` +} + +// ListPrebuiltEntityExtractor ... +type ListPrebuiltEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]PrebuiltEntityExtractor `json:"value,omitempty"` +} + +// ListRegexEntityExtractor ... +type ListRegexEntityExtractor struct { + autorest.Response `json:"-"` + Value *[]RegexEntityExtractor `json:"value,omitempty"` +} + +// ListString ... +type ListString struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// ListUUID ... +type ListUUID struct { + autorest.Response `json:"-"` + Value *[]uuid.UUID `json:"value,omitempty"` +} + +// ListVersionInfo ... +type ListVersionInfo struct { + autorest.Response `json:"-"` + Value *[]VersionInfo `json:"value,omitempty"` +} + +// LuisApp exported Model - An exported LUIS Application. +type LuisApp struct { + autorest.Response `json:"-"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - The name of the application. + Name *string `json:"name,omitempty"` + // VersionID - The version ID of the application that was exported. + VersionID *string `json:"versionId,omitempty"` + // Desc - The description of the application. + Desc *string `json:"desc,omitempty"` + // Culture - The culture of the application. E.g.: en-us. + Culture *string `json:"culture,omitempty"` + // Intents - List of intents. + Intents *[]HierarchicalModel `json:"intents,omitempty"` + // Entities - List of entities. + Entities *[]HierarchicalModel `json:"entities,omitempty"` + // ClosedLists - List of list entities. + ClosedLists *[]ClosedList `json:"closedLists,omitempty"` + // Composites - List of composite entities. + Composites *[]HierarchicalModel `json:"composites,omitempty"` + // PatternAnyEntities - List of Pattern.Any entities. + PatternAnyEntities *[]PatternAny `json:"patternAnyEntities,omitempty"` + // RegexEntities - List of regular expression entities. + RegexEntities *[]RegexEntity `json:"regex_entities,omitempty"` + // PrebuiltEntities - List of prebuilt entities. + PrebuiltEntities *[]PrebuiltEntity `json:"prebuiltEntities,omitempty"` + // RegexFeatures - List of pattern features. + RegexFeatures *[]JSONRegexFeature `json:"regex_features,omitempty"` + // ModelFeatures - List of model features. + ModelFeatures *[]JSONModelFeature `json:"model_features,omitempty"` + // Patterns - List of patterns. + Patterns *[]PatternRule `json:"patterns,omitempty"` + // Utterances - List of example utterances. + Utterances *[]JSONUtterance `json:"utterances,omitempty"` +} + +// MarshalJSON is the custom marshaler for LuisApp. +func (la LuisApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if la.Name != nil { + objectMap["name"] = la.Name + } + if la.VersionID != nil { + objectMap["versionId"] = la.VersionID + } + if la.Desc != nil { + objectMap["desc"] = la.Desc + } + if la.Culture != nil { + objectMap["culture"] = la.Culture + } + if la.Intents != nil { + objectMap["intents"] = la.Intents + } + if la.Entities != nil { + objectMap["entities"] = la.Entities + } + if la.ClosedLists != nil { + objectMap["closedLists"] = la.ClosedLists + } + if la.Composites != nil { + objectMap["composites"] = la.Composites + } + if la.PatternAnyEntities != nil { + objectMap["patternAnyEntities"] = la.PatternAnyEntities + } + if la.RegexEntities != nil { + objectMap["regex_entities"] = la.RegexEntities + } + if la.PrebuiltEntities != nil { + objectMap["prebuiltEntities"] = la.PrebuiltEntities + } + if la.RegexFeatures != nil { + objectMap["regex_features"] = la.RegexFeatures + } + if la.ModelFeatures != nil { + objectMap["model_features"] = la.ModelFeatures + } + if la.Patterns != nil { + objectMap["patterns"] = la.Patterns + } + if la.Utterances != nil { + objectMap["utterances"] = la.Utterances + } + for k, v := range la.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LuisApp struct. +func (la *LuisApp) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if la.AdditionalProperties == nil { + la.AdditionalProperties = make(map[string]interface{}) + } + la.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + la.Name = &name + } + case "versionId": + if v != nil { + var versionID string + err = json.Unmarshal(*v, &versionID) + if err != nil { + return err + } + la.VersionID = &versionID + } + case "desc": + if v != nil { + var desc string + err = json.Unmarshal(*v, &desc) + if err != nil { + return err + } + la.Desc = &desc + } + case "culture": + if v != nil { + var culture string + err = json.Unmarshal(*v, &culture) + if err != nil { + return err + } + la.Culture = &culture + } + case "intents": + if v != nil { + var intents []HierarchicalModel + err = json.Unmarshal(*v, &intents) + if err != nil { + return err + } + la.Intents = &intents + } + case "entities": + if v != nil { + var entities []HierarchicalModel + err = json.Unmarshal(*v, &entities) + if err != nil { + return err + } + la.Entities = &entities + } + case "closedLists": + if v != nil { + var closedLists []ClosedList + err = json.Unmarshal(*v, &closedLists) + if err != nil { + return err + } + la.ClosedLists = &closedLists + } + case "composites": + if v != nil { + var composites []HierarchicalModel + err = json.Unmarshal(*v, &composites) + if err != nil { + return err + } + la.Composites = &composites + } + case "patternAnyEntities": + if v != nil { + var patternAnyEntities []PatternAny + err = json.Unmarshal(*v, &patternAnyEntities) + if err != nil { + return err + } + la.PatternAnyEntities = &patternAnyEntities + } + case "regex_entities": + if v != nil { + var regexEntities []RegexEntity + err = json.Unmarshal(*v, ®exEntities) + if err != nil { + return err + } + la.RegexEntities = ®exEntities + } + case "prebuiltEntities": + if v != nil { + var prebuiltEntities []PrebuiltEntity + err = json.Unmarshal(*v, &prebuiltEntities) + if err != nil { + return err + } + la.PrebuiltEntities = &prebuiltEntities + } + case "regex_features": + if v != nil { + var regexFeatures []JSONRegexFeature + err = json.Unmarshal(*v, ®exFeatures) + if err != nil { + return err + } + la.RegexFeatures = ®exFeatures + } + case "model_features": + if v != nil { + var modelFeatures []JSONModelFeature + err = json.Unmarshal(*v, &modelFeatures) + if err != nil { + return err + } + la.ModelFeatures = &modelFeatures + } + case "patterns": + if v != nil { + var patterns []PatternRule + err = json.Unmarshal(*v, &patterns) + if err != nil { + return err + } + la.Patterns = &patterns + } + case "utterances": + if v != nil { + var utterances []JSONUtterance + err = json.Unmarshal(*v, &utterances) + if err != nil { + return err + } + la.Utterances = &utterances + } + } + } + + return nil +} + +// ModelCreateObject object model for creating a new entity extractor. +type ModelCreateObject struct { + // Name - Name of the new entity extractor. + Name *string `json:"name,omitempty"` +} + +// ModelInfo base type used in entity types. +type ModelInfo struct { + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableTypeEntityExtractor', 'ReadableTypeChildEntityExtractor', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier', 'ReadableTypePatternAnyEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypeRegexEntityExtractor' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// ModelInfoResponse an application model info. +type ModelInfoResponse struct { + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType2EntityExtractor', 'ReadableType2ChildEntityExtractor', 'ReadableType2HierarchicalEntityExtractor', 'ReadableType2HierarchicalChildEntityExtractor', 'ReadableType2CompositeEntityExtractor', 'ReadableType2ListEntityExtractor', 'ReadableType2PrebuiltEntityExtractor', 'ReadableType2IntentClassifier', 'ReadableType2PatternAnyEntityExtractor', 'ReadableType2ClosedListEntityExtractor', 'ReadableType2RegexEntityExtractor' + ReadableType ReadableType2 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // Children - List of child entities. + Children *[]ChildEntity `json:"children,omitempty"` + // SubLists - List of sublists. + SubLists *[]SubClosedListResponse `json:"subLists,omitempty"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,omitempty"` + // RegexPattern - The Regular Expression entity pattern. + RegexPattern *string `json:"regexPattern,omitempty"` + ExplicitList *[]ExplicitListItem `json:"explicitList,omitempty"` +} + +// ModelTrainingDetails model Training Details. +type ModelTrainingDetails struct { + // StatusID - The train request status ID. + StatusID *int32 `json:"statusId,omitempty"` + // Status - Possible values include: 'Status1Queued', 'Status1InProgress', 'Status1UpToDate', 'Status1Fail', 'Status1Success' + Status Status1 `json:"status,omitempty"` + // ExampleCount - The count of examples used to train the model. + ExampleCount *int32 `json:"exampleCount,omitempty"` + // TrainingDateTime - When the model was trained. + TrainingDateTime *date.Time `json:"trainingDateTime,omitempty"` + // FailureReason - Reason for the training failure. + FailureReason *string `json:"failureReason,omitempty"` +} + +// ModelTrainingInfo model Training Info. +type ModelTrainingInfo struct { + // ModelID - The ID (GUID) of the model. + ModelID *uuid.UUID `json:"modelId,omitempty"` + Details *ModelTrainingDetails `json:"details,omitempty"` +} + +// ModelUpdateObject object model for updating an intent classifier. +type ModelUpdateObject struct { + // Name - The entity's new name. + Name *string `json:"name,omitempty"` +} + +// NDepthEntityExtractor n-Depth Entity Extractor. +type NDepthEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType9EntityExtractor', 'ReadableType9ChildEntityExtractor', 'ReadableType9HierarchicalEntityExtractor', 'ReadableType9HierarchicalChildEntityExtractor', 'ReadableType9CompositeEntityExtractor', 'ReadableType9ListEntityExtractor', 'ReadableType9PrebuiltEntityExtractor', 'ReadableType9IntentClassifier', 'ReadableType9PatternAnyEntityExtractor', 'ReadableType9ClosedListEntityExtractor', 'ReadableType9RegexEntityExtractor' + ReadableType ReadableType9 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,omitempty"` + Children *[]ChildEntity `json:"children,omitempty"` +} + +// OperationError operation error details when invoking an operation on the API. +type OperationError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// OperationStatus response of an Operation status. +type OperationStatus struct { + autorest.Response `json:"-"` + // Code - Status Code. Possible values include: 'Failed', 'FAILED', 'Success' + Code OperationStatusType `json:"code,omitempty"` + // Message - Status details. + Message *string `json:"message,omitempty"` +} + +// PatternAny pattern.Any Entity Extractor. +type PatternAny struct { + Name *string `json:"name,omitempty"` + ExplicitList *[]string `json:"explicitList,omitempty"` + Roles *[]string `json:"roles,omitempty"` +} + +// PatternAnyEntityExtractor pattern.Any Entity Extractor. +type PatternAnyEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType11EntityExtractor', 'ReadableType11ChildEntityExtractor', 'ReadableType11HierarchicalEntityExtractor', 'ReadableType11HierarchicalChildEntityExtractor', 'ReadableType11CompositeEntityExtractor', 'ReadableType11ListEntityExtractor', 'ReadableType11PrebuiltEntityExtractor', 'ReadableType11IntentClassifier', 'ReadableType11PatternAnyEntityExtractor', 'ReadableType11ClosedListEntityExtractor', 'ReadableType11RegexEntityExtractor' + ReadableType ReadableType11 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + ExplicitList *[]ExplicitListItem `json:"explicitList,omitempty"` +} + +// PatternAnyModelCreateObject model object for creating a Pattern.Any entity model. +type PatternAnyModelCreateObject struct { + // Name - The model name. + Name *string `json:"name,omitempty"` + // ExplicitList - The Pattern.Any explicit list. + ExplicitList *[]string `json:"explicitList,omitempty"` +} + +// PatternAnyModelUpdateObject model object for updating a Pattern.Any entity model. +type PatternAnyModelUpdateObject struct { + // Name - The model name. + Name *string `json:"name,omitempty"` + // ExplicitList - The Pattern.Any explicit list. + ExplicitList *[]string `json:"explicitList,omitempty"` +} + +// PatternCreateObject object model for creating a Pattern feature. +type PatternCreateObject struct { + // Pattern - The Regular Expression to match. + Pattern *string `json:"pattern,omitempty"` + // Name - Name of the feature. + Name *string `json:"name,omitempty"` +} + +// PatternFeatureInfo pattern feature. +type PatternFeatureInfo struct { + autorest.Response `json:"-"` + // Pattern - The Regular Expression to match. + Pattern *string `json:"pattern,omitempty"` + // ID - A six-digit ID used for Features. + ID *int32 `json:"id,omitempty"` + // Name - The name of the Feature. + Name *string `json:"name,omitempty"` + // IsActive - Indicates if the feature is enabled. + IsActive *bool `json:"isActive,omitempty"` +} + +// PatternRule pattern +type PatternRule struct { + // Pattern - The pattern text. + Pattern *string `json:"pattern,omitempty"` + // Intent - The intent's name where the pattern belongs to. + Intent *string `json:"intent,omitempty"` +} + +// PatternRuleCreateObject object model for creating a pattern +type PatternRuleCreateObject struct { + // Pattern - The pattern text. + Pattern *string `json:"pattern,omitempty"` + // Intent - The intent's name which the pattern belongs to. + Intent *string `json:"intent,omitempty"` +} + +// PatternRuleInfo pattern rule +type PatternRuleInfo struct { + autorest.Response `json:"-"` + // ID - The pattern ID. + ID *uuid.UUID `json:"id,omitempty"` + // Pattern - The pattern text. + Pattern *string `json:"pattern,omitempty"` + // Intent - The intent's name where the pattern belongs to. + Intent *string `json:"intent,omitempty"` +} + +// PatternRuleUpdateObject object model for updating a pattern. +type PatternRuleUpdateObject struct { + // ID - The pattern ID. + ID *uuid.UUID `json:"id,omitempty"` + // Pattern - The pattern text. + Pattern *string `json:"pattern,omitempty"` + // Intent - The intent's name which the pattern belongs to. + Intent *string `json:"intent,omitempty"` +} + +// PatternUpdateObject object model for updating an existing Pattern feature. +type PatternUpdateObject struct { + // Pattern - The Regular Expression to match. + Pattern *string `json:"pattern,omitempty"` + // Name - Name of the feature. + Name *string `json:"name,omitempty"` + // IsActive - Indicates if the Pattern feature is enabled. + IsActive *bool `json:"isActive,omitempty"` +} + +// PersonalAssistantsResponse response containing user's endpoint keys and the endpoint URLs of the +// prebuilt Cortana applications. +type PersonalAssistantsResponse struct { + autorest.Response `json:"-"` + EndpointKeys *[]uuid.UUID `json:"endpointKeys,omitempty"` + EndpointUrls map[string]*string `json:"endpointUrls"` +} + +// MarshalJSON is the custom marshaler for PersonalAssistantsResponse. +func (par PersonalAssistantsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if par.EndpointKeys != nil { + objectMap["endpointKeys"] = par.EndpointKeys + } + if par.EndpointUrls != nil { + objectMap["endpointUrls"] = par.EndpointUrls + } + return json.Marshal(objectMap) +} + +// PhraselistCreateObject object model for creating a phraselist model. +type PhraselistCreateObject struct { + // Phrases - List of comma-separated phrases that represent the Phraselist. + Phrases *string `json:"phrases,omitempty"` + // Name - The Phraselist name. + Name *string `json:"name,omitempty"` + // IsExchangeable - An interchangeable phrase list feature serves as a list of synonyms for training. A non-exchangeable phrase list serves as separate features for training. So, if your non-interchangeable phrase list contains 5 phrases, they will be mapped to 5 separate features. You can think of the non-interchangeable phrase list as an additional bag of words to add to LUIS existing vocabulary features. It is used as a lexicon lookup feature where its value is 1 if the lexicon contains a given word or 0 if it doesn’t. Default value is true. + IsExchangeable *bool `json:"isExchangeable,omitempty"` +} + +// PhraseListFeatureInfo phraselist Feature. +type PhraseListFeatureInfo struct { + autorest.Response `json:"-"` + // Phrases - A list of comma-separated values. + Phrases *string `json:"phrases,omitempty"` + // IsExchangeable - An exchangeable phrase list feature are serves as single feature to the LUIS underlying training algorithm. It is used as a lexicon lookup feature where its value is 1 if the lexicon contains a given word or 0 if it doesn’t. Think of an exchangeable as a synonyms list. A non-exchangeable phrase list feature has all the phrases in the list serve as separate features to the underlying training algorithm. So, if you your phrase list feature contains 5 phrases, they will be mapped to 5 separate features. You can think of the non-exchangeable phrase list feature as an additional bag of words that you are willing to add to LUIS existing vocabulary features. Think of a non-exchangeable as set of different words. Default value is true. + IsExchangeable *bool `json:"isExchangeable,omitempty"` + // ID - A six-digit ID used for Features. + ID *int32 `json:"id,omitempty"` + // Name - The name of the Feature. + Name *string `json:"name,omitempty"` + // IsActive - Indicates if the feature is enabled. + IsActive *bool `json:"isActive,omitempty"` +} + +// PhraselistUpdateObject object model for updating a Phraselist. +type PhraselistUpdateObject struct { + // Phrases - List of comma-separated phrases that represent the Phraselist. + Phrases *string `json:"phrases,omitempty"` + // Name - The Phraselist name. + Name *string `json:"name,omitempty"` + // IsActive - Indicates if the Phraselist is enabled. + IsActive *bool `json:"isActive,omitempty"` + // IsExchangeable - An exchangeable phrase list feature are serves as single feature to the LUIS underlying training algorithm. It is used as a lexicon lookup feature where its value is 1 if the lexicon contains a given word or 0 if it doesn’t. Think of an exchangeable as a synonyms list. A non-exchangeable phrase list feature has all the phrases in the list serve as separate features to the underlying training algorithm. So, if you your phrase list feature contains 5 phrases, they will be mapped to 5 separate features. You can think of the non-exchangeable phrase list feature as an additional bag of words that you are willing to add to LUIS existing vocabulary features. Think of a non-exchangeable as set of different words. Default value is true. + IsExchangeable *bool `json:"isExchangeable,omitempty"` +} + +// PrebuiltDomain prebuilt Domain. +type PrebuiltDomain struct { + Name *string `json:"name,omitempty"` + Culture *string `json:"culture,omitempty"` + Description *string `json:"description,omitempty"` + Examples *string `json:"examples,omitempty"` + Intents *[]PrebuiltDomainItem `json:"intents,omitempty"` + Entities *[]PrebuiltDomainItem `json:"entities,omitempty"` +} + +// PrebuiltDomainCreateBaseObject a model object containing the name of the custom prebuilt entity and the +// name of the domain to which this model belongs. +type PrebuiltDomainCreateBaseObject struct { + // DomainName - The domain name. + DomainName *string `json:"domainName,omitempty"` +} + +// PrebuiltDomainCreateObject a prebuilt domain create object containing the name and culture of the +// domain. +type PrebuiltDomainCreateObject struct { + // DomainName - The domain name. + DomainName *string `json:"domainName,omitempty"` + // Culture - The culture of the new domain. + Culture *string `json:"culture,omitempty"` +} + +// PrebuiltDomainItem ... +type PrebuiltDomainItem struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Examples *string `json:"examples,omitempty"` +} + +// PrebuiltDomainModelCreateObject a model object containing the name of the custom prebuilt intent or +// entity and the name of the domain to which this model belongs. +type PrebuiltDomainModelCreateObject struct { + // DomainName - The domain name. + DomainName *string `json:"domainName,omitempty"` + // ModelName - The intent name or entity name. + ModelName *string `json:"modelName,omitempty"` +} + +// PrebuiltDomainObject ... +type PrebuiltDomainObject struct { + DomainName *string `json:"domain_name,omitempty"` + ModelName *string `json:"model_name,omitempty"` +} + +// PrebuiltEntity prebuilt Entity Extractor. +type PrebuiltEntity struct { + Name *string `json:"name,omitempty"` + Roles *[]string `json:"roles,omitempty"` +} + +// PrebuiltEntityExtractor prebuilt Entity Extractor. +type PrebuiltEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType6EntityExtractor', 'ReadableType6ChildEntityExtractor', 'ReadableType6HierarchicalEntityExtractor', 'ReadableType6HierarchicalChildEntityExtractor', 'ReadableType6CompositeEntityExtractor', 'ReadableType6ListEntityExtractor', 'ReadableType6PrebuiltEntityExtractor', 'ReadableType6IntentClassifier', 'ReadableType6PatternAnyEntityExtractor', 'ReadableType6ClosedListEntityExtractor', 'ReadableType6RegexEntityExtractor' + ReadableType ReadableType6 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` +} + +// ProductionOrStagingEndpointInfo ... +type ProductionOrStagingEndpointInfo struct { + autorest.Response `json:"-"` + // VersionID - The version ID to publish. + VersionID *string `json:"versionId,omitempty"` + // IsStaging - Indicates if the staging slot should be used, instead of the Production one. + IsStaging *bool `json:"isStaging,omitempty"` + // EndpointURL - The Runtime endpoint URL for this model version. + EndpointURL *string `json:"endpointUrl,omitempty"` + // Region - The target region that the application is published to. + Region *string `json:"region,omitempty"` + // AssignedEndpointKey - The endpoint key. + AssignedEndpointKey *string `json:"assignedEndpointKey,omitempty"` + // EndpointRegion - The endpoint's region. + EndpointRegion *string `json:"endpointRegion,omitempty"` + // FailedRegions - Regions where publishing failed. + FailedRegions *string `json:"failedRegions,omitempty"` + // PublishedDateTime - Timestamp when was last published. + PublishedDateTime *string `json:"publishedDateTime,omitempty"` +} + +// PublishSettings the application publish settings. +type PublishSettings struct { + autorest.Response `json:"-"` + // ID - The application ID. + ID *uuid.UUID `json:"id,omitempty"` + // IsSentimentAnalysisEnabled - Setting sentiment analysis as true returns the sentiment of the input utterance along with the response + IsSentimentAnalysisEnabled *bool `json:"sentimentAnalysis,omitempty"` + // IsSpeechEnabled - Enables speech priming in your app + IsSpeechEnabled *bool `json:"speech,omitempty"` + // IsSpellCheckerEnabled - Enables spell checking of the utterance. + IsSpellCheckerEnabled *bool `json:"spellChecker,omitempty"` +} + +// PublishSettingUpdateObject object model for updating an application's publish settings. +type PublishSettingUpdateObject struct { + // SentimentAnalysis - Setting sentiment analysis as true returns the Sentiment of the input utterance along with the response + SentimentAnalysis *bool `json:"sentimentAnalysis,omitempty"` + // Speech - Setting speech as public enables speech priming in your app + Speech *bool `json:"speech,omitempty"` + // SpellChecker - Setting spell checker as public enables spell checking the input utterance. + SpellChecker *bool `json:"spellChecker,omitempty"` +} + +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// RegexEntity regular Expression Entity Extractor. +type RegexEntity struct { + Name *string `json:"name,omitempty"` + RegexPattern *string `json:"regexPattern,omitempty"` + Roles *[]string `json:"roles,omitempty"` +} + +// RegexEntityExtractor regular Expression Entity Extractor. +type RegexEntityExtractor struct { + autorest.Response `json:"-"` + // ID - The ID of the Entity Model. + ID *uuid.UUID `json:"id,omitempty"` + // Name - Name of the Entity Model. + Name *string `json:"name,omitempty"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType10EntityExtractor', 'ReadableType10ChildEntityExtractor', 'ReadableType10HierarchicalEntityExtractor', 'ReadableType10HierarchicalChildEntityExtractor', 'ReadableType10CompositeEntityExtractor', 'ReadableType10ListEntityExtractor', 'ReadableType10PrebuiltEntityExtractor', 'ReadableType10IntentClassifier', 'ReadableType10PatternAnyEntityExtractor', 'ReadableType10ClosedListEntityExtractor', 'ReadableType10RegexEntityExtractor' + ReadableType ReadableType10 `json:"readableType,omitempty"` + Roles *[]EntityRole `json:"roles,omitempty"` + // RegexPattern - The Regular Expression entity pattern. + RegexPattern *string `json:"regexPattern,omitempty"` +} + +// RegexModelCreateObject model object for creating a regular expression entity model. +type RegexModelCreateObject struct { + // RegexPattern - The regular expression entity pattern. + RegexPattern *string `json:"regexPattern,omitempty"` + // Name - The model name. + Name *string `json:"name,omitempty"` +} + +// RegexModelUpdateObject model object for updating a regular expression entity model. +type RegexModelUpdateObject struct { + // RegexPattern - The regular expression entity pattern. + RegexPattern *string `json:"regexPattern,omitempty"` + // Name - The model name. + Name *string `json:"name,omitempty"` +} + +// SetString ... +type SetString struct { + autorest.Response `json:"-"` + Value map[string]*string `json:"value"` +} + +// MarshalJSON is the custom marshaler for SetString. +func (ss SetString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.Value != nil { + objectMap["value"] = ss.Value + } + return json.Marshal(objectMap) +} + +// String ... +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// SubClosedList sublist of items for a list entity. +type SubClosedList struct { + // CanonicalForm - The standard form that the list represents. + CanonicalForm *string `json:"canonicalForm,omitempty"` + // List - List of synonym words. + List *[]string `json:"list,omitempty"` +} + +// SubClosedListResponse sublist of items for a list entity. +type SubClosedListResponse struct { + // ID - The sublist ID + ID *int32 `json:"id,omitempty"` + // CanonicalForm - The standard form that the list represents. + CanonicalForm *string `json:"canonicalForm,omitempty"` + // List - List of synonym words. + List *[]string `json:"list,omitempty"` +} + +// TaskUpdateObject object model for cloning an application's version. +type TaskUpdateObject struct { + // Version - The new version for the cloned model. + Version *string `json:"version,omitempty"` +} + +// UserAccessList list of user permissions. +type UserAccessList struct { + autorest.Response `json:"-"` + // Owner - The email address of owner of the application. + Owner *string `json:"owner,omitempty"` + Emails *[]string `json:"emails,omitempty"` +} + +// UserCollaborator ... +type UserCollaborator struct { + // Email - The email address of the user. + Email *string `json:"email,omitempty"` +} + +// UUID ... +type UUID struct { + autorest.Response `json:"-"` + Value *uuid.UUID `json:"value,omitempty"` +} + +// VersionInfo object model of an application version. +type VersionInfo struct { + autorest.Response `json:"-"` + // Version - The version ID. E.g.: "0.1" + Version *string `json:"version,omitempty"` + // CreatedDateTime - The version's creation timestamp. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // LastModifiedDateTime - Timestamp of the last update. + LastModifiedDateTime *date.Time `json:"lastModifiedDateTime,omitempty"` + // LastTrainedDateTime - Timestamp of the last time the model was trained. + LastTrainedDateTime *date.Time `json:"lastTrainedDateTime,omitempty"` + // LastPublishedDateTime - Timestamp when was last published. + LastPublishedDateTime *date.Time `json:"lastPublishedDateTime,omitempty"` + // EndpointURL - The Runtime endpoint URL for this model version. + EndpointURL *string `json:"endpointUrl,omitempty"` + // AssignedEndpointKey - The endpoint key. + AssignedEndpointKey map[string]*string `json:"assignedEndpointKey"` + // ExternalAPIKeys - External keys. + ExternalAPIKeys interface{} `json:"externalApiKeys,omitempty"` + // IntentsCount - Number of intents in this model. + IntentsCount *int32 `json:"intentsCount,omitempty"` + // EntitiesCount - Number of entities in this model. + EntitiesCount *int32 `json:"entitiesCount,omitempty"` + // EndpointHitsCount - Number of calls made to this endpoint. + EndpointHitsCount *int32 `json:"endpointHitsCount,omitempty"` + // TrainingStatus - The current training status. Possible values include: 'NeedsTraining', 'InProgress', 'Trained' + TrainingStatus TrainingStatus `json:"trainingStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for VersionInfo. +func (vi VersionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vi.Version != nil { + objectMap["version"] = vi.Version + } + if vi.CreatedDateTime != nil { + objectMap["createdDateTime"] = vi.CreatedDateTime + } + if vi.LastModifiedDateTime != nil { + objectMap["lastModifiedDateTime"] = vi.LastModifiedDateTime + } + if vi.LastTrainedDateTime != nil { + objectMap["lastTrainedDateTime"] = vi.LastTrainedDateTime + } + if vi.LastPublishedDateTime != nil { + objectMap["lastPublishedDateTime"] = vi.LastPublishedDateTime + } + if vi.EndpointURL != nil { + objectMap["endpointUrl"] = vi.EndpointURL + } + if vi.AssignedEndpointKey != nil { + objectMap["assignedEndpointKey"] = vi.AssignedEndpointKey + } + if vi.ExternalAPIKeys != nil { + objectMap["externalApiKeys"] = vi.ExternalAPIKeys + } + if vi.IntentsCount != nil { + objectMap["intentsCount"] = vi.IntentsCount + } + if vi.EntitiesCount != nil { + objectMap["entitiesCount"] = vi.EntitiesCount + } + if vi.EndpointHitsCount != nil { + objectMap["endpointHitsCount"] = vi.EndpointHitsCount + } + if vi.TrainingStatus != "" { + objectMap["trainingStatus"] = vi.TrainingStatus + } + return json.Marshal(objectMap) +} + +// WordListBaseUpdateObject object model for updating one of the list entity's sublists. +type WordListBaseUpdateObject struct { + // CanonicalForm - The standard form that the list represents. + CanonicalForm *string `json:"canonicalForm,omitempty"` + // List - List of synonym words. + List *[]string `json:"list,omitempty"` +} + +// WordListObject sublist of items for a list entity. +type WordListObject struct { + // CanonicalForm - The standard form that the list represents. + CanonicalForm *string `json:"canonicalForm,omitempty"` + // List - List of synonym words. + List *[]string `json:"list,omitempty"` +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/pattern.go b/services/preview/cognitiveservices/v3.0/luis/authoring/pattern.go new file mode 100644 index 000000000000..d827805145dc --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/pattern.go @@ -0,0 +1,723 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// PatternClient is the client for the Pattern methods of the Authoring service. +type PatternClient struct { + BaseClient +} + +// NewPatternClient creates an instance of the PatternClient client. +func NewPatternClient(endpoint string) PatternClient { + return PatternClient{New(endpoint)} +} + +// AddPattern sends the add pattern request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// pattern - the input pattern. +func (client PatternClient) AddPattern(ctx context.Context, appID uuid.UUID, versionID string, pattern PatternRuleCreateObject) (result PatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.AddPattern") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddPatternPreparer(ctx, appID, versionID, pattern) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "AddPattern", nil, "Failure preparing request") + return + } + + resp, err := client.AddPatternSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "AddPattern", resp, "Failure sending request") + return + } + + result, err = client.AddPatternResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "AddPattern", resp, "Failure responding to request") + } + + return +} + +// AddPatternPreparer prepares the AddPattern request. +func (client PatternClient) AddPatternPreparer(ctx context.Context, appID uuid.UUID, versionID string, pattern PatternRuleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrule", pathParameters), + autorest.WithJSON(pattern)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPatternSender sends the AddPattern request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) AddPatternSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddPatternResponder handles the response to the AddPattern request. The method always +// closes the http.Response Body. +func (client PatternClient) AddPatternResponder(resp *http.Response) (result PatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BatchAddPatterns sends the batch add patterns request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patterns - a JSON array containing patterns. +func (client PatternClient) BatchAddPatterns(ctx context.Context, appID uuid.UUID, versionID string, patterns []PatternRuleCreateObject) (result ListPatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.BatchAddPatterns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: patterns, + Constraints: []validation.Constraint{{Target: "patterns", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.PatternClient", "BatchAddPatterns", err.Error()) + } + + req, err := client.BatchAddPatternsPreparer(ctx, appID, versionID, patterns) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "BatchAddPatterns", nil, "Failure preparing request") + return + } + + resp, err := client.BatchAddPatternsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "BatchAddPatterns", resp, "Failure sending request") + return + } + + result, err = client.BatchAddPatternsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "BatchAddPatterns", resp, "Failure responding to request") + } + + return +} + +// BatchAddPatternsPreparer prepares the BatchAddPatterns request. +func (client PatternClient) BatchAddPatternsPreparer(ctx context.Context, appID uuid.UUID, versionID string, patterns []PatternRuleCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules", pathParameters), + autorest.WithJSON(patterns)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BatchAddPatternsSender sends the BatchAddPatterns request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) BatchAddPatternsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// BatchAddPatternsResponder handles the response to the BatchAddPatterns request. The method always +// closes the http.Response Body. +func (client PatternClient) BatchAddPatternsResponder(resp *http.Response) (result ListPatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePattern sends the delete pattern request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternID - the pattern ID. +func (client PatternClient) DeletePattern(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.DeletePattern") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePatternPreparer(ctx, appID, versionID, patternID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePattern", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePatternSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePattern", resp, "Failure sending request") + return + } + + result, err = client.DeletePatternResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePattern", resp, "Failure responding to request") + } + + return +} + +// DeletePatternPreparer prepares the DeletePattern request. +func (client PatternClient) DeletePatternPreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "patternId": autorest.Encode("path", patternID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules/{patternId}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePatternSender sends the DeletePattern request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) DeletePatternSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePatternResponder handles the response to the DeletePattern request. The method always +// closes the http.Response Body. +func (client PatternClient) DeletePatternResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePatterns sends the delete patterns request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternIds - the patterns IDs. +func (client PatternClient) DeletePatterns(ctx context.Context, appID uuid.UUID, versionID string, patternIds []uuid.UUID) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.DeletePatterns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: patternIds, + Constraints: []validation.Constraint{{Target: "patternIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.PatternClient", "DeletePatterns", err.Error()) + } + + req, err := client.DeletePatternsPreparer(ctx, appID, versionID, patternIds) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePatterns", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePatternsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePatterns", resp, "Failure sending request") + return + } + + result, err = client.DeletePatternsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "DeletePatterns", resp, "Failure responding to request") + } + + return +} + +// DeletePatternsPreparer prepares the DeletePatterns request. +func (client PatternClient) DeletePatternsPreparer(ctx context.Context, appID uuid.UUID, versionID string, patternIds []uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules", pathParameters), + autorest.WithJSON(patternIds)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePatternsSender sends the DeletePatterns request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) DeletePatternsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeletePatternsResponder handles the response to the DeletePatterns request. The method always +// closes the http.Response Body. +func (client PatternClient) DeletePatternsResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListIntentPatterns sends the list intent patterns request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client PatternClient) ListIntentPatterns(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, skip *int32, take *int32) (result ListPatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.ListIntentPatterns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.PatternClient", "ListIntentPatterns", err.Error()) + } + + req, err := client.ListIntentPatternsPreparer(ctx, appID, versionID, intentID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListIntentPatterns", nil, "Failure preparing request") + return + } + + resp, err := client.ListIntentPatternsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListIntentPatterns", resp, "Failure sending request") + return + } + + result, err = client.ListIntentPatternsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListIntentPatterns", resp, "Failure responding to request") + } + + return +} + +// ListIntentPatternsPreparer prepares the ListIntentPatterns request. +func (client PatternClient) ListIntentPatternsPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/patternrules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListIntentPatternsSender sends the ListIntentPatterns request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) ListIntentPatternsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListIntentPatternsResponder handles the response to the ListIntentPatterns request. The method always +// closes the http.Response Body. +func (client PatternClient) ListIntentPatternsResponder(resp *http.Response) (result ListPatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPatterns sends the list patterns request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client PatternClient) ListPatterns(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.ListPatterns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.PatternClient", "ListPatterns", err.Error()) + } + + req, err := client.ListPatternsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListPatterns", nil, "Failure preparing request") + return + } + + resp, err := client.ListPatternsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListPatterns", resp, "Failure sending request") + return + } + + result, err = client.ListPatternsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "ListPatterns", resp, "Failure responding to request") + } + + return +} + +// ListPatternsPreparer prepares the ListPatterns request. +func (client PatternClient) ListPatternsPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPatternsSender sends the ListPatterns request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) ListPatternsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListPatternsResponder handles the response to the ListPatterns request. The method always +// closes the http.Response Body. +func (client PatternClient) ListPatternsResponder(resp *http.Response) (result ListPatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePattern sends the update pattern request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patternID - the pattern ID. +// pattern - an object representing a pattern. +func (client PatternClient) UpdatePattern(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID, pattern PatternRuleUpdateObject) (result PatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.UpdatePattern") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePatternPreparer(ctx, appID, versionID, patternID, pattern) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePattern", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePatternSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePattern", resp, "Failure sending request") + return + } + + result, err = client.UpdatePatternResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePattern", resp, "Failure responding to request") + } + + return +} + +// UpdatePatternPreparer prepares the UpdatePattern request. +func (client PatternClient) UpdatePatternPreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID uuid.UUID, pattern PatternRuleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "patternId": autorest.Encode("path", patternID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules/{patternId}", pathParameters), + autorest.WithJSON(pattern)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatternSender sends the UpdatePattern request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) UpdatePatternSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePatternResponder handles the response to the UpdatePattern request. The method always +// closes the http.Response Body. +func (client PatternClient) UpdatePatternResponder(resp *http.Response) (result PatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatterns sends the update patterns request. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// patterns - an array represents the patterns. +func (client PatternClient) UpdatePatterns(ctx context.Context, appID uuid.UUID, versionID string, patterns []PatternRuleUpdateObject) (result ListPatternRuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PatternClient.UpdatePatterns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: patterns, + Constraints: []validation.Constraint{{Target: "patterns", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.PatternClient", "UpdatePatterns", err.Error()) + } + + req, err := client.UpdatePatternsPreparer(ctx, appID, versionID, patterns) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePatterns", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePatternsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePatterns", resp, "Failure sending request") + return + } + + result, err = client.UpdatePatternsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PatternClient", "UpdatePatterns", resp, "Failure responding to request") + } + + return +} + +// UpdatePatternsPreparer prepares the UpdatePatterns request. +func (client PatternClient) UpdatePatternsPreparer(ctx context.Context, appID uuid.UUID, versionID string, patterns []PatternRuleUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patternrules", pathParameters), + autorest.WithJSON(patterns)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatternsSender sends the UpdatePatterns request. The method will close the +// http.Response Body if it receives an error. +func (client PatternClient) UpdatePatternsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdatePatternsResponder handles the response to the UpdatePatterns request. The method always +// closes the http.Response Body. +func (client PatternClient) UpdatePatternsResponder(resp *http.Response) (result ListPatternRuleInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/permissions.go b/services/preview/cognitiveservices/v3.0/luis/authoring/permissions.go new file mode 100644 index 000000000000..f502cfb640e0 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/permissions.go @@ -0,0 +1,337 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// PermissionsClient is the client for the Permissions methods of the Authoring service. +type PermissionsClient struct { + BaseClient +} + +// NewPermissionsClient creates an instance of the PermissionsClient client. +func NewPermissionsClient(endpoint string) PermissionsClient { + return PermissionsClient{New(endpoint)} +} + +// Add adds a user to the allowed list of users to access this LUIS application. Users are added using their email +// address. +// Parameters: +// appID - the application ID. +// userToAdd - a model containing the user's email address. +func (client PermissionsClient) Add(ctx context.Context, appID uuid.UUID, userToAdd UserCollaborator) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.Add") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddPreparer(ctx, appID, userToAdd) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client PermissionsClient) AddPreparer(ctx context.Context, appID uuid.UUID, userToAdd UserCollaborator) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/permissions", pathParameters), + autorest.WithJSON(userToAdd)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) AddSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client PermissionsClient) AddResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete removes a user from the allowed list of users to access this LUIS application. Users are removed using their +// email address. +// Parameters: +// appID - the application ID. +// userToDelete - a model containing the user's email address. +func (client PermissionsClient) Delete(ctx context.Context, appID uuid.UUID, userToDelete UserCollaborator) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, appID, userToDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PermissionsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, userToDelete UserCollaborator) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/permissions", pathParameters), + autorest.WithJSON(userToDelete)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PermissionsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list of user emails that have permissions to access your application. +// Parameters: +// appID - the application ID. +func (client PermissionsClient) List(ctx context.Context, appID uuid.UUID) (result UserAccessList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PermissionsClient) ListPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/permissions", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListResponder(resp *http.Response) (result UserAccessList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update replaces the current user access list with the new list sent in the body. If an empty list is sent, all +// access to other users will be removed. +// Parameters: +// appID - the application ID. +// collaborators - a model containing a list of user email addresses. +func (client PermissionsClient) Update(ctx context.Context, appID uuid.UUID, collaborators CollaboratorsArray) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, appID, collaborators) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.PermissionsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PermissionsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, collaborators CollaboratorsArray) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/permissions", pathParameters), + autorest.WithJSON(collaborators)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PermissionsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/settings.go b/services/preview/cognitiveservices/v3.0/luis/authoring/settings.go new file mode 100644 index 000000000000..f5a254b06f0b --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/settings.go @@ -0,0 +1,195 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// SettingsClient is the client for the Settings methods of the Authoring service. +type SettingsClient struct { + BaseClient +} + +// NewSettingsClient creates an instance of the SettingsClient client. +func NewSettingsClient(endpoint string) SettingsClient { + return SettingsClient{New(endpoint)} +} + +// List gets the settings in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client SettingsClient) List(ctx context.Context, appID uuid.UUID, versionID string) (result ListAppVersionSettingObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SettingsClient) ListPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/settings", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SettingsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SettingsClient) ListResponder(resp *http.Response) (result ListAppVersionSettingObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the settings in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// listOfAppVersionSettingObject - a list of the updated application version settings. +func (client SettingsClient) Update(ctx context.Context, appID uuid.UUID, versionID string, listOfAppVersionSettingObject []AppVersionSettingObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: listOfAppVersionSettingObject, + Constraints: []validation.Constraint{{Target: "listOfAppVersionSettingObject", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.SettingsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, appID, versionID, listOfAppVersionSettingObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.SettingsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SettingsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, versionID string, listOfAppVersionSettingObject []AppVersionSettingObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/settings", pathParameters), + autorest.WithJSON(listOfAppVersionSettingObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SettingsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/train.go b/services/preview/cognitiveservices/v3.0/luis/authoring/train.go new file mode 100644 index 000000000000..aaba41df3efc --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/train.go @@ -0,0 +1,191 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// TrainClient is the client for the Train methods of the Authoring service. +type TrainClient struct { + BaseClient +} + +// NewTrainClient creates an instance of the TrainClient client. +func NewTrainClient(endpoint string) TrainClient { + return TrainClient{New(endpoint)} +} + +// GetStatus gets the training status of all models (intents and entities) for the specified LUIS app. You must call +// the train API to train the LUIS app before you call this API to get training status. "appID" specifies the LUIS app +// ID. "versionId" specifies the version number of the LUIS app. For example, "0.1". +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client TrainClient) GetStatus(ctx context.Context, appID uuid.UUID, versionID string) (result ListModelTrainingInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TrainClient.GetStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetStatusPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "GetStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "GetStatus", resp, "Failure sending request") + return + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "GetStatus", resp, "Failure responding to request") + } + + return +} + +// GetStatusPreparer prepares the GetStatus request. +func (client TrainClient) GetStatusPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/train", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStatusSender sends the GetStatus request. The method will close the +// http.Response Body if it receives an error. +func (client TrainClient) GetStatusSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client TrainClient) GetStatusResponder(resp *http.Response) (result ListModelTrainingInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TrainVersion sends a training request for a version of a specified LUIS app. This POST request initiates a request +// asynchronously. To determine whether the training request is successful, submit a GET request to get training +// status. Note: The application version is not fully trained unless all the models (intents and entities) are trained +// successfully or are up to date. To verify training success, get the training status at least once after training is +// complete. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client TrainClient) TrainVersion(ctx context.Context, appID uuid.UUID, versionID string) (result EnqueueTrainingResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TrainClient.TrainVersion") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TrainVersionPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "TrainVersion", nil, "Failure preparing request") + return + } + + resp, err := client.TrainVersionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "TrainVersion", resp, "Failure sending request") + return + } + + result, err = client.TrainVersionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.TrainClient", "TrainVersion", resp, "Failure responding to request") + } + + return +} + +// TrainVersionPreparer prepares the TrainVersion request. +func (client TrainClient) TrainVersionPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/train", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TrainVersionSender sends the TrainVersion request. The method will close the +// http.Response Body if it receives an error. +func (client TrainClient) TrainVersionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// TrainVersionResponder handles the response to the TrainVersion request. The method always +// closes the http.Response Body. +func (client TrainClient) TrainVersionResponder(resp *http.Response) (result EnqueueTrainingResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/version.go b/services/preview/cognitiveservices/v3.0/luis/authoring/version.go new file mode 100644 index 000000000000..5621f83fc771 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/version.go @@ -0,0 +1,30 @@ +package authoring + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " authoring/3.0-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/versions.go b/services/preview/cognitiveservices/v3.0/luis/authoring/versions.go new file mode 100644 index 000000000000..bfb400e04767 --- /dev/null +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/versions.go @@ -0,0 +1,674 @@ +package authoring + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// VersionsClient is the client for the Versions methods of the Authoring service. +type VersionsClient struct { + BaseClient +} + +// NewVersionsClient creates an instance of the VersionsClient client. +func NewVersionsClient(endpoint string) VersionsClient { + return VersionsClient{New(endpoint)} +} + +// Clone creates a new version from the selected version. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// versionCloneObject - a model containing the new version ID. +func (client VersionsClient) Clone(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject TaskUpdateObject) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Clone") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ClonePreparer(ctx, appID, versionID, versionCloneObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", nil, "Failure preparing request") + return + } + + resp, err := client.CloneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", resp, "Failure sending request") + return + } + + result, err = client.CloneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", resp, "Failure responding to request") + } + + return +} + +// ClonePreparer prepares the Clone request. +func (client VersionsClient) ClonePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject TaskUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/clone", pathParameters), + autorest.WithJSON(versionCloneObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CloneSender sends the Clone request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) CloneSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CloneResponder handles the response to the Clone request. The method always +// closes the http.Response Body. +func (client VersionsClient) CloneResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application version. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client VersionsClient) Delete(ctx context.Context, appID uuid.UUID, versionID string) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VersionsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VersionsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteUnlabelledUtterance deleted an unlabelled utterance in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// utterance - the utterance text to delete. +func (client VersionsClient) DeleteUnlabelledUtterance(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.DeleteUnlabelledUtterance") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteUnlabelledUtterancePreparer(ctx, appID, versionID, utterance) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteUnlabelledUtteranceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure sending request") + return + } + + result, err = client.DeleteUnlabelledUtteranceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure responding to request") + } + + return +} + +// DeleteUnlabelledUtterancePreparer prepares the DeleteUnlabelledUtterance request. +func (client VersionsClient) DeleteUnlabelledUtterancePreparer(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/suggest", pathParameters), + autorest.WithJSON(utterance)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteUnlabelledUtteranceSender sends the DeleteUnlabelledUtterance request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) DeleteUnlabelledUtteranceSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteUnlabelledUtteranceResponder handles the response to the DeleteUnlabelledUtterance request. The method always +// closes the http.Response Body. +func (client VersionsClient) DeleteUnlabelledUtteranceResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Export exports a LUIS application to JSON format. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client VersionsClient) Export(ctx context.Context, appID uuid.UUID, versionID string) (result LuisApp, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Export") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExportPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", nil, "Failure preparing request") + return + } + + resp, err := client.ExportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", resp, "Failure sending request") + return + } + + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", resp, "Failure responding to request") + } + + return +} + +// ExportPreparer prepares the Export request. +func (client VersionsClient) ExportPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/export", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportSender sends the Export request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) ExportSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ExportResponder handles the response to the Export request. The method always +// closes the http.Response Body. +func (client VersionsClient) ExportResponder(resp *http.Response) (result LuisApp, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the version information such as date created, last modified date, endpoint URL, count of intents and +// entities, training and publishing status. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +func (client VersionsClient) Get(ctx context.Context, appID uuid.UUID, versionID string) (result VersionInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VersionsClient) GetPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VersionsClient) GetResponder(resp *http.Response) (result VersionInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Import imports a new version into a LUIS application. +// Parameters: +// appID - the application ID. +// luisApp - a LUIS application structure. +// versionID - the new versionId to import. If not specified, the versionId will be read from the imported +// object. +func (client VersionsClient) Import(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Import") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ImportPreparer(ctx, appID, luisApp, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", nil, "Failure preparing request") + return + } + + resp, err := client.ImportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", resp, "Failure sending request") + return + } + + result, err = client.ImportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", resp, "Failure responding to request") + } + + return +} + +// ImportPreparer prepares the Import request. +func (client VersionsClient) ImportPreparer(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + queryParameters := map[string]interface{}{} + if len(versionID) > 0 { + queryParameters["versionId"] = autorest.Encode("query", versionID) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/import", pathParameters), + autorest.WithJSON(luisApp), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportSender sends the Import request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) ImportSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ImportResponder handles the response to the Import request. The method always +// closes the http.Response Body. +func (client VersionsClient) ImportResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of versions for this application ID. +// Parameters: +// appID - the application ID. +// skip - the number of entries to skip. Default value is 0. +// take - the number of entries to return. Maximum page size is 500. Default is 100. +func (client VersionsClient) List(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (result ListVersionInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: take, + Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authoring.VersionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, appID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VersionsClient) ListPreparer(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + queryParameters := map[string]interface{}{} + if skip != nil { + queryParameters["skip"] = autorest.Encode("query", *skip) + } else { + queryParameters["skip"] = autorest.Encode("query", 0) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } else { + queryParameters["take"] = autorest.Encode("query", 100) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VersionsClient) ListResponder(resp *http.Response) (result ListVersionInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the name or description of the application version. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// versionUpdateObject - a model containing Name and Description of the application. +func (client VersionsClient) Update(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, appID, versionID, versionUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VersionsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters), + autorest.WithJSON(versionUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VersionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VersionsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}