Insomnia-Script-SDK-Docs
    Preparing search index...

    Class ParentFolders

    Represents a collection of parent folders and provides methods to interact with them.

    This class is designed to manage a hierarchy of folders, allowing retrieval of folders by their ID or name, searching for specific values in folder environments, and converting the folder structure into plain JavaScript objects.

    const folders = new ParentFolders([folder1, folder2]);
    const folderById = folders.getById('123');
    const folderByName = folders.getByName('MyFolder');
    const value = folders.findValue('key');
    const folderObjects = folders.toObject();
    const environments = folders.getEnvironments();
    Index

    Constructors

    Methods

    • Searches for a specific value in the environments of the folders, starting from the nearest ancestor folder and moving towards the top ancestor folder.

      Parameters

      • valueKey: string

        The key of the value to search for in the folder environments.

      Returns undefined | string | number | boolean

      The value associated with the specified key if found, otherwise undefined.

    • Converts the current folder structure into a plain JavaScript object representation.

      Returns {
          environment: { [k: string]: undefined | string | number | boolean };
          id: string;
          name: string;
      }[]

      An array of objects representing the folder structure.