Files
NapCatQQ/.pnpm-store/v3/files/20/fd182bfa96a753ea3b2f3a2f7830b26c4db720aa2d6c7b0f2bdbd96162a5d2e2ab88855645e1945c939a8617b6ef9f5bf910ffb263409189592dc14695c228
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

40 lines
1.7 KiB
Plaintext

import type { JsonObject, JsonValue } from "./json-typings";
import type { JsonReadOptions } from "./json-format-contract";
import type { EnumInfo } from "./reflection-info";
import { LongType, PartialMessageInfo, ScalarType } from "./reflection-info";
import type { UnknownEnum, UnknownScalar } from "./unknown-types";
/**
* Reads proto3 messages in canonical JSON format using reflection information.
*
* https://developers.google.com/protocol-buffers/docs/proto3#json
*/
export declare class ReflectionJsonReader {
private readonly info;
/**
* JSON key to field.
* Accepts the original proto field name in the .proto, the
* lowerCamelCase name, or the name specified by the json_name option.
*/
private fMap?;
constructor(info: PartialMessageInfo);
protected prepare(): void;
assert(condition: any, fieldName: string, jsonValue: JsonValue): asserts condition;
/**
* Reads a message from canonical JSON format into the target message.
*
* Repeated fields are appended. Map entries are added, overwriting
* existing keys.
*
* If a message field is already present, it will be merged with the
* new data.
*/
read<T extends object>(input: JsonObject, message: T, options: JsonReadOptions): void;
/**
* Returns `false` for unrecognized string representations.
*
* google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
*/
enum(type: EnumInfo, json: unknown, fieldName: string, ignoreUnknownFields: boolean): UnknownEnum | false;
scalar(json: JsonValue, type: ScalarType, longType: LongType | undefined, fieldName: string): UnknownScalar;
}