diff --git a/profiles/latest/cognitiveservices/face/models.go b/profiles/latest/cognitiveservices/face/models.go index de9a932fc7ed..61e652609b07 100644 --- a/profiles/latest/cognitiveservices/face/models.go +++ b/profiles/latest/cognitiveservices/face/models.go @@ -177,13 +177,13 @@ type IdentifyRequest = original.IdentifyRequest type IdentifyResult = original.IdentifyResult type ImageURL = original.ImageURL type Landmarks = original.Landmarks +type List = original.List type ListDetectedFace = original.ListDetectedFace type ListIdentifyResult = original.ListIdentifyResult -type ListListType = original.ListListType +type ListList = original.ListList type ListPerson = original.ListPerson type ListPersonGroup = original.ListPersonGroup type ListSimilarFace = original.ListSimilarFace -type ListType = original.ListType type Makeup = original.Makeup type NameAndUserDataContract = original.NameAndUserDataContract type Noise = original.Noise diff --git a/profiles/latest/cognitiveservices/luis/programmatic/models.go b/profiles/latest/cognitiveservices/luis/programmatic/models.go new file mode 100644 index 000000000000..ab6d52543a2d --- /dev/null +++ b/profiles/latest/cognitiveservices/luis/programmatic/models.go @@ -0,0 +1,283 @@ +// +build go1.9 + +// Copyright 2018 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 programmatic + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/luis/programmatic" + +type AppsClient = original.AppsClient + +func NewAppsClient(azureRegion AzureRegions) AppsClient { + return original.NewAppsClient(azureRegion) +} + +type BaseClient = original.BaseClient + +func New(azureRegion AzureRegions) BaseClient { + return original.New(azureRegion) +} +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return original.NewWithoutDefaults(azureRegion) +} + +type ExamplesClient = original.ExamplesClient + +func NewExamplesClient(azureRegion AzureRegions) ExamplesClient { + return original.NewExamplesClient(azureRegion) +} + +type FeaturesClient = original.FeaturesClient + +func NewFeaturesClient(azureRegion AzureRegions) FeaturesClient { + return original.NewFeaturesClient(azureRegion) +} + +type ModelClient = original.ModelClient + +func NewModelClient(azureRegion AzureRegions) ModelClient { + return original.NewModelClient(azureRegion) +} + +type AzureRegions = original.AzureRegions + +const ( + Australiaeast AzureRegions = original.Australiaeast + Brazilsouth AzureRegions = original.Brazilsouth + Eastasia AzureRegions = original.Eastasia + Eastus AzureRegions = original.Eastus + Eastus2 AzureRegions = original.Eastus2 + Northeurope AzureRegions = original.Northeurope + Southcentralus AzureRegions = original.Southcentralus + Southeastasia AzureRegions = original.Southeastasia + Westcentralus AzureRegions = original.Westcentralus + Westeurope AzureRegions = original.Westeurope + Westus AzureRegions = original.Westus + Westus2 AzureRegions = original.Westus2 +) + +type OperationStatusType = original.OperationStatusType + +const ( + Failed OperationStatusType = original.Failed + FAILED OperationStatusType = original.FAILED + Success OperationStatusType = original.Success +) + +type ReadableType = original.ReadableType + +const ( + ReadableTypeClosedListEntityExtractor ReadableType = original.ReadableTypeClosedListEntityExtractor + ReadableTypeCompositeEntityExtractor ReadableType = original.ReadableTypeCompositeEntityExtractor + ReadableTypeEntityExtractor ReadableType = original.ReadableTypeEntityExtractor + ReadableTypeHierarchicalChildEntityExtractor ReadableType = original.ReadableTypeHierarchicalChildEntityExtractor + ReadableTypeHierarchicalEntityExtractor ReadableType = original.ReadableTypeHierarchicalEntityExtractor + ReadableTypeIntentClassifier ReadableType = original.ReadableTypeIntentClassifier + ReadableTypePrebuiltEntityExtractor ReadableType = original.ReadableTypePrebuiltEntityExtractor +) + +type ReadableType1 = original.ReadableType1 + +const ( + ReadableType1ClosedListEntityExtractor ReadableType1 = original.ReadableType1ClosedListEntityExtractor + ReadableType1CompositeEntityExtractor ReadableType1 = original.ReadableType1CompositeEntityExtractor + ReadableType1EntityExtractor ReadableType1 = original.ReadableType1EntityExtractor + ReadableType1HierarchicalChildEntityExtractor ReadableType1 = original.ReadableType1HierarchicalChildEntityExtractor + ReadableType1HierarchicalEntityExtractor ReadableType1 = original.ReadableType1HierarchicalEntityExtractor + ReadableType1IntentClassifier ReadableType1 = original.ReadableType1IntentClassifier + ReadableType1PrebuiltEntityExtractor ReadableType1 = original.ReadableType1PrebuiltEntityExtractor +) + +type ReadableType2 = original.ReadableType2 + +const ( + ReadableType2ClosedListEntityExtractor ReadableType2 = original.ReadableType2ClosedListEntityExtractor + ReadableType2CompositeEntityExtractor ReadableType2 = original.ReadableType2CompositeEntityExtractor + ReadableType2EntityExtractor ReadableType2 = original.ReadableType2EntityExtractor + ReadableType2HierarchicalChildEntityExtractor ReadableType2 = original.ReadableType2HierarchicalChildEntityExtractor + ReadableType2HierarchicalEntityExtractor ReadableType2 = original.ReadableType2HierarchicalEntityExtractor + ReadableType2IntentClassifier ReadableType2 = original.ReadableType2IntentClassifier + ReadableType2PrebuiltEntityExtractor ReadableType2 = original.ReadableType2PrebuiltEntityExtractor +) + +type ReadableType3 = original.ReadableType3 + +const ( + ReadableType3ClosedListEntityExtractor ReadableType3 = original.ReadableType3ClosedListEntityExtractor + ReadableType3CompositeEntityExtractor ReadableType3 = original.ReadableType3CompositeEntityExtractor + ReadableType3EntityExtractor ReadableType3 = original.ReadableType3EntityExtractor + ReadableType3HierarchicalChildEntityExtractor ReadableType3 = original.ReadableType3HierarchicalChildEntityExtractor + ReadableType3HierarchicalEntityExtractor ReadableType3 = original.ReadableType3HierarchicalEntityExtractor + ReadableType3IntentClassifier ReadableType3 = original.ReadableType3IntentClassifier + ReadableType3PrebuiltEntityExtractor ReadableType3 = original.ReadableType3PrebuiltEntityExtractor +) + +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 ApplicationCreateObject = original.ApplicationCreateObject +type ApplicationInfoResponse = original.ApplicationInfoResponse +type ApplicationPublishObject = original.ApplicationPublishObject +type ApplicationSettings = original.ApplicationSettings +type ApplicationSettingUpdateObject = original.ApplicationSettingUpdateObject +type ApplicationUpdateObject = original.ApplicationUpdateObject +type AvailableCulture = original.AvailableCulture +type AvailablePrebuiltEntityModel = original.AvailablePrebuiltEntityModel +type BatchLabelExample = original.BatchLabelExample +type ChildEntity = original.ChildEntity +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 EntityPrediction = original.EntityPrediction +type ErrorResponse = original.ErrorResponse +type ExampleLabelObject = original.ExampleLabelObject +type FeatureInfoObject = original.FeatureInfoObject +type FeaturesResponseObject = original.FeaturesResponseObject +type HierarchicalChildEntity = original.HierarchicalChildEntity +type HierarchicalChildModelCreateObject = original.HierarchicalChildModelCreateObject +type HierarchicalChildModelUpdateObject = original.HierarchicalChildModelUpdateObject +type HierarchicalEntityExtractor = original.HierarchicalEntityExtractor +type HierarchicalEntityModel = original.HierarchicalEntityModel +type HierarchicalModel = original.HierarchicalModel +type Int32 = original.Int32 +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 LabeledUtterance = original.LabeledUtterance +type LabelExampleResponse = original.LabelExampleResponse +type ListApplicationInfoResponse = original.ListApplicationInfoResponse +type ListAvailableCulture = original.ListAvailableCulture +type ListAvailablePrebuiltEntityModel = original.ListAvailablePrebuiltEntityModel +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 ListHierarchicalEntityExtractor = original.ListHierarchicalEntityExtractor +type ListIntentClassifier = original.ListIntentClassifier +type ListIntentsSuggestionExample = original.ListIntentsSuggestionExample +type ListLabeledUtterance = original.ListLabeledUtterance +type ListModelInfoResponse = original.ListModelInfoResponse +type ListModelTrainingInfo = original.ListModelTrainingInfo +type ListPhraseListFeatureInfo = original.ListPhraseListFeatureInfo +type ListPrebuiltDomain = original.ListPrebuiltDomain +type ListPrebuiltEntityExtractor = original.ListPrebuiltEntityExtractor +type ListString = original.ListString +type ListUUID = original.ListUUID +type ListVersionInfo = original.ListVersionInfo +type LuisApp = original.LuisApp +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 OperationError = original.OperationError +type OperationStatus = original.OperationStatus +type PatternCreateObject = original.PatternCreateObject +type PatternFeatureInfo = original.PatternFeatureInfo +type PatternUpdateObject = original.PatternUpdateObject +type PersonalAssistantsResponse = original.PersonalAssistantsResponse +type PhraselistCreateObject = original.PhraselistCreateObject +type PhraseListFeatureInfo = original.PhraseListFeatureInfo +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 PrebuiltEntityExtractor = original.PrebuiltEntityExtractor +type ProductionOrStagingEndpointInfo = original.ProductionOrStagingEndpointInfo +type ReadCloser = original.ReadCloser +type SetString = original.SetString +type String = original.String +type SubClosedList = original.SubClosedList +type SubClosedListResponse = original.SubClosedListResponse +type TaskUpdateObject = original.TaskUpdateObject +type UserAccessList = original.UserAccessList +type UserCollaborator = original.UserCollaborator +type UUID = original.UUID +type VersionInfo = original.VersionInfo +type WordListBaseUpdateObject = original.WordListBaseUpdateObject +type WordListObject = original.WordListObject +type PermissionsClient = original.PermissionsClient + +func NewPermissionsClient(azureRegion AzureRegions) PermissionsClient { + return original.NewPermissionsClient(azureRegion) +} + +type TrainClient = original.TrainClient + +func NewTrainClient(azureRegion AzureRegions) TrainClient { + return original.NewTrainClient(azureRegion) +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} + +type VersionsClient = original.VersionsClient + +func NewVersionsClient(azureRegion AzureRegions) VersionsClient { + return original.NewVersionsClient(azureRegion) +} diff --git a/profiles/latest/cognitiveservices/luis/runtime/models.go b/profiles/latest/cognitiveservices/luis/runtime/models.go new file mode 100644 index 000000000000..0a262f334af3 --- /dev/null +++ b/profiles/latest/cognitiveservices/luis/runtime/models.go @@ -0,0 +1,68 @@ +// +build go1.9 + +// Copyright 2018 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 runtime + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/luis/runtime" + +type BaseClient = original.BaseClient + +func New(azureRegion AzureRegions) BaseClient { + return original.New(azureRegion) +} +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return original.NewWithoutDefaults(azureRegion) +} + +type AzureRegions = original.AzureRegions + +const ( + Australiaeast AzureRegions = original.Australiaeast + Brazilsouth AzureRegions = original.Brazilsouth + Eastasia AzureRegions = original.Eastasia + Eastus AzureRegions = original.Eastus + Eastus2 AzureRegions = original.Eastus2 + Northeurope AzureRegions = original.Northeurope + Southcentralus AzureRegions = original.Southcentralus + Southeastasia AzureRegions = original.Southeastasia + Westcentralus AzureRegions = original.Westcentralus + Westeurope AzureRegions = original.Westeurope + Westus AzureRegions = original.Westus + Westus2 AzureRegions = original.Westus2 +) + +type APIError = original.APIError +type CompositeChildModel = original.CompositeChildModel +type CompositeEntityModel = original.CompositeEntityModel +type EntityModel = original.EntityModel +type EntityWithResolution = original.EntityWithResolution +type EntityWithScore = original.EntityWithScore +type IntentModel = original.IntentModel +type LuisResult = original.LuisResult +type PredictionClient = original.PredictionClient + +func NewPredictionClient(azureRegion AzureRegions) PredictionClient { + return original.NewPredictionClient(azureRegion) +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/cognitiveservices/face/models.go b/profiles/preview/cognitiveservices/face/models.go index ed6649377aad..364e443f25b7 100644 --- a/profiles/preview/cognitiveservices/face/models.go +++ b/profiles/preview/cognitiveservices/face/models.go @@ -177,13 +177,13 @@ type IdentifyRequest = original.IdentifyRequest type IdentifyResult = original.IdentifyResult type ImageURL = original.ImageURL type Landmarks = original.Landmarks +type List = original.List type ListDetectedFace = original.ListDetectedFace type ListIdentifyResult = original.ListIdentifyResult -type ListListType = original.ListListType +type ListList = original.ListList type ListPerson = original.ListPerson type ListPersonGroup = original.ListPersonGroup type ListSimilarFace = original.ListSimilarFace -type ListType = original.ListType type Makeup = original.Makeup type NameAndUserDataContract = original.NameAndUserDataContract type Noise = original.Noise diff --git a/profiles/preview/cognitiveservices/luis/programmatic/models.go b/profiles/preview/cognitiveservices/luis/programmatic/models.go new file mode 100644 index 000000000000..9f8afa1569b4 --- /dev/null +++ b/profiles/preview/cognitiveservices/luis/programmatic/models.go @@ -0,0 +1,283 @@ +// +build go1.9 + +// Copyright 2018 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 programmatic + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/luis/programmatic" + +type AppsClient = original.AppsClient + +func NewAppsClient(azureRegion AzureRegions) AppsClient { + return original.NewAppsClient(azureRegion) +} + +type BaseClient = original.BaseClient + +func New(azureRegion AzureRegions) BaseClient { + return original.New(azureRegion) +} +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return original.NewWithoutDefaults(azureRegion) +} + +type ExamplesClient = original.ExamplesClient + +func NewExamplesClient(azureRegion AzureRegions) ExamplesClient { + return original.NewExamplesClient(azureRegion) +} + +type FeaturesClient = original.FeaturesClient + +func NewFeaturesClient(azureRegion AzureRegions) FeaturesClient { + return original.NewFeaturesClient(azureRegion) +} + +type ModelClient = original.ModelClient + +func NewModelClient(azureRegion AzureRegions) ModelClient { + return original.NewModelClient(azureRegion) +} + +type AzureRegions = original.AzureRegions + +const ( + Australiaeast AzureRegions = original.Australiaeast + Brazilsouth AzureRegions = original.Brazilsouth + Eastasia AzureRegions = original.Eastasia + Eastus AzureRegions = original.Eastus + Eastus2 AzureRegions = original.Eastus2 + Northeurope AzureRegions = original.Northeurope + Southcentralus AzureRegions = original.Southcentralus + Southeastasia AzureRegions = original.Southeastasia + Westcentralus AzureRegions = original.Westcentralus + Westeurope AzureRegions = original.Westeurope + Westus AzureRegions = original.Westus + Westus2 AzureRegions = original.Westus2 +) + +type OperationStatusType = original.OperationStatusType + +const ( + Failed OperationStatusType = original.Failed + FAILED OperationStatusType = original.FAILED + Success OperationStatusType = original.Success +) + +type ReadableType = original.ReadableType + +const ( + ReadableTypeClosedListEntityExtractor ReadableType = original.ReadableTypeClosedListEntityExtractor + ReadableTypeCompositeEntityExtractor ReadableType = original.ReadableTypeCompositeEntityExtractor + ReadableTypeEntityExtractor ReadableType = original.ReadableTypeEntityExtractor + ReadableTypeHierarchicalChildEntityExtractor ReadableType = original.ReadableTypeHierarchicalChildEntityExtractor + ReadableTypeHierarchicalEntityExtractor ReadableType = original.ReadableTypeHierarchicalEntityExtractor + ReadableTypeIntentClassifier ReadableType = original.ReadableTypeIntentClassifier + ReadableTypePrebuiltEntityExtractor ReadableType = original.ReadableTypePrebuiltEntityExtractor +) + +type ReadableType1 = original.ReadableType1 + +const ( + ReadableType1ClosedListEntityExtractor ReadableType1 = original.ReadableType1ClosedListEntityExtractor + ReadableType1CompositeEntityExtractor ReadableType1 = original.ReadableType1CompositeEntityExtractor + ReadableType1EntityExtractor ReadableType1 = original.ReadableType1EntityExtractor + ReadableType1HierarchicalChildEntityExtractor ReadableType1 = original.ReadableType1HierarchicalChildEntityExtractor + ReadableType1HierarchicalEntityExtractor ReadableType1 = original.ReadableType1HierarchicalEntityExtractor + ReadableType1IntentClassifier ReadableType1 = original.ReadableType1IntentClassifier + ReadableType1PrebuiltEntityExtractor ReadableType1 = original.ReadableType1PrebuiltEntityExtractor +) + +type ReadableType2 = original.ReadableType2 + +const ( + ReadableType2ClosedListEntityExtractor ReadableType2 = original.ReadableType2ClosedListEntityExtractor + ReadableType2CompositeEntityExtractor ReadableType2 = original.ReadableType2CompositeEntityExtractor + ReadableType2EntityExtractor ReadableType2 = original.ReadableType2EntityExtractor + ReadableType2HierarchicalChildEntityExtractor ReadableType2 = original.ReadableType2HierarchicalChildEntityExtractor + ReadableType2HierarchicalEntityExtractor ReadableType2 = original.ReadableType2HierarchicalEntityExtractor + ReadableType2IntentClassifier ReadableType2 = original.ReadableType2IntentClassifier + ReadableType2PrebuiltEntityExtractor ReadableType2 = original.ReadableType2PrebuiltEntityExtractor +) + +type ReadableType3 = original.ReadableType3 + +const ( + ReadableType3ClosedListEntityExtractor ReadableType3 = original.ReadableType3ClosedListEntityExtractor + ReadableType3CompositeEntityExtractor ReadableType3 = original.ReadableType3CompositeEntityExtractor + ReadableType3EntityExtractor ReadableType3 = original.ReadableType3EntityExtractor + ReadableType3HierarchicalChildEntityExtractor ReadableType3 = original.ReadableType3HierarchicalChildEntityExtractor + ReadableType3HierarchicalEntityExtractor ReadableType3 = original.ReadableType3HierarchicalEntityExtractor + ReadableType3IntentClassifier ReadableType3 = original.ReadableType3IntentClassifier + ReadableType3PrebuiltEntityExtractor ReadableType3 = original.ReadableType3PrebuiltEntityExtractor +) + +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 ApplicationCreateObject = original.ApplicationCreateObject +type ApplicationInfoResponse = original.ApplicationInfoResponse +type ApplicationPublishObject = original.ApplicationPublishObject +type ApplicationSettings = original.ApplicationSettings +type ApplicationSettingUpdateObject = original.ApplicationSettingUpdateObject +type ApplicationUpdateObject = original.ApplicationUpdateObject +type AvailableCulture = original.AvailableCulture +type AvailablePrebuiltEntityModel = original.AvailablePrebuiltEntityModel +type BatchLabelExample = original.BatchLabelExample +type ChildEntity = original.ChildEntity +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 EntityPrediction = original.EntityPrediction +type ErrorResponse = original.ErrorResponse +type ExampleLabelObject = original.ExampleLabelObject +type FeatureInfoObject = original.FeatureInfoObject +type FeaturesResponseObject = original.FeaturesResponseObject +type HierarchicalChildEntity = original.HierarchicalChildEntity +type HierarchicalChildModelCreateObject = original.HierarchicalChildModelCreateObject +type HierarchicalChildModelUpdateObject = original.HierarchicalChildModelUpdateObject +type HierarchicalEntityExtractor = original.HierarchicalEntityExtractor +type HierarchicalEntityModel = original.HierarchicalEntityModel +type HierarchicalModel = original.HierarchicalModel +type Int32 = original.Int32 +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 LabeledUtterance = original.LabeledUtterance +type LabelExampleResponse = original.LabelExampleResponse +type ListApplicationInfoResponse = original.ListApplicationInfoResponse +type ListAvailableCulture = original.ListAvailableCulture +type ListAvailablePrebuiltEntityModel = original.ListAvailablePrebuiltEntityModel +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 ListHierarchicalEntityExtractor = original.ListHierarchicalEntityExtractor +type ListIntentClassifier = original.ListIntentClassifier +type ListIntentsSuggestionExample = original.ListIntentsSuggestionExample +type ListLabeledUtterance = original.ListLabeledUtterance +type ListModelInfoResponse = original.ListModelInfoResponse +type ListModelTrainingInfo = original.ListModelTrainingInfo +type ListPhraseListFeatureInfo = original.ListPhraseListFeatureInfo +type ListPrebuiltDomain = original.ListPrebuiltDomain +type ListPrebuiltEntityExtractor = original.ListPrebuiltEntityExtractor +type ListString = original.ListString +type ListUUID = original.ListUUID +type ListVersionInfo = original.ListVersionInfo +type LuisApp = original.LuisApp +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 OperationError = original.OperationError +type OperationStatus = original.OperationStatus +type PatternCreateObject = original.PatternCreateObject +type PatternFeatureInfo = original.PatternFeatureInfo +type PatternUpdateObject = original.PatternUpdateObject +type PersonalAssistantsResponse = original.PersonalAssistantsResponse +type PhraselistCreateObject = original.PhraselistCreateObject +type PhraseListFeatureInfo = original.PhraseListFeatureInfo +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 PrebuiltEntityExtractor = original.PrebuiltEntityExtractor +type ProductionOrStagingEndpointInfo = original.ProductionOrStagingEndpointInfo +type ReadCloser = original.ReadCloser +type SetString = original.SetString +type String = original.String +type SubClosedList = original.SubClosedList +type SubClosedListResponse = original.SubClosedListResponse +type TaskUpdateObject = original.TaskUpdateObject +type UserAccessList = original.UserAccessList +type UserCollaborator = original.UserCollaborator +type UUID = original.UUID +type VersionInfo = original.VersionInfo +type WordListBaseUpdateObject = original.WordListBaseUpdateObject +type WordListObject = original.WordListObject +type PermissionsClient = original.PermissionsClient + +func NewPermissionsClient(azureRegion AzureRegions) PermissionsClient { + return original.NewPermissionsClient(azureRegion) +} + +type TrainClient = original.TrainClient + +func NewTrainClient(azureRegion AzureRegions) TrainClient { + return original.NewTrainClient(azureRegion) +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} + +type VersionsClient = original.VersionsClient + +func NewVersionsClient(azureRegion AzureRegions) VersionsClient { + return original.NewVersionsClient(azureRegion) +} diff --git a/profiles/preview/cognitiveservices/luis/runtime/models.go b/profiles/preview/cognitiveservices/luis/runtime/models.go new file mode 100644 index 000000000000..0b0a0685e17e --- /dev/null +++ b/profiles/preview/cognitiveservices/luis/runtime/models.go @@ -0,0 +1,68 @@ +// +build go1.9 + +// Copyright 2018 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 runtime + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/luis/runtime" + +type BaseClient = original.BaseClient + +func New(azureRegion AzureRegions) BaseClient { + return original.New(azureRegion) +} +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return original.NewWithoutDefaults(azureRegion) +} + +type AzureRegions = original.AzureRegions + +const ( + Australiaeast AzureRegions = original.Australiaeast + Brazilsouth AzureRegions = original.Brazilsouth + Eastasia AzureRegions = original.Eastasia + Eastus AzureRegions = original.Eastus + Eastus2 AzureRegions = original.Eastus2 + Northeurope AzureRegions = original.Northeurope + Southcentralus AzureRegions = original.Southcentralus + Southeastasia AzureRegions = original.Southeastasia + Westcentralus AzureRegions = original.Westcentralus + Westeurope AzureRegions = original.Westeurope + Westus AzureRegions = original.Westus + Westus2 AzureRegions = original.Westus2 +) + +type APIError = original.APIError +type CompositeChildModel = original.CompositeChildModel +type CompositeEntityModel = original.CompositeEntityModel +type EntityModel = original.EntityModel +type EntityWithResolution = original.EntityWithResolution +type EntityWithScore = original.EntityWithScore +type IntentModel = original.IntentModel +type LuisResult = original.LuisResult +type PredictionClient = original.PredictionClient + +func NewPredictionClient(azureRegion AzureRegions) PredictionClient { + return original.NewPredictionClient(azureRegion) +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/cognitiveservices/v1.0/computervision/client.go b/services/cognitiveservices/v1.0/computervision/client.go index 79aa4536a2ba..0c78e64febb4 100644 --- a/services/cognitiveservices/v1.0/computervision/client.go +++ b/services/cognitiveservices/v1.0/computervision/client.go @@ -59,16 +59,17 @@ func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { // // imageURL is a JSON document with a URL pointing to the image that is to be analyzed. visualFeatures is a string // indicating what visual feature types to return. Multiple values should be comma-separated. Valid visual feature -// types include:Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags -// the image with a detailed list of words related to the image content. Description - describes the image content with -// a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. -// ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and -// whether an image is black&white.Adult - detects if the image is pornographic in nature (depicts nudity or a sex -// act). Sexually suggestive content is also detected. details is a string indicating which domain-specific details to -// return. Multiple values should be comma-separated. Valid visual feature types include:Celebrities - identifies -// celebrities if detected in the image. language is a string indicating which language to return. The service will -// return recognition results in specified language. If this parameter is not specified, the default value is -// "en".Supported languages:en - English, Default.zh - Simplified Chinese. +// types include:Categories - categorizes image content according to a taxonomy defined in documentation. Tags - +// tags the image with a detailed list of words related to the image content. Description - describes the image +// content with a complete English sentence. Faces - detects if faces are present. If present, generate +// coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the +// accent color, dominant color, and whether an image is black&white.Adult - detects if the image is pornographic +// in nature (depicts nudity or a sex act). Sexually suggestive content is also detected. details is a string +// indicating which domain-specific details to return. Multiple values should be comma-separated. Valid visual +// feature types include:Celebrities - identifies celebrities if detected in the image. language is a string +// indicating which language to return. The service will return recognition results in specified language. If this +// parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - +// Simplified Chinese. func (client BaseClient) AnalyzeImage(ctx context.Context, imageURL ImageURL, visualFeatures []VisualFeatureTypes, details []Details, language Language1) (result ImageAnalysis, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -112,6 +113,8 @@ func (client BaseClient) AnalyzeImagePreparer(ctx context.Context, imageURL Imag } if len(string(language)) > 0 { queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "en") } preparer := autorest.CreatePreparer( @@ -150,8 +153,8 @@ func (client BaseClient) AnalyzeImageResponder(resp *http.Response) (result Imag // supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. // If the request failed, the response will contain an error code and a message to help understand what went wrong. // -// model is the domain-specific content to recognize. imageURL is a JSON document with a URL pointing to the image that -// is to be analyzed. +// model is the domain-specific content to recognize. imageURL is a JSON document with a URL pointing to the image +// that is to be analyzed. func (client BaseClient) AnalyzeImageByDomain(ctx context.Context, model DomainModels, imageURL ImageURL) (result DomainModelResults, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -225,8 +228,8 @@ func (client BaseClient) AnalyzeImageByDomainResponder(resp *http.Response) (res // supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. // If the request failed, the response will contain an error code and a message to help understand what went wrong. // -// model is the domain-specific content to recognize. imageParameter is an image stream. imageParameter will be closed -// upon successful return. Callers should ensure closure when receiving an error. +// model is the domain-specific content to recognize. imageParameter is an image stream. imageParameter will be +// closed upon successful return. Callers should ensure closure when receiving an error. func (client BaseClient) AnalyzeImageByDomainInStream(ctx context.Context, model string, imageParameter io.ReadCloser) (result DomainModelResults, err error) { req, err := client.AnalyzeImageByDomainInStreamPreparer(ctx, model, imageParameter) if err != nil { @@ -290,18 +293,18 @@ func (client BaseClient) AnalyzeImageByDomainInStreamResponder(resp *http.Respon // AnalyzeImageInStream this operation extracts a rich set of visual features based on the image content. // // imageParameter is an image stream. imageParameter will be closed upon successful return. Callers should ensure -// closure when receiving an error.visualFeatures is a string indicating what visual feature types to return. Multiple -// values should be comma-separated. Valid visual feature types include:Categories - categorizes image content -// according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the -// image content. Description - describes the image content with a complete English sentence. Faces - detects if faces -// are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line -// drawing. Color - determines the accent color, dominant color, and whether an image is black&white.Adult - detects if -// the image is pornographic in nature (depicts nudity or a sex act). Sexually suggestive content is also detected. -// details is a string indicating which domain-specific details to return. Multiple values should be comma-separated. -// Valid visual feature types include:Celebrities - identifies celebrities if detected in the image. language is a -// string indicating which language to return. The service will return recognition results in specified language. If -// this parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - -// Simplified Chinese. +// closure when receiving an error.visualFeatures is a string indicating what visual feature types to return. +// Multiple values should be comma-separated. Valid visual feature types include:Categories - categorizes image +// content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words +// related to the image content. Description - describes the image content with a complete English sentence. Faces +// - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image +// is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is +// black&white.Adult - detects if the image is pornographic in nature (depicts nudity or a sex act). Sexually +// suggestive content is also detected. details is a string indicating which domain-specific details to return. +// Multiple values should be comma-separated. Valid visual feature types include:Celebrities - identifies +// celebrities if detected in the image. language is a string indicating which language to return. The service will +// return recognition results in specified language. If this parameter is not specified, the default value is +// "en".Supported languages:en - English, Default.zh - Simplified Chinese. func (client BaseClient) AnalyzeImageInStream(ctx context.Context, imageParameter io.ReadCloser, visualFeatures []VisualFeatureTypes, details string, language string) (result ImageAnalysis, err error) { req, err := client.AnalyzeImageInStreamPreparer(ctx, imageParameter, visualFeatures, details, language) if err != nil { @@ -339,6 +342,8 @@ func (client BaseClient) AnalyzeImageInStreamPreparer(ctx context.Context, image } if len(string(language)) > 0 { queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "en") } preparer := autorest.CreatePreparer( @@ -377,8 +382,8 @@ func (client BaseClient) AnalyzeImageInStreamResponder(resp *http.Response) (res // successful response will be returned in JSON. If the request failed, the response will contain an error code and a // message to help understand what went wrong. // -// imageURL is a JSON document with a URL pointing to the image that is to be analyzed. maxCandidates is maximum number -// of candidate descriptions to be returned. The default is 1. +// imageURL is a JSON document with a URL pointing to the image that is to be analyzed. maxCandidates is maximum +// number of candidate descriptions to be returned. The default is 1. func (client BaseClient) DescribeImage(ctx context.Context, imageURL ImageURL, maxCandidates string) (result ImageDescription, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -416,6 +421,8 @@ func (client BaseClient) DescribeImagePreparer(ctx context.Context, imageURL Ima queryParameters := map[string]interface{}{} if len(maxCandidates) > 0 { queryParameters["maxCandidates"] = autorest.Encode("query", maxCandidates) + } else { + queryParameters["maxCandidates"] = autorest.Encode("query", "1") } preparer := autorest.CreatePreparer( @@ -489,6 +496,8 @@ func (client BaseClient) DescribeImageInStreamPreparer(ctx context.Context, imag queryParameters := map[string]interface{}{} if len(maxCandidates) > 0 { queryParameters["maxCandidates"] = autorest.Encode("query", maxCandidates) + } else { + queryParameters["maxCandidates"] = autorest.Encode("query", "1") } preparer := autorest.CreatePreparer( @@ -526,9 +535,9 @@ func (client BaseClient) DescribeImageInStreamResponder(resp *http.Response) (re // successful response contains the thumbnail image binary. If the request failed, the response contains an error code // and a message to help determine what went wrong. // -// width is width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. height is height of the -// thumbnail. It must be between 1 and 1024. Recommended minimum of 50. imageURL is a JSON document with a URL pointing -// to the image that is to be analyzed. smartCropping is boolean flag for enabling smart cropping. +// width is width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. height is height of +// the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. imageURL is a JSON document with a URL +// pointing to the image that is to be analyzed. smartCropping is boolean flag for enabling smart cropping. func (client BaseClient) GenerateThumbnail(ctx context.Context, width int32, height int32, imageURL ImageURL, smartCropping *bool) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: width, @@ -575,6 +584,8 @@ func (client BaseClient) GenerateThumbnailPreparer(ctx context.Context, width in } if smartCropping != nil { queryParameters["smartCropping"] = autorest.Encode("query", *smartCropping) + } else { + queryParameters["smartCropping"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( @@ -612,8 +623,8 @@ func (client BaseClient) GenerateThumbnailResponder(resp *http.Response) (result // input image. A successful response contains the thumbnail image binary. If the request failed, the response contains // an error code and a message to help determine what went wrong. // -// width is width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. height is height of the -// thumbnail. It must be between 1 and 1024. Recommended minimum of 50. imageParameter is an image stream. +// width is width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. height is height of +// the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. imageParameter is an image stream. // imageParameter will be closed upon successful return. Callers should ensure closure when receiving an // error.smartCropping is boolean flag for enabling smart cropping. func (client BaseClient) GenerateThumbnailInStream(ctx context.Context, width int32, height int32, imageParameter io.ReadCloser, smartCropping *bool) (result ReadCloser, err error) { @@ -660,6 +671,8 @@ func (client BaseClient) GenerateThumbnailInStreamPreparer(ctx context.Context, } if smartCropping != nil { queryParameters["smartCropping"] = autorest.Encode("query", *smartCropping) + } else { + queryParameters["smartCropping"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( @@ -818,10 +831,10 @@ func (client BaseClient) ListModelsResponder(resp *http.Response) (result ListMo // InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or // InternalServerError. // -// detectOrientation is whether detect the text orientation in the image. With detectOrientation=true the OCR service -// tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). imageURL -// is a JSON document with a URL pointing to the image that is to be analyzed. language is the BCP-47 language code of -// the text to be detected in the image. The default value is 'unk' +// detectOrientation is whether detect the text orientation in the image. With detectOrientation=true the OCR +// service tries to detect the image orientation and correct it before further processing (e.g. if it's +// upside-down). imageURL is a JSON document with a URL pointing to the image that is to be analyzed. language is +// the BCP-47 language code of the text to be detected in the image. The default value is 'unk' func (client BaseClient) RecognizePrintedText(ctx context.Context, detectOrientation bool, imageURL ImageURL, language OcrLanguages) (result OcrResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -861,6 +874,8 @@ func (client BaseClient) RecognizePrintedTextPreparer(ctx context.Context, detec } if len(string(language)) > 0 { queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "unk") } preparer := autorest.CreatePreparer( @@ -899,11 +914,11 @@ func (client BaseClient) RecognizePrintedTextResponder(resp *http.Response) (res // InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or // InternalServerError. // -// detectOrientation is whether detect the text orientation in the image. With detectOrientation=true the OCR service -// tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). -// imageParameter is an image stream. imageParameter will be closed upon successful return. Callers should ensure -// closure when receiving an error.language is the BCP-47 language code of the text to be detected in the image. The -// default value is 'unk' +// detectOrientation is whether detect the text orientation in the image. With detectOrientation=true the OCR +// service tries to detect the image orientation and correct it before further processing (e.g. if it's +// upside-down). imageParameter is an image stream. imageParameter will be closed upon successful return. Callers +// should ensure closure when receiving an error.language is the BCP-47 language code of the text to be detected in +// the image. The default value is 'unk' func (client BaseClient) RecognizePrintedTextInStream(ctx context.Context, detectOrientation bool, imageParameter io.ReadCloser, language OcrLanguages) (result OcrResult, err error) { req, err := client.RecognizePrintedTextInStreamPreparer(ctx, detectOrientation, imageParameter, language) if err != nil { @@ -937,6 +952,8 @@ func (client BaseClient) RecognizePrintedTextInStreamPreparer(ctx context.Contex } if len(string(language)) > 0 { queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "unk") } preparer := autorest.CreatePreparer( @@ -972,9 +989,9 @@ func (client BaseClient) RecognizePrintedTextInStreamResponder(resp *http.Respon // called “Operation-Location”. The “Operation-Location” field contains the URL that you must use for your Get // Handwritten Text Operation Result operation. // -// imageURL is a JSON document with a URL pointing to the image that is to be analyzed. detectHandwriting is if “true” -// is specified, handwriting recognition is performed. If this parameter is set to “false” or is not specified, printed -// text recognition is performed. +// imageURL is a JSON document with a URL pointing to the image that is to be analyzed. detectHandwriting is if +// “true” is specified, handwriting recognition is performed. If this parameter is set to “false” or is not +// specified, printed text recognition is performed. func (client BaseClient) RecognizeText(ctx context.Context, imageURL ImageURL, detectHandwriting *bool) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -1012,6 +1029,8 @@ func (client BaseClient) RecognizeTextPreparer(ctx context.Context, imageURL Ima queryParameters := map[string]interface{}{} if detectHandwriting != nil { queryParameters["detectHandwriting"] = autorest.Encode("query", *detectHandwriting) + } else { + queryParameters["detectHandwriting"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( @@ -1048,8 +1067,8 @@ func (client BaseClient) RecognizeTextResponder(resp *http.Response) (result aut // Handwritten Text Operation Result operation. // // imageParameter is an image stream. imageParameter will be closed upon successful return. Callers should ensure -// closure when receiving an error.detectHandwriting is if “true” is specified, handwriting recognition is performed. -// If this parameter is set to “false” or is not specified, printed text recognition is performed. +// closure when receiving an error.detectHandwriting is if “true” is specified, handwriting recognition is +// performed. If this parameter is set to “false” or is not specified, printed text recognition is performed. func (client BaseClient) RecognizeTextInStream(ctx context.Context, imageParameter io.ReadCloser, detectHandwriting *bool) (result autorest.Response, err error) { req, err := client.RecognizeTextInStreamPreparer(ctx, imageParameter, detectHandwriting) if err != nil { @@ -1081,6 +1100,8 @@ func (client BaseClient) RecognizeTextInStreamPreparer(ctx context.Context, imag queryParameters := map[string]interface{}{} if detectHandwriting != nil { queryParameters["detectHandwriting"] = autorest.Encode("query", *detectHandwriting) + } else { + queryParameters["detectHandwriting"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( diff --git a/services/cognitiveservices/v1.0/computervision/models.go b/services/cognitiveservices/v1.0/computervision/models.go index 885144d1accd..619198a476ef 100644 --- a/services/cognitiveservices/v1.0/computervision/models.go +++ b/services/cognitiveservices/v1.0/computervision/models.go @@ -294,36 +294,36 @@ func (dmr *DomainModelResults) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["result"] - if v != nil { - var resultVar DomainModelResult - err = json.Unmarshal(*m["result"], &resultVar) - if err != nil { - return err + for k, v := range m { + switch k { + case "result": + if v != nil { + var domainModelResult DomainModelResult + err = json.Unmarshal(*v, &domainModelResult) + if err != nil { + return err + } + dmr.DomainModelResult = &domainModelResult + } + case "requestId": + if v != nil { + var requestID string + err = json.Unmarshal(*v, &requestID) + if err != nil { + return err + } + dmr.RequestID = &requestID + } + case "metadata": + if v != nil { + var metadata ImageMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err + } + dmr.Metadata = &metadata + } } - dmr.DomainModelResult = &resultVar - } - - v = m["requestId"] - if v != nil { - var requestID string - err = json.Unmarshal(*m["requestId"], &requestID) - if err != nil { - return err - } - dmr.RequestID = &requestID - } - - v = m["metadata"] - if v != nil { - var metadata ImageMetadata - err = json.Unmarshal(*m["metadata"], &metadata) - if err != nil { - return err - } - dmr.Metadata = &metadata } return nil @@ -391,8 +391,8 @@ type ImageCaption struct { Confidence *float64 `json:"confidence,omitempty"` } -// ImageDescription a collection of content tags, along with a list of captions sorted by confidence level, and image -// metadata. +// ImageDescription a collection of content tags, along with a list of captions sorted by confidence level, and +// image metadata. type ImageDescription struct { autorest.Response `json:"-"` *ImageDescriptionDetails `json:"description,omitempty"` @@ -405,23 +405,25 @@ func (ID *ImageDescription) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["description"] - if v != nil { - var description ImageDescriptionDetails - err = json.Unmarshal(*m["description"], &description) - if err != nil { - return err + for k, v := range m { + switch k { + case "description": + if v != nil { + var imageDescriptionDetails ImageDescriptionDetails + err = json.Unmarshal(*v, &imageDescriptionDetails) + if err != nil { + return err + } + ID.ImageDescriptionDetails = &imageDescriptionDetails + } } - ID.ImageDescriptionDetails = &description } return nil } -// ImageDescriptionDetails a collection of content tags, along with a list of captions sorted by confidence level, and -// image metadata. +// ImageDescriptionDetails a collection of content tags, along with a list of captions sorted by confidence level, +// and image metadata. type ImageDescriptionDetails struct { // Tags - A collection of image tags. Tags *[]string `json:"tags,omitempty"` diff --git a/services/cognitiveservices/v1.0/contentmoderator/imagemoderation.go b/services/cognitiveservices/v1.0/contentmoderator/imagemoderation.go index fcb45698ccf4..61f6176e7902 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/imagemoderation.go +++ b/services/cognitiveservices/v1.0/contentmoderator/imagemoderation.go @@ -52,8 +52,9 @@ func NewImageModerationClient(baseURL AzureRegionBaseURL) ImageModerationClient // EvaluateFileInput returns probabilities of the image containing racy or adult content. // -// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure when -// receiving an error.cacheImage is whether to retain the submitted image for future use; defaults to false if omitted. +// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure +// when receiving an error.cacheImage is whether to retain the submitted image for future use; defaults to false if +// omitted. func (client ImageModerationClient) EvaluateFileInput(ctx context.Context, imageStream io.ReadCloser, cacheImage *bool) (result Evaluate, err error) { req, err := client.EvaluateFileInputPreparer(ctx, imageStream, cacheImage) if err != nil { @@ -182,8 +183,8 @@ func (client ImageModerationClient) EvaluateMethodResponder(resp *http.Response) // EvaluateURLInput returns probabilities of the image containing racy or adult content. // -// contentType is the content type. imageURL is the image url. cacheImage is whether to retain the submitted image for -// future use; defaults to false if omitted. +// contentType is the content type. imageURL is the image url. cacheImage is whether to retain the submitted image +// for future use; defaults to false if omitted. func (client ImageModerationClient) EvaluateURLInput(ctx context.Context, contentType string, imageURL BodyModel, cacheImage *bool) (result Evaluate, err error) { req, err := client.EvaluateURLInputPreparer(ctx, contentType, imageURL, cacheImage) if err != nil { @@ -314,8 +315,9 @@ func (client ImageModerationClient) FindFacesResponder(resp *http.Response) (res // FindFacesFileInput returns the list of faces found. // -// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure when -// receiving an error.cacheImage is whether to retain the submitted image for future use; defaults to false if omitted. +// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure +// when receiving an error.cacheImage is whether to retain the submitted image for future use; defaults to false if +// omitted. func (client ImageModerationClient) FindFacesFileInput(ctx context.Context, imageStream io.ReadCloser, cacheImage *bool) (result FoundFaces, err error) { req, err := client.FindFacesFileInputPreparer(ctx, imageStream, cacheImage) if err != nil { @@ -380,8 +382,8 @@ func (client ImageModerationClient) FindFacesFileInputResponder(resp *http.Respo // FindFacesURLInput returns the list of faces found. // -// contentType is the content type. imageURL is the image url. cacheImage is whether to retain the submitted image for -// future use; defaults to false if omitted. +// contentType is the content type. imageURL is the image url. cacheImage is whether to retain the submitted image +// for future use; defaults to false if omitted. func (client ImageModerationClient) FindFacesURLInput(ctx context.Context, contentType string, imageURL BodyModel, cacheImage *bool) (result FoundFaces, err error) { req, err := client.FindFacesURLInputPreparer(ctx, contentType, imageURL, cacheImage) if err != nil { @@ -455,9 +457,9 @@ func (client ImageModerationClient) FindFacesURLInputResponder(resp *http.Respon // Note: Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the // response. // -// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure when -// receiving an error.listID is the list Id. cacheImage is whether to retain the submitted image for future use; -// defaults to false if omitted. +// imageStream is the image file. imageStream will be closed upon successful return. Callers should ensure closure +// when receiving an error.listID is the list Id. cacheImage is whether to retain the submitted image for future +// use; defaults to false if omitted. func (client ImageModerationClient) MatchFileInput(ctx context.Context, imageStream io.ReadCloser, listID string, cacheImage *bool) (result MatchResponse, err error) { req, err := client.MatchFileInputPreparer(ctx, imageStream, listID, cacheImage) if err != nil { @@ -607,8 +609,8 @@ func (client ImageModerationClient) MatchMethodResponder(resp *http.Response) (r // Note: Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the // response. // -// contentType is the content type. imageURL is the image url. listID is the list Id. cacheImage is whether to retain -// the submitted image for future use; defaults to false if omitted. +// contentType is the content type. imageURL is the image url. listID is the list Id. cacheImage is whether to +// retain the submitted image for future use; defaults to false if omitted. func (client ImageModerationClient) MatchURLInput(ctx context.Context, contentType string, imageURL BodyModel, listID string, cacheImage *bool) (result MatchResponse, err error) { req, err := client.MatchURLInputPreparer(ctx, contentType, imageURL, listID, cacheImage) if err != nil { @@ -679,10 +681,10 @@ func (client ImageModerationClient) MatchURLInputResponder(resp *http.Response) // OCRFileInput returns any text found in the image for the language specified. If no language is specified in input // then the detection defaults to English. // -// language is language of the terms. imageStream is the image file. imageStream will be closed upon successful return. -// Callers should ensure closure when receiving an error.cacheImage is whether to retain the submitted image for future -// use; defaults to false if omitted. enhanced is when set to True, the image goes through additional processing to -// come with additional candidates. +// language is language of the terms. imageStream is the image file. imageStream will be closed upon successful +// return. Callers should ensure closure when receiving an error.cacheImage is whether to retain the submitted +// image for future use; defaults to false if omitted. enhanced is when set to True, the image goes through +// additional processing to come with additional candidates. // // image/tiff is not supported when enhanced is set to true // @@ -723,6 +725,8 @@ func (client ImageModerationClient) OCRFileInputPreparer(ctx context.Context, la } if enhanced != nil { queryParameters["enhanced"] = autorest.Encode("query", *enhanced) + } else { + queryParameters["enhanced"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( @@ -757,9 +761,9 @@ func (client ImageModerationClient) OCRFileInputResponder(resp *http.Response) ( // OCRMethod returns any text found in the image for the language specified. If no language is specified in input then // the detection defaults to English. // -// language is language of the terms. cacheImage is whether to retain the submitted image for future use; defaults to -// false if omitted. enhanced is when set to True, the image goes through additional processing to come with additional -// candidates. +// language is language of the terms. cacheImage is whether to retain the submitted image for future use; defaults +// to false if omitted. enhanced is when set to True, the image goes through additional processing to come with +// additional candidates. // // image/tiff is not supported when enhanced is set to true // @@ -800,6 +804,8 @@ func (client ImageModerationClient) OCRMethodPreparer(ctx context.Context, langu } if enhanced != nil { queryParameters["enhanced"] = autorest.Encode("query", *enhanced) + } else { + queryParameters["enhanced"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( @@ -833,9 +839,9 @@ func (client ImageModerationClient) OCRMethodResponder(resp *http.Response) (res // OCRURLInput returns any text found in the image for the language specified. If no language is specified in input // then the detection defaults to English. // -// language is language of the terms. contentType is the content type. imageURL is the image url. cacheImage is whether -// to retain the submitted image for future use; defaults to false if omitted. enhanced is when set to True, the image -// goes through additional processing to come with additional candidates. +// language is language of the terms. contentType is the content type. imageURL is the image url. cacheImage is +// whether to retain the submitted image for future use; defaults to false if omitted. enhanced is when set to +// True, the image goes through additional processing to come with additional candidates. // // image/tiff is not supported when enhanced is set to true // @@ -876,6 +882,8 @@ func (client ImageModerationClient) OCRURLInputPreparer(ctx context.Context, lan } if enhanced != nil { queryParameters["enhanced"] = autorest.Encode("query", *enhanced) + } else { + queryParameters["enhanced"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( diff --git a/services/cognitiveservices/v1.0/contentmoderator/listmanagementimage.go b/services/cognitiveservices/v1.0/contentmoderator/listmanagementimage.go index f54b0f313049..8e8e9af7a4b9 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/listmanagementimage.go +++ b/services/cognitiveservices/v1.0/contentmoderator/listmanagementimage.go @@ -124,7 +124,8 @@ func (client ListManagementImageClient) AddImageResponder(resp *http.Response) ( // AddImageFileInput add an image to the list with list Id equal to list Id passed. // // listID is list Id of the image list. imageStream is the image file. imageStream will be closed upon successful -// return. Callers should ensure closure when receiving an error.tag is tag for the image. label is the image label. +// return. Callers should ensure closure when receiving an error.tag is tag for the image. label is the image +// label. func (client ListManagementImageClient) AddImageFileInput(ctx context.Context, listID string, imageStream io.ReadCloser, tag *int32, label string) (result Image, err error) { req, err := client.AddImageFileInputPreparer(ctx, listID, imageStream, tag, label) if err != nil { @@ -196,8 +197,8 @@ func (client ListManagementImageClient) AddImageFileInputResponder(resp *http.Re // AddImageURLInput add an image to the list with list Id equal to list Id passed. // -// listID is list Id of the image list. contentType is the content type. imageURL is the image url. tag is tag for the -// image. label is the image label. +// listID is list Id of the image list. contentType is the content type. imageURL is the image url. tag is tag for +// the image. label is the image label. func (client ListManagementImageClient) AddImageURLInput(ctx context.Context, listID string, contentType string, imageURL BodyModel, tag *int32, label string) (result Image, err error) { req, err := client.AddImageURLInputPreparer(ctx, listID, contentType, imageURL, tag, label) if err != nil { diff --git a/services/cognitiveservices/v1.0/contentmoderator/listmanagementterm.go b/services/cognitiveservices/v1.0/contentmoderator/listmanagementterm.go index b554b94c592c..8ba92af35188 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/listmanagementterm.go +++ b/services/cognitiveservices/v1.0/contentmoderator/listmanagementterm.go @@ -254,8 +254,8 @@ func (client ListManagementTermClient) DeleteTermResponder(resp *http.Response) // GetAllTerms gets all terms from the list with list Id equal to the list Id passed. // -// listID is list Id of the image list. language is language of the terms. offset is the pagination start index. limit -// is the max limit. +// listID is list Id of the image list. language is language of the terms. offset is the pagination start index. +// limit is the max limit. func (client ListManagementTermClient) GetAllTerms(ctx context.Context, listID string, language string, offset *int32, limit *int32) (result Terms, err error) { req, err := client.GetAllTermsPreparer(ctx, listID, language, offset, limit) if err != nil { diff --git a/services/cognitiveservices/v1.0/contentmoderator/models.go b/services/cognitiveservices/v1.0/contentmoderator/models.go index d74bebc66988..4dbe380917c2 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/models.go +++ b/services/cognitiveservices/v1.0/contentmoderator/models.go @@ -173,7 +173,7 @@ type CreateVideoReviewsBodyItem struct { // ContentID - Content Identifier. ContentID *string `json:"ContentId,omitempty"` // Status - Status of the video(Complete,Unpublished,Pending). Possible values include: 'Complete', 'Unpublished', 'Pending' - Status Status `json:"Status,omitempty"` + Status StatusEnum `json:"Status,omitempty"` // Timescale - Timescale of the video. Timescale *int32 `json:"Timescale,omitempty"` // CallbackEndpoint - Optional CallbackEndpoint. @@ -608,7 +608,7 @@ type Screen struct { // SetObject ... type SetObject struct { autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` } // Status status properties. diff --git a/services/cognitiveservices/v1.0/contentmoderator/reviews.go b/services/cognitiveservices/v1.0/contentmoderator/reviews.go index db72e41e3228..b53ba27f01f3 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/reviews.go +++ b/services/cognitiveservices/v1.0/contentmoderator/reviews.go @@ -77,8 +77,8 @@ func NewReviewsClient(baseURL AzureRegionBaseURL) ReviewsClient { // //

