import { ResolvedErrorReason } from './reason.js'; /** reference: https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto */ declare enum DetailType { ERROR_INFO = "type.googleapis.com/google.rpc.ErrorInfo", RETRY_INFO = "type.googleapis.com/google.rpc.RetryInfo", DEBUG_INFO = "type.googleapis.com/google.rpc.DebugInfo", QUOTA_FAILURE = "type.googleapis.com/google.rpc.QuotaFailure", PRECONDITION_FAILURE = "type.googleapis.com/google.rpc.PreconditionFailure", BAD_REQUEST = "type.googleapis.com/google.rpc.BadRequest", REQUEST_INFO = "type.googleapis.com/google.rpc.RequestInfo", RESOURCE_INFO = "type.googleapis.com/google.rpc.ResourceInfo", HELP = "type.googleapis.com/google.rpc.Help", LOCALIZED_MESSAGE = "type.googleapis.com/google.rpc.LocalizedMessage" } interface ErrorInfo { '@type': DetailType.ERROR_INFO; reason: ResolvedErrorReason; domain?: string; metadata?: Record; } interface RetryInfo { '@type': DetailType.RETRY_INFO; retryDelay: number; } interface DebugInfo { '@type': DetailType.DEBUG_INFO; stackEntries: string[]; detail: string; } interface QuotaFailure { '@type': DetailType.QUOTA_FAILURE; violations: { subject: string; description: string; apiService: string; quoteId: string; quoteValue: number; quotaMetric: string; quotaDimensions: Record; futureQuotaValue: number; }[]; } interface PreconditionFailure { '@type': DetailType.PRECONDITION_FAILURE; violations: { type: string; subject: string; description: string; }[]; } interface BadRequest { '@type': DetailType.BAD_REQUEST; fieldViolations: { field: string; description: string; reason: string; localizedMessage: Omit; }[]; } interface RequestInfo { '@type': DetailType.REQUEST_INFO; requestId: string; servingData: string; } interface ResourceInfo { '@type': DetailType.RESOURCE_INFO; resourceType: string; resourceName: string; owner: string; description: string; } interface Help { '@type': DetailType.HELP; links: { url: string; description: string; }[]; } interface LocalizedMessage { '@type': DetailType.LOCALIZED_MESSAGE; locale: string; message: string; } type Detail = RetryInfo | DebugInfo | QuotaFailure | ErrorInfo | PreconditionFailure | BadRequest | RequestInfo | ResourceInfo | Help | LocalizedMessage; /** * Example usage: * const details = Details.new() * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' }) * .errorInfo({ reason: 'ACCOUNT_LOCKED' }); * */ declare class Details { readonly list: Detail[]; private constructor(); static new(): Details; errorInfo(detail: Omit): this; retryInfo(detail: Omit): this; debugInfo(detail: Omit): this; quotaFailure(detail: Omit): this; preconditionFailure(detail: Omit): this; badRequest(detail: Omit): this; requestInfo(detail: Omit): this; resourceInfo(detail: Omit): this; help(detail: Omit): this; localizedMessage(detail: Omit): this; } export { type BadRequest, type DebugInfo, type Detail, DetailType, Details, type ErrorInfo, type Help, type LocalizedMessage, type PreconditionFailure, type QuotaFailure, type RequestInfo, type ResourceInfo, type RetryInfo };