Record Class AgentStatus

java.lang.Object
java.lang.Record
io.github.chkrishnatej.rp3200.health.AgentStatus
Record Components:
ok - always true when the agent answered
version - agent version, e.g. "0.1.0"
os - "windows", "linux" or "darwin"
hostname - the PC's computer name - identifies the till
startedAt - when the agent (service) last started
uptimeSeconds - seconds since startedAt
printer - printer the agent prints to, e.g. "TVS RP3200"
printerState - one of ready, disconnected, offline, paused, paper-out, error, not-found, unknown; see printerReady()
printerReady - true only when printerState is "ready"
printerError - human-readable reason when not ready, otherwise null
queuedJobs - jobs waiting in the OS print queue (stuck jobs point to a problem)
jobsPrinted - jobs printed successfully since the agent started
jobsFailed - jobs that failed since the agent started
lastJobAt - time of the last job, or null
lastError - message of the last failed job, or null
lastErrorAt - time of the last failed job, or null
allowedOrigins - web origins the agent accepts

public record AgentStatus(boolean ok, String version, String os, String hostname, Instant startedAt, long uptimeSeconds, String printer, String printerState, boolean printerReady, String printerError, int queuedJobs, long jobsPrinted, long jobsFailed, Instant lastJobAt, String lastError, Instant lastErrorAt, List<String> allowedOrigins) extends Record
The health of one shop PC's print agent, as returned by the agent's GET /status endpoint and forwarded to your server by rp3200-print.js.

Field names match the agent's JSON exactly, so Jackson (Spring Boot's default) binds it without configuration. New fields may be added in later agent versions; Spring Boot ignores unknown JSON properties by default.

  • Constructor Details

    • AgentStatus

      public AgentStatus(boolean ok, String version, String os, String hostname, Instant startedAt, long uptimeSeconds, String printer, String printerState, boolean printerReady, String printerError, int queuedJobs, long jobsPrinted, long jobsFailed, Instant lastJobAt, String lastError, Instant lastErrorAt, List<String> allowedOrigins)
      Creates an instance of a AgentStatus record class.
      Parameters:
      ok - the value for the ok record component
      version - the value for the version record component
      os - the value for the os record component
      hostname - the value for the hostname record component
      startedAt - the value for the startedAt record component
      uptimeSeconds - the value for the uptimeSeconds record component
      printer - the value for the printer record component
      printerState - the value for the printerState record component
      printerReady - the value for the printerReady record component
      printerError - the value for the printerError record component
      queuedJobs - the value for the queuedJobs record component
      jobsPrinted - the value for the jobsPrinted record component
      jobsFailed - the value for the jobsFailed record component
      lastJobAt - the value for the lastJobAt record component
      lastError - the value for the lastError record component
      lastErrorAt - the value for the lastErrorAt record component
      allowedOrigins - the value for the allowedOrigins record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • ok

      public boolean ok()
      Returns the value of the ok record component.
      Returns:
      the value of the ok record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • os

      public String os()
      Returns the value of the os record component.
      Returns:
      the value of the os record component
    • hostname

      public String hostname()
      Returns the value of the hostname record component.
      Returns:
      the value of the hostname record component
    • startedAt

      public Instant startedAt()
      Returns the value of the startedAt record component.
      Returns:
      the value of the startedAt record component
    • uptimeSeconds

      public long uptimeSeconds()
      Returns the value of the uptimeSeconds record component.
      Returns:
      the value of the uptimeSeconds record component
    • printer

      public String printer()
      Returns the value of the printer record component.
      Returns:
      the value of the printer record component
    • printerState

      public String printerState()
      Returns the value of the printerState record component.
      Returns:
      the value of the printerState record component
    • printerReady

      public boolean printerReady()
      Returns the value of the printerReady record component.
      Returns:
      the value of the printerReady record component
    • printerError

      public String printerError()
      Returns the value of the printerError record component.
      Returns:
      the value of the printerError record component
    • queuedJobs

      public int queuedJobs()
      Returns the value of the queuedJobs record component.
      Returns:
      the value of the queuedJobs record component
    • jobsPrinted

      public long jobsPrinted()
      Returns the value of the jobsPrinted record component.
      Returns:
      the value of the jobsPrinted record component
    • jobsFailed

      public long jobsFailed()
      Returns the value of the jobsFailed record component.
      Returns:
      the value of the jobsFailed record component
    • lastJobAt

      public Instant lastJobAt()
      Returns the value of the lastJobAt record component.
      Returns:
      the value of the lastJobAt record component
    • lastError

      public String lastError()
      Returns the value of the lastError record component.
      Returns:
      the value of the lastError record component
    • lastErrorAt

      public Instant lastErrorAt()
      Returns the value of the lastErrorAt record component.
      Returns:
      the value of the lastErrorAt record component
    • allowedOrigins

      public List<String> allowedOrigins()
      Returns the value of the allowedOrigins record component.
      Returns:
      the value of the allowedOrigins record component