Status code definitions and utilities for the Gemini protocol
npm install @gemini-tools/response-code@gemini-tools/response-codeSmall utility module for interacting with Gemini response codes as defined in the Gemini specification.
``js
import {
GeminiResponseCode,
isGeminiResponseCode,
asGeminiResponseCode,
} from "@gemini-tools/response-code";
const code: GeminiResponseCode = GeminiResponseCode.INPUT;
const untypedValue: any = 10;
if (isGeminiResponseCode(untypedValue)) {
// untypedValue is refined into a GeminiResponseCode
const typedValue: GeminiResponseCode = untypedValue;
}
// may throw Error
const typedValue: GeminiResponseCode = asGeminiResponseCode(untypedValue);
``