UNPKG

spot-sdk-ts

Version:

TypeScript bindings based on protobufs (proto3) provided by Boston Dynamics

530 lines 20.4 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetFeatureEnabledResponse_FeatureEnabledEntry = exports.GetFeatureEnabledResponse = exports.GetFeatureEnabledRequest = exports.GetLicenseInfoResponse = exports.GetLicenseInfoRequest = exports.LicenseInfo = exports.licenseInfo_StatusToJSON = exports.licenseInfo_StatusFromJSON = exports.LicenseInfo_Status = exports.protobufPackage = void 0; /* eslint-disable */ const timestamp_1 = require("../../google/protobuf/timestamp"); const header_1 = require("./header"); const minimal_1 = __importDefault(require("protobufjs/minimal")); exports.protobufPackage = "bosdyn.api"; var LicenseInfo_Status; (function (LicenseInfo_Status) { LicenseInfo_Status[LicenseInfo_Status["STATUS_UNKNOWN"] = 0] = "STATUS_UNKNOWN"; LicenseInfo_Status[LicenseInfo_Status["STATUS_VALID"] = 1] = "STATUS_VALID"; LicenseInfo_Status[LicenseInfo_Status["STATUS_EXPIRED"] = 2] = "STATUS_EXPIRED"; LicenseInfo_Status[LicenseInfo_Status["STATUS_NOT_YET_VALID"] = 3] = "STATUS_NOT_YET_VALID"; LicenseInfo_Status[LicenseInfo_Status["STATUS_MALFORMED"] = 4] = "STATUS_MALFORMED"; LicenseInfo_Status[LicenseInfo_Status["STATUS_SERIAL_MISMATCH"] = 5] = "STATUS_SERIAL_MISMATCH"; LicenseInfo_Status[LicenseInfo_Status["STATUS_NO_LICENSE"] = 6] = "STATUS_NO_LICENSE"; LicenseInfo_Status[LicenseInfo_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(LicenseInfo_Status = exports.LicenseInfo_Status || (exports.LicenseInfo_Status = {})); function licenseInfo_StatusFromJSON(object) { switch (object) { case 0: case "STATUS_UNKNOWN": return LicenseInfo_Status.STATUS_UNKNOWN; case 1: case "STATUS_VALID": return LicenseInfo_Status.STATUS_VALID; case 2: case "STATUS_EXPIRED": return LicenseInfo_Status.STATUS_EXPIRED; case 3: case "STATUS_NOT_YET_VALID": return LicenseInfo_Status.STATUS_NOT_YET_VALID; case 4: case "STATUS_MALFORMED": return LicenseInfo_Status.STATUS_MALFORMED; case 5: case "STATUS_SERIAL_MISMATCH": return LicenseInfo_Status.STATUS_SERIAL_MISMATCH; case 6: case "STATUS_NO_LICENSE": return LicenseInfo_Status.STATUS_NO_LICENSE; case -1: case "UNRECOGNIZED": default: return LicenseInfo_Status.UNRECOGNIZED; } } exports.licenseInfo_StatusFromJSON = licenseInfo_StatusFromJSON; function licenseInfo_StatusToJSON(object) { switch (object) { case LicenseInfo_Status.STATUS_UNKNOWN: return "STATUS_UNKNOWN"; case LicenseInfo_Status.STATUS_VALID: return "STATUS_VALID"; case LicenseInfo_Status.STATUS_EXPIRED: return "STATUS_EXPIRED"; case LicenseInfo_Status.STATUS_NOT_YET_VALID: return "STATUS_NOT_YET_VALID"; case LicenseInfo_Status.STATUS_MALFORMED: return "STATUS_MALFORMED"; case LicenseInfo_Status.STATUS_SERIAL_MISMATCH: return "STATUS_SERIAL_MISMATCH"; case LicenseInfo_Status.STATUS_NO_LICENSE: return "STATUS_NO_LICENSE"; case LicenseInfo_Status.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } exports.licenseInfo_StatusToJSON = licenseInfo_StatusToJSON; function createBaseLicenseInfo() { return { status: 0, id: "", robotSerial: "", notValidBefore: undefined, notValidAfter: undefined, licensedFeatures: [], }; } exports.LicenseInfo = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.status !== 0) { writer.uint32(8).int32(message.status); } if (message.id !== "") { writer.uint32(18).string(message.id); } if (message.robotSerial !== "") { writer.uint32(26).string(message.robotSerial); } if (message.notValidBefore !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.notValidBefore), writer.uint32(34).fork()).ldelim(); } if (message.notValidAfter !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.notValidAfter), writer.uint32(42).fork()).ldelim(); } for (const v of message.licensedFeatures) { writer.uint32(50).string(v); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLicenseInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.status = reader.int32(); break; case 2: message.id = reader.string(); break; case 3: message.robotSerial = reader.string(); break; case 4: message.notValidBefore = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); break; case 5: message.notValidAfter = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); break; case 6: message.licensedFeatures.push(reader.string()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { status: isSet(object.status) ? licenseInfo_StatusFromJSON(object.status) : 0, id: isSet(object.id) ? String(object.id) : "", robotSerial: isSet(object.robotSerial) ? String(object.robotSerial) : "", notValidBefore: isSet(object.notValidBefore) ? fromJsonTimestamp(object.notValidBefore) : undefined, notValidAfter: isSet(object.notValidAfter) ? fromJsonTimestamp(object.notValidAfter) : undefined, licensedFeatures: Array.isArray(object?.licensedFeatures) ? object.licensedFeatures.map((e) => String(e)) : [], }; }, toJSON(message) { const obj = {}; message.status !== undefined && (obj.status = licenseInfo_StatusToJSON(message.status)); message.id !== undefined && (obj.id = message.id); message.robotSerial !== undefined && (obj.robotSerial = message.robotSerial); message.notValidBefore !== undefined && (obj.notValidBefore = message.notValidBefore.toISOString()); message.notValidAfter !== undefined && (obj.notValidAfter = message.notValidAfter.toISOString()); if (message.licensedFeatures) { obj.licensedFeatures = message.licensedFeatures.map((e) => e); } else { obj.licensedFeatures = []; } return obj; }, fromPartial(object) { const message = createBaseLicenseInfo(); message.status = object.status ?? 0; message.id = object.id ?? ""; message.robotSerial = object.robotSerial ?? ""; message.notValidBefore = object.notValidBefore ?? undefined; message.notValidAfter = object.notValidAfter ?? undefined; message.licensedFeatures = object.licensedFeatures?.map((e) => e) || []; return message; }, }; function createBaseGetLicenseInfoRequest() { return { header: undefined }; } exports.GetLicenseInfoRequest = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.RequestHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetLicenseInfoRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.RequestHeader.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.RequestHeader.fromJSON(object.header) : undefined, }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.RequestHeader.toJSON(message.header) : undefined); return obj; }, fromPartial(object) { const message = createBaseGetLicenseInfoRequest(); message.header = object.header !== undefined && object.header !== null ? header_1.RequestHeader.fromPartial(object.header) : undefined; return message; }, }; function createBaseGetLicenseInfoResponse() { return { header: undefined, license: undefined }; } exports.GetLicenseInfoResponse = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.ResponseHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } if (message.license !== undefined) { exports.LicenseInfo.encode(message.license, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetLicenseInfoResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.ResponseHeader.decode(reader, reader.uint32()); break; case 2: message.license = exports.LicenseInfo.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.ResponseHeader.fromJSON(object.header) : undefined, license: isSet(object.license) ? exports.LicenseInfo.fromJSON(object.license) : undefined, }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.ResponseHeader.toJSON(message.header) : undefined); message.license !== undefined && (obj.license = message.license ? exports.LicenseInfo.toJSON(message.license) : undefined); return obj; }, fromPartial(object) { const message = createBaseGetLicenseInfoResponse(); message.header = object.header !== undefined && object.header !== null ? header_1.ResponseHeader.fromPartial(object.header) : undefined; message.license = object.license !== undefined && object.license !== null ? exports.LicenseInfo.fromPartial(object.license) : undefined; return message; }, }; function createBaseGetFeatureEnabledRequest() { return { header: undefined, featureCodes: [] }; } exports.GetFeatureEnabledRequest = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.RequestHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } for (const v of message.featureCodes) { writer.uint32(18).string(v); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetFeatureEnabledRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.RequestHeader.decode(reader, reader.uint32()); break; case 2: message.featureCodes.push(reader.string()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.RequestHeader.fromJSON(object.header) : undefined, featureCodes: Array.isArray(object?.featureCodes) ? object.featureCodes.map((e) => String(e)) : [], }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.RequestHeader.toJSON(message.header) : undefined); if (message.featureCodes) { obj.featureCodes = message.featureCodes.map((e) => e); } else { obj.featureCodes = []; } return obj; }, fromPartial(object) { const message = createBaseGetFeatureEnabledRequest(); message.header = object.header !== undefined && object.header !== null ? header_1.RequestHeader.fromPartial(object.header) : undefined; message.featureCodes = object.featureCodes?.map((e) => e) || []; return message; }, }; function createBaseGetFeatureEnabledResponse() { return { header: undefined, featureEnabled: {} }; } exports.GetFeatureEnabledResponse = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.ResponseHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } Object.entries(message.featureEnabled).forEach(([key, value]) => { exports.GetFeatureEnabledResponse_FeatureEnabledEntry.encode({ key: key, value }, writer.uint32(18).fork()).ldelim(); }); return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetFeatureEnabledResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.ResponseHeader.decode(reader, reader.uint32()); break; case 2: const entry2 = exports.GetFeatureEnabledResponse_FeatureEnabledEntry.decode(reader, reader.uint32()); if (entry2.value !== undefined) { message.featureEnabled[entry2.key] = entry2.value; } break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.ResponseHeader.fromJSON(object.header) : undefined, featureEnabled: isObject(object.featureEnabled) ? Object.entries(object.featureEnabled).reduce((acc, [key, value]) => { acc[key] = Boolean(value); return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.ResponseHeader.toJSON(message.header) : undefined); obj.featureEnabled = {}; if (message.featureEnabled) { Object.entries(message.featureEnabled).forEach(([k, v]) => { obj.featureEnabled[k] = v; }); } return obj; }, fromPartial(object) { const message = createBaseGetFeatureEnabledResponse(); message.header = object.header !== undefined && object.header !== null ? header_1.ResponseHeader.fromPartial(object.header) : undefined; message.featureEnabled = Object.entries(object.featureEnabled ?? {}).reduce((acc, [key, value]) => { if (value !== undefined) { acc[key] = Boolean(value); } return acc; }, {}); return message; }, }; function createBaseGetFeatureEnabledResponse_FeatureEnabledEntry() { return { key: "", value: false }; } exports.GetFeatureEnabledResponse_FeatureEnabledEntry = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value === true) { writer.uint32(16).bool(message.value); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetFeatureEnabledResponse_FeatureEnabledEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.key = reader.string(); break; case 2: message.value = reader.bool(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? Boolean(object.value) : false, }; }, toJSON(message) { const obj = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); return obj; }, fromPartial(object) { const message = createBaseGetFeatureEnabledResponse_FeatureEnabledEntry(); message.key = object.key ?? ""; message.value = object.value ?? false; return message; }, }; function toTimestamp(date) { const seconds = date.getTime() / 1000; const nanos = (date.getTime() % 1000) * 1000000; return { seconds, nanos }; } function fromTimestamp(t) { let millis = t.seconds * 1000; millis += t.nanos / 1000000; return new Date(millis); } function fromJsonTimestamp(o) { if (o instanceof Date) { return o; } else if (typeof o === "string") { return new Date(o); } else { return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); } } function isObject(value) { return typeof value === "object" && value !== null; } function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=license.js.map