...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring/apps.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/authoring

     1  package authoring
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/autorest/validation"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"github.com/gofrs/uuid"
    16  	"net/http"
    17  )
    18  
    19  // AppsClient is the client for the Apps methods of the Authoring service.
    20  type AppsClient struct {
    21  	BaseClient
    22  }
    23  
    24  // NewAppsClient creates an instance of the AppsClient client.
    25  func NewAppsClient(endpoint string) AppsClient {
    26  	return AppsClient{New(endpoint)}
    27  }
    28  
    29  // Add creates a new LUIS app.
    30  // Parameters:
    31  // applicationCreateObject - an application containing Name, Description (optional), Culture, Usage Scenario
    32  // (optional), Domain (optional) and initial version ID (optional) of the application. Default value for the
    33  // version ID is "0.1". Note: the culture cannot be changed after the app is created.
    34  func (client AppsClient) Add(ctx context.Context, applicationCreateObject ApplicationCreateObject) (result UUID, err error) {
    35  	if tracing.IsEnabled() {
    36  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Add")
    37  		defer func() {
    38  			sc := -1
    39  			if result.Response.Response != nil {
    40  				sc = result.Response.Response.StatusCode
    41  			}
    42  			tracing.EndSpan(ctx, sc, err)
    43  		}()
    44  	}
    45  	if err := validation.Validate([]validation.Validation{
    46  		{TargetValue: applicationCreateObject,
    47  			Constraints: []validation.Constraint{{Target: "applicationCreateObject.Culture", Name: validation.Null, Rule: true, Chain: nil},
    48  				{Target: "applicationCreateObject.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
    49  		return result, validation.NewError("authoring.AppsClient", "Add", err.Error())
    50  	}
    51  
    52  	req, err := client.AddPreparer(ctx, applicationCreateObject)
    53  	if err != nil {
    54  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", nil, "Failure preparing request")
    55  		return
    56  	}
    57  
    58  	resp, err := client.AddSender(req)
    59  	if err != nil {
    60  		result.Response = autorest.Response{Response: resp}
    61  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", resp, "Failure sending request")
    62  		return
    63  	}
    64  
    65  	result, err = client.AddResponder(resp)
    66  	if err != nil {
    67  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Add", resp, "Failure responding to request")
    68  		return
    69  	}
    70  
    71  	return
    72  }
    73  
    74  // AddPreparer prepares the Add request.
    75  func (client AppsClient) AddPreparer(ctx context.Context, applicationCreateObject ApplicationCreateObject) (*http.Request, error) {
    76  	urlParameters := map[string]interface{}{
    77  		"Endpoint": client.Endpoint,
    78  	}
    79  
    80  	preparer := autorest.CreatePreparer(
    81  		autorest.AsContentType("application/json; charset=utf-8"),
    82  		autorest.AsPost(),
    83  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
    84  		autorest.WithPath("/apps/"),
    85  		autorest.WithJSON(applicationCreateObject))
    86  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    87  }
    88  
    89  // AddSender sends the Add request. The method will close the
    90  // http.Response Body if it receives an error.
    91  func (client AppsClient) AddSender(req *http.Request) (*http.Response, error) {
    92  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
    93  }
    94  
    95  // AddResponder handles the response to the Add request. The method always
    96  // closes the http.Response Body.
    97  func (client AppsClient) AddResponder(resp *http.Response) (result UUID, err error) {
    98  	err = autorest.Respond(
    99  		resp,
   100  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   101  		autorest.ByUnmarshallingJSON(&result.Value),
   102  		autorest.ByClosing())
   103  	result.Response = autorest.Response{Response: resp}
   104  	return
   105  }
   106  
   107  // AddCustomPrebuiltDomain adds a prebuilt domain along with its intent and entity models as a new application.
   108  // Parameters:
   109  // prebuiltDomainCreateObject - a prebuilt domain create object containing the name and culture of the domain.
   110  func (client AppsClient) AddCustomPrebuiltDomain(ctx context.Context, prebuiltDomainCreateObject PrebuiltDomainCreateObject) (result UUID, err error) {
   111  	if tracing.IsEnabled() {
   112  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AddCustomPrebuiltDomain")
   113  		defer func() {
   114  			sc := -1
   115  			if result.Response.Response != nil {
   116  				sc = result.Response.Response.StatusCode
   117  			}
   118  			tracing.EndSpan(ctx, sc, err)
   119  		}()
   120  	}
   121  	req, err := client.AddCustomPrebuiltDomainPreparer(ctx, prebuiltDomainCreateObject)
   122  	if err != nil {
   123  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", nil, "Failure preparing request")
   124  		return
   125  	}
   126  
   127  	resp, err := client.AddCustomPrebuiltDomainSender(req)
   128  	if err != nil {
   129  		result.Response = autorest.Response{Response: resp}
   130  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", resp, "Failure sending request")
   131  		return
   132  	}
   133  
   134  	result, err = client.AddCustomPrebuiltDomainResponder(resp)
   135  	if err != nil {
   136  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "AddCustomPrebuiltDomain", resp, "Failure responding to request")
   137  		return
   138  	}
   139  
   140  	return
   141  }
   142  
   143  // AddCustomPrebuiltDomainPreparer prepares the AddCustomPrebuiltDomain request.
   144  func (client AppsClient) AddCustomPrebuiltDomainPreparer(ctx context.Context, prebuiltDomainCreateObject PrebuiltDomainCreateObject) (*http.Request, error) {
   145  	urlParameters := map[string]interface{}{
   146  		"Endpoint": client.Endpoint,
   147  	}
   148  
   149  	preparer := autorest.CreatePreparer(
   150  		autorest.AsContentType("application/json; charset=utf-8"),
   151  		autorest.AsPost(),
   152  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   153  		autorest.WithPath("/apps/customprebuiltdomains"),
   154  		autorest.WithJSON(prebuiltDomainCreateObject))
   155  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   156  }
   157  
   158  // AddCustomPrebuiltDomainSender sends the AddCustomPrebuiltDomain request. The method will close the
   159  // http.Response Body if it receives an error.
   160  func (client AppsClient) AddCustomPrebuiltDomainSender(req *http.Request) (*http.Response, error) {
   161  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   162  }
   163  
   164  // AddCustomPrebuiltDomainResponder handles the response to the AddCustomPrebuiltDomain request. The method always
   165  // closes the http.Response Body.
   166  func (client AppsClient) AddCustomPrebuiltDomainResponder(resp *http.Response) (result UUID, err error) {
   167  	err = autorest.Respond(
   168  		resp,
   169  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   170  		autorest.ByUnmarshallingJSON(&result.Value),
   171  		autorest.ByClosing())
   172  	result.Response = autorest.Response{Response: resp}
   173  	return
   174  }
   175  
   176  // Delete deletes an application.
   177  // Parameters:
   178  // appID - the application ID.
   179  // force - a flag to indicate whether to force an operation.
   180  func (client AppsClient) Delete(ctx context.Context, appID uuid.UUID, force *bool) (result OperationStatus, err error) {
   181  	if tracing.IsEnabled() {
   182  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete")
   183  		defer func() {
   184  			sc := -1
   185  			if result.Response.Response != nil {
   186  				sc = result.Response.Response.StatusCode
   187  			}
   188  			tracing.EndSpan(ctx, sc, err)
   189  		}()
   190  	}
   191  	req, err := client.DeletePreparer(ctx, appID, force)
   192  	if err != nil {
   193  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", nil, "Failure preparing request")
   194  		return
   195  	}
   196  
   197  	resp, err := client.DeleteSender(req)
   198  	if err != nil {
   199  		result.Response = autorest.Response{Response: resp}
   200  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", resp, "Failure sending request")
   201  		return
   202  	}
   203  
   204  	result, err = client.DeleteResponder(resp)
   205  	if err != nil {
   206  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Delete", resp, "Failure responding to request")
   207  		return
   208  	}
   209  
   210  	return
   211  }
   212  
   213  // DeletePreparer prepares the Delete request.
   214  func (client AppsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, force *bool) (*http.Request, error) {
   215  	urlParameters := map[string]interface{}{
   216  		"Endpoint": client.Endpoint,
   217  	}
   218  
   219  	pathParameters := map[string]interface{}{
   220  		"appId": autorest.Encode("path", appID),
   221  	}
   222  
   223  	queryParameters := map[string]interface{}{}
   224  	if force != nil {
   225  		queryParameters["force"] = autorest.Encode("query", *force)
   226  	} else {
   227  		queryParameters["force"] = autorest.Encode("query", false)
   228  	}
   229  
   230  	preparer := autorest.CreatePreparer(
   231  		autorest.AsDelete(),
   232  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   233  		autorest.WithPathParameters("/apps/{appId}", pathParameters),
   234  		autorest.WithQueryParameters(queryParameters))
   235  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   236  }
   237  
   238  // DeleteSender sends the Delete request. The method will close the
   239  // http.Response Body if it receives an error.
   240  func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) {
   241  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   242  }
   243  
   244  // DeleteResponder handles the response to the Delete request. The method always
   245  // closes the http.Response Body.
   246  func (client AppsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) {
   247  	err = autorest.Respond(
   248  		resp,
   249  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   250  		autorest.ByUnmarshallingJSON(&result),
   251  		autorest.ByClosing())
   252  	result.Response = autorest.Response{Response: resp}
   253  	return
   254  }
   255  
   256  // DownloadQueryLogs gets the logs of the past month's endpoint queries for the application.
   257  // Parameters:
   258  // appID - the application ID.
   259  func (client AppsClient) DownloadQueryLogs(ctx context.Context, appID uuid.UUID) (result ReadCloser, err error) {
   260  	if tracing.IsEnabled() {
   261  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DownloadQueryLogs")
   262  		defer func() {
   263  			sc := -1
   264  			if result.Response.Response != nil {
   265  				sc = result.Response.Response.StatusCode
   266  			}
   267  			tracing.EndSpan(ctx, sc, err)
   268  		}()
   269  	}
   270  	req, err := client.DownloadQueryLogsPreparer(ctx, appID)
   271  	if err != nil {
   272  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", nil, "Failure preparing request")
   273  		return
   274  	}
   275  
   276  	resp, err := client.DownloadQueryLogsSender(req)
   277  	if err != nil {
   278  		result.Response = autorest.Response{Response: resp}
   279  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", resp, "Failure sending request")
   280  		return
   281  	}
   282  
   283  	result, err = client.DownloadQueryLogsResponder(resp)
   284  	if err != nil {
   285  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "DownloadQueryLogs", resp, "Failure responding to request")
   286  		return
   287  	}
   288  
   289  	return
   290  }
   291  
   292  // DownloadQueryLogsPreparer prepares the DownloadQueryLogs request.
   293  func (client AppsClient) DownloadQueryLogsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) {
   294  	urlParameters := map[string]interface{}{
   295  		"Endpoint": client.Endpoint,
   296  	}
   297  
   298  	pathParameters := map[string]interface{}{
   299  		"appId": autorest.Encode("path", appID),
   300  	}
   301  
   302  	preparer := autorest.CreatePreparer(
   303  		autorest.AsGet(),
   304  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   305  		autorest.WithPathParameters("/apps/{appId}/querylogs", pathParameters))
   306  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   307  }
   308  
   309  // DownloadQueryLogsSender sends the DownloadQueryLogs request. The method will close the
   310  // http.Response Body if it receives an error.
   311  func (client AppsClient) DownloadQueryLogsSender(req *http.Request) (*http.Response, error) {
   312  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   313  }
   314  
   315  // DownloadQueryLogsResponder handles the response to the DownloadQueryLogs request. The method always
   316  // closes the http.Response Body.
   317  func (client AppsClient) DownloadQueryLogsResponder(resp *http.Response) (result ReadCloser, err error) {
   318  	result.Value = &resp.Body
   319  	err = autorest.Respond(
   320  		resp,
   321  		azure.WithErrorUnlessStatusCode(http.StatusOK))
   322  	result.Response = autorest.Response{Response: resp}
   323  	return
   324  }
   325  
   326  // Get gets the application info.
   327  // Parameters:
   328  // appID - the application ID.
   329  func (client AppsClient) Get(ctx context.Context, appID uuid.UUID) (result ApplicationInfoResponse, err error) {
   330  	if tracing.IsEnabled() {
   331  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get")
   332  		defer func() {
   333  			sc := -1
   334  			if result.Response.Response != nil {
   335  				sc = result.Response.Response.StatusCode
   336  			}
   337  			tracing.EndSpan(ctx, sc, err)
   338  		}()
   339  	}
   340  	req, err := client.GetPreparer(ctx, appID)
   341  	if err != nil {
   342  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", nil, "Failure preparing request")
   343  		return
   344  	}
   345  
   346  	resp, err := client.GetSender(req)
   347  	if err != nil {
   348  		result.Response = autorest.Response{Response: resp}
   349  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", resp, "Failure sending request")
   350  		return
   351  	}
   352  
   353  	result, err = client.GetResponder(resp)
   354  	if err != nil {
   355  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Get", resp, "Failure responding to request")
   356  		return
   357  	}
   358  
   359  	return
   360  }
   361  
   362  // GetPreparer prepares the Get request.
   363  func (client AppsClient) GetPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) {
   364  	urlParameters := map[string]interface{}{
   365  		"Endpoint": client.Endpoint,
   366  	}
   367  
   368  	pathParameters := map[string]interface{}{
   369  		"appId": autorest.Encode("path", appID),
   370  	}
   371  
   372  	preparer := autorest.CreatePreparer(
   373  		autorest.AsGet(),
   374  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   375  		autorest.WithPathParameters("/apps/{appId}", pathParameters))
   376  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   377  }
   378  
   379  // GetSender sends the Get request. The method will close the
   380  // http.Response Body if it receives an error.
   381  func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) {
   382  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   383  }
   384  
   385  // GetResponder handles the response to the Get request. The method always
   386  // closes the http.Response Body.
   387  func (client AppsClient) GetResponder(resp *http.Response) (result ApplicationInfoResponse, err error) {
   388  	err = autorest.Respond(
   389  		resp,
   390  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   391  		autorest.ByUnmarshallingJSON(&result),
   392  		autorest.ByClosing())
   393  	result.Response = autorest.Response{Response: resp}
   394  	return
   395  }
   396  
   397  // GetPublishSettings get the application publish settings including 'UseAllTrainingData'.
   398  // Parameters:
   399  // appID - the application ID.
   400  func (client AppsClient) GetPublishSettings(ctx context.Context, appID uuid.UUID) (result PublishSettings, err error) {
   401  	if tracing.IsEnabled() {
   402  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPublishSettings")
   403  		defer func() {
   404  			sc := -1
   405  			if result.Response.Response != nil {
   406  				sc = result.Response.Response.StatusCode
   407  			}
   408  			tracing.EndSpan(ctx, sc, err)
   409  		}()
   410  	}
   411  	req, err := client.GetPublishSettingsPreparer(ctx, appID)
   412  	if err != nil {
   413  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", nil, "Failure preparing request")
   414  		return
   415  	}
   416  
   417  	resp, err := client.GetPublishSettingsSender(req)
   418  	if err != nil {
   419  		result.Response = autorest.Response{Response: resp}
   420  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", resp, "Failure sending request")
   421  		return
   422  	}
   423  
   424  	result, err = client.GetPublishSettingsResponder(resp)
   425  	if err != nil {
   426  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetPublishSettings", resp, "Failure responding to request")
   427  		return
   428  	}
   429  
   430  	return
   431  }
   432  
   433  // GetPublishSettingsPreparer prepares the GetPublishSettings request.
   434  func (client AppsClient) GetPublishSettingsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) {
   435  	urlParameters := map[string]interface{}{
   436  		"Endpoint": client.Endpoint,
   437  	}
   438  
   439  	pathParameters := map[string]interface{}{
   440  		"appId": autorest.Encode("path", appID),
   441  	}
   442  
   443  	preparer := autorest.CreatePreparer(
   444  		autorest.AsGet(),
   445  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   446  		autorest.WithPathParameters("/apps/{appId}/publishsettings", pathParameters))
   447  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   448  }
   449  
   450  // GetPublishSettingsSender sends the GetPublishSettings request. The method will close the
   451  // http.Response Body if it receives an error.
   452  func (client AppsClient) GetPublishSettingsSender(req *http.Request) (*http.Response, error) {
   453  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   454  }
   455  
   456  // GetPublishSettingsResponder handles the response to the GetPublishSettings request. The method always
   457  // closes the http.Response Body.
   458  func (client AppsClient) GetPublishSettingsResponder(resp *http.Response) (result PublishSettings, err error) {
   459  	err = autorest.Respond(
   460  		resp,
   461  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   462  		autorest.ByUnmarshallingJSON(&result),
   463  		autorest.ByClosing())
   464  	result.Response = autorest.Response{Response: resp}
   465  	return
   466  }
   467  
   468  // GetSettings get the application settings including 'UseAllTrainingData'.
   469  // Parameters:
   470  // appID - the application ID.
   471  func (client AppsClient) GetSettings(ctx context.Context, appID uuid.UUID) (result ApplicationSettings, err error) {
   472  	if tracing.IsEnabled() {
   473  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSettings")
   474  		defer func() {
   475  			sc := -1
   476  			if result.Response.Response != nil {
   477  				sc = result.Response.Response.StatusCode
   478  			}
   479  			tracing.EndSpan(ctx, sc, err)
   480  		}()
   481  	}
   482  	req, err := client.GetSettingsPreparer(ctx, appID)
   483  	if err != nil {
   484  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", nil, "Failure preparing request")
   485  		return
   486  	}
   487  
   488  	resp, err := client.GetSettingsSender(req)
   489  	if err != nil {
   490  		result.Response = autorest.Response{Response: resp}
   491  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", resp, "Failure sending request")
   492  		return
   493  	}
   494  
   495  	result, err = client.GetSettingsResponder(resp)
   496  	if err != nil {
   497  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "GetSettings", resp, "Failure responding to request")
   498  		return
   499  	}
   500  
   501  	return
   502  }
   503  
   504  // GetSettingsPreparer prepares the GetSettings request.
   505  func (client AppsClient) GetSettingsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) {
   506  	urlParameters := map[string]interface{}{
   507  		"Endpoint": client.Endpoint,
   508  	}
   509  
   510  	pathParameters := map[string]interface{}{
   511  		"appId": autorest.Encode("path", appID),
   512  	}
   513  
   514  	preparer := autorest.CreatePreparer(
   515  		autorest.AsGet(),
   516  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   517  		autorest.WithPathParameters("/apps/{appId}/settings", pathParameters))
   518  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   519  }
   520  
   521  // GetSettingsSender sends the GetSettings request. The method will close the
   522  // http.Response Body if it receives an error.
   523  func (client AppsClient) GetSettingsSender(req *http.Request) (*http.Response, error) {
   524  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   525  }
   526  
   527  // GetSettingsResponder handles the response to the GetSettings request. The method always
   528  // closes the http.Response Body.
   529  func (client AppsClient) GetSettingsResponder(resp *http.Response) (result ApplicationSettings, err error) {
   530  	err = autorest.Respond(
   531  		resp,
   532  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   533  		autorest.ByUnmarshallingJSON(&result),
   534  		autorest.ByClosing())
   535  	result.Response = autorest.Response{Response: resp}
   536  	return
   537  }
   538  
   539  // Import imports an application to LUIS, the application's structure is included in the request body.
   540  // Parameters:
   541  // luisApp - a LUIS application structure.
   542  // appName - the application name to create. If not specified, the application name will be read from the
   543  // imported object. If the application name already exists, an error is returned.
   544  func (client AppsClient) Import(ctx context.Context, luisApp LuisApp, appName string) (result UUID, err error) {
   545  	if tracing.IsEnabled() {
   546  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Import")
   547  		defer func() {
   548  			sc := -1
   549  			if result.Response.Response != nil {
   550  				sc = result.Response.Response.StatusCode
   551  			}
   552  			tracing.EndSpan(ctx, sc, err)
   553  		}()
   554  	}
   555  	req, err := client.ImportPreparer(ctx, luisApp, appName)
   556  	if err != nil {
   557  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", nil, "Failure preparing request")
   558  		return
   559  	}
   560  
   561  	resp, err := client.ImportSender(req)
   562  	if err != nil {
   563  		result.Response = autorest.Response{Response: resp}
   564  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", resp, "Failure sending request")
   565  		return
   566  	}
   567  
   568  	result, err = client.ImportResponder(resp)
   569  	if err != nil {
   570  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Import", resp, "Failure responding to request")
   571  		return
   572  	}
   573  
   574  	return
   575  }
   576  
   577  // ImportPreparer prepares the Import request.
   578  func (client AppsClient) ImportPreparer(ctx context.Context, luisApp LuisApp, appName string) (*http.Request, error) {
   579  	urlParameters := map[string]interface{}{
   580  		"Endpoint": client.Endpoint,
   581  	}
   582  
   583  	queryParameters := map[string]interface{}{}
   584  	if len(appName) > 0 {
   585  		queryParameters["appName"] = autorest.Encode("query", appName)
   586  	}
   587  
   588  	preparer := autorest.CreatePreparer(
   589  		autorest.AsContentType("application/json; charset=utf-8"),
   590  		autorest.AsPost(),
   591  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   592  		autorest.WithPath("/apps/import"),
   593  		autorest.WithJSON(luisApp),
   594  		autorest.WithQueryParameters(queryParameters))
   595  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   596  }
   597  
   598  // ImportSender sends the Import request. The method will close the
   599  // http.Response Body if it receives an error.
   600  func (client AppsClient) ImportSender(req *http.Request) (*http.Response, error) {
   601  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   602  }
   603  
   604  // ImportResponder handles the response to the Import request. The method always
   605  // closes the http.Response Body.
   606  func (client AppsClient) ImportResponder(resp *http.Response) (result UUID, err error) {
   607  	err = autorest.Respond(
   608  		resp,
   609  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   610  		autorest.ByUnmarshallingJSON(&result.Value),
   611  		autorest.ByClosing())
   612  	result.Response = autorest.Response{Response: resp}
   613  	return
   614  }
   615  
   616  // ImportLuFormat imports an application to LUIS, the application's structure is included in the request body.
   617  // Parameters:
   618  // luisAppLu - a LUIS application structure.
   619  // appName - the application name to create. If not specified, the application name will be read from the
   620  // imported object. If the application name already exists, an error is returned.
   621  func (client AppsClient) ImportLuFormat(ctx context.Context, luisAppLu string, appName string) (result UUID, err error) {
   622  	if tracing.IsEnabled() {
   623  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ImportLuFormat")
   624  		defer func() {
   625  			sc := -1
   626  			if result.Response.Response != nil {
   627  				sc = result.Response.Response.StatusCode
   628  			}
   629  			tracing.EndSpan(ctx, sc, err)
   630  		}()
   631  	}
   632  	req, err := client.ImportLuFormatPreparer(ctx, luisAppLu, appName)
   633  	if err != nil {
   634  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportLuFormat", nil, "Failure preparing request")
   635  		return
   636  	}
   637  
   638  	resp, err := client.ImportLuFormatSender(req)
   639  	if err != nil {
   640  		result.Response = autorest.Response{Response: resp}
   641  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportLuFormat", resp, "Failure sending request")
   642  		return
   643  	}
   644  
   645  	result, err = client.ImportLuFormatResponder(resp)
   646  	if err != nil {
   647  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportLuFormat", resp, "Failure responding to request")
   648  		return
   649  	}
   650  
   651  	return
   652  }
   653  
   654  // ImportLuFormatPreparer prepares the ImportLuFormat request.
   655  func (client AppsClient) ImportLuFormatPreparer(ctx context.Context, luisAppLu string, appName string) (*http.Request, error) {
   656  	urlParameters := map[string]interface{}{
   657  		"Endpoint": client.Endpoint,
   658  	}
   659  
   660  	queryParameters := map[string]interface{}{}
   661  	if len(appName) > 0 {
   662  		queryParameters["appName"] = autorest.Encode("query", appName)
   663  	}
   664  
   665  	preparer := autorest.CreatePreparer(
   666  		autorest.AsContentType("text/plain"),
   667  		autorest.AsPost(),
   668  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   669  		autorest.WithPath("/apps/import"),
   670  		autorest.WithJSON(luisAppLu),
   671  		autorest.WithQueryParameters(queryParameters))
   672  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   673  }
   674  
   675  // ImportLuFormatSender sends the ImportLuFormat request. The method will close the
   676  // http.Response Body if it receives an error.
   677  func (client AppsClient) ImportLuFormatSender(req *http.Request) (*http.Response, error) {
   678  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   679  }
   680  
   681  // ImportLuFormatResponder handles the response to the ImportLuFormat request. The method always
   682  // closes the http.Response Body.
   683  func (client AppsClient) ImportLuFormatResponder(resp *http.Response) (result UUID, err error) {
   684  	err = autorest.Respond(
   685  		resp,
   686  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   687  		autorest.ByUnmarshallingJSON(&result.Value),
   688  		autorest.ByClosing())
   689  	result.Response = autorest.Response{Response: resp}
   690  	return
   691  }
   692  
   693  // ImportV2App imports an application to LUIS, the application's structure is included in the request body.
   694  // Parameters:
   695  // luisAppV2 - a LUIS application structure.
   696  // appName - the application name to create. If not specified, the application name will be read from the
   697  // imported object. If the application name already exists, an error is returned.
   698  func (client AppsClient) ImportV2App(ctx context.Context, luisAppV2 LuisAppV2, appName string) (result UUID, err error) {
   699  	if tracing.IsEnabled() {
   700  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ImportV2App")
   701  		defer func() {
   702  			sc := -1
   703  			if result.Response.Response != nil {
   704  				sc = result.Response.Response.StatusCode
   705  			}
   706  			tracing.EndSpan(ctx, sc, err)
   707  		}()
   708  	}
   709  	req, err := client.ImportV2AppPreparer(ctx, luisAppV2, appName)
   710  	if err != nil {
   711  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportV2App", nil, "Failure preparing request")
   712  		return
   713  	}
   714  
   715  	resp, err := client.ImportV2AppSender(req)
   716  	if err != nil {
   717  		result.Response = autorest.Response{Response: resp}
   718  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportV2App", resp, "Failure sending request")
   719  		return
   720  	}
   721  
   722  	result, err = client.ImportV2AppResponder(resp)
   723  	if err != nil {
   724  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ImportV2App", resp, "Failure responding to request")
   725  		return
   726  	}
   727  
   728  	return
   729  }
   730  
   731  // ImportV2AppPreparer prepares the ImportV2App request.
   732  func (client AppsClient) ImportV2AppPreparer(ctx context.Context, luisAppV2 LuisAppV2, appName string) (*http.Request, error) {
   733  	urlParameters := map[string]interface{}{
   734  		"Endpoint": client.Endpoint,
   735  	}
   736  
   737  	queryParameters := map[string]interface{}{}
   738  	if len(appName) > 0 {
   739  		queryParameters["appName"] = autorest.Encode("query", appName)
   740  	}
   741  
   742  	preparer := autorest.CreatePreparer(
   743  		autorest.AsContentType("application/json; charset=utf-8"),
   744  		autorest.AsPost(),
   745  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   746  		autorest.WithPath("/apps/import"),
   747  		autorest.WithJSON(luisAppV2),
   748  		autorest.WithQueryParameters(queryParameters))
   749  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   750  }
   751  
   752  // ImportV2AppSender sends the ImportV2App request. The method will close the
   753  // http.Response Body if it receives an error.
   754  func (client AppsClient) ImportV2AppSender(req *http.Request) (*http.Response, error) {
   755  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   756  }
   757  
   758  // ImportV2AppResponder handles the response to the ImportV2App request. The method always
   759  // closes the http.Response Body.
   760  func (client AppsClient) ImportV2AppResponder(resp *http.Response) (result UUID, err error) {
   761  	err = autorest.Respond(
   762  		resp,
   763  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   764  		autorest.ByUnmarshallingJSON(&result.Value),
   765  		autorest.ByClosing())
   766  	result.Response = autorest.Response{Response: resp}
   767  	return
   768  }
   769  
   770  // List lists all of the user's applications.
   771  // Parameters:
   772  // skip - the number of entries to skip. Default value is 0.
   773  // take - the number of entries to return. Maximum page size is 500. Default is 100.
   774  func (client AppsClient) List(ctx context.Context, skip *int32, take *int32) (result ListApplicationInfoResponse, err error) {
   775  	if tracing.IsEnabled() {
   776  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List")
   777  		defer func() {
   778  			sc := -1
   779  			if result.Response.Response != nil {
   780  				sc = result.Response.Response.StatusCode
   781  			}
   782  			tracing.EndSpan(ctx, sc, err)
   783  		}()
   784  	}
   785  	if err := validation.Validate([]validation.Validation{
   786  		{TargetValue: skip,
   787  			Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
   788  				Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}},
   789  		{TargetValue: take,
   790  			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
   791  				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil},
   792  					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
   793  				}}}}}); err != nil {
   794  		return result, validation.NewError("authoring.AppsClient", "List", err.Error())
   795  	}
   796  
   797  	req, err := client.ListPreparer(ctx, skip, take)
   798  	if err != nil {
   799  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", nil, "Failure preparing request")
   800  		return
   801  	}
   802  
   803  	resp, err := client.ListSender(req)
   804  	if err != nil {
   805  		result.Response = autorest.Response{Response: resp}
   806  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", resp, "Failure sending request")
   807  		return
   808  	}
   809  
   810  	result, err = client.ListResponder(resp)
   811  	if err != nil {
   812  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "List", resp, "Failure responding to request")
   813  		return
   814  	}
   815  
   816  	return
   817  }
   818  
   819  // ListPreparer prepares the List request.
   820  func (client AppsClient) ListPreparer(ctx context.Context, skip *int32, take *int32) (*http.Request, error) {
   821  	urlParameters := map[string]interface{}{
   822  		"Endpoint": client.Endpoint,
   823  	}
   824  
   825  	queryParameters := map[string]interface{}{}
   826  	if skip != nil {
   827  		queryParameters["skip"] = autorest.Encode("query", *skip)
   828  	} else {
   829  		queryParameters["skip"] = autorest.Encode("query", 0)
   830  	}
   831  	if take != nil {
   832  		queryParameters["take"] = autorest.Encode("query", *take)
   833  	} else {
   834  		queryParameters["take"] = autorest.Encode("query", 100)
   835  	}
   836  
   837  	preparer := autorest.CreatePreparer(
   838  		autorest.AsGet(),
   839  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   840  		autorest.WithPath("/apps/"),
   841  		autorest.WithQueryParameters(queryParameters))
   842  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   843  }
   844  
   845  // ListSender sends the List request. The method will close the
   846  // http.Response Body if it receives an error.
   847  func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) {
   848  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   849  }
   850  
   851  // ListResponder handles the response to the List request. The method always
   852  // closes the http.Response Body.
   853  func (client AppsClient) ListResponder(resp *http.Response) (result ListApplicationInfoResponse, err error) {
   854  	err = autorest.Respond(
   855  		resp,
   856  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   857  		autorest.ByUnmarshallingJSON(&result.Value),
   858  		autorest.ByClosing())
   859  	result.Response = autorest.Response{Response: resp}
   860  	return
   861  }
   862  
   863  // ListAvailableCustomPrebuiltDomains gets all the available custom prebuilt domains for all cultures.
   864  func (client AppsClient) ListAvailableCustomPrebuiltDomains(ctx context.Context) (result ListPrebuiltDomain, err error) {
   865  	if tracing.IsEnabled() {
   866  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAvailableCustomPrebuiltDomains")
   867  		defer func() {
   868  			sc := -1
   869  			if result.Response.Response != nil {
   870  				sc = result.Response.Response.StatusCode
   871  			}
   872  			tracing.EndSpan(ctx, sc, err)
   873  		}()
   874  	}
   875  	req, err := client.ListAvailableCustomPrebuiltDomainsPreparer(ctx)
   876  	if err != nil {
   877  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", nil, "Failure preparing request")
   878  		return
   879  	}
   880  
   881  	resp, err := client.ListAvailableCustomPrebuiltDomainsSender(req)
   882  	if err != nil {
   883  		result.Response = autorest.Response{Response: resp}
   884  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", resp, "Failure sending request")
   885  		return
   886  	}
   887  
   888  	result, err = client.ListAvailableCustomPrebuiltDomainsResponder(resp)
   889  	if err != nil {
   890  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomains", resp, "Failure responding to request")
   891  		return
   892  	}
   893  
   894  	return
   895  }
   896  
   897  // ListAvailableCustomPrebuiltDomainsPreparer prepares the ListAvailableCustomPrebuiltDomains request.
   898  func (client AppsClient) ListAvailableCustomPrebuiltDomainsPreparer(ctx context.Context) (*http.Request, error) {
   899  	urlParameters := map[string]interface{}{
   900  		"Endpoint": client.Endpoint,
   901  	}
   902  
   903  	preparer := autorest.CreatePreparer(
   904  		autorest.AsGet(),
   905  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   906  		autorest.WithPath("/apps/customprebuiltdomains"))
   907  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   908  }
   909  
   910  // ListAvailableCustomPrebuiltDomainsSender sends the ListAvailableCustomPrebuiltDomains request. The method will close the
   911  // http.Response Body if it receives an error.
   912  func (client AppsClient) ListAvailableCustomPrebuiltDomainsSender(req *http.Request) (*http.Response, error) {
   913  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   914  }
   915  
   916  // ListAvailableCustomPrebuiltDomainsResponder handles the response to the ListAvailableCustomPrebuiltDomains request. The method always
   917  // closes the http.Response Body.
   918  func (client AppsClient) ListAvailableCustomPrebuiltDomainsResponder(resp *http.Response) (result ListPrebuiltDomain, err error) {
   919  	err = autorest.Respond(
   920  		resp,
   921  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   922  		autorest.ByUnmarshallingJSON(&result.Value),
   923  		autorest.ByClosing())
   924  	result.Response = autorest.Response{Response: resp}
   925  	return
   926  }
   927  
   928  // ListAvailableCustomPrebuiltDomainsForCulture gets all the available prebuilt domains for a specific culture.
   929  // Parameters:
   930  // culture - culture.
   931  func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCulture(ctx context.Context, culture string) (result ListPrebuiltDomain, err error) {
   932  	if tracing.IsEnabled() {
   933  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAvailableCustomPrebuiltDomainsForCulture")
   934  		defer func() {
   935  			sc := -1
   936  			if result.Response.Response != nil {
   937  				sc = result.Response.Response.StatusCode
   938  			}
   939  			tracing.EndSpan(ctx, sc, err)
   940  		}()
   941  	}
   942  	req, err := client.ListAvailableCustomPrebuiltDomainsForCulturePreparer(ctx, culture)
   943  	if err != nil {
   944  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", nil, "Failure preparing request")
   945  		return
   946  	}
   947  
   948  	resp, err := client.ListAvailableCustomPrebuiltDomainsForCultureSender(req)
   949  	if err != nil {
   950  		result.Response = autorest.Response{Response: resp}
   951  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", resp, "Failure sending request")
   952  		return
   953  	}
   954  
   955  	result, err = client.ListAvailableCustomPrebuiltDomainsForCultureResponder(resp)
   956  	if err != nil {
   957  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListAvailableCustomPrebuiltDomainsForCulture", resp, "Failure responding to request")
   958  		return
   959  	}
   960  
   961  	return
   962  }
   963  
   964  // ListAvailableCustomPrebuiltDomainsForCulturePreparer prepares the ListAvailableCustomPrebuiltDomainsForCulture request.
   965  func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCulturePreparer(ctx context.Context, culture string) (*http.Request, error) {
   966  	urlParameters := map[string]interface{}{
   967  		"Endpoint": client.Endpoint,
   968  	}
   969  
   970  	pathParameters := map[string]interface{}{
   971  		"culture": autorest.Encode("path", culture),
   972  	}
   973  
   974  	preparer := autorest.CreatePreparer(
   975  		autorest.AsGet(),
   976  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
   977  		autorest.WithPathParameters("/apps/customprebuiltdomains/{culture}", pathParameters))
   978  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   979  }
   980  
   981  // ListAvailableCustomPrebuiltDomainsForCultureSender sends the ListAvailableCustomPrebuiltDomainsForCulture request. The method will close the
   982  // http.Response Body if it receives an error.
   983  func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCultureSender(req *http.Request) (*http.Response, error) {
   984  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   985  }
   986  
   987  // ListAvailableCustomPrebuiltDomainsForCultureResponder handles the response to the ListAvailableCustomPrebuiltDomainsForCulture request. The method always
   988  // closes the http.Response Body.
   989  func (client AppsClient) ListAvailableCustomPrebuiltDomainsForCultureResponder(resp *http.Response) (result ListPrebuiltDomain, err error) {
   990  	err = autorest.Respond(
   991  		resp,
   992  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   993  		autorest.ByUnmarshallingJSON(&result.Value),
   994  		autorest.ByClosing())
   995  	result.Response = autorest.Response{Response: resp}
   996  	return
   997  }
   998  
   999  // ListCortanaEndpoints gets the endpoint URLs for the prebuilt Cortana applications.
  1000  func (client AppsClient) ListCortanaEndpoints(ctx context.Context) (result PersonalAssistantsResponse, err error) {
  1001  	if tracing.IsEnabled() {
  1002  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListCortanaEndpoints")
  1003  		defer func() {
  1004  			sc := -1
  1005  			if result.Response.Response != nil {
  1006  				sc = result.Response.Response.StatusCode
  1007  			}
  1008  			tracing.EndSpan(ctx, sc, err)
  1009  		}()
  1010  	}
  1011  	req, err := client.ListCortanaEndpointsPreparer(ctx)
  1012  	if err != nil {
  1013  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", nil, "Failure preparing request")
  1014  		return
  1015  	}
  1016  
  1017  	resp, err := client.ListCortanaEndpointsSender(req)
  1018  	if err != nil {
  1019  		result.Response = autorest.Response{Response: resp}
  1020  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", resp, "Failure sending request")
  1021  		return
  1022  	}
  1023  
  1024  	result, err = client.ListCortanaEndpointsResponder(resp)
  1025  	if err != nil {
  1026  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListCortanaEndpoints", resp, "Failure responding to request")
  1027  		return
  1028  	}
  1029  
  1030  	return
  1031  }
  1032  
  1033  // ListCortanaEndpointsPreparer prepares the ListCortanaEndpoints request.
  1034  func (client AppsClient) ListCortanaEndpointsPreparer(ctx context.Context) (*http.Request, error) {
  1035  	urlParameters := map[string]interface{}{
  1036  		"Endpoint": client.Endpoint,
  1037  	}
  1038  
  1039  	preparer := autorest.CreatePreparer(
  1040  		autorest.AsGet(),
  1041  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1042  		autorest.WithPath("/apps/assistants"))
  1043  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1044  }
  1045  
  1046  // ListCortanaEndpointsSender sends the ListCortanaEndpoints request. The method will close the
  1047  // http.Response Body if it receives an error.
  1048  func (client AppsClient) ListCortanaEndpointsSender(req *http.Request) (*http.Response, error) {
  1049  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1050  }
  1051  
  1052  // ListCortanaEndpointsResponder handles the response to the ListCortanaEndpoints request. The method always
  1053  // closes the http.Response Body.
  1054  func (client AppsClient) ListCortanaEndpointsResponder(resp *http.Response) (result PersonalAssistantsResponse, err error) {
  1055  	err = autorest.Respond(
  1056  		resp,
  1057  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1058  		autorest.ByUnmarshallingJSON(&result),
  1059  		autorest.ByClosing())
  1060  	result.Response = autorest.Response{Response: resp}
  1061  	return
  1062  }
  1063  
  1064  // ListDomains gets the available application domains.
  1065  func (client AppsClient) ListDomains(ctx context.Context) (result ListString, err error) {
  1066  	if tracing.IsEnabled() {
  1067  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomains")
  1068  		defer func() {
  1069  			sc := -1
  1070  			if result.Response.Response != nil {
  1071  				sc = result.Response.Response.StatusCode
  1072  			}
  1073  			tracing.EndSpan(ctx, sc, err)
  1074  		}()
  1075  	}
  1076  	req, err := client.ListDomainsPreparer(ctx)
  1077  	if err != nil {
  1078  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", nil, "Failure preparing request")
  1079  		return
  1080  	}
  1081  
  1082  	resp, err := client.ListDomainsSender(req)
  1083  	if err != nil {
  1084  		result.Response = autorest.Response{Response: resp}
  1085  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", resp, "Failure sending request")
  1086  		return
  1087  	}
  1088  
  1089  	result, err = client.ListDomainsResponder(resp)
  1090  	if err != nil {
  1091  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListDomains", resp, "Failure responding to request")
  1092  		return
  1093  	}
  1094  
  1095  	return
  1096  }
  1097  
  1098  // ListDomainsPreparer prepares the ListDomains request.
  1099  func (client AppsClient) ListDomainsPreparer(ctx context.Context) (*http.Request, error) {
  1100  	urlParameters := map[string]interface{}{
  1101  		"Endpoint": client.Endpoint,
  1102  	}
  1103  
  1104  	preparer := autorest.CreatePreparer(
  1105  		autorest.AsGet(),
  1106  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1107  		autorest.WithPath("/apps/domains"))
  1108  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1109  }
  1110  
  1111  // ListDomainsSender sends the ListDomains request. The method will close the
  1112  // http.Response Body if it receives an error.
  1113  func (client AppsClient) ListDomainsSender(req *http.Request) (*http.Response, error) {
  1114  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1115  }
  1116  
  1117  // ListDomainsResponder handles the response to the ListDomains request. The method always
  1118  // closes the http.Response Body.
  1119  func (client AppsClient) ListDomainsResponder(resp *http.Response) (result ListString, err error) {
  1120  	err = autorest.Respond(
  1121  		resp,
  1122  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1123  		autorest.ByUnmarshallingJSON(&result.Value),
  1124  		autorest.ByClosing())
  1125  	result.Response = autorest.Response{Response: resp}
  1126  	return
  1127  }
  1128  
  1129  // ListEndpoints returns the available endpoint deployment regions and URLs.
  1130  // Parameters:
  1131  // appID - the application ID.
  1132  func (client AppsClient) ListEndpoints(ctx context.Context, appID uuid.UUID) (result SetString, err error) {
  1133  	if tracing.IsEnabled() {
  1134  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListEndpoints")
  1135  		defer func() {
  1136  			sc := -1
  1137  			if result.Response.Response != nil {
  1138  				sc = result.Response.Response.StatusCode
  1139  			}
  1140  			tracing.EndSpan(ctx, sc, err)
  1141  		}()
  1142  	}
  1143  	req, err := client.ListEndpointsPreparer(ctx, appID)
  1144  	if err != nil {
  1145  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", nil, "Failure preparing request")
  1146  		return
  1147  	}
  1148  
  1149  	resp, err := client.ListEndpointsSender(req)
  1150  	if err != nil {
  1151  		result.Response = autorest.Response{Response: resp}
  1152  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", resp, "Failure sending request")
  1153  		return
  1154  	}
  1155  
  1156  	result, err = client.ListEndpointsResponder(resp)
  1157  	if err != nil {
  1158  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListEndpoints", resp, "Failure responding to request")
  1159  		return
  1160  	}
  1161  
  1162  	return
  1163  }
  1164  
  1165  // ListEndpointsPreparer prepares the ListEndpoints request.
  1166  func (client AppsClient) ListEndpointsPreparer(ctx context.Context, appID uuid.UUID) (*http.Request, error) {
  1167  	urlParameters := map[string]interface{}{
  1168  		"Endpoint": client.Endpoint,
  1169  	}
  1170  
  1171  	pathParameters := map[string]interface{}{
  1172  		"appId": autorest.Encode("path", appID),
  1173  	}
  1174  
  1175  	preparer := autorest.CreatePreparer(
  1176  		autorest.AsGet(),
  1177  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1178  		autorest.WithPathParameters("/apps/{appId}/endpoints", pathParameters))
  1179  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1180  }
  1181  
  1182  // ListEndpointsSender sends the ListEndpoints request. The method will close the
  1183  // http.Response Body if it receives an error.
  1184  func (client AppsClient) ListEndpointsSender(req *http.Request) (*http.Response, error) {
  1185  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1186  }
  1187  
  1188  // ListEndpointsResponder handles the response to the ListEndpoints request. The method always
  1189  // closes the http.Response Body.
  1190  func (client AppsClient) ListEndpointsResponder(resp *http.Response) (result SetString, err error) {
  1191  	err = autorest.Respond(
  1192  		resp,
  1193  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1194  		autorest.ByUnmarshallingJSON(&result.Value),
  1195  		autorest.ByClosing())
  1196  	result.Response = autorest.Response{Response: resp}
  1197  	return
  1198  }
  1199  
  1200  // ListSupportedCultures gets a list of supported cultures. Cultures are equivalent to the written language and locale.
  1201  // For example,"en-us" represents the U.S. variation of English.
  1202  func (client AppsClient) ListSupportedCultures(ctx context.Context) (result ListAvailableCulture, err error) {
  1203  	if tracing.IsEnabled() {
  1204  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSupportedCultures")
  1205  		defer func() {
  1206  			sc := -1
  1207  			if result.Response.Response != nil {
  1208  				sc = result.Response.Response.StatusCode
  1209  			}
  1210  			tracing.EndSpan(ctx, sc, err)
  1211  		}()
  1212  	}
  1213  	req, err := client.ListSupportedCulturesPreparer(ctx)
  1214  	if err != nil {
  1215  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", nil, "Failure preparing request")
  1216  		return
  1217  	}
  1218  
  1219  	resp, err := client.ListSupportedCulturesSender(req)
  1220  	if err != nil {
  1221  		result.Response = autorest.Response{Response: resp}
  1222  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", resp, "Failure sending request")
  1223  		return
  1224  	}
  1225  
  1226  	result, err = client.ListSupportedCulturesResponder(resp)
  1227  	if err != nil {
  1228  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListSupportedCultures", resp, "Failure responding to request")
  1229  		return
  1230  	}
  1231  
  1232  	return
  1233  }
  1234  
  1235  // ListSupportedCulturesPreparer prepares the ListSupportedCultures request.
  1236  func (client AppsClient) ListSupportedCulturesPreparer(ctx context.Context) (*http.Request, error) {
  1237  	urlParameters := map[string]interface{}{
  1238  		"Endpoint": client.Endpoint,
  1239  	}
  1240  
  1241  	preparer := autorest.CreatePreparer(
  1242  		autorest.AsGet(),
  1243  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1244  		autorest.WithPath("/apps/cultures"))
  1245  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1246  }
  1247  
  1248  // ListSupportedCulturesSender sends the ListSupportedCultures request. The method will close the
  1249  // http.Response Body if it receives an error.
  1250  func (client AppsClient) ListSupportedCulturesSender(req *http.Request) (*http.Response, error) {
  1251  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1252  }
  1253  
  1254  // ListSupportedCulturesResponder handles the response to the ListSupportedCultures request. The method always
  1255  // closes the http.Response Body.
  1256  func (client AppsClient) ListSupportedCulturesResponder(resp *http.Response) (result ListAvailableCulture, err error) {
  1257  	err = autorest.Respond(
  1258  		resp,
  1259  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1260  		autorest.ByUnmarshallingJSON(&result.Value),
  1261  		autorest.ByClosing())
  1262  	result.Response = autorest.Response{Response: resp}
  1263  	return
  1264  }
  1265  
  1266  // ListUsageScenarios gets the application available usage scenarios.
  1267  func (client AppsClient) ListUsageScenarios(ctx context.Context) (result ListString, err error) {
  1268  	if tracing.IsEnabled() {
  1269  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsageScenarios")
  1270  		defer func() {
  1271  			sc := -1
  1272  			if result.Response.Response != nil {
  1273  				sc = result.Response.Response.StatusCode
  1274  			}
  1275  			tracing.EndSpan(ctx, sc, err)
  1276  		}()
  1277  	}
  1278  	req, err := client.ListUsageScenariosPreparer(ctx)
  1279  	if err != nil {
  1280  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", nil, "Failure preparing request")
  1281  		return
  1282  	}
  1283  
  1284  	resp, err := client.ListUsageScenariosSender(req)
  1285  	if err != nil {
  1286  		result.Response = autorest.Response{Response: resp}
  1287  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", resp, "Failure sending request")
  1288  		return
  1289  	}
  1290  
  1291  	result, err = client.ListUsageScenariosResponder(resp)
  1292  	if err != nil {
  1293  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "ListUsageScenarios", resp, "Failure responding to request")
  1294  		return
  1295  	}
  1296  
  1297  	return
  1298  }
  1299  
  1300  // ListUsageScenariosPreparer prepares the ListUsageScenarios request.
  1301  func (client AppsClient) ListUsageScenariosPreparer(ctx context.Context) (*http.Request, error) {
  1302  	urlParameters := map[string]interface{}{
  1303  		"Endpoint": client.Endpoint,
  1304  	}
  1305  
  1306  	preparer := autorest.CreatePreparer(
  1307  		autorest.AsGet(),
  1308  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1309  		autorest.WithPath("/apps/usagescenarios"))
  1310  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1311  }
  1312  
  1313  // ListUsageScenariosSender sends the ListUsageScenarios request. The method will close the
  1314  // http.Response Body if it receives an error.
  1315  func (client AppsClient) ListUsageScenariosSender(req *http.Request) (*http.Response, error) {
  1316  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1317  }
  1318  
  1319  // ListUsageScenariosResponder handles the response to the ListUsageScenarios request. The method always
  1320  // closes the http.Response Body.
  1321  func (client AppsClient) ListUsageScenariosResponder(resp *http.Response) (result ListString, err error) {
  1322  	err = autorest.Respond(
  1323  		resp,
  1324  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1325  		autorest.ByUnmarshallingJSON(&result.Value),
  1326  		autorest.ByClosing())
  1327  	result.Response = autorest.Response{Response: resp}
  1328  	return
  1329  }
  1330  
  1331  // PackagePublishedApplicationAsGzip packages a published LUIS application as a GZip file to be used in the LUIS
  1332  // container.
  1333  // Parameters:
  1334  // appID - the application ID.
  1335  // slotName - the publishing slot name.
  1336  func (client AppsClient) PackagePublishedApplicationAsGzip(ctx context.Context, appID uuid.UUID, slotName string) (result ReadCloser, err error) {
  1337  	if tracing.IsEnabled() {
  1338  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PackagePublishedApplicationAsGzip")
  1339  		defer func() {
  1340  			sc := -1
  1341  			if result.Response.Response != nil {
  1342  				sc = result.Response.Response.StatusCode
  1343  			}
  1344  			tracing.EndSpan(ctx, sc, err)
  1345  		}()
  1346  	}
  1347  	req, err := client.PackagePublishedApplicationAsGzipPreparer(ctx, appID, slotName)
  1348  	if err != nil {
  1349  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", nil, "Failure preparing request")
  1350  		return
  1351  	}
  1352  
  1353  	resp, err := client.PackagePublishedApplicationAsGzipSender(req)
  1354  	if err != nil {
  1355  		result.Response = autorest.Response{Response: resp}
  1356  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", resp, "Failure sending request")
  1357  		return
  1358  	}
  1359  
  1360  	result, err = client.PackagePublishedApplicationAsGzipResponder(resp)
  1361  	if err != nil {
  1362  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackagePublishedApplicationAsGzip", resp, "Failure responding to request")
  1363  		return
  1364  	}
  1365  
  1366  	return
  1367  }
  1368  
  1369  // PackagePublishedApplicationAsGzipPreparer prepares the PackagePublishedApplicationAsGzip request.
  1370  func (client AppsClient) PackagePublishedApplicationAsGzipPreparer(ctx context.Context, appID uuid.UUID, slotName string) (*http.Request, error) {
  1371  	urlParameters := map[string]interface{}{
  1372  		"Endpoint": client.Endpoint,
  1373  	}
  1374  
  1375  	pathParameters := map[string]interface{}{
  1376  		"appId":    autorest.Encode("path", appID),
  1377  		"slotName": autorest.Encode("path", slotName),
  1378  	}
  1379  
  1380  	preparer := autorest.CreatePreparer(
  1381  		autorest.AsGet(),
  1382  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1383  		autorest.WithPathParameters("/package/{appId}/slot/{slotName}/gzip", pathParameters))
  1384  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1385  }
  1386  
  1387  // PackagePublishedApplicationAsGzipSender sends the PackagePublishedApplicationAsGzip request. The method will close the
  1388  // http.Response Body if it receives an error.
  1389  func (client AppsClient) PackagePublishedApplicationAsGzipSender(req *http.Request) (*http.Response, error) {
  1390  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1391  }
  1392  
  1393  // PackagePublishedApplicationAsGzipResponder handles the response to the PackagePublishedApplicationAsGzip request. The method always
  1394  // closes the http.Response Body.
  1395  func (client AppsClient) PackagePublishedApplicationAsGzipResponder(resp *http.Response) (result ReadCloser, err error) {
  1396  	result.Value = &resp.Body
  1397  	err = autorest.Respond(
  1398  		resp,
  1399  		azure.WithErrorUnlessStatusCode(http.StatusOK))
  1400  	result.Response = autorest.Response{Response: resp}
  1401  	return
  1402  }
  1403  
  1404  // PackageTrainedApplicationAsGzip packages trained LUIS application as GZip file to be used in the LUIS container.
  1405  // Parameters:
  1406  // appID - the application ID.
  1407  // versionID - the version ID.
  1408  func (client AppsClient) PackageTrainedApplicationAsGzip(ctx context.Context, appID uuid.UUID, versionID string) (result ReadCloser, err error) {
  1409  	if tracing.IsEnabled() {
  1410  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PackageTrainedApplicationAsGzip")
  1411  		defer func() {
  1412  			sc := -1
  1413  			if result.Response.Response != nil {
  1414  				sc = result.Response.Response.StatusCode
  1415  			}
  1416  			tracing.EndSpan(ctx, sc, err)
  1417  		}()
  1418  	}
  1419  	req, err := client.PackageTrainedApplicationAsGzipPreparer(ctx, appID, versionID)
  1420  	if err != nil {
  1421  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", nil, "Failure preparing request")
  1422  		return
  1423  	}
  1424  
  1425  	resp, err := client.PackageTrainedApplicationAsGzipSender(req)
  1426  	if err != nil {
  1427  		result.Response = autorest.Response{Response: resp}
  1428  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", resp, "Failure sending request")
  1429  		return
  1430  	}
  1431  
  1432  	result, err = client.PackageTrainedApplicationAsGzipResponder(resp)
  1433  	if err != nil {
  1434  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "PackageTrainedApplicationAsGzip", resp, "Failure responding to request")
  1435  		return
  1436  	}
  1437  
  1438  	return
  1439  }
  1440  
  1441  // PackageTrainedApplicationAsGzipPreparer prepares the PackageTrainedApplicationAsGzip request.
  1442  func (client AppsClient) PackageTrainedApplicationAsGzipPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) {
  1443  	urlParameters := map[string]interface{}{
  1444  		"Endpoint": client.Endpoint,
  1445  	}
  1446  
  1447  	pathParameters := map[string]interface{}{
  1448  		"appId":     autorest.Encode("path", appID),
  1449  		"versionId": autorest.Encode("path", versionID),
  1450  	}
  1451  
  1452  	preparer := autorest.CreatePreparer(
  1453  		autorest.AsGet(),
  1454  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1455  		autorest.WithPathParameters("/package/{appId}/versions/{versionId}/gzip", pathParameters))
  1456  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1457  }
  1458  
  1459  // PackageTrainedApplicationAsGzipSender sends the PackageTrainedApplicationAsGzip request. The method will close the
  1460  // http.Response Body if it receives an error.
  1461  func (client AppsClient) PackageTrainedApplicationAsGzipSender(req *http.Request) (*http.Response, error) {
  1462  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1463  }
  1464  
  1465  // PackageTrainedApplicationAsGzipResponder handles the response to the PackageTrainedApplicationAsGzip request. The method always
  1466  // closes the http.Response Body.
  1467  func (client AppsClient) PackageTrainedApplicationAsGzipResponder(resp *http.Response) (result ReadCloser, err error) {
  1468  	result.Value = &resp.Body
  1469  	err = autorest.Respond(
  1470  		resp,
  1471  		azure.WithErrorUnlessStatusCode(http.StatusOK))
  1472  	result.Response = autorest.Response{Response: resp}
  1473  	return
  1474  }
  1475  
  1476  // Publish publishes a specific version of the application.
  1477  // Parameters:
  1478  // appID - the application ID.
  1479  // applicationPublishObject - the application publish object. The region is the target region that the
  1480  // application is published to.
  1481  func (client AppsClient) Publish(ctx context.Context, appID uuid.UUID, applicationPublishObject ApplicationPublishObject) (result ProductionOrStagingEndpointInfo, err error) {
  1482  	if tracing.IsEnabled() {
  1483  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Publish")
  1484  		defer func() {
  1485  			sc := -1
  1486  			if result.Response.Response != nil {
  1487  				sc = result.Response.Response.StatusCode
  1488  			}
  1489  			tracing.EndSpan(ctx, sc, err)
  1490  		}()
  1491  	}
  1492  	req, err := client.PublishPreparer(ctx, appID, applicationPublishObject)
  1493  	if err != nil {
  1494  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", nil, "Failure preparing request")
  1495  		return
  1496  	}
  1497  
  1498  	resp, err := client.PublishSender(req)
  1499  	if err != nil {
  1500  		result.Response = autorest.Response{Response: resp}
  1501  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", resp, "Failure sending request")
  1502  		return
  1503  	}
  1504  
  1505  	result, err = client.PublishResponder(resp)
  1506  	if err != nil {
  1507  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Publish", resp, "Failure responding to request")
  1508  		return
  1509  	}
  1510  
  1511  	return
  1512  }
  1513  
  1514  // PublishPreparer prepares the Publish request.
  1515  func (client AppsClient) PublishPreparer(ctx context.Context, appID uuid.UUID, applicationPublishObject ApplicationPublishObject) (*http.Request, error) {
  1516  	urlParameters := map[string]interface{}{
  1517  		"Endpoint": client.Endpoint,
  1518  	}
  1519  
  1520  	pathParameters := map[string]interface{}{
  1521  		"appId": autorest.Encode("path", appID),
  1522  	}
  1523  
  1524  	preparer := autorest.CreatePreparer(
  1525  		autorest.AsContentType("application/json; charset=utf-8"),
  1526  		autorest.AsPost(),
  1527  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1528  		autorest.WithPathParameters("/apps/{appId}/publish", pathParameters),
  1529  		autorest.WithJSON(applicationPublishObject))
  1530  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1531  }
  1532  
  1533  // PublishSender sends the Publish request. The method will close the
  1534  // http.Response Body if it receives an error.
  1535  func (client AppsClient) PublishSender(req *http.Request) (*http.Response, error) {
  1536  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1537  }
  1538  
  1539  // PublishResponder handles the response to the Publish request. The method always
  1540  // closes the http.Response Body.
  1541  func (client AppsClient) PublishResponder(resp *http.Response) (result ProductionOrStagingEndpointInfo, err error) {
  1542  	err = autorest.Respond(
  1543  		resp,
  1544  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusMultiStatus),
  1545  		autorest.ByUnmarshallingJSON(&result),
  1546  		autorest.ByClosing())
  1547  	result.Response = autorest.Response{Response: resp}
  1548  	return
  1549  }
  1550  
  1551  // Update updates the name or description of the application.
  1552  // Parameters:
  1553  // appID - the application ID.
  1554  // applicationUpdateObject - a model containing Name and Description of the application.
  1555  func (client AppsClient) Update(ctx context.Context, appID uuid.UUID, applicationUpdateObject ApplicationUpdateObject) (result OperationStatus, err error) {
  1556  	if tracing.IsEnabled() {
  1557  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update")
  1558  		defer func() {
  1559  			sc := -1
  1560  			if result.Response.Response != nil {
  1561  				sc = result.Response.Response.StatusCode
  1562  			}
  1563  			tracing.EndSpan(ctx, sc, err)
  1564  		}()
  1565  	}
  1566  	req, err := client.UpdatePreparer(ctx, appID, applicationUpdateObject)
  1567  	if err != nil {
  1568  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", nil, "Failure preparing request")
  1569  		return
  1570  	}
  1571  
  1572  	resp, err := client.UpdateSender(req)
  1573  	if err != nil {
  1574  		result.Response = autorest.Response{Response: resp}
  1575  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", resp, "Failure sending request")
  1576  		return
  1577  	}
  1578  
  1579  	result, err = client.UpdateResponder(resp)
  1580  	if err != nil {
  1581  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "Update", resp, "Failure responding to request")
  1582  		return
  1583  	}
  1584  
  1585  	return
  1586  }
  1587  
  1588  // UpdatePreparer prepares the Update request.
  1589  func (client AppsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, applicationUpdateObject ApplicationUpdateObject) (*http.Request, error) {
  1590  	urlParameters := map[string]interface{}{
  1591  		"Endpoint": client.Endpoint,
  1592  	}
  1593  
  1594  	pathParameters := map[string]interface{}{
  1595  		"appId": autorest.Encode("path", appID),
  1596  	}
  1597  
  1598  	preparer := autorest.CreatePreparer(
  1599  		autorest.AsContentType("application/json; charset=utf-8"),
  1600  		autorest.AsPut(),
  1601  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1602  		autorest.WithPathParameters("/apps/{appId}", pathParameters),
  1603  		autorest.WithJSON(applicationUpdateObject))
  1604  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1605  }
  1606  
  1607  // UpdateSender sends the Update request. The method will close the
  1608  // http.Response Body if it receives an error.
  1609  func (client AppsClient) UpdateSender(req *http.Request) (*http.Response, error) {
  1610  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1611  }
  1612  
  1613  // UpdateResponder handles the response to the Update request. The method always
  1614  // closes the http.Response Body.
  1615  func (client AppsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) {
  1616  	err = autorest.Respond(
  1617  		resp,
  1618  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1619  		autorest.ByUnmarshallingJSON(&result),
  1620  		autorest.ByClosing())
  1621  	result.Response = autorest.Response{Response: resp}
  1622  	return
  1623  }
  1624  
  1625  // UpdatePublishSettings updates the application publish settings including 'UseAllTrainingData'.
  1626  // Parameters:
  1627  // appID - the application ID.
  1628  // publishSettingUpdateObject - an object containing the new publish application settings.
  1629  func (client AppsClient) UpdatePublishSettings(ctx context.Context, appID uuid.UUID, publishSettingUpdateObject PublishSettingUpdateObject) (result OperationStatus, err error) {
  1630  	if tracing.IsEnabled() {
  1631  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdatePublishSettings")
  1632  		defer func() {
  1633  			sc := -1
  1634  			if result.Response.Response != nil {
  1635  				sc = result.Response.Response.StatusCode
  1636  			}
  1637  			tracing.EndSpan(ctx, sc, err)
  1638  		}()
  1639  	}
  1640  	req, err := client.UpdatePublishSettingsPreparer(ctx, appID, publishSettingUpdateObject)
  1641  	if err != nil {
  1642  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", nil, "Failure preparing request")
  1643  		return
  1644  	}
  1645  
  1646  	resp, err := client.UpdatePublishSettingsSender(req)
  1647  	if err != nil {
  1648  		result.Response = autorest.Response{Response: resp}
  1649  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", resp, "Failure sending request")
  1650  		return
  1651  	}
  1652  
  1653  	result, err = client.UpdatePublishSettingsResponder(resp)
  1654  	if err != nil {
  1655  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdatePublishSettings", resp, "Failure responding to request")
  1656  		return
  1657  	}
  1658  
  1659  	return
  1660  }
  1661  
  1662  // UpdatePublishSettingsPreparer prepares the UpdatePublishSettings request.
  1663  func (client AppsClient) UpdatePublishSettingsPreparer(ctx context.Context, appID uuid.UUID, publishSettingUpdateObject PublishSettingUpdateObject) (*http.Request, error) {
  1664  	urlParameters := map[string]interface{}{
  1665  		"Endpoint": client.Endpoint,
  1666  	}
  1667  
  1668  	pathParameters := map[string]interface{}{
  1669  		"appId": autorest.Encode("path", appID),
  1670  	}
  1671  
  1672  	preparer := autorest.CreatePreparer(
  1673  		autorest.AsContentType("application/json; charset=utf-8"),
  1674  		autorest.AsPut(),
  1675  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1676  		autorest.WithPathParameters("/apps/{appId}/publishsettings", pathParameters),
  1677  		autorest.WithJSON(publishSettingUpdateObject))
  1678  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1679  }
  1680  
  1681  // UpdatePublishSettingsSender sends the UpdatePublishSettings request. The method will close the
  1682  // http.Response Body if it receives an error.
  1683  func (client AppsClient) UpdatePublishSettingsSender(req *http.Request) (*http.Response, error) {
  1684  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1685  }
  1686  
  1687  // UpdatePublishSettingsResponder handles the response to the UpdatePublishSettings request. The method always
  1688  // closes the http.Response Body.
  1689  func (client AppsClient) UpdatePublishSettingsResponder(resp *http.Response) (result OperationStatus, err error) {
  1690  	err = autorest.Respond(
  1691  		resp,
  1692  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1693  		autorest.ByUnmarshallingJSON(&result),
  1694  		autorest.ByClosing())
  1695  	result.Response = autorest.Response{Response: resp}
  1696  	return
  1697  }
  1698  
  1699  // UpdateSettings updates the application settings including 'UseAllTrainingData'.
  1700  // Parameters:
  1701  // appID - the application ID.
  1702  // applicationSettingUpdateObject - an object containing the new application settings.
  1703  func (client AppsClient) UpdateSettings(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject ApplicationSettingUpdateObject) (result OperationStatus, err error) {
  1704  	if tracing.IsEnabled() {
  1705  		ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSettings")
  1706  		defer func() {
  1707  			sc := -1
  1708  			if result.Response.Response != nil {
  1709  				sc = result.Response.Response.StatusCode
  1710  			}
  1711  			tracing.EndSpan(ctx, sc, err)
  1712  		}()
  1713  	}
  1714  	req, err := client.UpdateSettingsPreparer(ctx, appID, applicationSettingUpdateObject)
  1715  	if err != nil {
  1716  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", nil, "Failure preparing request")
  1717  		return
  1718  	}
  1719  
  1720  	resp, err := client.UpdateSettingsSender(req)
  1721  	if err != nil {
  1722  		result.Response = autorest.Response{Response: resp}
  1723  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", resp, "Failure sending request")
  1724  		return
  1725  	}
  1726  
  1727  	result, err = client.UpdateSettingsResponder(resp)
  1728  	if err != nil {
  1729  		err = autorest.NewErrorWithError(err, "authoring.AppsClient", "UpdateSettings", resp, "Failure responding to request")
  1730  		return
  1731  	}
  1732  
  1733  	return
  1734  }
  1735  
  1736  // UpdateSettingsPreparer prepares the UpdateSettings request.
  1737  func (client AppsClient) UpdateSettingsPreparer(ctx context.Context, appID uuid.UUID, applicationSettingUpdateObject ApplicationSettingUpdateObject) (*http.Request, error) {
  1738  	urlParameters := map[string]interface{}{
  1739  		"Endpoint": client.Endpoint,
  1740  	}
  1741  
  1742  	pathParameters := map[string]interface{}{
  1743  		"appId": autorest.Encode("path", appID),
  1744  	}
  1745  
  1746  	preparer := autorest.CreatePreparer(
  1747  		autorest.AsContentType("application/json; charset=utf-8"),
  1748  		autorest.AsPut(),
  1749  		autorest.WithCustomBaseURL("{Endpoint}/luis/authoring/v3.0-preview", urlParameters),
  1750  		autorest.WithPathParameters("/apps/{appId}/settings", pathParameters),
  1751  		autorest.WithJSON(applicationSettingUpdateObject))
  1752  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1753  }
  1754  
  1755  // UpdateSettingsSender sends the UpdateSettings request. The method will close the
  1756  // http.Response Body if it receives an error.
  1757  func (client AppsClient) UpdateSettingsSender(req *http.Request) (*http.Response, error) {
  1758  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1759  }
  1760  
  1761  // UpdateSettingsResponder handles the response to the UpdateSettings request. The method always
  1762  // closes the http.Response Body.
  1763  func (client AppsClient) UpdateSettingsResponder(resp *http.Response) (result OperationStatus, err error) {
  1764  	err = autorest.Respond(
  1765  		resp,
  1766  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1767  		autorest.ByUnmarshallingJSON(&result),
  1768  		autorest.ByClosing())
  1769  	result.Response = autorest.Response{Response: resp}
  1770  	return
  1771  }
  1772  

View as plain text