# Source code for azure.cognitiveservices.language.luis.authoring.operations._apps_operations

    # coding=utf-8
    # --------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for
    # license information.
    #
    # Code generated by Microsoft (R) AutoRest Code Generator.
    # Changes may cause incorrect behavior and will be lost if the code is
    # regenerated.
    # --------------------------------------------------------------------------

    from msrest.pipeline import ClientRawResponse
    from msrest.exceptions import HttpOperationError

    from .. import models

    class AppsOperations(object):
        """AppsOperations operations.

        You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

        :param client: Client for service requests.
        :param config: Configuration of service client.
        :param serializer: An object model serializer.
        :param deserializer: An object model deserializer.
        """

        models = models

        def __init__(self, client, config, serializer, deserializer):

            self._client = client
            self._serialize = serializer
            self._deserialize = deserializer

            self.config = config

        def add(
                self, application_create_object, custom_headers=None, raw=False, **operation_config):
            """Creates a new LUIS app.

            :param application_create_object: An application containing Name,
             Description (optional), Culture, Usage Scenario (optional), Domain
             (optional) and initial version ID (optional) of the application.
             Default value for the version ID is "0.1". Note: the culture cannot be
             changed after the app is created.
            :type application_create_object:
             ~azure.cognitiveservices.language.luis.authoring.models.ApplicationCreateObject
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: str or ClientRawResponse if raw=true
            :rtype: str or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.add.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(application_create_object, 'ApplicationCreateObject')

            # Construct and send request
            request = self._client.post(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [201]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 201:
                deserialized = self._deserialize('str', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        add.metadata = {'url': '/apps/'}

        def list(
                self, skip=0, take=100, custom_headers=None, raw=False, **operation_config):
            """Lists all of the user's applications.

            :param skip: The number of entries to skip. Default value is 0.
            :type skip: int
            :param take: The number of entries to return. Maximum page size is
             500. Default is 100.
            :type take: int
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype:
             list[~azure.cognitiveservices.language.luis.authoring.models.ApplicationInfoResponse]
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            if skip is not None:
                query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0)
            if take is not None:
                query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0)

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[ApplicationInfoResponse]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list.metadata = {'url': '/apps/'}

        def import_method(
                self, luis_app, app_name=None, custom_headers=None, raw=False, **operation_config):
            """Imports an application to LUIS, the application's structure is included
            in the request body.

            :param luis_app: A LUIS application structure.
            :type luis_app:
             ~azure.cognitiveservices.language.luis.authoring.models.LuisApp
            :param app_name: The application name to create. If not specified, the
             application name will be read from the imported object. If the
             application name already exists, an error is returned.
            :type app_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: str or ClientRawResponse if raw=true
            :rtype: str or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.import_method.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            if app_name is not None:
                query_parameters['appName'] = self._serialize.query("app_name", app_name, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(luis_app, 'LuisApp')

            # Construct and send request
            request = self._client.post(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [201]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 201:
                deserialized = self._deserialize('str', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        import_method.metadata = {'url': '/apps/import'}

        def list_cortana_endpoints(
                self, custom_headers=None, raw=False, **operation_config):
            """Gets the endpoint URLs for the prebuilt Cortana applications.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: PersonalAssistantsResponse or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.PersonalAssistantsResponse
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_cortana_endpoints.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('PersonalAssistantsResponse', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_cortana_endpoints.metadata = {'url': '/apps/assistants'}

        def list_domains(
                self, custom_headers=None, raw=False, **operation_config):
            """Gets the available application domains.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype: list[str] or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_domains.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[str]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_domains.metadata = {'url': '/apps/domains'}

        def list_usage_scenarios(
                self, custom_headers=None, raw=False, **operation_config):
            """Gets the application available usage scenarios.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype: list[str] or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_usage_scenarios.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[str]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_usage_scenarios.metadata = {'url': '/apps/usagescenarios'}

        def list_supported_cultures(
                self, custom_headers=None, raw=False, **operation_config):
            """Gets a list of supported cultures. Cultures are equivalent to the
            written language and locale. For example,"en-us" represents the U.S.
            variation of English.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype:
             list[~azure.cognitiveservices.language.luis.authoring.models.AvailableCulture]
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_supported_cultures.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[AvailableCulture]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_supported_cultures.metadata = {'url': '/apps/cultures'}

        def download_query_logs(
                self, app_id, custom_headers=None, raw=False, callback=None, **operation_config):
            """Gets the logs of the past month's endpoint queries for the application.

            :param app_id: The application ID.
            :type app_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param callback: When specified, will be called with each chunk of
             data that is streamed. The callback should take two arguments, the
             bytes of the current chunk of data and the response object. If the
             data is uploading, response will be None.
            :type callback: Callable[Bytes, response=None]
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: object or ClientRawResponse if raw=true
            :rtype: Generator or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
            """
            # Construct URL
            url = self.download_query_logs.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/octet-stream'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=True, **operation_config)

            if response.status_code not in [200]:
                raise HttpOperationError(self._deserialize, response)

            deserialized = self._client.stream_download(response, callback)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        download_query_logs.metadata = {'url': '/apps/{appId}/querylogs'}

        def get(
                self, app_id, custom_headers=None, raw=False, **operation_config):
            """Gets the application info.

            :param app_id: The application ID.
            :type app_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: ApplicationInfoResponse or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.ApplicationInfoResponse
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.get.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('ApplicationInfoResponse', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        get.metadata = {'url': '/apps/{appId}'}

        def update(
                self, app_id, name=None, description=None, custom_headers=None, raw=False, **operation_config):
            """Updates the name or description of the application.

            :param app_id: The application ID.
            :type app_id: str
            :param name: The application's new name.
            :type name: str
            :param description: The application's new description.
            :type description: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: OperationStatus or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            application_update_object = models.ApplicationUpdateObject(name=name, description=description)

            # Construct URL
            url = self.update.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(application_update_object, 'ApplicationUpdateObject')

            # Construct and send request
            request = self._client.put(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('OperationStatus', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        update.metadata = {'url': '/apps/{appId}'}

        def delete(
                self, app_id, force=False, custom_headers=None, raw=False, **operation_config):
            """Deletes an application.

            :param app_id: The application ID.
            :type app_id: str
            :param force: A flag to indicate whether to force an operation.
            :type force: bool
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: OperationStatus or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.delete.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            if force is not None:
                query_parameters['force'] = self._serialize.query("force", force, 'bool')

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.delete(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('OperationStatus', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        delete.metadata = {'url': '/apps/{appId}'}

        def publish(
                self, app_id, version_id=None, is_staging=False, custom_headers=None, raw=False, **operation_config):
            """Publishes a specific version of the application.

            :param app_id: The application ID.
            :type app_id: str
            :param version_id: The version ID to publish.
            :type version_id: str
            :param is_staging: Indicates if the staging slot should be used,
             instead of the Production one.
            :type is_staging: bool
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: ProductionOrStagingEndpointInfo or ClientRawResponse if
             raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.ProductionOrStagingEndpointInfo
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            application_publish_object = models.ApplicationPublishObject(version_id=version_id, is_staging=is_staging)

            # Construct URL
            url = self.publish.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(application_publish_object, 'ApplicationPublishObject')

            # Construct and send request
            request = self._client.post(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [201, 207]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 201:
                deserialized = self._deserialize('ProductionOrStagingEndpointInfo', response)
            if response.status_code == 207:
                deserialized = self._deserialize('ProductionOrStagingEndpointInfo', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        publish.metadata = {'url': '/apps/{appId}/publish'}

        def get_settings(
                self, app_id, custom_headers=None, raw=False, **operation_config):
            """Get the application settings including 'UseAllTrainingData'.

            :param app_id: The application ID.
            :type app_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: ApplicationSettings or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.ApplicationSettings
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.get_settings.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('ApplicationSettings', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        get_settings.metadata = {'url': '/apps/{appId}/settings'}

        def update_settings(
                self, app_id, is_public=None, custom_headers=None, raw=False, **operation_config):
            """Updates the application settings including 'UseAllTrainingData'.

            :param app_id: The application ID.
            :type app_id: str
            :param is_public: Setting your application as public allows other
             people to use your application's endpoint using their own keys.
            :type is_public: bool
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: OperationStatus or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            application_setting_update_object = models.ApplicationSettingUpdateObject(is_public=is_public)

            # Construct URL
            url = self.update_settings.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(application_setting_update_object, 'ApplicationSettingUpdateObject')

            # Construct and send request
            request = self._client.put(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('OperationStatus', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        update_settings.metadata = {'url': '/apps/{appId}/settings'}

        def get_publish_settings(
                self, app_id, custom_headers=None, raw=False, **operation_config):
            """Get the application publish settings including 'UseAllTrainingData'.

            :param app_id: The application ID.
            :type app_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: PublishSettings or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.PublishSettings
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.get_publish_settings.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('PublishSettings', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        get_publish_settings.metadata = {'url': '/apps/{appId}/publishsettings'}

        def update_publish_settings(
                self, app_id, publish_setting_update_object, custom_headers=None, raw=False, **operation_config):
            """Updates the application publish settings including
            'UseAllTrainingData'.

            :param app_id: The application ID.
            :type app_id: str
            :param publish_setting_update_object: An object containing the new
             publish application settings.
            :type publish_setting_update_object:
             ~azure.cognitiveservices.language.luis.authoring.models.PublishSettingUpdateObject
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: OperationStatus or ClientRawResponse if raw=true
            :rtype:
             ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.update_publish_settings.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(publish_setting_update_object, 'PublishSettingUpdateObject')

            # Construct and send request
            request = self._client.put(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('OperationStatus', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        update_publish_settings.metadata = {'url': '/apps/{appId}/publishsettings'}

        def list_endpoints(
                self, app_id, custom_headers=None, raw=False, **operation_config):
            """Returns the available endpoint deployment regions and URLs.

            :param app_id: The application ID.
            :type app_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: dict or ClientRawResponse if raw=true
            :rtype: dict[str, str] or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_endpoints.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('{str}', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_endpoints.metadata = {'url': '/apps/{appId}/endpoints'}

        def list_available_custom_prebuilt_domains(
                self, custom_headers=None, raw=False, **operation_config):
            """Gets all the available custom prebuilt domains for all cultures.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype:
             list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltDomain]
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_available_custom_prebuilt_domains.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[PrebuiltDomain]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_available_custom_prebuilt_domains.metadata = {'url': '/apps/customprebuiltdomains'}

        def add_custom_prebuilt_domain(
                self, domain_name=None, culture=None, custom_headers=None, raw=False, **operation_config):
            """Adds a prebuilt domain along with its intent and entity models as a new
            application.

            :param domain_name: The domain name.
            :type domain_name: str
            :param culture: The culture of the new domain.
            :type culture: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: str or ClientRawResponse if raw=true
            :rtype: str or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            prebuilt_domain_create_object = models.PrebuiltDomainCreateObject(domain_name=domain_name, culture=culture)

            # Construct URL
            url = self.add_custom_prebuilt_domain.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct body
            body_content = self._serialize.body(prebuilt_domain_create_object, 'PrebuiltDomainCreateObject')

            # Construct and send request
            request = self._client.post(url, query_parameters, header_parameters, body_content)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [201]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 201:
                deserialized = self._deserialize('str', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        add_custom_prebuilt_domain.metadata = {'url': '/apps/customprebuiltdomains'}

        def list_available_custom_prebuilt_domains_for_culture(
                self, culture, custom_headers=None, raw=False, **operation_config):
            """Gets all the available prebuilt domains for a specific culture.

            :param culture: Culture.
            :type culture: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: list or ClientRawResponse if raw=true
            :rtype:
             list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltDomain]
             or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.list_available_custom_prebuilt_domains_for_culture.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'culture': self._serialize.url("culture", culture, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = None
            if response.status_code == 200:
                deserialized = self._deserialize('[PrebuiltDomain]', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        list_available_custom_prebuilt_domains_for_culture.metadata = {'url': '/apps/customprebuiltdomains/{culture}'}

        def package_published_application_as_gzip(
                self, app_id, slot_name, custom_headers=None, raw=False, callback=None, **operation_config):
            """package - Gets published LUIS application package in binary stream GZip
            format.

            Packages a published LUIS application as a GZip file to be used in the
            LUIS container.

            :param app_id: The application ID.
            :type app_id: str
            :param slot_name: The publishing slot name.
            :type slot_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param callback: When specified, will be called with each chunk of
             data that is streamed. The callback should take two arguments, the
             bytes of the current chunk of data and the response object. If the
             data is uploading, response will be None.
            :type callback: Callable[Bytes, response=None]
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: object or ClientRawResponse if raw=true
            :rtype: Generator or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.package_published_application_as_gzip.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str'),
                'slotName': self._serialize.url("slot_name", slot_name, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=True, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = self._client.stream_download(response, callback)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        package_published_application_as_gzip.metadata = {'url': '/package/{appId}/slot/{slotName}/gzip'}

        def package_trained_application_as_gzip(
                self, app_id, version_id, custom_headers=None, raw=False, callback=None, **operation_config):
            """package - Gets trained LUIS application package in binary stream GZip
            format.

            Packages trained LUIS application as GZip file to be used in the LUIS
            container.

            :param app_id: The application ID.
            :type app_id: str
            :param version_id: The version ID.
            :type version_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param callback: When specified, will be called with each chunk of
             data that is streamed. The callback should take two arguments, the
             bytes of the current chunk of data and the response object. If the
             data is uploading, response will be None.
            :type callback: Callable[Bytes, response=None]
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :return: object or ClientRawResponse if raw=true
            :rtype: Generator or ~msrest.pipeline.ClientRawResponse
            :raises:
             :class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
            """
            # Construct URL
            url = self.package_trained_application_as_gzip.metadata['url']
            path_format_arguments = {
                'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
                'appId': self._serialize.url("app_id", app_id, 'str'),
                'versionId': self._serialize.url("version_id", version_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if custom_headers:
                header_parameters.update(custom_headers)

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            response = self._client.send(request, stream=True, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorResponseException(self._deserialize, response)

            deserialized = self._client.stream_download(response, callback)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized
        package_trained_application_as_gzip.metadata = {'url': '/package/{appId}/versions/{versionId}/gzip'}