declare const codes: { readonly HTTP_STATUS_BAD_REQUEST: 400; readonly HTTP_STATUS_UNAUTHORIZED: 401; readonly HTTP_STATUS_PAYMENT_REQUIRED: 402; readonly HTTP_STATUS_FORBIDDEN: 403; readonly HTTP_STATUS_NOT_FOUND: 404; readonly HTTP_STATUS_METHOD_NOT_ALLOWED: 405; readonly HTTP_STATUS_REQUEST_TIMEOUT: 408; readonly HTTP_STATUS_CONFLICT: 409; readonly HTTP_STATUS_GONE: 410; readonly HTTP_STATUS_PAYLOAD_TOO_LARGE: 413; readonly HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415; readonly HTTP_STATUS_DEPENDENCY_FAILED: 424; readonly HTTP_STATUS_TOO_MANY_REQUESTS: 429; readonly HTTP_STATUS_INTERNAL_SERVER_ERROR: 500; readonly HTTP_STATUS_NOT_IMPLEMENTED: 501; readonly HTTP_STATUS_BAD_GATEWAY: 502; readonly HTTP_STATUS_SERVICE_UNAVAILABLE: 503; readonly HTTP_STATUS_GATEWAY_TIMEOUT: 504; }; type ErrorCode = typeof codes[keyof typeof codes]; declare abstract class BaseApiError extends Error { readonly code: Code; readonly description: Description; readonly type: Type; readonly message: string; readonly error?: Error | undefined; readonly id?: string | undefined; readonly metadata?: Record | undefined; readonly isApiError = true; constructor(code: Code, description: Description, type: Type, message: string, error?: Error | undefined, id?: string | undefined, metadata?: Record | undefined); format(): string; toJSON(): { id: string | undefined; code: Code; type: Type; message: string; metadata: Record | undefined; }; static generateId(): string; private static getPrefix; } export declare const isApiError: (thrown: unknown) => thrown is ApiError; type UnknownType = 'Unknown'; /** * An unknown error occurred */ export declare class UnknownError extends BaseApiError<500, UnknownType, 'An unknown error occurred'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InternalType = 'Internal'; /** * An internal error occurred */ export declare class InternalError extends BaseApiError<500, InternalType, 'An internal error occurred'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type UnauthorizedType = 'Unauthorized'; /** * The request requires to be authenticated. */ export declare class UnauthorizedError extends BaseApiError<401, UnauthorizedType, 'The request requires to be authenticated.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type ForbiddenType = 'Forbidden'; /** * The requested action can\'t be peform by this resource. */ export declare class ForbiddenError extends BaseApiError<403, ForbiddenType, 'The requested action can\'t be peform by this resource.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type PayloadTooLargeType = 'PayloadTooLarge'; /** * The request payload is too large. */ export declare class PayloadTooLargeError extends BaseApiError<413, PayloadTooLargeType, 'The request payload is too large.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InvalidPayloadType = 'InvalidPayload'; /** * The request payload is invalid. */ export declare class InvalidPayloadError extends BaseApiError<400, InvalidPayloadType, 'The request payload is invalid.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type UnsupportedMediaTypeType = 'UnsupportedMediaType'; /** * The request is invalid because the content-type is not supported. */ export declare class UnsupportedMediaTypeError extends BaseApiError<415, UnsupportedMediaTypeType, 'The request is invalid because the content-type is not supported.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type MethodNotFoundType = 'MethodNotFound'; /** * The requested method does not exist. */ export declare class MethodNotFoundError extends BaseApiError<405, MethodNotFoundType, 'The requested method does not exist.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type ResourceNotFoundType = 'ResourceNotFound'; /** * The requested resource does not exist. */ export declare class ResourceNotFoundError extends BaseApiError<404, ResourceNotFoundType, 'The requested resource does not exist.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InvalidJsonSchemaType = 'InvalidJsonSchema'; /** * The provided JSON schema is invalid. */ export declare class InvalidJsonSchemaError extends BaseApiError<400, InvalidJsonSchemaType, 'The provided JSON schema is invalid.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InvalidDataFormatType = 'InvalidDataFormat'; /** * The provided data doesn\'t respect the provided JSON schema. */ export declare class InvalidDataFormatError extends BaseApiError<400, InvalidDataFormatType, 'The provided data doesn\'t respect the provided JSON schema.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InvalidIdentifierType = 'InvalidIdentifier'; /** * The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters. */ export declare class InvalidIdentifierError extends BaseApiError<400, InvalidIdentifierType, 'The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type RelationConflictType = 'RelationConflict'; /** * The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren\'t linked together. */ export declare class RelationConflictError extends BaseApiError<409, RelationConflictType, 'The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren\'t linked together.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type ReferenceConstraintType = 'ReferenceConstraint'; /** * The resource cannot be deleted because it\'s referenced by another resource */ export declare class ReferenceConstraintError extends BaseApiError<409, ReferenceConstraintType, 'The resource cannot be deleted because it\'s referenced by another resource'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type ResourceLockedConflictType = 'ResourceLockedConflict'; /** * The resource is current locked and cannot be operated on until the lock is released. */ export declare class ResourceLockedConflictError extends BaseApiError<409, ResourceLockedConflictType, 'The resource is current locked and cannot be operated on until the lock is released.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type ReferenceNotFoundType = 'ReferenceNotFound'; /** * The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request. */ export declare class ReferenceNotFoundError extends BaseApiError<400, ReferenceNotFoundType, 'The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type InvalidQueryType = 'InvalidQuery'; /** * The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource. */ export declare class InvalidQueryError extends BaseApiError<400, InvalidQueryType, 'The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type RuntimeType = 'Runtime'; /** * An error happened during the execution of a runtime (bot or integration). */ export declare class RuntimeError extends BaseApiError<400, RuntimeType, 'An error happened during the execution of a runtime (bot or integration).'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type AlreadyExistsType = 'AlreadyExists'; /** * The record attempted to be created already exists. */ export declare class AlreadyExistsError extends BaseApiError<409, AlreadyExistsType, 'The record attempted to be created already exists.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type RateLimitedType = 'RateLimited'; /** * The request has been rate limited. */ export declare class RateLimitedError extends BaseApiError<429, RateLimitedType, 'The request has been rate limited.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type PaymentRequiredType = 'PaymentRequired'; /** * A payment is required to perform this request. */ export declare class PaymentRequiredError extends BaseApiError<402, PaymentRequiredType, 'A payment is required to perform this request.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type QuotaExceededType = 'QuotaExceeded'; /** * The request exceeds the allowed quota. Quotas are a soft limit that can be increased. */ export declare class QuotaExceededError extends BaseApiError<403, QuotaExceededType, 'The request exceeds the allowed quota. Quotas are a soft limit that can be increased.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type LimitExceededType = 'LimitExceeded'; /** * The request exceeds the allowed limit. Limits are a hard limit that cannot be increased. */ export declare class LimitExceededError extends BaseApiError<413, LimitExceededType, 'The request exceeds the allowed limit. Limits are a hard limit that cannot be increased.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } type BreakingChangesType = 'BreakingChanges'; /** * Request payload contains breaking changes which is not allowed for this resource without a version increment. */ export declare class BreakingChangesError extends BaseApiError<400, BreakingChangesType, 'Request payload contains breaking changes which is not allowed for this resource without a version increment.'> { constructor(message: string, error?: Error, id?: string, metadata?: Record); } export type ErrorType = 'Unknown' | 'Internal' | 'Unauthorized' | 'Forbidden' | 'PayloadTooLarge' | 'InvalidPayload' | 'UnsupportedMediaType' | 'MethodNotFound' | 'ResourceNotFound' | 'InvalidJsonSchema' | 'InvalidDataFormat' | 'InvalidIdentifier' | 'RelationConflict' | 'ReferenceConstraint' | 'ResourceLockedConflict' | 'ReferenceNotFound' | 'InvalidQuery' | 'Runtime' | 'AlreadyExists' | 'RateLimited' | 'PaymentRequired' | 'QuotaExceeded' | 'LimitExceeded' | 'BreakingChanges'; export type ApiError = UnknownError | InternalError | UnauthorizedError | ForbiddenError | PayloadTooLargeError | InvalidPayloadError | UnsupportedMediaTypeError | MethodNotFoundError | ResourceNotFoundError | InvalidJsonSchemaError | InvalidDataFormatError | InvalidIdentifierError | RelationConflictError | ReferenceConstraintError | ResourceLockedConflictError | ReferenceNotFoundError | InvalidQueryError | RuntimeError | AlreadyExistsError | RateLimitedError | PaymentRequiredError | QuotaExceededError | LimitExceededError | BreakingChangesError; export declare const errorFrom: (err: unknown) => ApiError; export {};