Detects the language of text within a request.

        Example:
            >>> from google.cloud import translate_v3beta1
            >>>
            >>> client = translate_v3beta1.TranslationServiceClient()
            >>>
            >>> response = client.detect_language()

        Args:
            parent (str): Optional. Only used when making regionalized call.
                Format:
                projects/{project-id}/locations/{location-id}.

                Only custom model within the same location-id can be used.
                Otherwise 400 is returned.
            model (str): Optional. The language detection model to be used.
                projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}
                If not specified, default will be used.
            content (str): The content of the input stored as a string.
            mime_type (str): Optional. The format of the source text, for example, "text/html",
                "text/plain". If left blank, the MIME type is assumed to be "text/html".
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.translate_v3beta1.types.DetectLanguageResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.

def detect_language(
        self,
        parent=None,
        model=None,
        content=None,
        mime_type=None,
        retry=google.api_core.gapic_v1.method.DEFAULT,
        timeout=google.api_core.gapic_v1.method.DEFAULT,
        metadata=None,
    ):
        """
        Detects the language of text within a request.

        Example:
            >>> from google.cloud import translate_v3beta1
            >>>
            >>> client = translate_v3beta1.TranslationServiceClient()
            >>>
            >>> response = client.detect_language()

        Args:
            parent (str): Optional. Only used when making regionalized call.
                Format:
                projects/{project-id}/locations/{location-id}.

                Only custom model within the same location-id can be used.
                Otherwise 400 is returned.
            model (str): Optional. The language detection model to be used.
                projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}
                If not specified, default will be used.
            content (str): The content of the input stored as a string.
            mime_type (str): Optional. The format of the source text, for example, "text/html",
                "text/plain". If left blank, the MIME type is assumed to be "text/html".
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.translate_v3beta1.types.DetectLanguageResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "detect_language" not in self._inner_api_calls:
            self._inner_api_calls[
                "detect_language"
            ] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.detect_language,
                default_retry=self._method_configs["DetectLanguage"].retry,
                default_timeout=self._method_configs["DetectLanguage"].timeout,
                client_info=self._client_info,
            )

        # Sanity check: We have some fields which are mutually exclusive;
        # raise ValueError if more than one is sent.
        google.api_core.protobuf_helpers.check_oneof(content=content)

        request = translation_service_pb2.DetectLanguageRequest(
            parent=parent, model=model, content=content, mime_type=mime_type
        )
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        try:
            routing_header = [("parent", parent)]
        except AttributeError:
            pass
        else:
            routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                routing_header
            )
            metadata.append(routing_metadata)

        return self._inner_api_calls["detect_language"](
            request, retry=retry, timeout=timeout, metadata=metadata
        )