import { ITGlueClient } from '../client'; import { QueryUtilOptions, QueryParams, RequestBody, BaseListResponse, BaseItemResponse, PasswordFolderResource } from '../types'; /** * PasswordFolders resource module for IT Glue API * * Provides methods to interact with password folders via the organization-scoped endpoint: * `/organizations/:organization_id/relationships/password_folders` * * Password folders represent organizational containers for passwords in IT Glue, * allowing for hierarchical organization of credentials with parent-child relationships. * * **Note:** Password folders are organization-scoped resources. All methods require * an organization ID to be provided. * * ## Related Resources * Password folders are commonly used with: * - {@link Passwords} - Passwords stored within folders * - {@link Organizations} - Organizations that own the password folders * - {@link PasswordCategories} - Categories that can be applied to passwords within folders * * @example * import { ITGlueClient } from '../client'; * import { PasswordFolders } from './resources/password-folders'; * * const client = new ITGlueClient({ apiKey: 'your-api-key' }); * const passwordFolders = new PasswordFolders(client); * * // List password folders for an organization * const list = await passwordFolders.list('org-123'); * * // Get a single password folder * const folder = await passwordFolders.get('org-123', 'folder-456'); * * // Create a password folder * const created = await passwordFolders.create('org-123', { * data: { * type: 'password-folders', * attributes: { * name: 'Production Servers' * } * } * }); * * // Update a password folder * const updated = await passwordFolders.update('org-123', 'folder-456', { * data: { * type: 'password-folders', * attributes: { * name: 'Updated Folder Name' * } * } * }); * * // Delete a password folder * await passwordFolders.delete('org-123', 'folder-456'); * * @category Access Management */ export declare class PasswordFolders { private client; private paginationUtil; /** * Create a PasswordFolders resource instance * @param {ITGlueClient} client - ITGlueClient instance */ constructor(client: ITGlueClient); /** * Get the base path for password folders within an organization * @param {string} organizationId - Organization ID * @returns {string} The base path for the organization's password folders * @private */ private getBasePath; /** * List all password folders for an organization * @param {string} organizationId - Organization ID * @param {QueryUtilOptions} [options] - Optional query parameters (filter, sort, page, etc.) * @param {boolean} [allPages=false] - If true, fetches all pages automatically * @returns {Promise>} List of password folders and pagination metadata * @example * // Basic usage - get first page of password folders * const results = await client.passwordFolders.list('org-123'); * console.log(`Found ${results.data.length} password folders`); * * @example * // Get all password folders across multiple pages * const allFolders = await client.passwordFolders.list('org-123', {}, true); * console.log(`Retrieved all ${allFolders.data.length} password folders`); * * @example * // Filtering and sorting password folders * const sortedFolders = await client.passwordFolders.list('org-123', { * sort: 'name' * }); * * @example * // Get root-level folders (no parent) * const rootFolders = await client.passwordFolders.list('org-123', { * filter: { parent_id: null }, * sort: 'name' * }); */ list(organizationId: string, options?: QueryUtilOptions, allPages?: boolean): Promise>; /** * Get a single password folder by ID * @param {string} organizationId - Organization ID * @param {string} id - Password folder ID * @param {QueryParams} [params] - Optional query parameters * @returns {Promise>} Password folder resource * @example * // Basic usage - get password folder by ID * const folder = await client.passwordFolders.get('org-123', 'folder-456'); * console.log('Folder name:', folder.data.attributes.name); * console.log('Parent ID:', folder.data.attributes['parent-id']); * * @example * // Get password folder with related data included * const folderWithDetails = await client.passwordFolders.get('org-123', 'folder-456', { * include: 'passwords' * }); */ get(organizationId: string, id: string, params?: QueryParams): Promise>; /** * Create a new password folder * @param {string} organizationId - Organization ID * @param {RequestBody} data - Password folder data (JSON:API format) * @returns {Promise>} Created password folder resource * @example * // Basic password folder creation * const created = await client.passwordFolders.create('org-123', { * data: { * type: 'password-folders', * attributes: { * name: 'Development Credentials' * } * } * }); * * console.log('Created password folder with ID:', created.data.id); * * @example * // Create a nested password folder * const nestedFolder = await client.passwordFolders.create('org-123', { * data: { * type: 'password-folders', * attributes: { * name: 'Database Credentials', * 'parent-id': 456 * } * } * }); */ create(organizationId: string, data: RequestBody): Promise>; /** * Update a password folder by ID * @param {string} organizationId - Organization ID * @param {string} id - Password folder ID * @param {RequestBody} data - Updated password folder data (JSON:API format) * @returns {Promise>} Updated password folder resource * @example * // Update password folder name * const updated = await client.passwordFolders.update('org-123', 'folder-456', { * data: { * type: 'password-folders', * attributes: { * name: 'Renamed Folder' * } * } * }); * * @example * // Move folder to a new parent * const moved = await client.passwordFolders.update('org-123', 'folder-456', { * data: { * type: 'password-folders', * attributes: { * 'parent-id': 789 * } * } * }); */ update(organizationId: string, id: string, data: RequestBody): Promise>; /** * Delete a password folder by ID * @param {string} organizationId - Organization ID * @param {string} id - Password folder ID * @returns {Promise} * @example * // Delete a password folder * await client.passwordFolders.delete('org-123', 'folder-456'); * console.log('Password folder deleted successfully'); * * @example * // Safe deletion with error handling * try { * await client.passwordFolders.delete('org-123', 'folder-456'); * console.log('Folder deleted'); * } catch (error) { * if (error.response?.status === 409) { * console.log('Cannot delete - folder contains passwords'); * } * } */ delete(organizationId: string, id: string): Promise; }