|
| 1 | +/* eslint-disable */ |
| 2 | +import _m0 from "protobufjs/minimal"; |
| 3 | +import { Certificate } from "./certificate"; |
| 4 | + |
| 5 | +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; |
| 6 | + |
| 7 | +export interface AllCertificatesBySubjectKeyId { |
| 8 | + subjectKeyId: string; |
| 9 | + certs: Certificate[]; |
| 10 | + schemaVersion: number; |
| 11 | +} |
| 12 | + |
| 13 | +function createBaseAllCertificatesBySubjectKeyId(): AllCertificatesBySubjectKeyId { |
| 14 | + return { subjectKeyId: "", certs: [], schemaVersion: 0 }; |
| 15 | +} |
| 16 | + |
| 17 | +export const AllCertificatesBySubjectKeyId = { |
| 18 | + encode(message: AllCertificatesBySubjectKeyId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { |
| 19 | + if (message.subjectKeyId !== "") { |
| 20 | + writer.uint32(10).string(message.subjectKeyId); |
| 21 | + } |
| 22 | + for (const v of message.certs) { |
| 23 | + Certificate.encode(v!, writer.uint32(18).fork()).ldelim(); |
| 24 | + } |
| 25 | + if (message.schemaVersion !== 0) { |
| 26 | + writer.uint32(24).uint32(message.schemaVersion); |
| 27 | + } |
| 28 | + return writer; |
| 29 | + }, |
| 30 | + |
| 31 | + decode(input: _m0.Reader | Uint8Array, length?: number): AllCertificatesBySubjectKeyId { |
| 32 | + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); |
| 33 | + let end = length === undefined ? reader.len : reader.pos + length; |
| 34 | + const message = createBaseAllCertificatesBySubjectKeyId(); |
| 35 | + while (reader.pos < end) { |
| 36 | + const tag = reader.uint32(); |
| 37 | + switch (tag >>> 3) { |
| 38 | + case 1: |
| 39 | + message.subjectKeyId = reader.string(); |
| 40 | + break; |
| 41 | + case 2: |
| 42 | + message.certs.push(Certificate.decode(reader, reader.uint32())); |
| 43 | + break; |
| 44 | + case 3: |
| 45 | + message.schemaVersion = reader.uint32(); |
| 46 | + break; |
| 47 | + default: |
| 48 | + reader.skipType(tag & 7); |
| 49 | + break; |
| 50 | + } |
| 51 | + } |
| 52 | + return message; |
| 53 | + }, |
| 54 | + |
| 55 | + fromJSON(object: any): AllCertificatesBySubjectKeyId { |
| 56 | + return { |
| 57 | + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", |
| 58 | + certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], |
| 59 | + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, |
| 60 | + }; |
| 61 | + }, |
| 62 | + |
| 63 | + toJSON(message: AllCertificatesBySubjectKeyId): unknown { |
| 64 | + const obj: any = {}; |
| 65 | + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); |
| 66 | + if (message.certs) { |
| 67 | + obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); |
| 68 | + } else { |
| 69 | + obj.certs = []; |
| 70 | + } |
| 71 | + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); |
| 72 | + return obj; |
| 73 | + }, |
| 74 | + |
| 75 | + fromPartial<I extends Exact<DeepPartial<AllCertificatesBySubjectKeyId>, I>>( |
| 76 | + object: I, |
| 77 | + ): AllCertificatesBySubjectKeyId { |
| 78 | + const message = createBaseAllCertificatesBySubjectKeyId(); |
| 79 | + message.subjectKeyId = object.subjectKeyId ?? ""; |
| 80 | + message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; |
| 81 | + message.schemaVersion = object.schemaVersion ?? 0; |
| 82 | + return message; |
| 83 | + }, |
| 84 | +}; |
| 85 | + |
| 86 | +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; |
| 87 | + |
| 88 | +export type DeepPartial<T> = T extends Builtin ? T |
| 89 | + : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> |
| 90 | + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } |
| 91 | + : Partial<T>; |
| 92 | + |
| 93 | +type KeysOfUnion<T> = T extends T ? keyof T : never; |
| 94 | +export type Exact<P, I extends P> = P extends Builtin ? P |
| 95 | + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; |
| 96 | + |
| 97 | +function isSet(value: any): boolean { |
| 98 | + return value !== null && value !== undefined; |
| 99 | +} |
0 commit comments