. // -// teamName is your team name. reviewID is id of the review. timescale is timescale of the video you are adding frames -// to. +// teamName is your team name. reviewID is id of the review. timescale is timescale of the video you are adding +// frames to. func (client ReviewsClient) AddVideoFrame(ctx context.Context, teamName string, reviewID string, timescale *int32) (result autorest.Response, err error) { req, err := client.AddVideoFramePreparer(ctx, teamName, reviewID, timescale) if err != nil { @@ -149,9 +149,9 @@ func (client ReviewsClient) AddVideoFrameResponder(resp *http.Response) (result // Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is // Ticks/Second. // -// contentType is the content type. teamName is your team name. reviewID is id of the review. frameImageZip is zip file -// containing frame images. frameImageZip will be closed upon successful return. Callers should ensure closure when -// receiving an error.frameMetadata is metadata of the frame. timescale is timescale of the video . +// contentType is the content type. teamName is your team name. reviewID is id of the review. frameImageZip is zip +// file containing frame images. frameImageZip will be closed upon successful return. Callers should ensure closure +// when receiving an error.frameMetadata is metadata of the frame. timescale is timescale of the video . func (client ReviewsClient) AddVideoFrameStream(ctx context.Context, contentType string, teamName string, reviewID string, frameImageZip io.ReadCloser, frameMetadata string, timescale *int32) (result autorest.Response, err error) { req, err := client.AddVideoFrameStreamPreparer(ctx, contentType, teamName, reviewID, frameImageZip, frameMetadata, timescale) if err != nil { @@ -229,8 +229,8 @@ func (client ReviewsClient) AddVideoFrameStreamResponder(resp *http.Response) (r // Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is // Ticks/Second. // -// contentType is the content type. teamName is your team name. reviewID is id of the review. videoFrameBody is body -// for add video frames API timescale is timescale of the video. +// contentType is the content type. teamName is your team name. reviewID is id of the review. videoFrameBody is +// body for add video frames API timescale is timescale of the video. func (client ReviewsClient) AddVideoFrameURL(ctx context.Context, contentType string, teamName string, reviewID string, videoFrameBody []VideoFrameBodyItem, timescale *int32) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: videoFrameBody, @@ -308,11 +308,10 @@ func (client ReviewsClient) AddVideoFrameURLResponder(resp *http.Response) (resu // AddVideoTranscript this API adds a transcript file (text version of all the words spoken in a video) to a video // review. The file should be a valid WebVTT format. // -// teamName is your team name. reviewID is id of the review. contentType is the content type. vttfile is transcript -// file of the video. vttfile will be closed upon successful return. Callers should ensure closure when receiving an -// error. -func (client ReviewsClient) AddVideoTranscript(ctx context.Context, teamName string, reviewID string, contentType string, vttfile io.ReadCloser) (result autorest.Response, err error) { - req, err := client.AddVideoTranscriptPreparer(ctx, teamName, reviewID, contentType, vttfile) +// teamName is your team name. reviewID is id of the review. vttfile is transcript file of the video. vttfile will +// be closed upon successful return. Callers should ensure closure when receiving an error. +func (client ReviewsClient) AddVideoTranscript(ctx context.Context, teamName string, reviewID string, vttfile io.ReadCloser) (result autorest.Response, err error) { + req, err := client.AddVideoTranscriptPreparer(ctx, teamName, reviewID, vttfile) if err != nil { err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscript", nil, "Failure preparing request") return @@ -334,7 +333,7 @@ func (client ReviewsClient) AddVideoTranscript(ctx context.Context, teamName str } // AddVideoTranscriptPreparer prepares the AddVideoTranscript request. -func (client ReviewsClient) AddVideoTranscriptPreparer(ctx context.Context, teamName string, reviewID string, contentType string, vttfile io.ReadCloser) (*http.Request, error) { +func (client ReviewsClient) AddVideoTranscriptPreparer(ctx context.Context, teamName string, reviewID string, vttfile io.ReadCloser) (*http.Request, error) { urlParameters := map[string]interface{}{ "baseUrl": client.BaseURL, } @@ -349,7 +348,7 @@ func (client ReviewsClient) AddVideoTranscriptPreparer(ctx context.Context, team autorest.WithCustomBaseURL("https://{baseUrl}", urlParameters), autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript", pathParameters), autorest.WithFile(vttfile), - autorest.WithHeader("Content-Type", autorest.String(contentType))) + autorest.WithHeader("Content-Type", "text/plain")) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -376,8 +375,8 @@ func (client ReviewsClient) AddVideoTranscriptResponder(resp *http.Response) (re // screen text result file is a result of Screen Text API . In order to generate transcript screen text result file , a // transcript file has to be screened for profanity using Screen Text API. // -// contentType is the content type. teamName is your team name. reviewID is id of the review. transcriptModerationBody -// is body for add video transcript moderation result API +// contentType is the content type. teamName is your team name. reviewID is id of the review. +// transcriptModerationBody is body for add video transcript moderation result API func (client ReviewsClient) AddVideoTranscriptModerationResult(ctx context.Context, contentType string, teamName string, reviewID string, transcriptModerationBody []TranscriptModerationBodyItem) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: transcriptModerationBody, @@ -705,8 +704,8 @@ func (client ReviewsClient) CreateReviewsResponder(resp *http.Response) (result // //

