From b7568dfeaecb5a04ad33936fc3bf10f15bda16e2 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Tue, 17 Sep 2019 22:46:37 +0000 Subject: [PATCH] Generated from d3620f1cf3fda9d30555c4b0e47a1ea521ca5404 Review 1 + remove v3.0 preview --- .../cognitiveservices/luis/runtime/models.go | 52 ++++ .../luis/runtime/runtimeapi/models.go | 24 ++ .../cognitiveservices/luis/runtime/models.go | 52 ++++ .../luis/runtime/runtimeapi/models.go | 24 ++ .../v3.0/luis/runtime/client.go | 44 ++++ .../v3.0/luis/runtime/models.go | 152 ++++++++++++ .../v3.0/luis/runtime/prediction.go | 234 ++++++++++++++++++ .../luis/runtime/runtimeapi/interfaces.go | 32 +++ .../v3.0/luis/runtime/version.go | 30 +++ 9 files changed, 644 insertions(+) create mode 100644 profiles/latest/stable/cognitiveservices/luis/runtime/models.go create mode 100644 profiles/latest/stable/cognitiveservices/luis/runtime/runtimeapi/models.go create mode 100644 profiles/preview/stable/cognitiveservices/luis/runtime/models.go create mode 100644 profiles/preview/stable/cognitiveservices/luis/runtime/runtimeapi/models.go create mode 100644 services/stable/cognitiveservices/v3.0/luis/runtime/client.go create mode 100644 services/stable/cognitiveservices/v3.0/luis/runtime/models.go create mode 100644 services/stable/cognitiveservices/v3.0/luis/runtime/prediction.go create mode 100644 services/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi/interfaces.go create mode 100644 services/stable/cognitiveservices/v3.0/luis/runtime/version.go diff --git a/profiles/latest/stable/cognitiveservices/luis/runtime/models.go b/profiles/latest/stable/cognitiveservices/luis/runtime/models.go new file mode 100644 index 000000000000..dbf309afd91e --- /dev/null +++ b/profiles/latest/stable/cognitiveservices/luis/runtime/models.go @@ -0,0 +1,52 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package runtime + +import original "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime" + +type BaseClient = original.BaseClient +type DynamicList = original.DynamicList +type Error = original.Error +type ErrorBody = original.ErrorBody +type ExternalEntity = original.ExternalEntity +type Intent = original.Intent +type Prediction = original.Prediction +type PredictionClient = original.PredictionClient +type PredictionRequest = original.PredictionRequest +type PredictionRequestOptions = original.PredictionRequestOptions +type PredictionResponse = original.PredictionResponse +type RequestList = original.RequestList +type Sentiment = original.Sentiment + +func New(endpoint string) BaseClient { + return original.New(endpoint) +} +func NewPredictionClient(endpoint string) PredictionClient { + return original.NewPredictionClient(endpoint) +} +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/latest/stable/cognitiveservices/luis/runtime/runtimeapi/models.go b/profiles/latest/stable/cognitiveservices/luis/runtime/runtimeapi/models.go new file mode 100644 index 000000000000..ef12380cc6ec --- /dev/null +++ b/profiles/latest/stable/cognitiveservices/luis/runtime/runtimeapi/models.go @@ -0,0 +1,24 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package runtimeapi + +import original "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi" + +type PredictionClientAPI = original.PredictionClientAPI diff --git a/profiles/preview/stable/cognitiveservices/luis/runtime/models.go b/profiles/preview/stable/cognitiveservices/luis/runtime/models.go new file mode 100644 index 000000000000..03f934ef87b7 --- /dev/null +++ b/profiles/preview/stable/cognitiveservices/luis/runtime/models.go @@ -0,0 +1,52 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package runtime + +import original "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime" + +type BaseClient = original.BaseClient +type DynamicList = original.DynamicList +type Error = original.Error +type ErrorBody = original.ErrorBody +type ExternalEntity = original.ExternalEntity +type Intent = original.Intent +type Prediction = original.Prediction +type PredictionClient = original.PredictionClient +type PredictionRequest = original.PredictionRequest +type PredictionRequestOptions = original.PredictionRequestOptions +type PredictionResponse = original.PredictionResponse +type RequestList = original.RequestList +type Sentiment = original.Sentiment + +func New(endpoint string) BaseClient { + return original.New(endpoint) +} +func NewPredictionClient(endpoint string) PredictionClient { + return original.NewPredictionClient(endpoint) +} +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/stable/cognitiveservices/luis/runtime/runtimeapi/models.go b/profiles/preview/stable/cognitiveservices/luis/runtime/runtimeapi/models.go new file mode 100644 index 000000000000..ef12380cc6ec --- /dev/null +++ b/profiles/preview/stable/cognitiveservices/luis/runtime/runtimeapi/models.go @@ -0,0 +1,24 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package runtimeapi + +import original "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi" + +type PredictionClientAPI = original.PredictionClientAPI diff --git a/services/stable/cognitiveservices/v3.0/luis/runtime/client.go b/services/stable/cognitiveservices/v3.0/luis/runtime/client.go new file mode 100644 index 000000000000..b9e8440b450c --- /dev/null +++ b/services/stable/cognitiveservices/v3.0/luis/runtime/client.go @@ -0,0 +1,44 @@ +// Package runtime implements the Azure ARM Runtime service API version 3.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 + Endpoint string +} + +// New creates an instance of the BaseClient client. +func New(endpoint string) BaseClient { + return NewWithoutDefaults(endpoint) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(endpoint string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, + } +} diff --git a/services/stable/cognitiveservices/v3.0/luis/runtime/models.go b/services/stable/cognitiveservices/v3.0/luis/runtime/models.go new file mode 100644 index 000000000000..e4d87ddb02ad --- /dev/null +++ b/services/stable/cognitiveservices/v3.0/luis/runtime/models.go @@ -0,0 +1,152 @@ +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" + "github.com/Azure/go-autorest/autorest/date" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime" + +// DynamicList defines an extension for a list entity. +type DynamicList struct { + // ListEntityName - The name of the list entity to extend. + ListEntityName *string `json:"listEntityName,omitempty"` + // RequestLists - The lists to append on the extended list entity. + RequestLists *[]RequestList `json:"requestLists,omitempty"` +} + +// Error represents the error that occurred. +type Error struct { + Error *ErrorBody `json:"error,omitempty"` +} + +// ErrorBody represents the definition of the error that occurred. +type ErrorBody struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` +} + +// ExternalEntity defines a user predicted entity that extends an already existing one. +type ExternalEntity struct { + // EntityName - The name of the entity to extend. + EntityName *string `json:"entityName,omitempty"` + // StartIndex - The start character index of the predicted entity. + StartIndex *int32 `json:"startIndex,omitempty"` + // EntityLength - The length of the predicted entity. + EntityLength *int32 `json:"entityLength,omitempty"` + // Resolution - A user supplied custom resolution to return as the entity's prediction. + Resolution interface{} `json:"resolution,omitempty"` + // Score - A user supplied score to return as the entity's prediction score. + Score *float64 `json:"score,omitempty"` +} + +// Intent represents an intent prediction. +type Intent struct { + // Score - The score of the fired intent. + Score *float64 `json:"score,omitempty"` + // ChildApp - The prediction of the dispatched application. + ChildApp *Prediction `json:"childApp,omitempty"` +} + +// Prediction represents the prediction of a query. +type Prediction struct { + // AlteredQuery - The query after spell checking. Only set if spell check was enabled and a spelling mistake was found. + AlteredQuery *string `json:"alteredQuery,omitempty"` + // TopIntent - The name of the top scoring intent. + TopIntent *string `json:"topIntent,omitempty"` + // Intents - A dictionary representing the intents that fired. + Intents map[string]*Intent `json:"intents"` + // Entities - A dictionary representing the entities that fired. + Entities map[string]interface{} `json:"entities"` + // Sentiment - The result of the sentiment analysis. + Sentiment *Sentiment `json:"sentiment,omitempty"` +} + +// MarshalJSON is the custom marshaler for Prediction. +func (p Prediction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.AlteredQuery != nil { + objectMap["alteredQuery"] = p.AlteredQuery + } + if p.TopIntent != nil { + objectMap["topIntent"] = p.TopIntent + } + if p.Intents != nil { + objectMap["intents"] = p.Intents + } + if p.Entities != nil { + objectMap["entities"] = p.Entities + } + if p.Sentiment != nil { + objectMap["sentiment"] = p.Sentiment + } + return json.Marshal(objectMap) +} + +// PredictionRequest represents the prediction request parameters. +type PredictionRequest struct { + // Query - The query to predict. + Query *string `json:"query,omitempty"` + // Options - The custom options defined for this request. + Options *PredictionRequestOptions `json:"options,omitempty"` + // ExternalEntities - The externally predicted entities for this request. + ExternalEntities *[]ExternalEntity `json:"externalEntities,omitempty"` + // DynamicLists - The dynamically created list entities for this request. + DynamicLists *[]DynamicList `json:"dynamicLists,omitempty"` +} + +// PredictionRequestOptions the custom options for the prediction request. +type PredictionRequestOptions struct { + // DatetimeReference - The reference DateTime used for predicting datetime entities. + DatetimeReference *date.Time `json:"datetimeReference,omitempty"` + // PreferExternalEntities - Whether to make the external entities resolution override the predictions if an overlap occurs. + PreferExternalEntities *bool `json:"preferExternalEntities,omitempty"` +} + +// PredictionResponse represents the prediction response. +type PredictionResponse struct { + autorest.Response `json:"-"` + // Query - The query used in the prediction. + Query *string `json:"query,omitempty"` + // Prediction - The prediction of the requested query. + Prediction *Prediction `json:"prediction,omitempty"` +} + +// RequestList defines a sub-list to append to an existing list entity. +type RequestList struct { + // Name - The name of the sub-list. + Name *string `json:"name,omitempty"` + // CanonicalForm - The canonical form of the sub-list. + CanonicalForm *string `json:"canonicalForm,omitempty"` + // Synonyms - The synonyms of the canonical form. + Synonyms *[]string `json:"synonyms,omitempty"` +} + +// Sentiment the result of the sentiment analysis. +type Sentiment struct { + // Label - The label of the sentiment analysis result. + Label *string `json:"label,omitempty"` + // Score - The sentiment score of the query. + Score *float64 `json:"score,omitempty"` +} diff --git a/services/stable/cognitiveservices/v3.0/luis/runtime/prediction.go b/services/stable/cognitiveservices/v3.0/luis/runtime/prediction.go new file mode 100644 index 000000000000..660332524e7f --- /dev/null +++ b/services/stable/cognitiveservices/v3.0/luis/runtime/prediction.go @@ -0,0 +1,234 @@ +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" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "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(endpoint string) PredictionClient { + return PredictionClient{New(endpoint)} +} + +// GetSlotPrediction gets the predictions for an application slot. +// Parameters: +// appID - the application ID. +// slotName - the application slot name. +// predictionRequest - the prediction request parameters. +// verbose - indicates whether to get extra metadata for the entities predictions or not. +// showAllIntents - indicates whether to return all the intents in the response or just the top intent. +// logParameter - indicates whether to log the endpoint query or not. +func (client PredictionClient) GetSlotPrediction(ctx context.Context, appID uuid.UUID, slotName string, predictionRequest PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (result PredictionResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PredictionClient.GetSlotPrediction") + 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: predictionRequest, + Constraints: []validation.Constraint{{Target: "predictionRequest.Query", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("runtime.PredictionClient", "GetSlotPrediction", err.Error()) + } + + req, err := client.GetSlotPredictionPreparer(ctx, appID, slotName, predictionRequest, verbose, showAllIntents, logParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetSlotPrediction", nil, "Failure preparing request") + return + } + + resp, err := client.GetSlotPredictionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetSlotPrediction", resp, "Failure sending request") + return + } + + result, err = client.GetSlotPredictionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetSlotPrediction", resp, "Failure responding to request") + } + + return +} + +// GetSlotPredictionPreparer prepares the GetSlotPrediction request. +func (client PredictionClient) GetSlotPredictionPreparer(ctx context.Context, appID uuid.UUID, slotName string, predictionRequest PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "appId": autorest.Encode("path", appID), + "slotName": autorest.Encode("path", slotName), + } + + queryParameters := map[string]interface{}{} + if verbose != nil { + queryParameters["verbose"] = autorest.Encode("query", *verbose) + } + if showAllIntents != nil { + queryParameters["show-all-intents"] = autorest.Encode("query", *showAllIntents) + } + if logParameter != nil { + queryParameters["log"] = autorest.Encode("query", *logParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/v3.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/slots/{slotName}/predict", pathParameters), + autorest.WithJSON(predictionRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSlotPredictionSender sends the GetSlotPrediction request. The method will close the +// http.Response Body if it receives an error. +func (client PredictionClient) GetSlotPredictionSender(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...) +} + +// GetSlotPredictionResponder handles the response to the GetSlotPrediction request. The method always +// closes the http.Response Body. +func (client PredictionClient) GetSlotPredictionResponder(resp *http.Response) (result PredictionResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVersionPrediction gets the predictions for an application version. +// Parameters: +// appID - the application ID. +// versionID - the application version ID. +// predictionRequest - the prediction request parameters. +// verbose - indicates whether to get extra metadata for the entities predictions or not. +// showAllIntents - indicates whether to return all the intents in the response or just the top intent. +// logParameter - indicates whether to log the endpoint query or not. +func (client PredictionClient) GetVersionPrediction(ctx context.Context, appID uuid.UUID, versionID string, predictionRequest PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (result PredictionResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PredictionClient.GetVersionPrediction") + 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: predictionRequest, + Constraints: []validation.Constraint{{Target: "predictionRequest.Query", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("runtime.PredictionClient", "GetVersionPrediction", err.Error()) + } + + req, err := client.GetVersionPredictionPreparer(ctx, appID, versionID, predictionRequest, verbose, showAllIntents, logParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetVersionPrediction", nil, "Failure preparing request") + return + } + + resp, err := client.GetVersionPredictionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetVersionPrediction", resp, "Failure sending request") + return + } + + result, err = client.GetVersionPredictionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "runtime.PredictionClient", "GetVersionPrediction", resp, "Failure responding to request") + } + + return +} + +// GetVersionPredictionPreparer prepares the GetVersionPrediction request. +func (client PredictionClient) GetVersionPredictionPreparer(ctx context.Context, appID uuid.UUID, versionID string, predictionRequest PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (*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 verbose != nil { + queryParameters["verbose"] = autorest.Encode("query", *verbose) + } + if showAllIntents != nil { + queryParameters["show-all-intents"] = autorest.Encode("query", *showAllIntents) + } + if logParameter != nil { + queryParameters["log"] = autorest.Encode("query", *logParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/luis/v3.0", urlParameters), + autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/predict", pathParameters), + autorest.WithJSON(predictionRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVersionPredictionSender sends the GetVersionPrediction request. The method will close the +// http.Response Body if it receives an error. +func (client PredictionClient) GetVersionPredictionSender(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...) +} + +// GetVersionPredictionResponder handles the response to the GetVersionPrediction request. The method always +// closes the http.Response Body. +func (client PredictionClient) GetVersionPredictionResponder(resp *http.Response) (result PredictionResponse, 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/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi/interfaces.go b/services/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi/interfaces.go new file mode 100644 index 000000000000..a244f925e4ab --- /dev/null +++ b/services/stable/cognitiveservices/v3.0/luis/runtime/runtimeapi/interfaces.go @@ -0,0 +1,32 @@ +package runtimeapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/stable/cognitiveservices/v3.0/luis/runtime" + "github.com/satori/go.uuid" +) + +// PredictionClientAPI contains the set of methods on the PredictionClient type. +type PredictionClientAPI interface { + GetSlotPrediction(ctx context.Context, appID uuid.UUID, slotName string, predictionRequest runtime.PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (result runtime.PredictionResponse, err error) + GetVersionPrediction(ctx context.Context, appID uuid.UUID, versionID string, predictionRequest runtime.PredictionRequest, verbose *bool, showAllIntents *bool, logParameter *bool) (result runtime.PredictionResponse, err error) +} + +var _ PredictionClientAPI = (*runtime.PredictionClient)(nil) diff --git a/services/stable/cognitiveservices/v3.0/luis/runtime/version.go b/services/stable/cognitiveservices/v3.0/luis/runtime/version.go new file mode 100644 index 000000000000..5c5aa27eab02 --- /dev/null +++ b/services/stable/cognitiveservices/v3.0/luis/runtime/version.go @@ -0,0 +1,30 @@ +package runtime + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " runtime/3.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}