@squidcloud/client
Version:
A typescript implementation of the Squid client
97 lines (96 loc) • 3.81 kB
TypeScript
import { SecretEntry, SecretKey, SecretValue, SetSecretRequestEntry } from './public-types';
/**
* SecretClient provides methods for managing secrets, including retrieval,
* update, and deletion of stored secrets and API keys.
* @category Secret
*/
export declare class SecretClient {
private readonly rpcManager;
/**
* Retrieves a stored custom secret by its key.
*
* @param key The key of the secret to retrieve.
* @returns A promise resolving to the secret entry if found, or `undefined` if not found.
*/
get(key: SecretKey): Promise<SecretEntry | undefined>;
/**
* Retrieves all stored custom secrets.
*
* @returns A promise resolving to a record of secret entries keyed by their secret keys.
*/
getAll(): Promise<Record<SecretKey, SecretEntry>>;
/**
* Creates or updates a single secret entry.
*
* @param key The secret key to upsert.
* @param value The value associated with the secret.
* @returns A promise resolving to the created or updated secret entry.
*/
upsert(key: SecretKey, value: SecretValue): Promise<SecretEntry>;
/**
* Creates or updates multiple secret entries at once.
*
* @param entries An array of secret entries to set, each containing a key and value.
* @returns A promise resolving to an array of created or updated secret entries.
*/
upsertMany(entries: Array<SetSecretRequestEntry>): Promise<Array<SecretEntry>>;
/**
* Deletes a specified secret key.
* If the secret is missing, it will be ignored, and the operation will proceed without failure.
*
* @param key - The secret key to delete.
* @param force - If set to true, forces deletion regardless of the secret's usage status across any enabled
* integrations. Default is false.
* @returns A promise that resolves when the deletion request is complete.
*/
delete(key: SecretKey, force?: boolean): Promise<void>;
/**
* Deletes a list of specified secret keys.
* If any secret in the list is missing, it will be ignored, and the operation will proceed without failure.
*
* @param keys - An array of secret keys to delete.
* @param force - If set to true, forces deletion regardless of the secret's usage status across any enabled
* integrations. Default is false.
* @returns A promise that resolves when the deletion request is complete.
*/
deleteMany(keys: Array<SecretKey>, force?: boolean): Promise<void>;
/**
* Provides access to API key secret management operations.
*
* @returns An instance of {@link ApiKeysSecretClient} for managing API keys.
*/
get apiKeys(): ApiKeysSecretClient;
}
/**
* ApiKeysSecretClient manages API key secrets, providing methods
* for retrieval, creation, and deletion of API keys.
* @category Secret
*/
export declare class ApiKeysSecretClient {
private readonly rpcManager;
/**
* Retrieves a stored API key by its key.
*
* @param key The API key to retrieve.
* @returns A promise resolving to the secret entry or undefined if not found.
*/
get(key: SecretKey): Promise<SecretEntry | undefined>;
/**
* Retrieves all secrets.
*
* @returns A promise resolving to a record of all stored secret entries.
*/
getAll(): Promise<Record<SecretKey, SecretEntry>>;
/**
* Inserts a new API key or updates an existing one with a new autogenerated value.
* Returns the created secret.
*/
upsert(key: SecretKey): Promise<SecretEntry>;
/**
* Deletes a specified API key.
*
* @param key The key of the API key to delete.
* @returns A promise resolving once deletion is complete.
*/
delete(key: SecretKey): Promise<void>;
}