|
| 1 | +/* eslint-disable import/export */ |
| 2 | +/* eslint-disable complexity */ |
| 3 | +/* eslint-disable @typescript-eslint/no-namespace */ |
| 4 | +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ |
| 5 | +/* eslint-disable @typescript-eslint/no-empty-interface */ |
| 6 | + |
| 7 | +import { encodeMessage, decodeMessage, message } from 'protons-runtime' |
| 8 | +import type { Codec } from 'protons-runtime' |
| 9 | +import type { Uint8ArrayList } from 'uint8arraylist' |
| 10 | + |
| 11 | +export interface WakuMetadataRequest { |
| 12 | + clusterId?: number |
| 13 | + shards: number[] |
| 14 | +} |
| 15 | + |
| 16 | +export namespace WakuMetadataRequest { |
| 17 | + let _codec: Codec<WakuMetadataRequest> |
| 18 | + |
| 19 | + export const codec = (): Codec<WakuMetadataRequest> => { |
| 20 | + if (_codec == null) { |
| 21 | + _codec = message<WakuMetadataRequest>((obj, w, opts = {}) => { |
| 22 | + if (opts.lengthDelimited !== false) { |
| 23 | + w.fork() |
| 24 | + } |
| 25 | + |
| 26 | + if (obj.clusterId != null) { |
| 27 | + w.uint32(8) |
| 28 | + w.uint32(obj.clusterId) |
| 29 | + } |
| 30 | + |
| 31 | + if (obj.shards != null) { |
| 32 | + for (const value of obj.shards) { |
| 33 | + w.uint32(16) |
| 34 | + w.uint32(value) |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + if (opts.lengthDelimited !== false) { |
| 39 | + w.ldelim() |
| 40 | + } |
| 41 | + }, (reader, length) => { |
| 42 | + const obj: any = { |
| 43 | + shards: [] |
| 44 | + } |
| 45 | + |
| 46 | + const end = length == null ? reader.len : reader.pos + length |
| 47 | + |
| 48 | + while (reader.pos < end) { |
| 49 | + const tag = reader.uint32() |
| 50 | + |
| 51 | + switch (tag >>> 3) { |
| 52 | + case 1: |
| 53 | + obj.clusterId = reader.uint32() |
| 54 | + break |
| 55 | + case 2: |
| 56 | + obj.shards.push(reader.uint32()) |
| 57 | + break |
| 58 | + default: |
| 59 | + reader.skipType(tag & 7) |
| 60 | + break |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + return obj |
| 65 | + }) |
| 66 | + } |
| 67 | + |
| 68 | + return _codec |
| 69 | + } |
| 70 | + |
| 71 | + export const encode = (obj: Partial<WakuMetadataRequest>): Uint8Array => { |
| 72 | + return encodeMessage(obj, WakuMetadataRequest.codec()) |
| 73 | + } |
| 74 | + |
| 75 | + export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMetadataRequest => { |
| 76 | + return decodeMessage(buf, WakuMetadataRequest.codec()) |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +export interface WakuMetadataResponse { |
| 81 | + clusterId?: number |
| 82 | + shards: number[] |
| 83 | +} |
| 84 | + |
| 85 | +export namespace WakuMetadataResponse { |
| 86 | + let _codec: Codec<WakuMetadataResponse> |
| 87 | + |
| 88 | + export const codec = (): Codec<WakuMetadataResponse> => { |
| 89 | + if (_codec == null) { |
| 90 | + _codec = message<WakuMetadataResponse>((obj, w, opts = {}) => { |
| 91 | + if (opts.lengthDelimited !== false) { |
| 92 | + w.fork() |
| 93 | + } |
| 94 | + |
| 95 | + if (obj.clusterId != null) { |
| 96 | + w.uint32(8) |
| 97 | + w.uint32(obj.clusterId) |
| 98 | + } |
| 99 | + |
| 100 | + if (obj.shards != null) { |
| 101 | + for (const value of obj.shards) { |
| 102 | + w.uint32(16) |
| 103 | + w.uint32(value) |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + if (opts.lengthDelimited !== false) { |
| 108 | + w.ldelim() |
| 109 | + } |
| 110 | + }, (reader, length) => { |
| 111 | + const obj: any = { |
| 112 | + shards: [] |
| 113 | + } |
| 114 | + |
| 115 | + const end = length == null ? reader.len : reader.pos + length |
| 116 | + |
| 117 | + while (reader.pos < end) { |
| 118 | + const tag = reader.uint32() |
| 119 | + |
| 120 | + switch (tag >>> 3) { |
| 121 | + case 1: |
| 122 | + obj.clusterId = reader.uint32() |
| 123 | + break |
| 124 | + case 2: |
| 125 | + obj.shards.push(reader.uint32()) |
| 126 | + break |
| 127 | + default: |
| 128 | + reader.skipType(tag & 7) |
| 129 | + break |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + return obj |
| 134 | + }) |
| 135 | + } |
| 136 | + |
| 137 | + return _codec |
| 138 | + } |
| 139 | + |
| 140 | + export const encode = (obj: Partial<WakuMetadataResponse>): Uint8Array => { |
| 141 | + return encodeMessage(obj, WakuMetadataResponse.codec()) |
| 142 | + } |
| 143 | + |
| 144 | + export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMetadataResponse => { |
| 145 | + return decodeMessage(buf, WakuMetadataResponse.codec()) |
| 146 | + } |
| 147 | +} |
0 commit comments