spot-sdk-ts
Version:
TypeScript bindings based on protobufs (proto3) provided by Boston Dynamics
275 lines • 12.1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetAuthTokenResponse = exports.GetAuthTokenRequest = exports.getAuthTokenResponse_StatusToJSON = exports.getAuthTokenResponse_StatusFromJSON = exports.GetAuthTokenResponse_Status = exports.protobufPackage = void 0;
/* eslint-disable */
const header_1 = require("./header");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "bosdyn.api";
var GetAuthTokenResponse_Status;
(function (GetAuthTokenResponse_Status) {
/** STATUS_UNKNOWN - STATUS_UNKNOWN should never be used. If used, an internal error has happend. */
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_UNKNOWN"] = 0] = "STATUS_UNKNOWN";
/**
* STATUS_OK - STATUS_OK indicates that authentication has succeeded. The 'token' field field will
* be populated with a session token that can be used to authenticate the user.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_OK"] = 1] = "STATUS_OK";
/**
* STATUS_INVALID_LOGIN - STATUS_INVALID_LOGIN indicates that authentication has failed since an invalid
* username and/or password were provided.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_INVALID_LOGIN"] = 2] = "STATUS_INVALID_LOGIN";
/**
* STATUS_INVALID_TOKEN - STATUS_INVALID_TOKEN indicates that authentication has failed since the 'token'
* provided in the request is invalid. Reasons for the token being invalid could be
* because it has expired, because it is improperly formed, for the wrong robot, the
* user that the token is for has changed a password, or many other reasons. Clients
* should use username/password-based authentication when refreshing the token fails.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_INVALID_TOKEN"] = 3] = "STATUS_INVALID_TOKEN";
/**
* STATUS_TEMPORARILY_LOCKED_OUT - STATUS_TEMPORARILY_LOCKED_OUT indicates that authentication has failed since
* authentication for the user is temporarily locked out due to too many unsuccessful
* attempts. Any new authentication attempts should be delayed so they may happen after
* the lock out period ends.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_TEMPORARILY_LOCKED_OUT"] = 4] = "STATUS_TEMPORARILY_LOCKED_OUT";
/**
* STATUS_INVALID_APPLICATION_TOKEN - STATUS_INVALID_APPLICATION_TOKEN indicates that the 'application_token' field in the
* request was invalid.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_INVALID_APPLICATION_TOKEN"] = 5] = "STATUS_INVALID_APPLICATION_TOKEN";
/**
* STATUS_EXPIRED_APPLICATION_TOKEN - STATUS_EXPIRED_APPLICATION_TOKEN indicates that the 'application_token' field in the
* request was valid, but has expired.
*/
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["STATUS_EXPIRED_APPLICATION_TOKEN"] = 6] = "STATUS_EXPIRED_APPLICATION_TOKEN";
GetAuthTokenResponse_Status[GetAuthTokenResponse_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(GetAuthTokenResponse_Status = exports.GetAuthTokenResponse_Status || (exports.GetAuthTokenResponse_Status = {}));
function getAuthTokenResponse_StatusFromJSON(object) {
switch (object) {
case 0:
case "STATUS_UNKNOWN":
return GetAuthTokenResponse_Status.STATUS_UNKNOWN;
case 1:
case "STATUS_OK":
return GetAuthTokenResponse_Status.STATUS_OK;
case 2:
case "STATUS_INVALID_LOGIN":
return GetAuthTokenResponse_Status.STATUS_INVALID_LOGIN;
case 3:
case "STATUS_INVALID_TOKEN":
return GetAuthTokenResponse_Status.STATUS_INVALID_TOKEN;
case 4:
case "STATUS_TEMPORARILY_LOCKED_OUT":
return GetAuthTokenResponse_Status.STATUS_TEMPORARILY_LOCKED_OUT;
case 5:
case "STATUS_INVALID_APPLICATION_TOKEN":
return GetAuthTokenResponse_Status.STATUS_INVALID_APPLICATION_TOKEN;
case 6:
case "STATUS_EXPIRED_APPLICATION_TOKEN":
return GetAuthTokenResponse_Status.STATUS_EXPIRED_APPLICATION_TOKEN;
case -1:
case "UNRECOGNIZED":
default:
return GetAuthTokenResponse_Status.UNRECOGNIZED;
}
}
exports.getAuthTokenResponse_StatusFromJSON = getAuthTokenResponse_StatusFromJSON;
function getAuthTokenResponse_StatusToJSON(object) {
switch (object) {
case GetAuthTokenResponse_Status.STATUS_UNKNOWN:
return "STATUS_UNKNOWN";
case GetAuthTokenResponse_Status.STATUS_OK:
return "STATUS_OK";
case GetAuthTokenResponse_Status.STATUS_INVALID_LOGIN:
return "STATUS_INVALID_LOGIN";
case GetAuthTokenResponse_Status.STATUS_INVALID_TOKEN:
return "STATUS_INVALID_TOKEN";
case GetAuthTokenResponse_Status.STATUS_TEMPORARILY_LOCKED_OUT:
return "STATUS_TEMPORARILY_LOCKED_OUT";
case GetAuthTokenResponse_Status.STATUS_INVALID_APPLICATION_TOKEN:
return "STATUS_INVALID_APPLICATION_TOKEN";
case GetAuthTokenResponse_Status.STATUS_EXPIRED_APPLICATION_TOKEN:
return "STATUS_EXPIRED_APPLICATION_TOKEN";
case GetAuthTokenResponse_Status.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.getAuthTokenResponse_StatusToJSON = getAuthTokenResponse_StatusToJSON;
function createBaseGetAuthTokenRequest() {
return {
header: undefined,
username: "",
password: "",
token: "",
applicationToken: "",
};
}
exports.GetAuthTokenRequest = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.header !== undefined) {
header_1.RequestHeader.encode(message.header, writer.uint32(10).fork()).ldelim();
}
if (message.username !== "") {
writer.uint32(18).string(message.username);
}
if (message.password !== "") {
writer.uint32(26).string(message.password);
}
if (message.token !== "") {
writer.uint32(34).string(message.token);
}
if (message.applicationToken !== "") {
writer.uint32(42).string(message.applicationToken);
}
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 = createBaseGetAuthTokenRequest();
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.username = reader.string();
break;
case 3:
message.password = reader.string();
break;
case 4:
message.token = reader.string();
break;
case 5:
message.applicationToken = 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,
username: isSet(object.username) ? String(object.username) : "",
password: isSet(object.password) ? String(object.password) : "",
token: isSet(object.token) ? String(object.token) : "",
applicationToken: isSet(object.applicationToken)
? String(object.applicationToken)
: "",
};
},
toJSON(message) {
const obj = {};
message.header !== undefined &&
(obj.header = message.header
? header_1.RequestHeader.toJSON(message.header)
: undefined);
message.username !== undefined && (obj.username = message.username);
message.password !== undefined && (obj.password = message.password);
message.token !== undefined && (obj.token = message.token);
message.applicationToken !== undefined &&
(obj.applicationToken = message.applicationToken);
return obj;
},
fromPartial(object) {
const message = createBaseGetAuthTokenRequest();
message.header =
object.header !== undefined && object.header !== null
? header_1.RequestHeader.fromPartial(object.header)
: undefined;
message.username = object.username ?? "";
message.password = object.password ?? "";
message.token = object.token ?? "";
message.applicationToken = object.applicationToken ?? "";
return message;
},
};
function createBaseGetAuthTokenResponse() {
return { header: undefined, status: 0, token: "" };
}
exports.GetAuthTokenResponse = {
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.status !== 0) {
writer.uint32(16).int32(message.status);
}
if (message.token !== "") {
writer.uint32(26).string(message.token);
}
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 = createBaseGetAuthTokenResponse();
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.status = reader.int32();
break;
case 3:
message.token = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
header: isSet(object.header)
? header_1.ResponseHeader.fromJSON(object.header)
: undefined,
status: isSet(object.status)
? getAuthTokenResponse_StatusFromJSON(object.status)
: 0,
token: isSet(object.token) ? String(object.token) : "",
};
},
toJSON(message) {
const obj = {};
message.header !== undefined &&
(obj.header = message.header
? header_1.ResponseHeader.toJSON(message.header)
: undefined);
message.status !== undefined &&
(obj.status = getAuthTokenResponse_StatusToJSON(message.status));
message.token !== undefined && (obj.token = message.token);
return obj;
},
fromPartial(object) {
const message = createBaseGetAuthTokenResponse();
message.header =
object.header !== undefined && object.header !== null
? header_1.ResponseHeader.fromPartial(object.header)
: undefined;
message.status = object.status ?? 0;
message.token = object.token ?? "";
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=auth.js.map