Viam SDK
    Preparing search index...

    Function doCommandFromClient

    • Send/Receive an arbitrary command using a resource client.

      Parameters

      • doCommander: doCommand
      • name: string
      • command: Struct | Record<string, JsonValue>

        The command to execute. Accepts either a Struct or a plain object, which will be converted automatically.

      • options: Options = {}
      • callOptions: CallOptions = {}

      Returns Promise<JsonValue>

      // Plain object (recommended)
      const result = await doCommandFromClient(doFn, name, {
      myCommand: { key: 'value' },
      });

      // Struct (still supported)
      const result = await doCommandFromClient(
      doFn,
      name,
      Struct.fromJson({ myCommand: { key: 'value' } }),
      );