import { GraphQLError } from "graphql"; export default interface API { list?: (params?: any) => Promise>; save?: (model: T) => Promise>; saveBulk?: (models: T[]) => Promise>; delete?: (idList: string[]) => Promise>; } /** * Error codes the SDK itself distinguishes. NOT exhaustive: the APIResponse * constructor copies `extensions.code` from GraphQL errors verbatim, so * `errorCodes` can carry backend codes that are not listed here (e.g. * VARIANT_NOT_FOUND). Never build an exhaustive switch over this enum. */ export declare enum APIErrorCode { ARGUMENT_VALIDATION_ERROR = "ARGUMENT_VALIDATION_ERROR", UNAUTHENTICATED = "UNAUTHENTICATED", UNAUTHORIZED = "UNAUTHORIZED", INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR", LOGIN_REQUIRED = "LOGIN_REQUIRED", NETWORK_ERROR = "NETWORK_ERROR", REQUEST_CANCELLED = "REQUEST_CANCELLED", DUPLICATE_KEY_ERROR = "DUPLICATE_KEY_ERROR", CUSTOMER_ALREADY_SUBSCRIBED = "CUSTOMER_ALREADY_SUBSCRIBED", MAX_QUANTITY_PER_CART_LIMIT_REACHED = "MAX_QUANTITY_PER_CART_LIMIT_REACHED", UNKNOWN = "UNKNOWN" } export declare class APIResponse { data?: T; errors: string[]; errorCodes: APIErrorCode[]; graphQLErrors?: readonly GraphQLError[]; constructor(data?: T, errors?: readonly GraphQLError[], errorCodes?: APIErrorCode[]); get firstErrorMessage(): string; get isUnAuthenticated(): boolean; get isNetworkError(): boolean; get isSuccess(): boolean; get isCancelled(): boolean; get isRecoverableError(): boolean; static networkError(): APIResponse; static requestCancelled(): APIResponse; static unknownError(): APIResponse; static authError(): APIResponse; static success(): APIResponse; } export declare function handleAPIError(err: any): APIResponse; type EmptyData = undefined; export {};