From 2d0edaefaf855084be03d063049606766c6d619a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Mon, 21 Oct 2019 18:50:17 +0000 Subject: [PATCH] Generated from 6fe4f8016ca318dac93474cf69f5c111c0671454 fix build --- .../luis/authoring/models.go | 5 +- .../luis/authoring/authoringapi/interfaces.go | 13 +- .../v3.0/luis/authoring/features.go | 391 +++----------- .../v3.0/luis/authoring/model.go | 482 ++++++++++++++++++ .../v3.0/luis/authoring/models.go | 48 +- 5 files changed, 582 insertions(+), 357 deletions(-) diff --git a/profiles/preview/preview/cognitiveservices/luis/authoring/models.go b/profiles/preview/preview/cognitiveservices/luis/authoring/models.go index adbce417b2c5..cec1f7e12769 100644 --- a/profiles/preview/preview/cognitiveservices/luis/authoring/models.go +++ b/profiles/preview/preview/cognitiveservices/luis/authoring/models.go @@ -331,11 +331,11 @@ type ListIntentClassifier = original.ListIntentClassifier type ListIntentsSuggestionExample = original.ListIntentsSuggestionExample type ListLabelTextObject = original.ListLabelTextObject type ListLabeledUtterance = original.ListLabeledUtterance +type ListModelFeatureInformation = original.ListModelFeatureInformation type ListModelInfoResponse = original.ListModelInfoResponse type ListModelTrainingInfo = original.ListModelTrainingInfo type ListNDepthEntityExtractor = original.ListNDepthEntityExtractor type ListPatternAnyEntityExtractor = original.ListPatternAnyEntityExtractor -type ListPatternFeatureInfo = original.ListPatternFeatureInfo type ListPatternRuleInfo = original.ListPatternRuleInfo type ListPhraseListFeatureInfo = original.ListPhraseListFeatureInfo type ListPrebuiltDomain = original.ListPrebuiltDomain @@ -347,6 +347,7 @@ type ListVersionInfo = original.ListVersionInfo type LuisApp = original.LuisApp type ModelClient = original.ModelClient type ModelCreateObject = original.ModelCreateObject +type ModelFeatureInformation = original.ModelFeatureInformation type ModelInfo = original.ModelInfo type ModelInfoResponse = original.ModelInfoResponse type ModelTrainingDetails = original.ModelTrainingDetails @@ -360,13 +361,11 @@ type PatternAnyEntityExtractor = original.PatternAnyEntityExtractor type PatternAnyModelCreateObject = original.PatternAnyModelCreateObject type PatternAnyModelUpdateObject = original.PatternAnyModelUpdateObject type PatternClient = original.PatternClient -type PatternCreateObject = original.PatternCreateObject type PatternFeatureInfo = original.PatternFeatureInfo type PatternRule = original.PatternRule type PatternRuleCreateObject = original.PatternRuleCreateObject type PatternRuleInfo = original.PatternRuleInfo type PatternRuleUpdateObject = original.PatternRuleUpdateObject -type PatternUpdateObject = original.PatternUpdateObject type PermissionsClient = original.PermissionsClient type PersonalAssistantsResponse = original.PersonalAssistantsResponse type PhraseListFeatureInfo = original.PhraseListFeatureInfo diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go b/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go index e5c24dda3a5e..004c989ed5ed 100644 --- a/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/authoringapi/interfaces.go @@ -25,16 +25,13 @@ import ( // FeaturesClientAPI contains the set of methods on the FeaturesClient type. type FeaturesClientAPI interface { + AddEntityFeature(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationCreateObject authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) + AddIntentFeature(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationCreateObject authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) AddPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject authoring.PhraselistCreateObject) (result authoring.Int32, err error) - CreatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject authoring.PatternCreateObject) (result authoring.Int32, err error) - DeletePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result authoring.OperationStatus, err error) DeletePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result authoring.OperationStatus, err error) - GetPatternFeatureInfo(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result authoring.PatternFeatureInfo, err error) GetPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32) (result authoring.PhraseListFeatureInfo, err error) List(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.FeaturesResponseObject, err error) - ListApplicationVersionPatternFeatures(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPatternFeatureInfo, err error) ListPhraseLists(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListPhraseListFeatureInfo, err error) - UpdatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject authoring.PatternUpdateObject) (result authoring.OperationStatus, err error) UpdatePhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistID int32, phraselistUpdateObject *authoring.PhraselistUpdateObject) (result authoring.OperationStatus, err error) } @@ -81,12 +78,14 @@ type ModelClientAPI interface { DeleteCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) DeleteCustomPrebuiltDomain(ctx context.Context, appID uuid.UUID, versionID string, domainName string) (result authoring.OperationStatus, err error) DeleteEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.OperationStatus, err error) + DeleteEntityFeature(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationDeleteObject authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) DeleteEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) DeleteExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result authoring.OperationStatus, err error) DeleteHierarchicalEntity(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID) (result authoring.OperationStatus, err error) DeleteHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result authoring.OperationStatus, err error) DeleteHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) DeleteIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, deleteUtterances *bool) (result authoring.OperationStatus, err error) + DeleteIntentFeature(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationDeleteObject authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) DeletePatternAnyEntityModel(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.OperationStatus, err error) DeletePatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.OperationStatus, err error) DeletePrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result authoring.OperationStatus, err error) @@ -101,6 +100,7 @@ type ModelClientAPI interface { GetCompositeEntityRole(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) GetCustomEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) GetEntity(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.NDepthEntityExtractor, err error) + GetEntityFeatures(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListModelFeatureInformation, err error) GetEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) GetExplicitList(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListExplicitListItem, err error) GetExplicitListItem(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, itemID int64) (result authoring.ExplicitListItem, err error) @@ -108,6 +108,7 @@ type ModelClientAPI interface { GetHierarchicalEntityChild(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, hChildID uuid.UUID) (result authoring.HierarchicalChildEntity, err error) GetHierarchicalEntityRole(ctx context.Context, appID uuid.UUID, versionID string, hEntityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) GetIntent(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result authoring.IntentClassifier, err error) + GetIntentFeatures(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result authoring.ListModelFeatureInformation, err error) GetPatternAnyEntityInfo(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.PatternAnyEntityExtractor, err error) GetPatternAnyEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID) (result authoring.EntityRole, err error) GetPrebuilt(ctx context.Context, appID uuid.UUID, versionID string, prebuiltID uuid.UUID) (result authoring.PrebuiltEntityExtractor, err error) @@ -138,6 +139,8 @@ type ModelClientAPI interface { ListRegexEntityInfos(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result authoring.ListRegexEntityExtractor, err error) ListRegexEntityRoles(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result authoring.ListEntityRole, err error) PatchClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelPatchObject authoring.ClosedListModelPatchObject) (result authoring.OperationStatus, err error) + ReplaceEntityFeatures(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationsUpdateObject []authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) + ReplaceIntentFeatures(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationsUpdateObject []authoring.ModelFeatureInformation) (result authoring.OperationStatus, err error) UpdateClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID, closedListModelUpdateObject authoring.ClosedListModelUpdateObject) (result authoring.OperationStatus, err error) UpdateClosedListEntityRole(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, roleID uuid.UUID, entityRoleUpdateObject authoring.EntityRoleUpdateObject) (result authoring.OperationStatus, err error) UpdateCompositeEntity(ctx context.Context, appID uuid.UUID, versionID string, cEntityID uuid.UUID, compositeModelUpdateObject authoring.CompositeEntityModel) (result authoring.OperationStatus, err error) diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/features.go b/services/preview/cognitiveservices/v3.0/luis/authoring/features.go index 23015f60839d..58c6067d6245 100644 --- a/services/preview/cognitiveservices/v3.0/luis/authoring/features.go +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/features.go @@ -37,15 +37,15 @@ func NewFeaturesClient(endpoint string) FeaturesClient { return FeaturesClient{New(endpoint)} } -// AddPhraseList creates a new phraselist feature in a version of the application. +// AddEntityFeature adds a new feature relation to be used by the entity in a version of the application. // Parameters: // appID - the application ID. // versionID - the version ID. -// phraselistCreateObject - a Phraselist object containing Name, comma-separated Phrases and the isExchangeable -// boolean. Default value for isExchangeable is true. -func (client FeaturesClient) AddPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject PhraselistCreateObject) (result Int32, err error) { +// entityID - the entity extractor ID. +// featureRelationCreateObject - a Feature relation information object. +func (client FeaturesClient) AddEntityFeature(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationCreateObject ModelFeatureInformation) (result OperationStatus, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.AddPhraseList") + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.AddEntityFeature") defer func() { sc := -1 if result.Response.Response != nil { @@ -54,35 +54,36 @@ func (client FeaturesClient) AddPhraseList(ctx context.Context, appID uuid.UUID, tracing.EndSpan(ctx, sc, err) }() } - req, err := client.AddPhraseListPreparer(ctx, appID, versionID, phraselistCreateObject) + req, err := client.AddEntityFeaturePreparer(ctx, appID, versionID, entityID, featureRelationCreateObject) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddEntityFeature", nil, "Failure preparing request") return } - resp, err := client.AddPhraseListSender(req) + resp, err := client.AddEntityFeatureSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddEntityFeature", resp, "Failure sending request") return } - result, err = client.AddPhraseListResponder(resp) + result, err = client.AddEntityFeatureResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddEntityFeature", 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) { +// AddEntityFeaturePreparer prepares the AddEntityFeature request. +func (client FeaturesClient) AddEntityFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationCreateObject ModelFeatureInformation) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } pathParameters := map[string]interface{}{ "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), "versionId": autorest.Encode("path", versionID), } @@ -90,40 +91,40 @@ func (client FeaturesClient) AddPhraseListPreparer(ctx context.Context, appID uu autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists", pathParameters), - autorest.WithJSON(phraselistCreateObject)) + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/features", pathParameters), + autorest.WithJSON(featureRelationCreateObject)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// AddPhraseListSender sends the AddPhraseList request. The method will close the +// AddEntityFeatureSender sends the AddEntityFeature request. The method will close the // http.Response Body if it receives an error. -func (client FeaturesClient) AddPhraseListSender(req *http.Request) (*http.Response, error) { +func (client FeaturesClient) AddEntityFeatureSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) return autorest.SendWithSender(client, req, sd...) } -// AddPhraseListResponder handles the response to the AddPhraseList request. The method always +// AddEntityFeatureResponder handles the response to the AddEntityFeature request. The method always // closes the http.Response Body. -func (client FeaturesClient) AddPhraseListResponder(resp *http.Response) (result Int32, err error) { +func (client FeaturesClient) AddEntityFeatureResponder(resp *http.Response) (result OperationStatus, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Value), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// CreatePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Creates a new pattern feature in a -// version of the application. +// AddIntentFeature adds a new feature relation to be used by the intent in a version of the application. // Parameters: // appID - the application ID. // versionID - the version ID. -// patternCreateObject - the Name and Pattern of the feature. -func (client FeaturesClient) CreatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject PatternCreateObject) (result Int32, err error) { +// intentID - the intent classifier ID. +// featureRelationCreateObject - a Feature relation information object. +func (client FeaturesClient) AddIntentFeature(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationCreateObject ModelFeatureInformation) (result OperationStatus, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.CreatePatternFeature") + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.AddIntentFeature") defer func() { sc := -1 if result.Response.Response != nil { @@ -132,35 +133,36 @@ func (client FeaturesClient) CreatePatternFeature(ctx context.Context, appID uui tracing.EndSpan(ctx, sc, err) }() } - req, err := client.CreatePatternFeaturePreparer(ctx, appID, versionID, patternCreateObject) + req, err := client.AddIntentFeaturePreparer(ctx, appID, versionID, intentID, featureRelationCreateObject) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddIntentFeature", nil, "Failure preparing request") return } - resp, err := client.CreatePatternFeatureSender(req) + resp, err := client.AddIntentFeatureSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddIntentFeature", resp, "Failure sending request") return } - result, err = client.CreatePatternFeatureResponder(resp) + result, err = client.AddIntentFeatureResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "CreatePatternFeature", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddIntentFeature", resp, "Failure responding to request") } return } -// CreatePatternFeaturePreparer prepares the CreatePatternFeature request. -func (client FeaturesClient) CreatePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternCreateObject PatternCreateObject) (*http.Request, error) { +// AddIntentFeaturePreparer prepares the AddIntentFeature request. +func (client FeaturesClient) AddIntentFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationCreateObject ModelFeatureInformation) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } pathParameters := map[string]interface{}{ "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), "versionId": autorest.Encode("path", versionID), } @@ -168,40 +170,40 @@ func (client FeaturesClient) CreatePatternFeaturePreparer(ctx context.Context, a autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns", pathParameters), - autorest.WithJSON(patternCreateObject)) + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/features", pathParameters), + autorest.WithJSON(featureRelationCreateObject)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// CreatePatternFeatureSender sends the CreatePatternFeature request. The method will close the +// AddIntentFeatureSender sends the AddIntentFeature request. The method will close the // http.Response Body if it receives an error. -func (client FeaturesClient) CreatePatternFeatureSender(req *http.Request) (*http.Response, error) { +func (client FeaturesClient) AddIntentFeatureSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) return autorest.SendWithSender(client, req, sd...) } -// CreatePatternFeatureResponder handles the response to the CreatePatternFeature request. The method always +// AddIntentFeatureResponder handles the response to the AddIntentFeature request. The method always // closes the http.Response Body. -func (client FeaturesClient) CreatePatternFeatureResponder(resp *http.Response) (result Int32, err error) { +func (client FeaturesClient) AddIntentFeatureResponder(resp *http.Response) (result OperationStatus, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Value), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// DeletePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Deletes a pattern feature in a version -// of the application. +// AddPhraseList creates a new phraselist feature in a version of the application. // Parameters: // appID - the application ID. // versionID - the version ID. -// patternID - the pattern feature ID. -func (client FeaturesClient) DeletePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result OperationStatus, err error) { +// phraselistCreateObject - a Phraselist object containing Name, comma-separated Phrases and the isExchangeable +// boolean. Default value for isExchangeable is true. +func (client FeaturesClient) AddPhraseList(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject PhraselistCreateObject) (result Int32, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.DeletePatternFeature") + ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.AddPhraseList") defer func() { sc := -1 if result.Response.Response != nil { @@ -210,61 +212,62 @@ func (client FeaturesClient) DeletePatternFeature(ctx context.Context, appID uui tracing.EndSpan(ctx, sc, err) }() } - req, err := client.DeletePatternFeaturePreparer(ctx, appID, versionID, patternID) + req, err := client.AddPhraseListPreparer(ctx, appID, versionID, phraselistCreateObject) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", nil, "Failure preparing request") return } - resp, err := client.DeletePatternFeatureSender(req) + resp, err := client.AddPhraseListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure sending request") return } - result, err = client.DeletePatternFeatureResponder(resp) + result, err = client.AddPhraseListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "DeletePatternFeature", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "AddPhraseList", resp, "Failure responding to request") } return } -// DeletePatternFeaturePreparer prepares the DeletePatternFeature request. -func (client FeaturesClient) DeletePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (*http.Request, error) { +// AddPhraseListPreparer prepares the AddPhraseList request. +func (client FeaturesClient) AddPhraseListPreparer(ctx context.Context, appID uuid.UUID, versionID string, phraselistCreateObject PhraselistCreateObject) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } pathParameters := map[string]interface{}{ "appId": autorest.Encode("path", appID), - "patternId": autorest.Encode("path", patternID), "versionId": autorest.Encode("path", versionID), } preparer := autorest.CreatePreparer( - autorest.AsDelete(), + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters)) + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/phraselists", pathParameters), + autorest.WithJSON(phraselistCreateObject)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// DeletePatternFeatureSender sends the DeletePatternFeature request. The method will close the +// AddPhraseListSender sends the AddPhraseList request. The method will close the // http.Response Body if it receives an error. -func (client FeaturesClient) DeletePatternFeatureSender(req *http.Request) (*http.Response, error) { +func (client FeaturesClient) AddPhraseListSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) return autorest.SendWithSender(client, req, sd...) } -// DeletePatternFeatureResponder handles the response to the DeletePatternFeature request. The method always +// AddPhraseListResponder handles the response to the AddPhraseList request. The method always // closes the http.Response Body. -func (client FeaturesClient) DeletePatternFeatureResponder(resp *http.Response) (result OperationStatus, err error) { +func (client FeaturesClient) AddPhraseListResponder(resp *http.Response) (result Int32, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -346,83 +349,6 @@ func (client FeaturesClient) DeletePhraseListResponder(resp *http.Response) (res return } -// GetPatternFeatureInfo [DEPRECATED NOTICE: This operation will soon be removed] Gets the specified pattern feature's -// info in a version of the application. -// Parameters: -// appID - the application ID. -// versionID - the version ID. -// patternID - the pattern feature ID. -func (client FeaturesClient) GetPatternFeatureInfo(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (result PatternFeatureInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.GetPatternFeatureInfo") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPatternFeatureInfoPreparer(ctx, appID, versionID, patternID) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", nil, "Failure preparing request") - return - } - - resp, err := client.GetPatternFeatureInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", resp, "Failure sending request") - return - } - - result, err = client.GetPatternFeatureInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "GetPatternFeatureInfo", resp, "Failure responding to request") - } - - return -} - -// GetPatternFeatureInfoPreparer prepares the GetPatternFeatureInfo request. -func (client FeaturesClient) GetPatternFeatureInfoPreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "Endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "appId": autorest.Encode("path", appID), - "patternId": autorest.Encode("path", patternID), - "versionId": autorest.Encode("path", versionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPatternFeatureInfoSender sends the GetPatternFeatureInfo request. The method will close the -// http.Response Body if it receives an error. -func (client FeaturesClient) GetPatternFeatureInfoSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - return autorest.SendWithSender(client, req, sd...) -} - -// GetPatternFeatureInfoResponder handles the response to the GetPatternFeatureInfo request. The method always -// closes the http.Response Body. -func (client FeaturesClient) GetPatternFeatureInfoResponder(resp *http.Response) (result PatternFeatureInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // GetPhraseList gets phraselist feature info in a version of the application. // Parameters: // appID - the application ID. @@ -600,108 +526,6 @@ func (client FeaturesClient) ListResponder(resp *http.Response) (result Features return } -// ListApplicationVersionPatternFeatures [DEPRECATED NOTICE: This operation will soon be removed] Gets all the pattern -// features. -// Parameters: -// appID - the application ID. -// versionID - the version ID. -// skip - the number of entries to skip. Default value is 0. -// take - the number of entries to return. Maximum page size is 500. Default is 100. -func (client FeaturesClient) ListApplicationVersionPatternFeatures(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (result ListPatternFeatureInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.ListApplicationVersionPatternFeatures") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, - {TargetValue: take, - Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil}, - {Target: "take", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", err.Error()) - } - - req, err := client.ListApplicationVersionPatternFeaturesPreparer(ctx, appID, versionID, skip, take) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicationVersionPatternFeaturesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", resp, "Failure sending request") - return - } - - result, err = client.ListApplicationVersionPatternFeaturesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "ListApplicationVersionPatternFeatures", resp, "Failure responding to request") - } - - return -} - -// ListApplicationVersionPatternFeaturesPreparer prepares the ListApplicationVersionPatternFeatures request. -func (client FeaturesClient) ListApplicationVersionPatternFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, skip *int32, take *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "Endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "appId": autorest.Encode("path", appID), - "versionId": autorest.Encode("path", versionID), - } - - queryParameters := map[string]interface{}{} - if skip != nil { - queryParameters["skip"] = autorest.Encode("query", *skip) - } else { - queryParameters["skip"] = autorest.Encode("query", 0) - } - if take != nil { - queryParameters["take"] = autorest.Encode("query", *take) - } else { - queryParameters["take"] = autorest.Encode("query", 100) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListApplicationVersionPatternFeaturesSender sends the ListApplicationVersionPatternFeatures request. The method will close the -// http.Response Body if it receives an error. -func (client FeaturesClient) ListApplicationVersionPatternFeaturesSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListApplicationVersionPatternFeaturesResponder handles the response to the ListApplicationVersionPatternFeatures request. The method always -// closes the http.Response Body. -func (client FeaturesClient) ListApplicationVersionPatternFeaturesResponder(resp *http.Response) (result ListPatternFeatureInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // ListPhraseLists gets all the phraselist features in a version of the application. // Parameters: // appID - the application ID. @@ -803,87 +627,6 @@ func (client FeaturesClient) ListPhraseListsResponder(resp *http.Response) (resu return } -// UpdatePatternFeature [DEPRECATED NOTICE: This operation will soon be removed] Updates the pattern, the name and the -// state of the pattern feature in a version of the application. -// Parameters: -// appID - the application ID. -// versionID - the version ID. -// patternID - the pattern feature ID. -// patternUpdateObject - the new values for: - Just a boolean called IsActive, in which case the status of the -// feature will be changed. - Name, Pattern and a boolean called IsActive to update the feature. -func (client FeaturesClient) UpdatePatternFeature(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject PatternUpdateObject) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FeaturesClient.UpdatePatternFeature") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePatternFeaturePreparer(ctx, appID, versionID, patternID, patternUpdateObject) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePatternFeatureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", resp, "Failure sending request") - return - } - - result, err = client.UpdatePatternFeatureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authoring.FeaturesClient", "UpdatePatternFeature", resp, "Failure responding to request") - } - - return -} - -// UpdatePatternFeaturePreparer prepares the UpdatePatternFeature request. -func (client FeaturesClient) UpdatePatternFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, patternID int32, patternUpdateObject PatternUpdateObject) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "Endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "appId": autorest.Encode("path", appID), - "patternId": autorest.Encode("path", patternID), - "versionId": autorest.Encode("path", versionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), - autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/patterns/{patternId}", pathParameters), - autorest.WithJSON(patternUpdateObject)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdatePatternFeatureSender sends the UpdatePatternFeature request. The method will close the -// http.Response Body if it receives an error. -func (client FeaturesClient) UpdatePatternFeatureSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - return autorest.SendWithSender(client, req, sd...) -} - -// UpdatePatternFeatureResponder handles the response to the UpdatePatternFeature request. The method always -// closes the http.Response Body. -func (client FeaturesClient) UpdatePatternFeatureResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // UpdatePhraseList updates the phrases, the state and the name of the phraselist feature in a version of the // application. // Parameters: diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/model.go b/services/preview/cognitiveservices/v3.0/luis/authoring/model.go index 5799f5189ad8..eebc34e1e621 100644 --- a/services/preview/cognitiveservices/v3.0/luis/authoring/model.go +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/model.go @@ -2306,6 +2306,86 @@ func (client ModelClient) DeleteEntityResponder(resp *http.Response) (result Ope return } +// DeleteEntityFeature deletes a relation from the feature relations used by the entity in a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +// featureRelationDeleteObject - a feature information object containing the feature relation to delete. +func (client ModelClient) DeleteEntityFeature(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationDeleteObject ModelFeatureInformation) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteEntityFeature") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteEntityFeaturePreparer(ctx, appID, versionID, entityID, featureRelationDeleteObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityFeature", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteEntityFeatureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityFeature", resp, "Failure sending request") + return + } + + result, err = client.DeleteEntityFeatureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteEntityFeature", resp, "Failure responding to request") + } + + return +} + +// DeleteEntityFeaturePreparer prepares the DeleteEntityFeature request. +func (client ModelClient) DeleteEntityFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationDeleteObject ModelFeatureInformation) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/features", pathParameters), + autorest.WithJSON(featureRelationDeleteObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteEntityFeatureSender sends the DeleteEntityFeature request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteEntityFeatureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteEntityFeatureResponder handles the response to the DeleteEntityFeature request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteEntityFeatureResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // DeleteEntityRole sends the delete entity role request. // Parameters: // appID - the application ID. @@ -2780,6 +2860,86 @@ func (client ModelClient) DeleteIntentResponder(resp *http.Response) (result Ope return } +// DeleteIntentFeature deletes a relation from the feature relations used by the intent in a version of the +// application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// featureRelationDeleteObject - a feature information object containing the feature relation to delete. +func (client ModelClient) DeleteIntentFeature(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationDeleteObject ModelFeatureInformation) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.DeleteIntentFeature") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteIntentFeaturePreparer(ctx, appID, versionID, intentID, featureRelationDeleteObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntentFeature", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteIntentFeatureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntentFeature", resp, "Failure sending request") + return + } + + result, err = client.DeleteIntentFeatureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "DeleteIntentFeature", resp, "Failure responding to request") + } + + return +} + +// DeleteIntentFeaturePreparer prepares the DeleteIntentFeature request. +func (client ModelClient) DeleteIntentFeaturePreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationDeleteObject ModelFeatureInformation) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/features", pathParameters), + autorest.WithJSON(featureRelationDeleteObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteIntentFeatureSender sends the DeleteIntentFeature request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) DeleteIntentFeatureSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteIntentFeatureResponder handles the response to the DeleteIntentFeature request. The method always +// closes the http.Response Body. +func (client ModelClient) DeleteIntentFeatureResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // DeletePatternAnyEntityModel sends the delete pattern any entity model request. // Parameters: // appID - the application ID. @@ -3885,6 +4045,82 @@ func (client ModelClient) GetEntityResponder(resp *http.Response) (result NDepth return } +// GetEntityFeatures gets the information of the features used by the entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +func (client ModelClient) GetEntityFeatures(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (result ListModelFeatureInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetEntityFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEntityFeaturesPreparer(ctx, appID, versionID, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.GetEntityFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityFeatures", resp, "Failure sending request") + return + } + + result, err = client.GetEntityFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetEntityFeatures", resp, "Failure responding to request") + } + + return +} + +// GetEntityFeaturesPreparer prepares the GetEntityFeatures request. +func (client ModelClient) GetEntityFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/features", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEntityFeaturesSender sends the GetEntityFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetEntityFeaturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetEntityFeaturesResponder handles the response to the GetEntityFeatures request. The method always +// closes the http.Response Body. +func (client ModelClient) GetEntityFeaturesResponder(resp *http.Response) (result ListModelFeatureInformation, 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 +} + // GetEntityRole sends the get entity role request. // Parameters: // appID - the application ID. @@ -4426,6 +4662,82 @@ func (client ModelClient) GetIntentResponder(resp *http.Response) (result Intent return } +// GetIntentFeatures gets the information of the features used by the intent in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +func (client ModelClient) GetIntentFeatures(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (result ListModelFeatureInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.GetIntentFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetIntentFeaturesPreparer(ctx, appID, versionID, intentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntentFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.GetIntentFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntentFeatures", resp, "Failure sending request") + return + } + + result, err = client.GetIntentFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "GetIntentFeatures", resp, "Failure responding to request") + } + + return +} + +// GetIntentFeaturesPreparer prepares the GetIntentFeatures request. +func (client ModelClient) GetIntentFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/features", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIntentFeaturesSender sends the GetIntentFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) GetIntentFeaturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetIntentFeaturesResponder handles the response to the GetIntentFeatures request. The method always +// closes the http.Response Body. +func (client ModelClient) GetIntentFeaturesResponder(resp *http.Response) (result ListModelFeatureInformation, 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 +} + // GetPatternAnyEntityInfo sends the get pattern any entity info request. // Parameters: // appID - the application ID. @@ -6972,6 +7284,176 @@ func (client ModelClient) PatchClosedListResponder(resp *http.Response) (result return } +// ReplaceEntityFeatures updates the information of the features used by the entity in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// entityID - the entity extractor ID. +// featureRelationsUpdateObject - a list of feature information objects containing the new feature relations. +func (client ModelClient) ReplaceEntityFeatures(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationsUpdateObject []ModelFeatureInformation) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ReplaceEntityFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: featureRelationsUpdateObject, + Constraints: []validation.Constraint{{Target: "featureRelationsUpdateObject", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ReplaceEntityFeatures", err.Error()) + } + + req, err := client.ReplaceEntityFeaturesPreparer(ctx, appID, versionID, entityID, featureRelationsUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceEntityFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.ReplaceEntityFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceEntityFeatures", resp, "Failure sending request") + return + } + + result, err = client.ReplaceEntityFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceEntityFeatures", resp, "Failure responding to request") + } + + return +} + +// ReplaceEntityFeaturesPreparer prepares the ReplaceEntityFeatures request. +func (client ModelClient) ReplaceEntityFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, entityID uuid.UUID, featureRelationsUpdateObject []ModelFeatureInformation) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "entityId": autorest.Encode("path", entityID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/entities/{entityId}/features", pathParameters), + autorest.WithJSON(featureRelationsUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplaceEntityFeaturesSender sends the ReplaceEntityFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ReplaceEntityFeaturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ReplaceEntityFeaturesResponder handles the response to the ReplaceEntityFeatures request. The method always +// closes the http.Response Body. +func (client ModelClient) ReplaceEntityFeaturesResponder(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 +} + +// ReplaceIntentFeatures updates the information of the features used by the intent in a version of the application. +// Parameters: +// appID - the application ID. +// versionID - the version ID. +// intentID - the intent classifier ID. +// featureRelationsUpdateObject - a list of feature information objects containing the new feature relations. +func (client ModelClient) ReplaceIntentFeatures(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationsUpdateObject []ModelFeatureInformation) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelClient.ReplaceIntentFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: featureRelationsUpdateObject, + Constraints: []validation.Constraint{{Target: "featureRelationsUpdateObject", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("authoring.ModelClient", "ReplaceIntentFeatures", err.Error()) + } + + req, err := client.ReplaceIntentFeaturesPreparer(ctx, appID, versionID, intentID, featureRelationsUpdateObject) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceIntentFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.ReplaceIntentFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceIntentFeatures", resp, "Failure sending request") + return + } + + result, err = client.ReplaceIntentFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authoring.ModelClient", "ReplaceIntentFeatures", resp, "Failure responding to request") + } + + return +} + +// ReplaceIntentFeaturesPreparer prepares the ReplaceIntentFeatures request. +func (client ModelClient) ReplaceIntentFeaturesPreparer(ctx context.Context, appID uuid.UUID, versionID string, intentID uuid.UUID, featureRelationsUpdateObject []ModelFeatureInformation) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "intentId": autorest.Encode("path", intentID), + "versionId": autorest.Encode("path", versionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{Endpoint}/luis/api/v3.0-preview", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/intents/{intentId}/features", pathParameters), + autorest.WithJSON(featureRelationsUpdateObject)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplaceIntentFeaturesSender sends the ReplaceIntentFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client ModelClient) ReplaceIntentFeaturesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ReplaceIntentFeaturesResponder handles the response to the ReplaceIntentFeatures request. The method always +// closes the http.Response Body. +func (client ModelClient) ReplaceIntentFeaturesResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // UpdateClosedList updates the list entity in a version of the application. // Parameters: // appID - the application ID. diff --git a/services/preview/cognitiveservices/v3.0/luis/authoring/models.go b/services/preview/cognitiveservices/v3.0/luis/authoring/models.go index 4bb36f436ce5..64d7ab0da5b2 100644 --- a/services/preview/cognitiveservices/v3.0/luis/authoring/models.go +++ b/services/preview/cognitiveservices/v3.0/luis/authoring/models.go @@ -982,6 +982,8 @@ type FeatureInfoObject struct { Name *string `json:"name,omitempty"` // IsActive - Indicates if the feature is enabled. IsActive *bool `json:"isActive,omitempty"` + // EnabledForAllModels - Indicates if the feature is enabled for all models in the application. + EnabledForAllModels *bool `json:"enabledForAllModels,omitempty"` } // FeaturesResponseObject model Features, including Patterns and Phraselists. @@ -1273,6 +1275,12 @@ type ListLabelTextObject struct { Value *[]LabelTextObject `json:"value,omitempty"` } +// ListModelFeatureInformation ... +type ListModelFeatureInformation struct { + autorest.Response `json:"-"` + Value *[]ModelFeatureInformation `json:"value,omitempty"` +} + // ListModelInfoResponse ... type ListModelInfoResponse struct { autorest.Response `json:"-"` @@ -1297,12 +1305,6 @@ type ListPatternAnyEntityExtractor struct { Value *[]PatternAnyEntityExtractor `json:"value,omitempty"` } -// ListPatternFeatureInfo ... -type ListPatternFeatureInfo struct { - autorest.Response `json:"-"` - Value *[]PatternFeatureInfo `json:"value,omitempty"` -} - // ListPatternRuleInfo ... type ListPatternRuleInfo struct { autorest.Response `json:"-"` @@ -1610,6 +1612,15 @@ type ModelCreateObject struct { Name *string `json:"name,omitempty"` } +// ModelFeatureInformation an object containing the model feature information either the model name or +// feature name. +type ModelFeatureInformation struct { + // ModelName - The name of the model used. + ModelName *string `json:"modelName,omitempty"` + // FeatureName - The name of the feature used. + FeatureName *string `json:"featureName,omitempty"` +} + // ModelInfo base type used in entity types. type ModelInfo struct { // ID - The ID of the Entity Model. @@ -1745,17 +1756,8 @@ type PatternAnyModelUpdateObject struct { ExplicitList *[]string `json:"explicitList,omitempty"` } -// PatternCreateObject object model for creating a Pattern feature. -type PatternCreateObject struct { - // Pattern - The Regular Expression to match. - Pattern *string `json:"pattern,omitempty"` - // Name - Name of the feature. - Name *string `json:"name,omitempty"` -} - // PatternFeatureInfo pattern feature. type PatternFeatureInfo struct { - autorest.Response `json:"-"` // Pattern - The Regular Expression to match. Pattern *string `json:"pattern,omitempty"` // ID - A six-digit ID used for Features. @@ -1764,6 +1766,8 @@ type PatternFeatureInfo struct { Name *string `json:"name,omitempty"` // IsActive - Indicates if the feature is enabled. IsActive *bool `json:"isActive,omitempty"` + // EnabledForAllModels - Indicates if the feature is enabled for all models in the application. + EnabledForAllModels *bool `json:"enabledForAllModels,omitempty"` } // PatternRule pattern @@ -1803,16 +1807,6 @@ type PatternRuleUpdateObject struct { Intent *string `json:"intent,omitempty"` } -// PatternUpdateObject object model for updating an existing Pattern feature. -type PatternUpdateObject struct { - // Pattern - The Regular Expression to match. - Pattern *string `json:"pattern,omitempty"` - // Name - Name of the feature. - Name *string `json:"name,omitempty"` - // IsActive - Indicates if the Pattern feature is enabled. - IsActive *bool `json:"isActive,omitempty"` -} - // PersonalAssistantsResponse response containing user's endpoint keys and the endpoint URLs of the // prebuilt Cortana applications. type PersonalAssistantsResponse struct { @@ -1856,6 +1850,8 @@ type PhraseListFeatureInfo struct { Name *string `json:"name,omitempty"` // IsActive - Indicates if the feature is enabled. IsActive *bool `json:"isActive,omitempty"` + // EnabledForAllModels - Indicates if the feature is enabled for all models in the application. + EnabledForAllModels *bool `json:"enabledForAllModels,omitempty"` } // PhraselistUpdateObject object model for updating a Phraselist. @@ -1868,6 +1864,8 @@ type PhraselistUpdateObject struct { 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"` + // EnabledForAllModels - Indicates if the Phraselist is enabled for all models in the application. + EnabledForAllModels *bool `json:"enabledForAllModels,omitempty"` } // PrebuiltDomain prebuilt Domain.