import { GNHashtable } from "./../common/GNData"; import { InvalidMember } from "./InvalidMember"; /** * Low-level response container produced by the SDK transports. * * Built by {@link PeerBase.onResponseHandler} from the raw response * payload and handed to either: * - the application callback registered through * {@link GNNetwork.sendViaSocket} / `sendViaHttp` (raw consumers); * or * - the typed `*OperationResponse` wrapper that * {@link GNNetwork.sendViaSocketTResponse} / `sendViaHttpTResponse` * built from the supplied response class. * * Validation: when the server rejects a request because of malformed * parameters, it ships a list of offending keys via * `invalidRequestParameters`. {@link PeerBase.onResponseHandler} * decodes the inner array into typed {@link InvalidMember} entries * accessible through {@link getInvalidMembers}. */ export declare class OperationResponse { private operationCode; private responseId; private returnCode; private debugMessage; private parameters; private invalidMembers; /** * @param operationCode Operation code that produced the * response (mirrored from the matching * request). * @param responseId Response id used for correlation. * Matches the request's id assigned by * {@link PeerBase.enqueue}. */ constructor(operationCode: string, responseId: number); /** * Returns the operation code carried by the response. */ getOperationCode(): string; /** * Returns the backend return code (from {@link ReturnCode}). * * Use {@link hasError} when you only need a boolean * success / failure check. */ getReturnCode(): number; /** * Returns the deserialized response parameter bag. * * For a successful response this carries the operation-specific * payload; for a failed response it is typically empty. */ getParameters(): GNHashtable; /** * Returns the response correlation id. * * Used internally by the in-flight tracking machinery. Most * application code can ignore it. */ getResponseId(): number; /** * Returns the debug message attached by the backend, or `null` * when none was provided. * * Populated mainly for failure responses — the GearN backend * does not include a debug message on success. */ getDebugMessage(): string; /** * Returns the list of invalid request parameters reported by * the backend, or `null` when none were reported. * * Populated only when {@link getReturnCode} equals * `ReturnCode.InvalidRequestParameters`. */ getInvalidMembers(): InvalidMember[]; /** * Returns whether the response represents a non-success outcome. * * @returns `true` when {@link getReturnCode} is anything other * than `ReturnCode.Ok`. Note that this is **not** the * same as a domain error * ({@link ErrorCode}) — domain errors travel inside * successful responses; check the operation-specific * response data for those. */ hasError(): boolean; /** * Sets the return code and returns the response for chaining. * * Used by {@link PeerBase.onResponseHandler}; application code * does not normally call this directly. */ setReturnCode(returnCode: number): OperationResponse; /** * Sets the debug message and returns the response for chaining. */ setDebugMessage(debugMessage: string): OperationResponse; /** * Adds or replaces a single response parameter. * * @param k Parameter key — usually a constant from * {@link ParameterCode}. * @param value Any value accepted by {@link GNHashtable.add}. * @returns The response for chaining. */ setParameter(k: string, value: any): OperationResponse; /** * Replaces the entire response parameter bag. * * Used by {@link PeerBase.onResponseHandler} after decoding the * raw payload. */ setParameters(parameters: GNHashtable): OperationResponse; /** * Replaces the invalid-member collection. * * Set by {@link PeerBase.onResponseHandler} when the raw * response carries `invalidRequestParameters`. */ setInvalidMembers(invalidMembers: InvalidMember[]): OperationResponse; /** * Returns a debug-friendly summary of the response, used by the * `[GN RECV]` log line. * * The format adapts to the outcome: * - `Ok`: appends the parameter dump. * - `InvalidRequestParameters`: appends the offending member * list. * - Other failures: appends the debug message. */ toString(): string; }