@edgible-team/sdk
    Preparing search index...

    Class DevicesClient

    Device CRUD, network isolation, telemetry sessions, and per-device reads.

    Index

    Constructors

    Methods

    • Collect a one-shot diagnostics report from the device. Dispatches a synchronous collect_diagnostics job (fulfillImmediately: true) and returns the typed DiagnosticsReport plus collection metadata.

      A gateway and a serving device populate different sub-objects of the same envelope (see DiagnosticsReport); include selects which categories to gather (all expands to every category valid for the device type).

      Parameters

      Returns Promise<CollectDiagnosticsResult>

      ServerError if the job completes without a diagnostics output (e.g. the device-side collection failed).

    • Register a device record.

      Parameters

      Returns Promise<DeviceData>

      ValidationError if the request body is rejected.

    • Mint a session token for programmatic access to the device's telemetry app (sent as the X-Session-Token header).

      Parameters

      Returns Promise<CreateTelemetrySessionResponse>

      Deprecated: scheduled for removal in diagnostics Phase 5 — use collectDiagnostics instead.

    • WS-H — the device's AGENT journal (edgible-agent unit only), collected on demand over the diagnostics jobs channel (GET /devices/{id}/logs). Authz: org OWNER on the device's org; platform admin for managed devices. An offline device yields offline: true; a dispatched-but-failed collection yields collectionError (never conflated).

      Parameters

      • params: {
            deviceId: string;
            limit?: number;
            priority?: "debug" | "info" | "warning" | "err";
            since?: string | number;
        }
      • Optionalopts: RequestOptions

      Returns Promise<DeviceAgentLogsResponse>

    • Desired target-version vector for a device (CP-2.5 fast poll). Returns only the per-application target release versions and the desired pool config hash, so an agent can cheaply detect drift between polls and trigger a scoped reconcile on mismatch. The full reconcile stays the deep backstop.

      Parameters

      Returns Promise<DesiredVersionsResponse>

    • Device lifecycle event history (newest-first, backend default limit 100). Typed with the vendored LifecycleEvent — the legacy client returned events: any[].

      Parameters

      • params: {
            deviceId: string;
            endTime?: number;
            limit?: number;
            organizationId: string;
            startTime?: number;
        }
      • Optionalopts: RequestOptions

      Returns Promise<LifecycleEvent[]>

    • Pre-signed metric/log files for a device. Times are unix-ms. Response shape comes from the backend getDeviceLogsFilesHandler (a LogFilesResponse), which the legacy client re-declared inline.

      Parameters

      • params: { deviceId: string; endTime: number; organizationId: string; startTime: number }
      • Optionalopts: RequestOptions

      Returns Promise<LogFilesResponse>

    • Applications assigned to this device.

      Parameters

      Returns Promise<ApplicationData[]>

    • Pools that contain this device. The backend returns the bare array.

      Parameters

      Returns Promise<DevicePoolData[]>

    • Idempotently (re)provision the device's ingest application (A7). No-op when the ingest app is already healthy; otherwise recreates, adopts, or creates it. Backs edgible device repair.

      Gateway assignment is deferred (not failed) when no healthy managed gateway exists — inspect RepairDeviceResult.gatewayDeferred.

      Parameters

      Returns Promise<RepairDeviceResult>

      ValidationError (400 INGEST_NOT_APPLICABLE) if the device is a gateway or cloud device — those types have no ingest app to repair.

      NotFoundError if the device does not exist.

    • Update a device; returns the updated row.

      Parameters

      Returns Promise<DeviceData>

      NotFoundError if the device does not exist.

    • Update the device's agent to the latest published release for its device type. Latest-only by design — there is no target-version parameter; the backend resolves the newest gateway/serving release (see DevicesClient.getLatestAgentRelease) and enqueues an agent_self_update job (202 Accepted). Returns the created job id plus the resolved targetVersion and the device's current fromVersion (null if the device never reported one).

      The agent reports the terminal disposition as the result of the returned job — restarting | noop | blocked | rolled_back | failed (AgentSelfUpdateResult) — pollable via sdk.jobs.get(jobId); the job output is an AgentSelfUpdateOutput. A gateway device without an active maintenance window reports blocked with reason 'gateway-maintenance-window' rather than restarting in place.

      Parameters

      Returns Promise<UpdateDeviceAgentResult>

      AuthorizationError (403 MANAGED_DEVICE) for platform-managed devices, whose agent the platform updates on your behalf.

      ConflictError (409) when the update cannot start: AGENT_VERSION_PINNED (the details carry pinnedVersion and the pinning scopeKindpool | stage | org), AGENT_UPDATE_IN_FLIGHT (details carry the in-flight jobId), or DEVICE_OFFLINE.

      ServerError (502 RELEASE_LOOKUP_FAILED) when the release manifest could not be resolved.