. // -// contentType is the content type. teamName is your team name. createVideoReviewsBody is body for create reviews API -// subTeam is subTeam of your team, you want to assign the created review to. +// contentType is the content type. teamName is your team name. createVideoReviewsBody is body for create reviews +// API subTeam is subTeam of your team, you want to assign the created review to. func (client ReviewsClient) CreateVideoReviews(ctx context.Context, contentType string, teamName string, createVideoReviewsBody []CreateVideoReviewsBodyItem, subTeam string) (result ListString, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: createVideoReviewsBody, @@ -933,8 +932,9 @@ func (client ReviewsClient) GetReviewResponder(resp *http.Response) (result Revi // //

. // -// teamName is your team name. reviewID is id of the review. startSeed is time stamp of the frame from where you want -// to start fetching the frames. noOfRecords is number of frames to fetch. filter is get frames filtered by tags. +// teamName is your team name. reviewID is id of the review. startSeed is time stamp of the frame from where you +// want to start fetching the frames. noOfRecords is number of frames to fetch. filter is get frames filtered by +// tags. func (client ReviewsClient) GetVideoFrames(ctx context.Context, teamName string, reviewID string, startSeed *int32, noOfRecords *int32, filter string) (result Frames, err error) { req, err := client.GetVideoFramesPreparer(ctx, teamName, reviewID, startSeed, noOfRecords, filter) if err != nil { diff --git a/services/cognitiveservices/v1.0/contentmoderator/textmoderation.go b/services/cognitiveservices/v1.0/contentmoderator/textmoderation.go index 06d36a71c17e..6f887a07c721 100644 --- a/services/cognitiveservices/v1.0/contentmoderator/textmoderation.go +++ b/services/cognitiveservices/v1.0/contentmoderator/textmoderation.go @@ -115,8 +115,8 @@ func (client TextModerationClient) DetectLanguageResponder(resp *http.Response) // ScreenText detects profanity in more than 100 languages and match against custom and shared blacklists. // // language is language of the terms. textContentType is the content type. textContent is content to screen. -// autocorrect is autocorrect text. pii is detect personal identifiable information. listID is the list Id. classify is -// classify input. +// autocorrect is autocorrect text. pii is detect personal identifiable information. listID is the list Id. +// classify is classify input. func (client TextModerationClient) ScreenText(ctx context.Context, language string, textContentType string, textContent string, autocorrect *bool, pii *bool, listID string, classify *bool) (result Screen, err error) { req, err := client.ScreenTextPreparer(ctx, language, textContentType, textContent, autocorrect, pii, listID, classify) if err != nil { @@ -150,15 +150,21 @@ func (client TextModerationClient) ScreenTextPreparer(ctx context.Context, langu } if autocorrect != nil { queryParameters["autocorrect"] = autorest.Encode("query", *autocorrect) + } else { + queryParameters["autocorrect"] = autorest.Encode("query", false) } if pii != nil { queryParameters["PII"] = autorest.Encode("query", *pii) + } else { + queryParameters["PII"] = autorest.Encode("query", false) } if len(listID) > 0 { queryParameters["listId"] = autorest.Encode("query", listID) } if classify != nil { queryParameters["classify"] = autorest.Encode("query", *classify) + } else { + queryParameters["classify"] = autorest.Encode("query", false) } preparer := autorest.CreatePreparer( diff --git a/services/cognitiveservices/v1.0/face/face.go b/services/cognitiveservices/v1.0/face/face.go index b6ceab6d5172..dd68928f5cd9 100644 --- a/services/cognitiveservices/v1.0/face/face.go +++ b/services/cognitiveservices/v1.0/face/face.go @@ -40,9 +40,9 @@ func NewClient(azureRegion AzureRegions) Client { // and attributes. // // imageParameter is an image stream. imageParameter will be closed upon successful return. Callers should ensure -// closure when receiving an error.returnFaceID is a value indicating whether the operation should return faceIds of -// detected faces. returnFaceLandmarks is a value indicating whether the operation should return landmarks of the -// detected faces. returnFaceAttributes is analyze and return the one or more specified face attributes in the +// closure when receiving an error.returnFaceID is a value indicating whether the operation should return faceIds +// of detected faces. returnFaceLandmarks is a value indicating whether the operation should return landmarks of +// the detected faces. returnFaceAttributes is analyze and return the one or more specified face attributes in the // comma-separated string like "returnFaceAttributes=age,gender". Supported face attributes include age, gender, // headPose, smile, facialHair, glasses and emotion. Note that each face attribute analysis has additional // computational and time cost. @@ -77,9 +77,13 @@ func (client Client) DetectWithStreamPreparer(ctx context.Context, imageParamete queryParameters := map[string]interface{}{} if returnFaceID != nil { queryParameters["returnFaceId"] = autorest.Encode("query", *returnFaceID) + } else { + queryParameters["returnFaceId"] = autorest.Encode("query", true) } if returnFaceLandmarks != nil { queryParameters["returnFaceLandmarks"] = autorest.Encode("query", *returnFaceLandmarks) + } else { + queryParameters["returnFaceLandmarks"] = autorest.Encode("query", false) } if returnFaceAttributes != nil && len(returnFaceAttributes) > 0 { queryParameters["returnFaceAttributes"] = autorest.Encode("query", returnFaceAttributes, ",") @@ -118,11 +122,11 @@ func (client Client) DetectWithStreamResponder(resp *http.Response) (result List // attributes. // // imageURL is a JSON document with a URL pointing to the image that is to be analyzed. returnFaceID is a value -// indicating whether the operation should return faceIds of detected faces. returnFaceLandmarks is a value indicating -// whether the operation should return landmarks of the detected faces. returnFaceAttributes is analyze and return the -// one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". -// Supported face attributes include age, gender, headPose, smile, facialHair, glasses and emotion. Note that each face -// attribute analysis has additional computational and time cost. +// indicating whether the operation should return faceIds of detected faces. returnFaceLandmarks is a value +// indicating whether the operation should return landmarks of the detected faces. returnFaceAttributes is analyze +// and return the one or more specified face attributes in the comma-separated string like +// "returnFaceAttributes=age,gender". Supported face attributes include age, gender, headPose, smile, facialHair, +// glasses and emotion. Note that each face attribute analysis has additional computational and time cost. func (client Client) DetectWithURL(ctx context.Context, imageURL ImageURL, returnFaceID *bool, returnFaceLandmarks *bool, returnFaceAttributes []AttributeType) (result ListDetectedFace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -160,9 +164,13 @@ func (client Client) DetectWithURLPreparer(ctx context.Context, imageURL ImageUR queryParameters := map[string]interface{}{} if returnFaceID != nil { queryParameters["returnFaceId"] = autorest.Encode("query", *returnFaceID) + } else { + queryParameters["returnFaceId"] = autorest.Encode("query", true) } if returnFaceLandmarks != nil { queryParameters["returnFaceLandmarks"] = autorest.Encode("query", *returnFaceLandmarks) + } else { + queryParameters["returnFaceLandmarks"] = autorest.Encode("query", false) } if returnFaceAttributes != nil && len(returnFaceAttributes) > 0 { queryParameters["returnFaceAttributes"] = autorest.Encode("query", returnFaceAttributes, ",") diff --git a/services/cognitiveservices/v1.0/face/list.go b/services/cognitiveservices/v1.0/face/list.go index a3de19ee96a9..9e677dd87867 100644 --- a/services/cognitiveservices/v1.0/face/list.go +++ b/services/cognitiveservices/v1.0/face/list.go @@ -41,11 +41,11 @@ func NewListClient(azureRegion AzureRegions) ListClient { // returns a persistedFaceId representing the added face, and persistedFaceId will not expire. // // faceListID is id referencing a particular face list. imageParameter is an image stream. imageParameter will be -// closed upon successful return. Callers should ensure closure when receiving an error.userData is user-specified data -// about the face for any purpose. The maximum length is 1KB. targetFace is a face rectangle to specify the target face -// to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If -// there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means -// there is only one face detected in the entire image. +// closed upon successful return. Callers should ensure closure when receiving an error.userData is user-specified +// data about the face for any purpose. The maximum length is 1KB. targetFace is a face rectangle to specify the +// target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. +// "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which +// face to add. No targetFace means there is only one face detected in the entire image. func (client ListClient) AddFaceFromStream(ctx context.Context, faceListID string, imageParameter io.ReadCloser, userData string, targetFace []int32) (result PersistedFace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: faceListID, @@ -127,12 +127,12 @@ func (client ListClient) AddFaceFromStreamResponder(resp *http.Response) (result // AddFaceFromURL add a face to a face list. The input face is specified as an image with a targetFace rectangle. It // returns a persistedFaceId representing the added face, and persistedFaceId will not expire. // -// faceListID is id referencing a particular face list. imageURL is a JSON document with a URL pointing to the image -// that is to be analyzed. userData is user-specified data about the face for any purpose. The maximum length is 1KB. -// targetFace is a face rectangle to specify the target face to be added to a person in the format of -// "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, -// targetFace is required to specify which face to add. No targetFace means there is only one face detected in the -// entire image. +// faceListID is id referencing a particular face list. imageURL is a JSON document with a URL pointing to the +// image that is to be analyzed. userData is user-specified data about the face for any purpose. The maximum length +// is 1KB. targetFace is a face rectangle to specify the target face to be added to a person in the format of +// "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the +// image, targetFace is required to specify which face to add. No targetFace means there is only one face detected +// in the entire image. func (client ListClient) AddFaceFromURL(ctx context.Context, faceListID string, imageURL ImageURL, userData string, targetFace []int32) (result PersistedFace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: faceListID, @@ -361,8 +361,8 @@ func (client ListClient) DeleteResponder(resp *http.Response) (result autorest.R // DeleteFace delete an existing face from a face list (given by a persisitedFaceId and a faceListId). Persisted image // related to the face will also be deleted. // -// faceListID is id referencing a particular face list. persistedFaceID is id referencing a particular persistedFaceId -// of an existing face. +// faceListID is id referencing a particular face list. persistedFaceID is id referencing a particular +// persistedFaceId of an existing face. func (client ListClient) DeleteFace(ctx context.Context, faceListID string, persistedFaceID uuid.UUID) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: faceListID, @@ -432,7 +432,7 @@ func (client ListClient) DeleteFaceResponder(resp *http.Response) (result autore // Get retrieve a face list's information. // // faceListID is id referencing a particular face list. -func (client ListClient) Get(ctx context.Context, faceListID string) (result ListType, err error) { +func (client ListClient) Get(ctx context.Context, faceListID string) (result List, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: faceListID, Constraints: []validation.Constraint{{Target: "faceListID", Name: validation.MaxLength, Rule: 64, Chain: nil}, @@ -487,7 +487,7 @@ func (client ListClient) GetSender(req *http.Request) (*http.Response, error) { // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ListClient) GetResponder(resp *http.Response) (result ListType, err error) { +func (client ListClient) GetResponder(resp *http.Response) (result List, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -499,7 +499,7 @@ func (client ListClient) GetResponder(resp *http.Response) (result ListType, err } // List retrieve information about all existing face lists. Only faceListId, name and userData will be returned. -func (client ListClient) List(ctx context.Context) (result ListListType, err error) { +func (client ListClient) List(ctx context.Context) (result ListList, err error) { req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "face.ListClient", "List", nil, "Failure preparing request") @@ -543,7 +543,7 @@ func (client ListClient) ListSender(req *http.Request) (*http.Response, error) { // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client ListClient) ListResponder(resp *http.Response) (result ListListType, err error) { +func (client ListClient) ListResponder(resp *http.Response) (result ListList, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/cognitiveservices/v1.0/face/models.go b/services/cognitiveservices/v1.0/face/models.go index f27a3525777c..b6524705b219 100644 --- a/services/cognitiveservices/v1.0/face/models.go +++ b/services/cognitiveservices/v1.0/face/models.go @@ -427,6 +427,19 @@ type Landmarks struct { UnderLipBottom *Coordinate `json:"underLipBottom,omitempty"` } +// List face list object. +type List struct { + autorest.Response `json:"-"` + // FaceListID - FaceListId of the target face list. + FaceListID *string `json:"faceListId,omitempty"` + // PersistedFaces - Persisted faces within the face list. + PersistedFaces *[]PersistedFace `json:"persistedFaces,omitempty"` + // Name - User defined name, maximum length is 128. + Name *string `json:"name,omitempty"` + // UserData - User specified data. Length should not exceed 16KB. + UserData *string `json:"userData,omitempty"` +} + // ListDetectedFace ... type ListDetectedFace struct { autorest.Response `json:"-"` @@ -439,10 +452,10 @@ type ListIdentifyResult struct { Value *[]IdentifyResult `json:"value,omitempty"` } -// ListListType ... -type ListListType struct { +// ListList ... +type ListList struct { autorest.Response `json:"-"` - Value *[]ListType `json:"value,omitempty"` + Value *[]List `json:"value,omitempty"` } // ListPerson ... @@ -463,19 +476,6 @@ type ListSimilarFace struct { Value *[]SimilarFace `json:"value,omitempty"` } -// ListType face list object. -type ListType struct { - autorest.Response `json:"-"` - // Name - User defined name, maximum length is 128. - Name *string `json:"name,omitempty"` - // UserData - User specified data. Length should not exceed 16KB. - UserData *string `json:"userData,omitempty"` - // FaceListID - FaceListId of the target face list. - FaceListID *string `json:"faceListId,omitempty"` - // PersistedFaces - Persisted faces within the face list. - PersistedFaces *[]PersistedFace `json:"persistedFaces,omitempty"` -} - // Makeup properties describing present makeups on a given face. type Makeup struct { // EyeMakeup - A boolean value describing whether eye makeup is present on a face. @@ -484,8 +484,8 @@ type Makeup struct { LipMakeup *bool `json:"lipMakeup,omitempty"` } -// NameAndUserDataContract a combination of user defined name and user specified data for the person, personGroup, and -// faceList +// NameAndUserDataContract a combination of user defined name and user specified data for the person, personGroup, +// and faceList type NameAndUserDataContract struct { // Name - User defined name, maximum length is 128. Name *string `json:"name,omitempty"` @@ -523,25 +523,25 @@ type PersistedFace struct { // Person person object. type Person struct { autorest.Response `json:"-"` - // Name - User defined name, maximum length is 128. - Name *string `json:"name,omitempty"` - // UserData - User specified data. Length should not exceed 16KB. - UserData *string `json:"userData,omitempty"` // PersonID - PersonId of the target face list. PersonID *uuid.UUID `json:"personId,omitempty"` // PersistedFaceIds - PersistedFaceIds of registered faces in the person. These persistedFaceIds are returned from Person - Add a Person Face, and will not expire. PersistedFaceIds *[]uuid.UUID `json:"persistedFaceIds,omitempty"` + // Name - User defined name, maximum length is 128. + Name *string `json:"name,omitempty"` + // UserData - User specified data. Length should not exceed 16KB. + UserData *string `json:"userData,omitempty"` } // PersonGroup person group object. type PersonGroup struct { autorest.Response `json:"-"` + // PersonGroupID - PersonGroupId of the existing person groups. + PersonGroupID *string `json:"personGroupId,omitempty"` // Name - User defined name, maximum length is 128. Name *string `json:"name,omitempty"` // UserData - User specified data. Length should not exceed 16KB. UserData *string `json:"userData,omitempty"` - // PersonGroupID - PersonGroupId of the existing person groups. - PersonGroupID *string `json:"personGroupId,omitempty"` } // Rectangle a rectangle within which a face can be found diff --git a/services/cognitiveservices/v1.0/face/persongroup.go b/services/cognitiveservices/v1.0/face/persongroup.go index 6ed8756d4942..733114e2d164 100644 --- a/services/cognitiveservices/v1.0/face/persongroup.go +++ b/services/cognitiveservices/v1.0/face/persongroup.go @@ -366,6 +366,8 @@ func (client PersonGroupClient) ListPreparer(ctx context.Context, start string, } if top != nil { queryParameters["top"] = autorest.Encode("query", *top) + } else { + queryParameters["top"] = autorest.Encode("query", 1000) } preparer := autorest.CreatePreparer( diff --git a/services/cognitiveservices/v1.0/face/persongroupperson.go b/services/cognitiveservices/v1.0/face/persongroupperson.go index f2b34b9da12f..d4a33a256b16 100644 --- a/services/cognitiveservices/v1.0/face/persongroupperson.go +++ b/services/cognitiveservices/v1.0/face/persongroupperson.go @@ -42,11 +42,11 @@ func NewPersonGroupPersonClient(azureRegion AzureRegions) PersonGroupPersonClien // // personGroupID is id referencing a particular person group. personID is id referencing a particular person. // imageParameter is an image stream. imageParameter will be closed upon successful return. Callers should ensure -// closure when receiving an error.userData is user-specified data about the face for any purpose. The maximum length -// is 1KB. targetFace is a face rectangle to specify the target face to be added to a person in the format of -// "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, -// targetFace is required to specify which face to add. No targetFace means there is only one face detected in the -// entire image. +// closure when receiving an error.userData is user-specified data about the face for any purpose. The maximum +// length is 1KB. targetFace is a face rectangle to specify the target face to be added to a person in the format +// of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the +// image, targetFace is required to specify which face to add. No targetFace means there is only one face detected +// in the entire image. func (client PersonGroupPersonClient) AddPersonFaceFromStream(ctx context.Context, personGroupID string, personID uuid.UUID, imageParameter io.ReadCloser, userData string, targetFace []int32) (result PersistedFace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: personGroupID, @@ -129,12 +129,12 @@ func (client PersonGroupPersonClient) AddPersonFaceFromStreamResponder(resp *htt // AddPersonFaceFromURL add a representative face to a person for identification. The input face is specified as an // image with a targetFace rectangle. // -// personGroupID is id referencing a particular person group. personID is id referencing a particular person. imageURL -// is a JSON document with a URL pointing to the image that is to be analyzed. userData is user-specified data about -// the face for any purpose. The maximum length is 1KB. targetFace is a face rectangle to specify the target face to be -// added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is -// more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is -// only one face detected in the entire image. +// personGroupID is id referencing a particular person group. personID is id referencing a particular person. +// imageURL is a JSON document with a URL pointing to the image that is to be analyzed. userData is user-specified +// data about the face for any purpose. The maximum length is 1KB. targetFace is a face rectangle to specify the +// target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. +// "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which +// face to add. No targetFace means there is only one face detected in the entire image. func (client PersonGroupPersonClient) AddPersonFaceFromURL(ctx context.Context, personGroupID string, personID uuid.UUID, imageURL ImageURL, userData string, targetFace []int32) (result PersistedFace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: personGroupID, @@ -664,8 +664,8 @@ func (client PersonGroupPersonClient) ListResponder(resp *http.Response) (result // Update update name or userData of a person. // -// personGroupID is id referencing a particular person group. personID is id referencing a particular person. body is -// request body for person update operation. +// personGroupID is id referencing a particular person group. personID is id referencing a particular person. body +// is request body for person update operation. func (client PersonGroupPersonClient) Update(ctx context.Context, personGroupID string, personID uuid.UUID, body NameAndUserDataContract) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: personGroupID, diff --git a/services/cognitiveservices/v2.0/luis/programmatic/apps.go b/services/cognitiveservices/v2.0/luis/programmatic/apps.go new file mode 100644 index 000000000000..26317551f554 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/apps.go @@ -0,0 +1,1163 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// AppsClient is the client for the Apps methods of the Programmatic service. +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(azureRegion AzureRegions) AppsClient { + return AppsClient{New(azureRegion)} +} + +// Add creates a new LUIS app. +// +// applicationCreateObject is a model 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 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.NewErrorWithValidationError(err, "programmatic.AppsClient", "Add") + } + + req, err := client.AddPreparer(ctx, applicationCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 models as a new application. +// +// prebuiltDomainCreateObject is 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) { + req, err := client.AddCustomPrebuiltDomainPreparer(ctx, prebuiltDomainCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "AddCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. +func (client AppsClient) Delete(ctx context.Context, appID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeletePreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.AppsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}", 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 AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 query logs of the past month for the application. +// +// appID is the application ID. +func (client AppsClient) DownloadQueryLogs(ctx context.Context, appID uuid.UUID) (result ReadCloser, err error) { + req, err := client.DownloadQueryLogsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "DownloadQueryLogs", resp, "Failure sending request") + return + } + + result, err = client.DownloadQueryLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. +func (client AppsClient) Get(ctx context.Context, appID uuid.UUID) (result ApplicationInfoResponse, err error) { + req, err := client.GetPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetSettings get the application settings. +// +// appID is the application ID. +func (client AppsClient) GetSettings(ctx context.Context, appID uuid.UUID) (result ApplicationSettings, err error) { + req, err := client.GetSettingsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "GetSettings", resp, "Failure sending request") + return + } + + result, err = client.GetSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 should be included in in the request body. +// +// luisApp is a LUIS application structure. appName is the application name to create. If not specified, the +// application name will be read from the imported object. +func (client AppsClient) Import(ctx context.Context, luisApp LuisApp, appName string) (result UUID, err error) { + req, err := client.ImportPreparer(ctx, luisApp, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Import", resp, "Failure sending request") + return + } + + result, err = client.ImportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + queryParameters := map[string]interface{}{} + if len(appName) > 0 { + queryParameters["appName"] = autorest.Encode("query", appName) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 applications. +// +// skip is the number of entries to skip. Default value is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.AppsClient", "List") + } + + req, err := client.ListPreparer(ctx, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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) { + req, err := client.ListAvailableCustomPrebuiltDomainsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListAvailableCustomPrebuiltDomains", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableCustomPrebuiltDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 custom prebuilt domains for a specific culture. +// +// culture is culture. +func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCulture(ctx context.Context, culture string) (result ListPrebuiltDomain, err error) { + req, err := client.ListAvailableCustomPrebuiltDomainsForCulturePreparer(ctx, culture) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableCustomPrebuiltDomainsForCultureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "culture": autorest.Encode("path", culture), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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) { + req, err := client.ListCortanaEndpointsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListCortanaEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListCortanaEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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) { + req, err := client.ListDomainsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListDomains", resp, "Failure sending request") + return + } + + result, err = client.ListDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. +func (client AppsClient) ListEndpoints(ctx context.Context, appID uuid.UUID) (result SetString, err error) { + req, err := client.ListEndpointsPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the supported application cultures. +func (client AppsClient) ListSupportedCultures(ctx context.Context) (result ListAvailableCulture, err error) { + req, err := client.ListSupportedCulturesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListSupportedCultures", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedCulturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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) { + req, err := client.ListUsageScenariosPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "ListUsageScenarios", resp, "Failure sending request") + return + } + + result, err = client.ListUsageScenariosResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// Publish publishes a specific version of the application. +// +// appID is the application ID. applicationPublishObject is 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) { + req, err := client.PublishPreparer(ctx, appID, applicationPublishObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Publish", resp, "Failure sending request") + return + } + + result, err = client.PublishResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the name or description of the application. +// +// appID is the application ID. applicationUpdateObject is 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) { + req, err := client.UpdatePreparer(ctx, appID, applicationUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdateSettings updates the application settings. +// +// appID is the application ID. applicationSettingUpdateObject is an object containing the new application +// settings. +func (client AppsClient) UpdateSettings(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject ApplicationSettingUpdateObject) (result OperationStatus, err error) { + req, err := client.UpdateSettingsPreparer(ctx, appID, applicationSettingUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.AppsClient", "UpdateSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/client.go b/services/cognitiveservices/v2.0/luis/programmatic/client.go new file mode 100644 index 000000000000..bacfa5957703 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/client.go @@ -0,0 +1,44 @@ +// Package programmatic implements the Azure ARM Programmatic service API version v2.0. +// +// +package programmatic + +// 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 Programmatic. +type BaseClient struct { + autorest.Client + AzureRegion AzureRegions +} + +// New creates an instance of the BaseClient client. +func New(azureRegion AzureRegions) BaseClient { + return NewWithoutDefaults(azureRegion) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + AzureRegion: azureRegion, + } +} diff --git a/services/cognitiveservices/v2.0/luis/programmatic/examples.go b/services/cognitiveservices/v2.0/luis/programmatic/examples.go new file mode 100644 index 000000000000..86f3fb1b3478 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/examples.go @@ -0,0 +1,327 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// ExamplesClient is the client for the Examples methods of the Programmatic service. +type ExamplesClient struct { + BaseClient +} + +// NewExamplesClient creates an instance of the ExamplesClient client. +func NewExamplesClient(azureRegion AzureRegions) ExamplesClient { + return ExamplesClient{New(azureRegion)} +} + +// Add adds a labeled example to the application. +// +// appID is the application ID. versionID is the version ID. exampleLabelObject is an example label with the +// expected intent and entities. +func (client ExamplesClient) Add(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObject ExampleLabelObject) (result LabelExampleResponse, err error) { + req, err := client.AddPreparer(ctx, appID, versionID, exampleLabelObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ExamplesClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 examples to the application. +// +// appID is the application ID. versionID is the version ID. exampleLabelObjectArray is array of examples. +func (client ExamplesClient) Batch(ctx context.Context, appID uuid.UUID, versionID string, exampleLabelObjectArray []ExampleLabelObject) (result ListBatchLabelExample, err error) { + 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.NewErrorWithValidationError(err, "programmatic.ExamplesClient", "Batch") + } + + req, err := client.BatchPreparer(ctx, appID, versionID, exampleLabelObjectArray) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ExamplesClient", "Batch", resp, "Failure sending request") + return + } + + result, err = client.BatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 with the specified ID. +// +// appID is the application ID. versionID is the version ID. exampleID is the example ID. +func (client ExamplesClient) Delete(ctx context.Context, appID uuid.UUID, versionID string, exampleID int32) (result OperationStatus, err error) { + req, err := client.DeletePreparer(ctx, appID, versionID, exampleID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ExamplesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 examples to be reviewed. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ExamplesClient", "List") + } + + req, err := client.ListPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ExamplesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/features.go b/services/cognitiveservices/v2.0/luis/programmatic/features.go new file mode 100644 index 000000000000..0bf429606ad1 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/features.go @@ -0,0 +1,481 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// FeaturesClient is the client for the Features methods of the Programmatic service. +type FeaturesClient struct { + BaseClient +} + +// NewFeaturesClient creates an instance of the FeaturesClient client. +func NewFeaturesClient(azureRegion AzureRegions) FeaturesClient { + return FeaturesClient{New(azureRegion)} +} + +// AddPhraseList creates a new phraselist feature. +// +// appID is the application ID. versionID is the version ID. phraselistCreateObject is 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) { + req, err := client.AddPhraseListPreparer(ctx, appID, versionID, phraselistCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "AddPhraseList", resp, "Failure sending request") + return + } + + result, err = client.AddPhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeletePhraseList deletes a phraselist feature. +// +// appID is the application ID. versionID is the version ID. phraselistID is 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) { + req, err := client.DeletePhraseListPreparer(ctx, appID, versionID, phraselistID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "DeletePhraseList", resp, "Failure sending request") + return + } + + result, err = client.DeletePhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetPhraseList gets phraselist feature info. +// +// appID is the application ID. versionID is the version ID. phraselistID is 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) { + req, err := client.GetPhraseListPreparer(ctx, appID, versionID, phraselistID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "GetPhraseList", resp, "Failure sending request") + return + } + + result, err = client.GetPhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 features for the specified application version. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.FeaturesClient", "List") + } + + req, err := client.ListPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListPhraseLists gets all the phraselist features. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.FeaturesClient", "ListPhraseLists") + } + + req, err := client.ListPhraseListsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "ListPhraseLists", resp, "Failure sending request") + return + } + + result, err = client.ListPhraseListsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdatePhraseList updates the phrases, the state and the name of the phraselist feature. +// +// appID is the application ID. versionID is the version ID. phraselistID is the ID of the feature to be updated. +// phraselistUpdateObject is 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) { + req, err := client.UpdatePhraseListPreparer(ctx, appID, versionID, phraselistID, phraselistUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.FeaturesClient", "UpdatePhraseList", resp, "Failure sending request") + return + } + + result, err = client.UpdatePhraseListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "phraselistId": autorest.Encode("path", phraselistID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/model.go b/services/cognitiveservices/v2.0/luis/programmatic/model.go new file mode 100644 index 000000000000..bcbfa1ec33f1 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/model.go @@ -0,0 +1,3523 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// ModelClient is the client for the Model methods of the Programmatic service. +type ModelClient struct { + BaseClient +} + +// NewModelClient creates an instance of the ModelClient client. +func NewModelClient(azureRegion AzureRegions) ModelClient { + return ModelClient{New(azureRegion)} +} + +// AddClosedList adds a closed list model to the application. +// +// appID is the application ID. versionID is the version ID. closedListModelCreateObject is a model containing the +// name and words for the new closed list entity extractor. +func (client ModelClient) AddClosedList(ctx context.Context, appID uuid.UUID, versionID string, closedListModelCreateObject ClosedListModelCreateObject) (result UUID, err error) { + req, err := client.AddClosedListPreparer(ctx, appID, versionID, closedListModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddClosedList", resp, "Failure sending request") + return + } + + result, err = client.AddClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// AddCompositeEntity adds a composite entity extractor to the application. +// +// appID is the application ID. versionID is the version ID. compositeModelCreateObject is a model containing the +// name and children of the new entity extractor. +func (client ModelClient) AddCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, compositeModelCreateObject CompositeEntityModel) (result UUID, err error) { + req, err := client.AddCompositeEntityPreparer(ctx, appID, versionID, compositeModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddCompositeEntity", nil, "Failure preparing request") + return + } + + resp, err := client.AddCompositeEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.AddCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddCompositeEntity", resp, "Failure responding to request") + } + + return +} + +// AddCompositeEntityPreparer prepares the AddCompositeEntity request. +func (client ModelClient) AddCompositeEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, compositeModelCreateObject CompositeEntityModel) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/compositeentities", pathParameters), + autorest.WithJSON(compositeModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCompositeEntitySender sends the AddCompositeEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddCompositeEntitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddCompositeEntityResponder handles the response to the AddCompositeEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) AddCompositeEntityResponder(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. +// +// appID is the application ID. versionID is the version ID. cEntityID is the composite entity extractor ID. +// compositeChildModelCreateObject is 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) { + req, err := client.AddCompositeEntityChildPreparer(ctx, appID, versionID, cEntityID, compositeChildModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddCompositeEntityChild", resp, "Failure sending request") + return + } + + result, err = client.AddCompositeEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 models to this application. +// +// appID is the application ID. versionID is the version ID. prebuiltDomainObject is 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) { + req, err := client.AddCustomPrebuiltDomainPreparer(ctx, appID, versionID, prebuiltDomainObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 custom prebuilt entity model to the application. +// +// appID is the application ID. versionID is the version ID. prebuiltDomainModelCreateObject is a model object +// containing the name of the custom 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) { + req, err := client.AddCustomPrebuiltEntityPreparer(ctx, appID, versionID, prebuiltDomainModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddCustomPrebuiltEntity", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 custom prebuilt intent model to the application. +// +// appID is the application ID. versionID is the version ID. prebuiltDomainModelCreateObject is a model object +// containing the name of the custom 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) { + req, err := client.AddCustomPrebuiltIntentPreparer(ctx, appID, versionID, prebuiltDomainModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddCustomPrebuiltIntent", resp, "Failure sending request") + return + } + + result, err = client.AddCustomPrebuiltIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the application. +// +// appID is the application ID. versionID is the version ID. modelCreateObject is a model object containing the +// name for the new entity extractor. +func (client ModelClient) AddEntity(ctx context.Context, appID uuid.UUID, versionID string, modelCreateObject ModelCreateObject) (result UUID, err error) { + req, err := client.AddEntityPreparer(ctx, appID, versionID, modelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddEntity", resp, "Failure sending request") + return + } + + result, err = client.AddEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, modelCreateObject ModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities", pathParameters), + autorest.WithJSON(modelCreateObject)) + 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// AddHierarchicalEntity adds a hierarchical entity extractor to the application version. +// +// appID is the application ID. versionID is the version ID. hierarchicalModelCreateObject is a model containing +// the name and children of the new entity extractor. +func (client ModelClient) AddHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hierarchicalModelCreateObject HierarchicalEntityModel) (result UUID, err error) { + req, err := client.AddHierarchicalEntityPreparer(ctx, appID, versionID, hierarchicalModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntity", nil, "Failure preparing request") + return + } + + resp, err := client.AddHierarchicalEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.AddHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntity", resp, "Failure responding to request") + } + + return +} + +// AddHierarchicalEntityPreparer prepares the AddHierarchicalEntity request. +func (client ModelClient) AddHierarchicalEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, hierarchicalModelCreateObject HierarchicalEntityModel) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities", pathParameters), + autorest.WithJSON(hierarchicalModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddHierarchicalEntitySender sends the AddHierarchicalEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddHierarchicalEntitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddHierarchicalEntityResponder handles the response to the AddHierarchicalEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) AddHierarchicalEntityResponder(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 +} + +// AddHierarchicalEntityChild creates a single child in an existing hierarchical entity model. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +// hierarchicalChildModelCreateObject is a model object containing the name of the new hierarchical child model. +func (client ModelClient) AddHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hierarchicalChildModelCreateObject HierarchicalChildModelCreateObject) (result UUID, err error) { + req, err := client.AddHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hierarchicalChildModelCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntityChild", nil, "Failure preparing request") + return + } + + resp, err := client.AddHierarchicalEntityChildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.AddHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "AddHierarchicalEntityChild", resp, "Failure responding to request") + } + + return +} + +// AddHierarchicalEntityChildPreparer prepares the AddHierarchicalEntityChild request. +func (client ModelClient) AddHierarchicalEntityChildPreparer(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hierarchicalChildModelCreateObject HierarchicalChildModelCreateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children", pathParameters), + autorest.WithJSON(hierarchicalChildModelCreateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddHierarchicalEntityChildSender sends the AddHierarchicalEntityChild request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) AddHierarchicalEntityChildSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddHierarchicalEntityChildResponder handles the response to the AddHierarchicalEntityChild request. The method always +// closes the http.Response Body. +func (client ModelClient) AddHierarchicalEntityChildResponder(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 +} + +// AddIntent adds an intent classifier to the application. +// +// appID is the application ID. versionID is the version ID. intentCreateObject is a model object containing the +// name of the new intent classifier. +func (client ModelClient) AddIntent(ctx context.Context, appID uuid.UUID, versionID string, intentCreateObject ModelCreateObject) (result UUID, err error) { + req, err := client.AddIntentPreparer(ctx, appID, versionID, intentCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddIntent", resp, "Failure sending request") + return + } + + result, err = client.AddIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 entity extractors to the application. +// +// appID is the application ID. versionID is the version ID. prebuiltExtractorNames is 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 err := validation.Validate([]validation.Validation{ + {TargetValue: prebuiltExtractorNames, + Constraints: []validation.Constraint{{Target: "prebuiltExtractorNames", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "AddPrebuilt") + } + + req, err := client.AddPrebuiltPreparer(ctx, appID, versionID, prebuiltExtractorNames) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddPrebuilt", resp, "Failure sending request") + return + } + + result, err = client.AddPrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 list to an existing closed list. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list entity extractor ID. +// wordListCreateObject is words list. +func (client ModelClient) AddSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, wordListCreateObject WordListObject) (result Int32, err error) { + req, err := client.AddSubListPreparer(ctx, appID, versionID, clEntityID, wordListCreateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "AddSubList", resp, "Failure sending request") + return + } + + result, err = client.AddSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddSubListResponder handles the response to the AddSubList request. The method always +// closes the http.Response Body. +func (client ModelClient) AddSubListResponder(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 +} + +// DeleteClosedList deletes a closed list model from the application. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list model ID. +func (client ModelClient) DeleteClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeleteClosedListPreparer(ctx, appID, versionID, clEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteClosedList", resp, "Failure sending request") + return + } + + result, err = client.DeleteClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeleteCompositeEntity deletes a composite entity extractor from the application. +// +// appID is the application ID. versionID is the version ID. cEntityID is the composite entity extractor ID. +func (client ModelClient) DeleteCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeleteCompositeEntityPreparer(ctx, appID, versionID, cEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the application. +// +// appID is the application ID. versionID is the version ID. cEntityID is the composite entity extractor ID. +// cChildID is 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) { + req, err := client.DeleteCompositeEntityChildPreparer(ctx, appID, versionID, cEntityID, cChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteCompositeEntityChild", resp, "Failure sending request") + return + } + + result, err = client.DeleteCompositeEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeleteCustomPrebuiltDomain deletes a prebuilt domain's models from the application. +// +// appID is the application ID. versionID is the version ID. domainName is domain name. +func (client ModelClient) DeleteCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, domainName string) (result OperationStatus, err error) { + req, err := client.DeleteCustomPrebuiltDomainPreparer(ctx, appID, versionID, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteCustomPrebuiltDomain", resp, "Failure sending request") + return + } + + result, err = client.DeleteCustomPrebuiltDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 extractor from the application. +// +// appID is the application ID. versionID is the version ID. entityID is the entity extractor ID. +func (client ModelClient) DeleteEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeleteEntityPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeleteHierarchicalEntity deletes a hierarchical entity extractor from the application version. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +func (client ModelClient) DeleteHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeleteHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.DeleteHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 from the application. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +// hChildID is 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) { + req, err := client.DeleteHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.DeleteHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeleteIntent deletes an intent classifier from the application. +// +// appID is the application ID. versionID is the version ID. intentID is the intent classifier ID. deleteUtterances +// is also delete the intent's utterances (true). Or move the utterances to the None intent (false - the default +// value). +func (client ModelClient) DeleteIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, deleteUtterances *bool) (result OperationStatus, err error) { + req, err := client.DeleteIntentPreparer(ctx, appID, versionID, intentID, deleteUtterances) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteIntent", resp, "Failure sending request") + return + } + + result, err = client.DeleteIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeletePrebuilt deletes a prebuilt entity extractor from the application. +// +// appID is the application ID. versionID is the version ID. prebuiltID is the prebuilt entity extractor ID. +func (client ModelClient) DeletePrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result OperationStatus, err error) { + req, err := client.DeletePrebuiltPreparer(ctx, appID, versionID, prebuiltID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeletePrebuilt", resp, "Failure sending request") + return + } + + result, err = client.DeletePrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// DeleteSubList deletes a sublist of a specific closed list model. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list entity extractor ID. +// subListID is the sublist ID. +func (client ModelClient) DeleteSubList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, subListID int32) (result OperationStatus, err error) { + req, err := client.DeleteSubListPreparer(ctx, appID, versionID, clEntityID, subListID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "DeleteSubList", resp, "Failure sending request") + return + } + + result, err = client.DeleteSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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 int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetClosedList gets information of a closed list model. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list model ID. +func (client ModelClient) GetClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result ClosedListEntityExtractor, err error) { + req, err := client.GetClosedListPreparer(ctx, appID, versionID, clEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetClosedList", resp, "Failure sending request") + return + } + + result, err = client.GetClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetCompositeEntity gets information about the composite entity model. +// +// appID is the application ID. versionID is the version ID. cEntityID is the composite entity extractor ID. +func (client ModelClient) GetCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID) (result CompositeEntityExtractor, err error) { + req, err := client.GetCompositeEntityPreparer(ctx, appID, versionID, cEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.GetCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetEntity gets information about the entity model. +// +// appID is the application ID. versionID is the version ID. entityID is the entity extractor ID. +func (client ModelClient) GetEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result EntityExtractor, err error) { + req, err := client.GetEntityPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetEntity", resp, "Failure sending request") + return + } + + result, err = client.GetEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetEntityResponder handles the response to the GetEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) GetEntityResponder(resp *http.Response) (result EntityExtractor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEntitySuggestions get suggestion examples that would improve the accuracy of the entity model. +// +// appID is the application ID. versionID is the version ID. entityID is the target entity extractor model to +// enhance. take is the number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) GetEntitySuggestions(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, take *int32) (result ListEntitiesSuggestionExample, err error) { + 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "GetEntitySuggestions") + } + + req, err := client.GetEntitySuggestionsPreparer(ctx, appID, versionID, entityID, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetEntitySuggestions", nil, "Failure preparing request") + return + } + + resp, err := client.GetEntitySuggestionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetEntitySuggestions", resp, "Failure sending request") + return + } + + result, err = client.GetEntitySuggestionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetEntitySuggestions", resp, "Failure responding to request") + } + + return +} + +// GetEntitySuggestionsPreparer prepares the GetEntitySuggestions request. +func (client ModelClient) GetEntitySuggestionsPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/suggest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEntitySuggestionsSender sends the GetEntitySuggestions request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetEntitySuggestionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetEntitySuggestionsResponder handles the response to the GetEntitySuggestions request. The method always +// closes the http.Response Body. +func (client ModelClient) GetEntitySuggestionsResponder(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 +} + +// GetHierarchicalEntity gets information about the hierarchical entity model. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +func (client ModelClient) GetHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result HierarchicalEntityExtractor, err error) { + req, err := client.GetHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.GetHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 hierarchical entity child model. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +// hChildID is 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) { + req, err := client.GetHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.GetHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetIntent gets information about the intent model. +// +// appID is the application ID. versionID is the version ID. intentID is the intent classifier ID. +func (client ModelClient) GetIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result IntentClassifier, err error) { + req, err := client.GetIntentPreparer(ctx, appID, versionID, intentID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetIntent", resp, "Failure sending request") + return + } + + result, err = client.GetIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// GetIntentSuggestions suggests examples that would improve the accuracy of the intent model. +// +// appID is the application ID. versionID is the version ID. intentID is the intent classifier ID. take is the +// number of entries to return. Maximum page size is 500. Default is 100. +func (client ModelClient) GetIntentSuggestions(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, take *int32) (result ListIntentsSuggestionExample, err error) { + 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "GetIntentSuggestions") + } + + req, err := client.GetIntentSuggestionsPreparer(ctx, appID, versionID, intentID, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetIntentSuggestions", nil, "Failure preparing request") + return + } + + resp, err := client.GetIntentSuggestionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetIntentSuggestions", resp, "Failure sending request") + return + } + + result, err = client.GetIntentSuggestionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "GetIntentSuggestions", resp, "Failure responding to request") + } + + return +} + +// GetIntentSuggestionsPreparer prepares the GetIntentSuggestions request. +func (client ModelClient) GetIntentSuggestionsPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, take *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/suggest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIntentSuggestionsSender sends the GetIntentSuggestions request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetIntentSuggestionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetIntentSuggestionsResponder handles the response to the GetIntentSuggestions request. The method always +// closes the http.Response Body. +func (client ModelClient) GetIntentSuggestionsResponder(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 +} + +// GetPrebuilt gets information about the prebuilt entity model. +// +// appID is the application ID. versionID is the version ID. prebuiltID is the prebuilt entity extractor ID. +func (client ModelClient) GetPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result PrebuiltEntityExtractor, err error) { + req, err := client.GetPrebuiltPreparer(ctx, appID, versionID, prebuiltID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "GetPrebuilt", resp, "Failure sending request") + return + } + + result, err = client.GetPrebuiltResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListClosedLists gets information about the closedlist models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListClosedLists") + } + + req, err := client.ListClosedListsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListClosedLists", resp, "Failure sending request") + return + } + + result, err = client.ListClosedListsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the composite entity models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListCompositeEntities") + } + + req, err := client.ListCompositeEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListCompositeEntities", resp, "Failure sending request") + return + } + + result, err = client.ListCompositeEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListCustomPrebuiltEntities gets all custom prebuilt entities information of this application. +// +// appID is the application ID. versionID is the version ID. +func (client ModelClient) ListCustomPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result ListEntityExtractor, err error) { + req, err := client.ListCustomPrebuiltEntitiesPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListCustomPrebuiltEntities", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListCustomPrebuiltIntents gets custom prebuilt intents information of this application. +// +// appID is the application ID. versionID is the version ID. +func (client ModelClient) ListCustomPrebuiltIntents(ctx context.Context, appID uuid.UUID, versionID string) (result ListIntentClassifier, err error) { + req, err := client.ListCustomPrebuiltIntentsPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListCustomPrebuiltIntents", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltIntentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 custom prebuilt models information of this application. +// +// appID is the application ID. versionID is the version ID. +func (client ModelClient) ListCustomPrebuiltModels(ctx context.Context, appID uuid.UUID, versionID string) (result ListCustomPrebuiltModel, err error) { + req, err := client.ListCustomPrebuiltModelsPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListCustomPrebuiltModels", resp, "Failure sending request") + return + } + + result, err = client.ListCustomPrebuiltModelsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the entity models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 ListEntityExtractor, err error) { + 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListEntities") + } + + req, err := client.ListEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListEntities", resp, "Failure sending request") + return + } + + result, err = client.ListEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListEntitiesResponder handles the response to the ListEntities request. The method always +// closes the http.Response Body. +func (client ModelClient) ListEntitiesResponder(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 +} + +// ListHierarchicalEntities gets information about the hierarchical entity models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListHierarchicalEntities") + } + + req, err := client.ListHierarchicalEntitiesPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListHierarchicalEntities", resp, "Failure sending request") + return + } + + result, err = client.ListHierarchicalEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListIntents gets information about the intent models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListIntents") + } + + req, err := client.ListIntentsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListIntents", resp, "Failure sending request") + return + } + + result, err = client.ListIntentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListModels gets information about the application version models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListModels") + } + + req, err := client.ListModelsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListModels", resp, "Failure sending request") + return + } + + result, err = client.ListModelsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListPrebuiltEntities gets all the available prebuilt entity extractors for the application. +// +// appID is the application ID. versionID is the version ID. +func (client ModelClient) ListPrebuiltEntities(ctx context.Context, appID uuid.UUID, versionID string) (result ListAvailablePrebuiltEntityModel, err error) { + req, err := client.ListPrebuiltEntitiesPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListPrebuiltEntities", resp, "Failure sending request") + return + } + + result, err = client.ListPrebuiltEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// ListPrebuilts gets information about the prebuilt entity models. +// +// appID is the application ID. versionID is the version ID. skip is the number of entries to skip. Default value +// is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.ModelClient", "ListPrebuilts") + } + + req, err := client.ListPrebuiltsPreparer(ctx, appID, versionID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "ListPrebuilts", resp, "Failure sending request") + return + } + + result, err = client.ListPrebuiltsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// PatchClosedList adds a batch of sublists to an existing closedlist. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list model ID. +// closedListModelPatchObject is 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) { + req, err := client.PatchClosedListPreparer(ctx, appID, versionID, clEntityID, closedListModelPatchObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "PatchClosedList", resp, "Failure sending request") + return + } + + result, err = client.PatchClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 closed list model. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list model ID. +// closedListModelUpdateObject is the new 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) { + req, err := client.UpdateClosedListPreparer(ctx, appID, versionID, clEntityID, closedListModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateClosedList", resp, "Failure sending request") + return + } + + result, err = client.UpdateClosedListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "clEntityId": autorest.Encode("path", clEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdateCompositeEntity updates the composite entity extractor. +// +// appID is the application ID. versionID is the version ID. cEntityID is the composite entity extractor ID. +// compositeModelUpdateObject is 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) { + req, err := client.UpdateCompositeEntityPreparer(ctx, appID, versionID, cEntityID, compositeModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateCompositeEntity", resp, "Failure sending request") + return + } + + result, err = client.UpdateCompositeEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "cEntityId": autorest.Encode("path", cEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdateEntity updates the name of an entity extractor. +// +// appID is the application ID. versionID is the version ID. entityID is the entity extractor ID. modelUpdateObject +// is a model object containing the new entity extractor name. +func (client ModelClient) UpdateEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, modelUpdateObject ModelUpdateObject) (result OperationStatus, err error) { + req, err := client.UpdateEntityPreparer(ctx, appID, versionID, entityID, modelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "UpdateEntity", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateEntitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "UpdateEntity", resp, "Failure sending request") + return + } + + result, err = client.UpdateEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.ModelClient", "UpdateEntity", resp, "Failure responding to request") + } + + return +} + +// UpdateEntityPreparer prepares the UpdateEntity request. +func (client ModelClient) UpdateEntityPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, modelUpdateObject ModelUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}", pathParameters), + autorest.WithJSON(modelUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateEntitySender sends the UpdateEntity request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) UpdateEntitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateEntityResponder handles the response to the UpdateEntity request. The method always +// closes the http.Response Body. +func (client ModelClient) UpdateEntityResponder(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 and children of a hierarchical entity model. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +// hierarchicalModelUpdateObject is model containing names of the children of the hierarchical entity. +func (client ModelClient) UpdateHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hierarchicalModelUpdateObject HierarchicalEntityModel) (result OperationStatus, err error) { + req, err := client.UpdateHierarchicalEntityPreparer(ctx, appID, versionID, hEntityID, hierarchicalModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateHierarchicalEntity", resp, "Failure sending request") + return + } + + result, err = client.UpdateHierarchicalEntityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, hierarchicalModelUpdateObject HierarchicalEntityModel) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "hEntityId": autorest.Encode("path", hEntityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}", pathParameters), + autorest.WithJSON(hierarchicalModelUpdateObject)) + 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. hEntityID is the hierarchical entity extractor ID. +// hChildID is the hierarchical entity extractor child ID. hierarchicalChildModelUpdateObject is 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) { + req, err := client.UpdateHierarchicalEntityChildPreparer(ctx, appID, versionID, hEntityID, hChildID, hierarchicalChildModelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateHierarchicalEntityChild", resp, "Failure sending request") + return + } + + result, err = client.UpdateHierarchicalEntityChildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdateIntent updates the name of an intent classifier. +// +// appID is the application ID. versionID is the version ID. intentID is the intent classifier ID. +// modelUpdateObject is a model object containing the new intent classifier name. +func (client ModelClient) UpdateIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, modelUpdateObject ModelUpdateObject) (result OperationStatus, err error) { + req, err := client.UpdateIntentPreparer(ctx, appID, versionID, intentID, modelUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateIntent", resp, "Failure sending request") + return + } + + result, err = client.UpdateIntentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} + +// UpdateSubList updates one of the closed list's sublists. +// +// appID is the application ID. versionID is the version ID. clEntityID is the closed list entity extractor ID. +// subListID is the sublist ID. wordListBaseUpdateObject is 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 int32, wordListBaseUpdateObject WordListBaseUpdateObject) (result OperationStatus, err error) { + req, err := client.UpdateSubListPreparer(ctx, appID, versionID, clEntityID, subListID, wordListBaseUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.ModelClient", "UpdateSubList", resp, "Failure sending request") + return + } + + result, err = client.UpdateSubListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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 int32, wordListBaseUpdateObject WordListBaseUpdateObject) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + 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.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/models.go b/services/cognitiveservices/v2.0/luis/programmatic/models.go new file mode 100644 index 000000000000..ae1afbb0974d --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/models.go @@ -0,0 +1,1290 @@ +package programmatic + +// 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" +) + +// AzureRegions enumerates the values for azure regions. +type AzureRegions string + +const ( + // Australiaeast ... + Australiaeast AzureRegions = "australiaeast" + // Brazilsouth ... + Brazilsouth AzureRegions = "brazilsouth" + // Eastasia ... + Eastasia AzureRegions = "eastasia" + // Eastus ... + Eastus AzureRegions = "eastus" + // Eastus2 ... + Eastus2 AzureRegions = "eastus2" + // Northeurope ... + Northeurope AzureRegions = "northeurope" + // Southcentralus ... + Southcentralus AzureRegions = "southcentralus" + // Southeastasia ... + Southeastasia AzureRegions = "southeastasia" + // Westcentralus ... + Westcentralus AzureRegions = "westcentralus" + // Westeurope ... + Westeurope AzureRegions = "westeurope" + // Westus ... + Westus AzureRegions = "westus" + // Westus2 ... + Westus2 AzureRegions = "westus2" +) + +// OperationStatusType enumerates the values for operation status type. +type OperationStatusType string + +const ( + // Failed ... + Failed OperationStatusType = "Failed" + // FAILED ... + FAILED OperationStatusType = "FAILED" + // Success ... + Success OperationStatusType = "Success" +) + +// ReadableType enumerates the values for readable type. +type ReadableType string + +const ( + // 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" + // ReadableTypePrebuiltEntityExtractor ... + ReadableTypePrebuiltEntityExtractor ReadableType = "Prebuilt Entity Extractor" +) + +// ReadableType1 enumerates the values for readable type 1. +type ReadableType1 string + +const ( + // 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" + // ReadableType1PrebuiltEntityExtractor ... + ReadableType1PrebuiltEntityExtractor ReadableType1 = "Prebuilt Entity Extractor" +) + +// ReadableType2 enumerates the values for readable type 2. +type ReadableType2 string + +const ( + // 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" + // ReadableType2PrebuiltEntityExtractor ... + ReadableType2PrebuiltEntityExtractor ReadableType2 = "Prebuilt Entity Extractor" +) + +// ReadableType3 enumerates the values for readable type 3. +type ReadableType3 string + +const ( + // 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" + // ReadableType3PrebuiltEntityExtractor ... + ReadableType3PrebuiltEntityExtractor ReadableType3 = "Prebuilt Entity Extractor" +) + +// 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" +) + +// 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" +) + +// TrainingStatus enumerates the values for training status. +type TrainingStatus string + +const ( + // InProgress ... + InProgress TrainingStatus = "InProgress" + // NeedsTraining ... + NeedsTraining TrainingStatus = "NeedsTraining" + // Trained ... + Trained TrainingStatus = "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. E.g.: en-us. + Culture *string `json:"culture,omitempty"` + // UsageScenario - Defines the scenario for the new application. Optional. E.g.: IoT. + UsageScenario *string `json:"usageScenario,omitempty"` + // Domain - The domain for the new application. Optional. E.g.: 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"` + // Region - The target region that the application is published to. + Region *string `json:"region,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. + IsPublic *bool `json:"public,omitempty"` +} + +// ApplicationSettingUpdateObject object model for updating an application's settings. +type ApplicationSettingUpdateObject struct { + // Public - Setting your application as public allows other people to use your application's endpoint using their own keys. + Public *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"` +} + +// 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"` +} + +// BatchLabelExample response when adding a batch of labeled examples. +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"` +} + +// ClosedList exported Model - A Closed List. +type ClosedList struct { + // Name - Name of the closed list feature. + Name *string `json:"name,omitempty"` + // SubLists - Sublists for the feature. + SubLists *[]SubClosedList `json:"subLists,omitempty"` +} + +// ClosedListEntityExtractor closed List Entity Extractor. +type ClosedListEntityExtractor struct { + autorest.Response `json:"-"` + // SubLists - List of sub-lists. + SubLists *[]SubClosedListResponse `json:"subLists,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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// ClosedListModelCreateObject object model for creating a closed list. +type ClosedListModelCreateObject struct { + // SubLists - Sublists for the feature. + SubLists *[]WordListObject `json:"subLists,omitempty"` + // Name - Name of the closed list feature. + Name *string `json:"name,omitempty"` +} + +// ClosedListModelPatchObject object model for adding a batch of sublists to an existing closedlist. +type ClosedListModelPatchObject struct { + // SubLists - Sublists to add. + SubLists *[]WordListObject `json:"subLists,omitempty"` +} + +// ClosedListModelUpdateObject object model for updating a closed list. +type ClosedListModelUpdateObject struct { + // SubLists - The new sublists for the feature. + SubLists *[]WordListObject `json:"subLists,omitempty"` + // Name - The new name of the closed list feature. + 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:"-"` + // Children - List of child entities. + Children *[]ChildEntity `json:"children,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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// CompositeEntityModel a composite entity. +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: 'ReadableType3EntityExtractor', 'ReadableType3HierarchicalEntityExtractor', 'ReadableType3HierarchicalChildEntityExtractor', 'ReadableType3CompositeEntityExtractor', 'ReadableType3ClosedListEntityExtractor', 'ReadableType3PrebuiltEntityExtractor', 'ReadableType3IntentClassifier' + ReadableType ReadableType3 `json:"readableType,omitempty"` + // CustomPrebuiltDomainName - The domain name. + CustomPrebuiltDomainName *string `json:"customPrebuiltDomainName,omitempty"` + // CustomPrebuiltModelName - The intent name or entity name. + CustomPrebuiltModelName *string `json:"customPrebuiltModelName,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"` + // 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. E.g.: 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 { + 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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,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"` +} + +// 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"` +} + +// 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"` +} + +// 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) +} + +// ExampleLabelObject a labeled example. +type ExampleLabelObject struct { + // Text - The sample's utterance. + Text *string `json:"text,omitempty"` + // EntityLabels - The idenfied entities within the utterance. + EntityLabels *[]EntityLabelObject `json:"entityLabels,omitempty"` + // IntentName - The idenfitied intent representing the utterance. + IntentName *string `json:"intentName,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:"-"` + // TypeID - The type ID of the Entity Model. + TypeID *int32 `json:"typeId,omitempty"` + // ReadableType - Possible values include: 'ReadableType2EntityExtractor', 'ReadableType2HierarchicalEntityExtractor', 'ReadableType2HierarchicalChildEntityExtractor', 'ReadableType2CompositeEntityExtractor', 'ReadableType2ClosedListEntityExtractor', 'ReadableType2PrebuiltEntityExtractor', 'ReadableType2IntentClassifier' + ReadableType ReadableType2 `json:"readableType,omitempty"` + // 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"` +} + +// HierarchicalChildModelCreateObject ... +type HierarchicalChildModelCreateObject struct { + Name *string `json:"name,omitempty"` +} + +// HierarchicalChildModelUpdateObject ... +type HierarchicalChildModelUpdateObject struct { + Name *string `json:"name,omitempty"` +} + +// HierarchicalEntityExtractor hierarchical Entity Extractor. +type HierarchicalEntityExtractor struct { + autorest.Response `json:"-"` + // Children - List of child entities. + Children *[]ChildEntity `json:"children,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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// HierarchicalEntityModel a Hierarchical Entity Extractor. +type HierarchicalEntityModel struct { + // Children - Child entities. + Children *[]string `json:"children,omitempty"` + // Name - Entity name. + Name *string `json:"name,omitempty"` +} + +// HierarchicalModel ... +type HierarchicalModel struct { + Name *string `json:"name,omitempty"` + Children *[]string `json:"children,omitempty"` +} + +// Int32 ... +type Int32 struct { + autorest.Response `json:"-"` + Value *int32 `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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + 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. E.g.: 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"` +} + +// 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"` +} + +// 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 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. + 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. E.g.: 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. +type LabelExampleResponse struct { + autorest.Response `json:"-"` + // UtteranceText - The sample's utterance. + UtteranceText *string `json:"UtteranceText,omitempty"` + // ExampleID - The newly created sample ID. + ExampleID *int32 `json:"ExampleId,omitempty"` +} + +// ListApplicationInfoResponse ... +type ListApplicationInfoResponse struct { + autorest.Response `json:"-"` + Value *[]ApplicationInfoResponse `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"` +} + +// 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"` +} + +// 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"` +} + +// ListModelInfoResponse ... +type ListModelInfoResponse struct { + autorest.Response `json:"-"` + Value *[]ModelInfoResponse `json:"value,omitempty"` +} + +// ListModelTrainingInfo ... +type ListModelTrainingInfo struct { + autorest.Response `json:"-"` + Value *[]ModelTrainingInfo `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"` +} + +// 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"` + // BingEntities - List of prebuilt intents. + BingEntities *[]string `json:"bing_entities,omitempty"` + // ClosedLists - List of closed lists. + ClosedLists *[]ClosedList `json:"closedLists,omitempty"` + // Composites - List of composite entities. + Composites *[]HierarchicalModel `json:"composites,omitempty"` + // RegexFeatures - List of pattern features. + RegexFeatures *[]JSONRegexFeature `json:"regex_features,omitempty"` + // ModelFeatures - List of model features. + ModelFeatures *[]JSONModelFeature `json:"model_features,omitempty"` + // Utterances - List of sample 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.BingEntities != nil { + objectMap["bing_entities"] = la.BingEntities + } + if la.ClosedLists != nil { + objectMap["closedLists"] = la.ClosedLists + } + if la.Composites != nil { + objectMap["composites"] = la.Composites + } + if la.RegexFeatures != nil { + objectMap["regex_features"] = la.RegexFeatures + } + if la.ModelFeatures != nil { + objectMap["model_features"] = la.ModelFeatures + } + if la.Utterances != nil { + objectMap["utterances"] = la.Utterances + } + for k, v := range la.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// 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', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,omitempty"` +} + +// ModelInfoResponse an application model info. +type ModelInfoResponse struct { + // Children - List of child entities. + Children *[]ChildEntity `json:"children,omitempty"` + // SubLists - List of sub-lists. + 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"` + // 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: 'ReadableType1EntityExtractor', 'ReadableType1HierarchicalEntityExtractor', 'ReadableType1HierarchicalChildEntityExtractor', 'ReadableType1CompositeEntityExtractor', 'ReadableType1ClosedListEntityExtractor', 'ReadableType1PrebuiltEntityExtractor', 'ReadableType1IntentClassifier' + ReadableType ReadableType1 `json:"readableType,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"` +} + +// 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"` +} + +// 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 { + // 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"` +} + +// 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 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"` +} + +// 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"` +} + +// 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: 'ReadableTypeEntityExtractor', 'ReadableTypeHierarchicalEntityExtractor', 'ReadableTypeHierarchicalChildEntityExtractor', 'ReadableTypeCompositeEntityExtractor', 'ReadableTypeClosedListEntityExtractor', 'ReadableTypePrebuiltEntityExtractor', 'ReadableTypeIntentClassifier' + ReadableType ReadableType `json:"readableType,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"` + // PublishedDateTime - Timestamp when was last published. + PublishedDateTime *string `json:"publishedDateTime,omitempty"` +} + +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,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 Closed list. +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 Closed list. +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 + } + 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 + } + objectMap["trainingStatus"] = vi.TrainingStatus + return json.Marshal(objectMap) +} + +// WordListBaseUpdateObject object model for updating one of the closed list'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 Closed list. +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/cognitiveservices/v2.0/luis/programmatic/permissions.go b/services/cognitiveservices/v2.0/luis/programmatic/permissions.go new file mode 100644 index 000000000000..3101d10e8297 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/permissions.go @@ -0,0 +1,293 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// PermissionsClient is the client for the Permissions methods of the Programmatic service. +type PermissionsClient struct { + BaseClient +} + +// NewPermissionsClient creates an instance of the PermissionsClient client. +func NewPermissionsClient(azureRegion AzureRegions) PermissionsClient { + return PermissionsClient{New(azureRegion)} +} + +// Add adds a user to the allowed list of users to access this LUIS application. Users are added using their email +// address. +// +// appID is the application ID. userToAdd is a model containing the user's email address. +func (client PermissionsClient) Add(ctx context.Context, appID uuid.UUID, userToAdd UserCollaborator) (result OperationStatus, err error) { + req, err := client.AddPreparer(ctx, appID, userToAdd) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.PermissionsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. userToDelete is a model containing the user's email address. +func (client PermissionsClient) Delete(ctx context.Context, appID uuid.UUID, userToDelete UserCollaborator) (result OperationStatus, err error) { + req, err := client.DeletePreparer(ctx, appID, userToDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.PermissionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. +func (client PermissionsClient) List(ctx context.Context, appID uuid.UUID) (result UserAccessList, err error) { + req, err := client.ListPreparer(ctx, appID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.PermissionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 users access list with the one sent in the body. If an empty list is sent, all access to +// other users will be removed. +// +// appID is the application ID. collaborators is a model containing a list of user's email addresses. +func (client PermissionsClient) Update(ctx context.Context, appID uuid.UUID, collaborators CollaboratorsArray) (result OperationStatus, err error) { + req, err := client.UpdatePreparer(ctx, appID, collaborators) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.PermissionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/train.go b/services/cognitiveservices/v2.0/luis/programmatic/train.go new file mode 100644 index 000000000000..10d5713e0373 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/train.go @@ -0,0 +1,168 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// TrainClient is the client for the Train methods of the Programmatic service. +type TrainClient struct { + BaseClient +} + +// NewTrainClient creates an instance of the TrainClient client. +func NewTrainClient(azureRegion AzureRegions) TrainClient { + return TrainClient{New(azureRegion)} +} + +// 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". +// +// appID is the application ID. versionID is the version ID. +func (client TrainClient) GetStatus(ctx context.Context, appID uuid.UUID, versionID string) (result ListModelTrainingInfo, err error) { + req, err := client.GetStatusPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.TrainClient", "GetStatus", resp, "Failure sending request") + return + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. +func (client TrainClient) TrainVersion(ctx context.Context, appID uuid.UUID, versionID string) (result EnqueueTrainingResponse, err error) { + req, err := client.TrainVersionPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.TrainClient", "TrainVersion", resp, "Failure sending request") + return + } + + result, err = client.TrainVersionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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/cognitiveservices/v2.0/luis/programmatic/version.go b/services/cognitiveservices/v2.0/luis/programmatic/version.go new file mode 100644 index 000000000000..bd116451f8ec --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/version.go @@ -0,0 +1,28 @@ +package programmatic + +// 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/v12.1.1-beta services" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v12.1.1-beta" +} diff --git a/services/cognitiveservices/v2.0/luis/programmatic/versions.go b/services/cognitiveservices/v2.0/luis/programmatic/versions.go new file mode 100644 index 000000000000..5874374bb946 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/programmatic/versions.go @@ -0,0 +1,585 @@ +package programmatic + +// 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/satori/go.uuid" + "net/http" +) + +// VersionsClient is the client for the Versions methods of the Programmatic service. +type VersionsClient struct { + BaseClient +} + +// NewVersionsClient creates an instance of the VersionsClient client. +func NewVersionsClient(azureRegion AzureRegions) VersionsClient { + return VersionsClient{New(azureRegion)} +} + +// Clone creates a new version using the current snapshot of the selected application version. +// +// appID is the application ID. versionID is the version ID. versionCloneObject is 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) { + req, err := client.ClonePreparer(ctx, appID, versionID, versionCloneObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Clone", resp, "Failure sending request") + return + } + + result, err = client.CloneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/clone", pathParameters)) + if versionCloneObject != nil { + preparer = autorest.DecoratePreparer(preparer, + 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. +func (client VersionsClient) Delete(ctx context.Context, appID uuid.UUID, versionID string) (result OperationStatus, err error) { + req, err := client.DeletePreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. utterance is the utterance text to delete. +func (client VersionsClient) DeleteUnlabelledUtterance(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (result OperationStatus, err error) { + req, err := client.DeleteUnlabelledUtterancePreparer(ctx, appID, versionID, utterance) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure sending request") + return + } + + result, err = client.DeleteUnlabelledUtteranceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. +func (client VersionsClient) Export(ctx context.Context, appID uuid.UUID, versionID string) (result LuisApp, err error) { + req, err := client.ExportPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Export", resp, "Failure sending request") + return + } + + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 info. +// +// appID is the application ID. versionID is the version ID. +func (client VersionsClient) Get(ctx context.Context, appID uuid.UUID, versionID string) (result VersionInfo, err error) { + req, err := client.GetPreparer(ctx, appID, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. luisApp is a LUIS application structure. versionID is 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) { + req, err := client.ImportPreparer(ctx, appID, luisApp, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Import", resp, "Failure sending request") + return + } + + result, err = client.ImportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 the application versions info. +// +// appID is the application ID. skip is the number of entries to skip. Default value is 0. take is 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 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: 500, Chain: nil}, + {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "programmatic.VersionsClient", "List") + } + + req, err := client.ListPreparer(ctx, appID, skip, take) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + 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("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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. +// +// appID is the application ID. versionID is the version ID. versionUpdateObject is 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) { + req, err := client.UpdatePreparer(ctx, appID, versionID, versionUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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, "programmatic.VersionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "programmatic.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{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0", 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) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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 +} diff --git a/services/cognitiveservices/v2.0/luis/runtime/client.go b/services/cognitiveservices/v2.0/luis/runtime/client.go new file mode 100644 index 000000000000..57a39845aa76 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/runtime/client.go @@ -0,0 +1,44 @@ +// Package runtime implements the Azure ARM Runtime service API version v2.0. +// +// +package runtime + +// 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 Runtime. +type BaseClient struct { + autorest.Client + AzureRegion AzureRegions +} + +// New creates an instance of the BaseClient client. +func New(azureRegion AzureRegions) BaseClient { + return NewWithoutDefaults(azureRegion) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + AzureRegion: azureRegion, + } +} diff --git a/services/cognitiveservices/v2.0/luis/runtime/models.go b/services/cognitiveservices/v2.0/luis/runtime/models.go new file mode 100644 index 000000000000..2774b7882620 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/runtime/models.go @@ -0,0 +1,216 @@ +package runtime + +// 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" +) + +// AzureRegions enumerates the values for azure regions. +type AzureRegions string + +const ( + // Australiaeast ... + Australiaeast AzureRegions = "australiaeast" + // Brazilsouth ... + Brazilsouth AzureRegions = "brazilsouth" + // Eastasia ... + Eastasia AzureRegions = "eastasia" + // Eastus ... + Eastus AzureRegions = "eastus" + // Eastus2 ... + Eastus2 AzureRegions = "eastus2" + // Northeurope ... + Northeurope AzureRegions = "northeurope" + // Southcentralus ... + Southcentralus AzureRegions = "southcentralus" + // Southeastasia ... + Southeastasia AzureRegions = "southeastasia" + // Westcentralus ... + Westcentralus AzureRegions = "westcentralus" + // Westeurope ... + Westeurope AzureRegions = "westeurope" + // Westus ... + Westus AzureRegions = "westus" + // Westus2 ... + Westus2 AzureRegions = "westus2" +) + +// APIError error information returned by the API +type APIError struct { + // StatusCode - HTTP Status code + StatusCode *string `json:"statusCode,omitempty"` + // Message - Cause of the error. + Message *string `json:"message,omitempty"` +} + +// CompositeChildModel child entity in a LUIS Composite Entity. +type CompositeChildModel struct { + // Type - Type of child entity. + Type *string `json:"type,omitempty"` + // Value - Value extracted by LUIS. + Value *string `json:"value,omitempty"` +} + +// CompositeEntityModel LUIS Composite Entity. +type CompositeEntityModel struct { + // ParentType - Type/name of parent entity. + ParentType *string `json:"parentType,omitempty"` + // Value - Value for composite entity extracted by LUIS. + Value *string `json:"value,omitempty"` + // Children - Child entities. + Children *[]CompositeChildModel `json:"children,omitempty"` +} + +// EntityModel an entity extracted from the utterance. +type EntityModel struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Entity - Name of the entity, as defined in LUIS. + Entity *string `json:"entity,omitempty"` + // Type - Type of the entity, as defined in LUIS. + Type *string `json:"type,omitempty"` + // StartIndex - The position of the first character of the matched entity within the utterance. + StartIndex *float64 `json:"startIndex,omitempty"` + // EndIndex - The position of the last character of the matched entity within the utterance. + EndIndex *float64 `json:"endIndex,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityModel. +func (em EntityModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if em.Entity != nil { + objectMap["entity"] = em.Entity + } + if em.Type != nil { + objectMap["type"] = em.Type + } + if em.StartIndex != nil { + objectMap["startIndex"] = em.StartIndex + } + if em.EndIndex != nil { + objectMap["endIndex"] = em.EndIndex + } + for k, v := range em.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// EntityWithResolution ... +type EntityWithResolution struct { + // Resolution - Resolution values for pre-built LUIS entities. + Resolution interface{} `json:"resolution,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Entity - Name of the entity, as defined in LUIS. + Entity *string `json:"entity,omitempty"` + // Type - Type of the entity, as defined in LUIS. + Type *string `json:"type,omitempty"` + // StartIndex - The position of the first character of the matched entity within the utterance. + StartIndex *float64 `json:"startIndex,omitempty"` + // EndIndex - The position of the last character of the matched entity within the utterance. + EndIndex *float64 `json:"endIndex,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityWithResolution. +func (ewr EntityWithResolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["resolution"] = ewr.Resolution + if ewr.Entity != nil { + objectMap["entity"] = ewr.Entity + } + if ewr.Type != nil { + objectMap["type"] = ewr.Type + } + if ewr.StartIndex != nil { + objectMap["startIndex"] = ewr.StartIndex + } + if ewr.EndIndex != nil { + objectMap["endIndex"] = ewr.EndIndex + } + for k, v := range ewr.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// EntityWithScore ... +type EntityWithScore struct { + // Score - Associated prediction score for the intent (float). + Score *float64 `json:"score,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Entity - Name of the entity, as defined in LUIS. + Entity *string `json:"entity,omitempty"` + // Type - Type of the entity, as defined in LUIS. + Type *string `json:"type,omitempty"` + // StartIndex - The position of the first character of the matched entity within the utterance. + StartIndex *float64 `json:"startIndex,omitempty"` + // EndIndex - The position of the last character of the matched entity within the utterance. + EndIndex *float64 `json:"endIndex,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityWithScore. +func (ews EntityWithScore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ews.Score != nil { + objectMap["score"] = ews.Score + } + if ews.Entity != nil { + objectMap["entity"] = ews.Entity + } + if ews.Type != nil { + objectMap["type"] = ews.Type + } + if ews.StartIndex != nil { + objectMap["startIndex"] = ews.StartIndex + } + if ews.EndIndex != nil { + objectMap["endIndex"] = ews.EndIndex + } + for k, v := range ews.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// IntentModel an intent detected from the utterance. +type IntentModel struct { + // Intent - Name of the intent, as defined in LUIS. + Intent *string `json:"intent,omitempty"` + // Score - Associated prediction score for the intent (float). + Score *float64 `json:"score,omitempty"` +} + +// LuisResult prediction, based on the input query, containing intent(s) and entities. +type LuisResult struct { + autorest.Response `json:"-"` + // Query - The input utterance that was analized. + Query *string `json:"query,omitempty"` + // AlteredQuery - The corrected utterance (when spell checking was enabled). + AlteredQuery *string `json:"alteredQuery,omitempty"` + TopScoringIntent *IntentModel `json:"topScoringIntent,omitempty"` + // Intents - All the intents (and their score) that were detected from utterance. + Intents *[]IntentModel `json:"intents,omitempty"` + // Entities - The entities extracted from the utterance. + Entities *[]EntityModel `json:"entities,omitempty"` + // CompositeEntities - The composite entities extracted from the utterance. + CompositeEntities *[]CompositeEntityModel `json:"compositeEntities,omitempty"` +} diff --git a/services/cognitiveservices/v2.0/luis/runtime/prediction.go b/services/cognitiveservices/v2.0/luis/runtime/prediction.go new file mode 100644 index 000000000000..60d74f37fb4e --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/runtime/prediction.go @@ -0,0 +1,132 @@ +package runtime + +// 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" + "net/http" +) + +// PredictionClient is the client for the Prediction methods of the Runtime service. +type PredictionClient struct { + BaseClient +} + +// NewPredictionClient creates an instance of the PredictionClient client. +func NewPredictionClient(azureRegion AzureRegions) PredictionClient { + return PredictionClient{New(azureRegion)} +} + +// Resolve gets predictions for a given utterance, in the form of intents and entities. The current maximum query size +// is 500 characters. +// +// appID is the LUIS application ID (Guid). query is the utterance to predict. timezoneOffset is the timezone +// offset for the location of the request. verbose is if true, return all intents instead of just the top scoring +// intent. staging is use the staging endpoint slot. spellCheck is enable spell checking. +// bingSpellCheckSubscriptionKey is the subscription key to use when enabling bing spell check logParameter is log +// query (default is true) +func (client PredictionClient) Resolve(ctx context.Context, appID string, query string, timezoneOffset *float64, verbose *bool, staging *bool, spellCheck *bool, bingSpellCheckSubscriptionKey string, logParameter *bool) (result LuisResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: query, + Constraints: []validation.Constraint{{Target: "query", Name: validation.MaxLength, Rule: 500, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "runtime.PredictionClient", "Resolve") + } + + req, err := client.ResolvePreparer(ctx, appID, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, logParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "Resolve", nil, "Failure preparing request") + return + } + + resp, err := client.ResolveSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "Resolve", resp, "Failure sending request") + return + } + + result, err = client.ResolveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "Resolve", resp, "Failure responding to request") + } + + return +} + +// ResolvePreparer prepares the Resolve request. +func (client PredictionClient) ResolvePreparer(ctx context.Context, appID string, query string, timezoneOffset *float64, verbose *bool, staging *bool, spellCheck *bool, bingSpellCheckSubscriptionKey string, logParameter *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "AzureRegion": client.AzureRegion, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + } + + queryParameters := map[string]interface{}{} + if timezoneOffset != nil { + queryParameters["timezoneOffset"] = autorest.Encode("query", *timezoneOffset) + } + if verbose != nil { + queryParameters["verbose"] = autorest.Encode("query", *verbose) + } + if staging != nil { + queryParameters["staging"] = autorest.Encode("query", *staging) + } + if spellCheck != nil { + queryParameters["spellCheck"] = autorest.Encode("query", *spellCheck) + } + if len(bingSpellCheckSubscriptionKey) > 0 { + queryParameters["bing-spell-check-subscription-key"] = autorest.Encode("query", bingSpellCheckSubscriptionKey) + } + if logParameter != nil { + queryParameters["log"] = autorest.Encode("query", *logParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/luis/v2.0/apps", urlParameters), + autorest.WithPathParameters("/{appId}", pathParameters), + autorest.WithJSON(query), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResolveSender sends the Resolve request. The method will close the +// http.Response Body if it receives an error. +func (client PredictionClient) ResolveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ResolveResponder handles the response to the Resolve request. The method always +// closes the http.Response Body. +func (client PredictionClient) ResolveResponder(resp *http.Response) (result LuisResult, 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/cognitiveservices/v2.0/luis/runtime/version.go b/services/cognitiveservices/v2.0/luis/runtime/version.go new file mode 100644 index 000000000000..415df3ff6c66 --- /dev/null +++ b/services/cognitiveservices/v2.0/luis/runtime/version.go @@ -0,0 +1,28 @@ +package runtime + +// 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/v12.1.1-beta services" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v12.1.1-beta" +} diff --git a/tools/profileBuilder/latest.go b/tools/profileBuilder/latest.go index 5d6e95138881..fa61d60e899b 100644 --- a/tools/profileBuilder/latest.go +++ b/tools/profileBuilder/latest.go @@ -49,7 +49,7 @@ func IgnorePreview(name string) (result bool) { return } -var packageName = regexp.MustCompile(`services[/\\](?P[\w\-\.\d_\\/]+)[/\\](?:(?P` + armPathModifier + `)[/\\])?(?Pv?\d{4}-\d{2}-\d{2}[\w\d\.\-]*|v?\d+\.\d+[\.\d\w\-]*)[/\\](?P[\w\d\-\._]+)`) +var packageName = regexp.MustCompile(`services[/\\](?P[\w\-\.\d_\\/]+)[/\\](?:(?P` + armPathModifier + `)[/\\])?(?Pv?\d{4}-\d{2}-\d{2}[\w\d\.\-]*|v?\d+\.\d+[\.\d\w\-]*)[/\\](?P[/\\\w\d\-\._]+)`) // Enumerate scans through the known Azure SDK for Go packages and finds each func (latest LatestStrategy) Enumerate(cancel <-chan struct{}) collection.Enumerator {