@xmtp/proto
Version:
Protobuf client and generated classes for GRPC API
344 lines (343 loc) • 12 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.2
// protoc v3.21.12
// source: google/api/http.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "google.api";
function createBaseHttp() {
return { rules: [], fullyDecodeReservedExpansion: false };
}
export const Http = {
encode(message, writer = _m0.Writer.create()) {
for (const v of message.rules) {
HttpRule.encode(v, writer.uint32(10).fork()).ldelim();
}
if (message.fullyDecodeReservedExpansion !== false) {
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHttp();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.rules.push(HttpRule.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 16) {
break;
}
message.fullyDecodeReservedExpansion = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => HttpRule.fromJSON(e)) : [],
fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion)
? globalThis.Boolean(object.fullyDecodeReservedExpansion)
: false,
};
},
toJSON(message) {
const obj = {};
if (message.rules?.length) {
obj.rules = message.rules.map((e) => HttpRule.toJSON(e));
}
if (message.fullyDecodeReservedExpansion !== false) {
obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion;
}
return obj;
},
create(base) {
return Http.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseHttp();
message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || [];
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false;
return message;
},
};
function createBaseHttpRule() {
return {
selector: "",
get: undefined,
put: undefined,
post: undefined,
delete: undefined,
patch: undefined,
custom: undefined,
body: "",
responseBody: "",
additionalBindings: [],
};
}
export const HttpRule = {
encode(message, writer = _m0.Writer.create()) {
if (message.selector !== "") {
writer.uint32(10).string(message.selector);
}
if (message.get !== undefined) {
writer.uint32(18).string(message.get);
}
if (message.put !== undefined) {
writer.uint32(26).string(message.put);
}
if (message.post !== undefined) {
writer.uint32(34).string(message.post);
}
if (message.delete !== undefined) {
writer.uint32(42).string(message.delete);
}
if (message.patch !== undefined) {
writer.uint32(50).string(message.patch);
}
if (message.custom !== undefined) {
CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim();
}
if (message.body !== "") {
writer.uint32(58).string(message.body);
}
if (message.responseBody !== "") {
writer.uint32(98).string(message.responseBody);
}
for (const v of message.additionalBindings) {
HttpRule.encode(v, writer.uint32(90).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHttpRule();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.selector = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.get = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.put = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.post = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.delete = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.patch = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.body = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.responseBody = reader.string();
continue;
case 11:
if (tag !== 90) {
break;
}
message.additionalBindings.push(HttpRule.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
selector: isSet(object.selector) ? globalThis.String(object.selector) : "",
get: isSet(object.get) ? globalThis.String(object.get) : undefined,
put: isSet(object.put) ? globalThis.String(object.put) : undefined,
post: isSet(object.post) ? globalThis.String(object.post) : undefined,
delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined,
patch: isSet(object.patch) ? globalThis.String(object.patch) : undefined,
custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined,
body: isSet(object.body) ? globalThis.String(object.body) : "",
responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "",
additionalBindings: globalThis.Array.isArray(object?.additionalBindings)
? object.additionalBindings.map((e) => HttpRule.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.selector !== "") {
obj.selector = message.selector;
}
if (message.get !== undefined) {
obj.get = message.get;
}
if (message.put !== undefined) {
obj.put = message.put;
}
if (message.post !== undefined) {
obj.post = message.post;
}
if (message.delete !== undefined) {
obj.delete = message.delete;
}
if (message.patch !== undefined) {
obj.patch = message.patch;
}
if (message.custom !== undefined) {
obj.custom = CustomHttpPattern.toJSON(message.custom);
}
if (message.body !== "") {
obj.body = message.body;
}
if (message.responseBody !== "") {
obj.responseBody = message.responseBody;
}
if (message.additionalBindings?.length) {
obj.additionalBindings = message.additionalBindings.map((e) => HttpRule.toJSON(e));
}
return obj;
},
create(base) {
return HttpRule.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseHttpRule();
message.selector = object.selector ?? "";
message.get = object.get ?? undefined;
message.put = object.put ?? undefined;
message.post = object.post ?? undefined;
message.delete = object.delete ?? undefined;
message.patch = object.patch ?? undefined;
message.custom = (object.custom !== undefined && object.custom !== null)
? CustomHttpPattern.fromPartial(object.custom)
: undefined;
message.body = object.body ?? "";
message.responseBody = object.responseBody ?? "";
message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || [];
return message;
},
};
function createBaseCustomHttpPattern() {
return { kind: "", path: "" };
}
export const CustomHttpPattern = {
encode(message, writer = _m0.Writer.create()) {
if (message.kind !== "") {
writer.uint32(10).string(message.kind);
}
if (message.path !== "") {
writer.uint32(18).string(message.path);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCustomHttpPattern();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.kind = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.path = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
kind: isSet(object.kind) ? globalThis.String(object.kind) : "",
path: isSet(object.path) ? globalThis.String(object.path) : "",
};
},
toJSON(message) {
const obj = {};
if (message.kind !== "") {
obj.kind = message.kind;
}
if (message.path !== "") {
obj.path = message.path;
}
return obj;
},
create(base) {
return CustomHttpPattern.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCustomHttpPattern();
message.kind = object.kind ?? "";
message.path = object.path ?? "";
return message;
},
};
if (_m0.util.Long !== Long) {
_m0.util.Long = Long;
_m0.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}