Innovenergy_trunk/csharp/lib/Wireformat/ts/Payload.ts

114 lines
2.8 KiB
TypeScript
Raw Normal View History

2023-02-16 12:57:06 +00:00
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { VictronTopologyV1 } from "./VictronV1/VictronTopologyV1";
export const protobufPackage = "";
export interface Payload {
VictronTopologyV1: VictronTopologyV1 | undefined;
}
function createBasePayload(): Payload {
return { VictronTopologyV1: undefined };
}
export const Payload = {
encode(
message: Payload,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.VictronTopologyV1 !== undefined) {
VictronTopologyV1.encode(
message.VictronTopologyV1,
writer.uint32(10).fork()
).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Payload {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.VictronTopologyV1 = VictronTopologyV1.decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Payload {
return {
VictronTopologyV1: isSet(object.VictronTopologyV1)
? VictronTopologyV1.fromJSON(object.VictronTopologyV1)
: undefined,
};
},
toJSON(message: Payload): unknown {
const obj: any = {};
message.VictronTopologyV1 !== undefined &&
(obj.VictronTopologyV1 = message.VictronTopologyV1
? VictronTopologyV1.toJSON(message.VictronTopologyV1)
: undefined);
return obj;
},
fromPartial<I extends Exact<DeepPartial<Payload>, I>>(object: I): Payload {
const message = createBasePayload();
message.VictronTopologyV1 =
object.VictronTopologyV1 !== undefined &&
object.VictronTopologyV1 !== null
? VictronTopologyV1.fromPartial(object.VictronTopologyV1)
: undefined;
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}