@snap/camera-kit
Version:
Camera Kit Web
45 lines • 1.63 kB
JavaScript
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "snapchat.cdp.cof";
function createBasePerceptionSignals() {
return { scannedCategoryIds: [] };
}
export const PerceptionSignals = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.scannedCategoryIds) {
writer.uint32(10).string(v);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePerceptionSignals();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.scannedCategoryIds.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base) {
return PerceptionSignals.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePerceptionSignals();
message.scannedCategoryIds = ((_a = object.scannedCategoryIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
//# sourceMappingURL=perception_provided_signals.js.map