addSharedUser

Requires:
@ray-js/lock-sdk≥1.2.0

Method signature
addSharedUser(params: )

Description

Add a shared user (Bluetooth door lock).

Parameters

ParameterTypeRequiredDescription
YesCountry code, account, name, validity, etc.

Return Value

Type: Promise<AddSharedUserResult>
Add result
AddSharedUserResult
PropertyTypeDescription
idstringRecord ID
namestringName
userExistbooleanWhether a corresponding App account exists

Error Code

Error CodeError Message
1031Name length exceeds 20 characters
1032effectiveType is limit but effective is not provided
1033Validity start date not configured
1034Validity end date not configured
1010Start time cannot be later than end time
1035weeks not configured for weekly repetition
1083Name contains unsupported emojis
1084Invalid share account
1085Virtual key unavailable (or other pre-share checks failed)
1086Device does not exist
1038Shared user name already exists

Referenced Types

typeWeekWeekly repeat bitmap: indices 0–6 correspond to Sun–Sat; 0 inactive, 1 active
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];

Valid Values

AddSharedUserParams.effectiveType
ValueDescriptionSince
once--
permanent--
limit--
EffectiveConfig.repeat
ValueDescriptionSince
none--
week--
Week
ValueDescriptionSince
0--
1--

Examples

import { addSharedUser } from '@ray-js/lock-sdk';
await addSharedUser({
  countryCode: '86',
  account: '13800138000',
  name: 'Zhang San',
  effectiveType: 'once',
});