def from_api_repr(cls, resource, client, loggers=None):
        """Factory:  construct an entry given its API representation

        :type resource: dict
        :param resource: text entry resource representation returned from
                         the API

        :type client: :class:`google.cloud.logging.client.Client`
        :param client: Client which holds credentials and project
                       configuration.

        :type loggers: dict
        :param loggers:
            (Optional) A mapping of logger fullnames -> loggers.  If not
            passed, the entry will have a newly-created logger.

        :rtype: :class:`google.cloud.logging.entries.LogEntry`
        :returns: Log entry parsed from ``resource``.
        """
        if loggers is None:
            loggers = {}
        logger_fullname = resource["logName"]
        logger = loggers.get(logger_fullname)
        if logger is None:
            logger_name = logger_name_from_path(logger_fullname)
            logger = loggers[logger_fullname] = client.logger(logger_name)
        payload = cls._extract_payload(resource)
        insert_id = resource.get("insertId")
        timestamp = resource.get("timestamp")
        if timestamp is not None:
            timestamp = _rfc3339_nanos_to_datetime(timestamp)
        labels = resource.get("labels")
        severity = resource.get("severity")
        http_request = resource.get("httpRequest")
        trace = resource.get("trace")
        span_id = resource.get("spanId")
        trace_sampled = resource.get("traceSampled")
        source_location = resource.get("sourceLocation")
        if source_location is not None:
            line = source_location.pop("line", None)
            source_location["line"] = _int_or_none(line)
        operation = resource.get("operation")

        monitored_resource_dict = resource.get("resource")
        monitored_resource = None
        if monitored_resource_dict is not None:
            monitored_resource = Resource._from_dict(monitored_resource_dict)

        inst = cls(
            log_name=logger_fullname,
            insert_id=insert_id,
            timestamp=timestamp,
            labels=labels,
            severity=severity,
            http_request=http_request,
            resource=monitored_resource,
            trace=trace,
            span_id=span_id,
            trace_sampled=trace_sampled,
            source_location=source_location,
            operation=operation,
            logger=logger,
            payload=payload,
        )
        received = resource.get("receiveTimestamp")
        if received is not None:
            inst.received_timestamp = _rfc3339_nanos_to_datetime(received)
        return inst