@bitblit/ratchet-misc
Version:
Ratchet miscellaneous tooling that requires smallish dependant libraries
131 lines • 6.53 kB
JavaScript
import { exists } from '../runtime.js';
import { UserLocalIdentitiesInnerFromJSON, UserLocalIdentitiesInnerToJSON } from './UserLocalIdentitiesInner.js';
export var UserTypeEnum;
(function (UserTypeEnum) {
UserTypeEnum["user"] = "user";
})(UserTypeEnum || (UserTypeEnum = {}));
export var UserUserTypeEnum;
(function (UserUserTypeEnum) {
UserUserTypeEnum["regular"] = "regular";
UserUserTypeEnum["admin"] = "admin";
UserUserTypeEnum["system"] = "system";
UserUserTypeEnum["read_only"] = "read_only";
})(UserUserTypeEnum || (UserUserTypeEnum = {}));
export var UserStatusEnum;
(function (UserStatusEnum) {
UserStatusEnum["draft"] = "draft";
UserStatusEnum["active"] = "active";
UserStatusEnum["archived"] = "archived";
})(UserStatusEnum || (UserStatusEnum = {}));
export var UserExternalTypeEnum;
(function (UserExternalTypeEnum) {
UserExternalTypeEnum["discord"] = "discord";
UserExternalTypeEnum["scim"] = "scim";
})(UserExternalTypeEnum || (UserExternalTypeEnum = {}));
export function instanceOfUser(value) {
let isInstance = true;
isInstance = isInstance && '_id' in value;
isInstance = isInstance && '_rootId' in value;
isInstance = isInstance && '_createdBy' in value;
isInstance = isInstance && '_isAutomated' in value;
isInstance = isInstance && 'name' in value;
isInstance = isInstance && '_userType' in value;
return isInstance;
}
export function UserFromJSON(json) {
return UserFromJSONTyped(json, false);
}
export function UserFromJSONTyped(json, ignoreDiscriminator) {
if (json === undefined || json === null) {
return json;
}
return {
_id: json['_id'],
_type: !exists(json, '_type') ? undefined : json['_type'],
_rootId: json['_rootId'],
_createdOn: !exists(json, '_createdOn') ? undefined : new Date(json['_createdOn']),
_createdBy: json['_createdBy'],
_updatedOn: !exists(json, '_updatedOn') ? undefined : new Date(json['_updatedOn']),
_updatedBy: !exists(json, '_updatedBy') ? undefined : json['_updatedBy'],
_archivedOn: !exists(json, '_archivedOn') ? undefined : new Date(json['_archivedOn']),
_archivedBy: !exists(json, '_archivedBy') ? undefined : json['_archivedBy'],
_deletedOn: !exists(json, '_deletedOn') ? undefined : new Date(json['_deletedOn']),
_deletedBy: !exists(json, '_deletedBy') ? undefined : json['_deletedBy'],
_operationId: !exists(json, '_operationId') ? undefined : json['_operationId'],
_isPublic: !exists(json, '_isPublic') ? undefined : json['_isPublic'],
firstName: !exists(json, 'firstName') ? undefined : json['firstName'],
lastName: !exists(json, 'lastName') ? undefined : json['lastName'],
username: !exists(json, 'username') ? undefined : json['username'],
_picture: !exists(json, '_picture') ? undefined : json['_picture'],
_picture_small: !exists(json, '_picture_small') ? undefined : json['_picture_small'],
_picture_medium: !exists(json, '_picture_medium') ? undefined : json['_picture_medium'],
_picture_large: !exists(json, '_picture_large') ? undefined : json['_picture_large'],
state: !exists(json, 'state') ? undefined : json['state'],
countryCode: !exists(json, 'countryCode') ? undefined : json['countryCode'],
city: !exists(json, 'city') ? undefined : json['city'],
_lastLogin: !exists(json, '_lastLogin') ? undefined : new Date(json['_lastLogin']),
latLng: !exists(json, 'latLng') ? undefined : json['latLng'],
timezone: !exists(json, 'timezone') ? undefined : json['timezone'],
_globalId: !exists(json, '_globalId') ? undefined : json['_globalId'],
_currentRootId: !exists(json, '_currentRootId') ? undefined : json['_currentRootId'],
_isAutomated: json['_isAutomated'],
name: json['name'],
_userType: json['_userType'],
status: !exists(json, 'status') ? undefined : json['status'],
_externalId: !exists(json, '_externalId') ? undefined : json['_externalId'],
_externalType: !exists(json, '_externalType') ? undefined : json['_externalType'],
templateId: !exists(json, 'templateId') ? undefined : json['templateId'],
_invitedOn: !exists(json, '_invitedOn') ? undefined : new Date(json['_invitedOn']),
localIdentities: !exists(json, 'localIdentities')
? undefined
: json['localIdentities'].map(UserLocalIdentitiesInnerFromJSON),
};
}
export function UserToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
_id: value._id,
_type: value._type,
_rootId: value._rootId,
_createdOn: value._createdOn === undefined ? undefined : value._createdOn.toISOString(),
_createdBy: value._createdBy,
_updatedOn: value._updatedOn === undefined ? undefined : value._updatedOn.toISOString(),
_updatedBy: value._updatedBy,
_archivedOn: value._archivedOn === undefined ? undefined : value._archivedOn.toISOString(),
_archivedBy: value._archivedBy,
_deletedOn: value._deletedOn === undefined ? undefined : value._deletedOn.toISOString(),
_deletedBy: value._deletedBy,
_operationId: value._operationId,
_isPublic: value._isPublic,
firstName: value.firstName,
lastName: value.lastName,
username: value.username,
_picture: value._picture,
_picture_small: value._picture_small,
_picture_medium: value._picture_medium,
_picture_large: value._picture_large,
state: value.state,
countryCode: value.countryCode,
city: value.city,
_lastLogin: value._lastLogin === undefined ? undefined : value._lastLogin.toISOString(),
latLng: value.latLng,
timezone: value.timezone,
_globalId: value._globalId,
_currentRootId: value._currentRootId,
_isAutomated: value._isAutomated,
name: value.name,
_userType: value._userType,
status: value.status,
_externalId: value._externalId,
_externalType: value._externalType,
templateId: value.templateId,
_invitedOn: value._invitedOn === undefined ? undefined : value._invitedOn.toISOString(),
localIdentities: value.localIdentities === undefined ? undefined : value.localIdentities.map(UserLocalIdentitiesInnerToJSON),
};
}
//# sourceMappingURL=User.js.map