Skip to content

ExternalStream

nats.js.api.ExternalStream dataclass #

ExternalStream(api, deliver=None)

Bases: Base

api instance-attribute #

api

deliver class-attribute instance-attribute #

deliver = None

from_response classmethod #

from_response(resp)

Read the class instance from a server response.

Unknown fields are ignored ("open-world assumption").

Source code in nats/js/api.py
@classmethod
def from_response(cls: type[_B], resp: Dict[str, Any]) -> _B:
    """Read the class instance from a server response.

    Unknown fields are ignored ("open-world assumption").
    """
    params = {}
    for field in fields(cls):
        if field.name in resp:
            params[field.name] = resp[field.name]
    return cls(**params)

evolve #

evolve(**params)

Return a copy of the instance with the passed values replaced.

Source code in nats/js/api.py
def evolve(self: _B, **params) -> _B:
    """Return a copy of the instance with the passed values replaced.
    """
    return replace(self, **params)

as_dict #

as_dict()
Source code in nats/js/api.py
def as_dict(self) -> Dict[str, object]:
    result = super().as_dict()
    return result