// @generated by protobuf-ts 2.9.0 // @generated from protobuf file "request.proto" (package "pb", syntax proto3) // tslint:disable import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; import { WireType } from "@protobuf-ts/runtime"; import type { BinaryReadOptions } from "@protobuf-ts/runtime"; import type { IBinaryReader } from "@protobuf-ts/runtime"; import { UnknownFieldHandler } from "@protobuf-ts/runtime"; import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; /** * * Request structure for API v1 * * @generated from protobuf message pb.Request */ export interface Request { /** * Request body * * @generated from protobuf field: bytes body = 1; */ body: Uint8Array; /** * User public key * * @generated from protobuf field: bytes publicKey = 3; */ publicKey: Uint8Array; /** * User signature sign(CID(HTTP method size + HTTP method + url size + url + varint body size + body + varint sessionId size + sessionId)) * * @generated from protobuf field: bytes signature = 4; */ signature: Uint8Array; /** * The name of the signature scheme (sr25519, ed25519). * Default and recommended value: "" or "sr25519". * * @generated from protobuf field: string scheme = 5; */ scheme: string; /** * The ID of the hashing algorithm as per multiformats/multihash. * Default and recommended value: 0 or 0xb220, meaning blake2b-256. * * @generated from protobuf field: uint64 multiHashType = 6; */ multiHashType: bigint; /** * Session Id * * @generated from protobuf field: bytes sessionId = 7; */ sessionId: Uint8Array; /** * Request ID * * @generated from protobuf field: string requestId = 8; */ requestId: string; } // @generated message type with reflection information, may provide speed optimized methods class Request$Type extends MessageType { constructor() { super("pb.Request", [ { no: 1, name: "body", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 3, name: "publicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 4, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 5, name: "scheme", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 6, name: "multiHashType", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 7, name: "sessionId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 8, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } ]); } create(value?: PartialMessage): Request { const message = { body: new Uint8Array(0), publicKey: new Uint8Array(0), signature: new Uint8Array(0), scheme: "", multiHashType: 0n, sessionId: new Uint8Array(0), requestId: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Request): Request { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* bytes body */ 1: message.body = reader.bytes(); break; case /* bytes publicKey */ 3: message.publicKey = reader.bytes(); break; case /* bytes signature */ 4: message.signature = reader.bytes(); break; case /* string scheme */ 5: message.scheme = reader.string(); break; case /* uint64 multiHashType */ 6: message.multiHashType = reader.uint64().toBigInt(); break; case /* bytes sessionId */ 7: message.sessionId = reader.bytes(); break; case /* string requestId */ 8: message.requestId = reader.string(); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message: Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* bytes body = 1; */ if (message.body.length) writer.tag(1, WireType.LengthDelimited).bytes(message.body); /* bytes publicKey = 3; */ if (message.publicKey.length) writer.tag(3, WireType.LengthDelimited).bytes(message.publicKey); /* bytes signature = 4; */ if (message.signature.length) writer.tag(4, WireType.LengthDelimited).bytes(message.signature); /* string scheme = 5; */ if (message.scheme !== "") writer.tag(5, WireType.LengthDelimited).string(message.scheme); /* uint64 multiHashType = 6; */ if (message.multiHashType !== 0n) writer.tag(6, WireType.Varint).uint64(message.multiHashType); /* bytes sessionId = 7; */ if (message.sessionId.length) writer.tag(7, WireType.LengthDelimited).bytes(message.sessionId); /* string requestId = 8; */ if (message.requestId !== "") writer.tag(8, WireType.LengthDelimited).string(message.requestId); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message pb.Request */ export const Request = new Request$Type();