UNPKG

@limitly/limitly-nextjs

Version:

Official Next.js SDK for Limitly - API Key management, plans, users and request validation optimized for server-side

79 lines 3.1 kB
import { HttpClient } from '../client'; import { ApiKey, CreateApiKeyRequest, UpdateApiKeyRequest, ApiKeyUsage, ApiKeyRequestsResponse, ApiResponse, PaginatedResponse, LimitInfo, RequestOptions } from '../types'; /** * Module for managing API Keys * Optimized for Next.js server-side rendering */ export declare class ApiKeysModule { private client; constructor(client: HttpClient); /** * Lists all API Keys for the authenticated owner * @param options - Request options including Next.js cache options * @returns Promise with paginated API keys */ list(options?: RequestOptions): Promise<PaginatedResponse<ApiKey>>; /** * Creates a new API Key * @param data - API key creation data * @param options - Request options * @returns Promise with created API key */ create(data: CreateApiKeyRequest, options?: RequestOptions): Promise<ApiResponse<ApiKey & { limitInfo?: LimitInfo; }>>; /** * Gets a specific API Key by ID * @param keyId - The API key ID * @param options - Request options including Next.js cache options * @returns Promise with API key details */ get(keyId: string, options?: RequestOptions): Promise<ApiResponse<ApiKey>>; /** * Updates an existing API Key * @param keyId - The API key ID * @param data - Update data * @param options - Request options * @returns Promise with updated API key */ update(keyId: string, data: UpdateApiKeyRequest, options?: RequestOptions): Promise<ApiResponse<ApiKey>>; /** * Deletes an API Key (soft delete) * @param keyId - The API key ID * @param options - Request options * @returns Promise with deletion confirmation */ delete(keyId: string, options?: RequestOptions): Promise<ApiResponse<{ message: string; }>>; /** * Regenerates an existing API Key * @param keyId - The API key ID * @param options - Request options * @returns Promise with regenerated API key */ regenerate(keyId: string, options?: RequestOptions): Promise<ApiResponse<ApiKey>>; /** * Gets usage statistics for an API Key * @param keyId - The API key ID * @param options - Request options including Next.js cache options * @returns Promise with usage statistics */ getUsage(keyId: string, options?: RequestOptions): Promise<ApiResponse<ApiKeyUsage>>; /** * Gets detailed request history for an API Key * @param keyId - The API key ID * @param options - Request options including Next.js cache options * @returns Promise with request history */ getRequests(keyId: string, options?: RequestOptions): Promise<ApiResponse<ApiKeyRequestsResponse>>; /** * Gets API keys with usage statistics (optimized for Next.js) * @param options - Request options * @returns Promise with API keys and their usage */ listWithUsage(options?: RequestOptions): Promise<PaginatedResponse<ApiKey & { usage?: ApiKeyUsage; }>>; } //# sourceMappingURL=api-keys.d.ts.map