/** * API Tokens Resource * * Provides methods for managing API tokens for programmatic access. * API tokens are scoped to a specific tenant and provide an alternative * to JWT authentication for WhatsApp API endpoints. * * Requires JWT authentication with admin role. */ import type { HttpClient } from '../http/client'; import type { ApiToken, CreateApiTokenData } from '../types/api-tokens'; export declare class ApiTokensResource { private http; constructor(http: HttpClient); /** * List all API tokens for a tenant * * @param tenantId - Tenant ID * @returns Array of API tokens (without secrets) * * @example * ```typescript * const tokens = await client.apiTokens.list('tenant_123'); * console.log(`Found ${tokens.length} tokens`); * tokens.forEach(token => { * console.log(`${token.name} (${token.prefix})`); * }); * ``` */ list(tenantId: string): Promise; /** * Create a new API token for a tenant * * IMPORTANT: The token secret is only returned once during creation. * Make sure to store it securely. It cannot be retrieved later. * * Token format: `{prefix}_{tokenId}_{secret}` * - wpp_live: Production tokens * - wpp_test: Test/development tokens * * @param tenantId - Tenant ID * @param data - Token creation data * @returns Created token with secret (token/key field) * @throws {ValidationError} If validation fails * * @example * ```typescript * const token = await client.apiTokens.create('tenant_123', { * name: 'Production API Key', * prefix: 'wpp_live', * expiresAt: '2025-12-31T23:59:59Z' * }); * * // IMPORTANT: Store this securely - it won't be shown again! * console.log('API Token:', token.token); * // Format: wpp_live_abc123_xyz789 * ``` * * @example * ```typescript * // Create test token (no expiration) * const testToken = await client.apiTokens.create('tenant_123', { * name: 'Development Token', * prefix: 'wpp_test' * }); * ``` */ create(tenantId: string, data: CreateApiTokenData): Promise; /** * Delete an API token * * This permanently revokes the token. All requests using this token * will be rejected immediately. * * @param tenantId - Tenant ID * @param tokenId - Token ID to delete * @throws {NotFoundError} If token not found * * @example * ```typescript * await client.apiTokens.delete('tenant_123', 'token_abc123'); * console.log('Token revoked successfully'); * ``` */ delete(tenantId: string, tokenId: string): Promise; } //# sourceMappingURL=api-tokens.d.ts.map