Last Updated on : 2024-03-21 05:57:57download
This topic describes how to manage a password. For more information, see Commercial Lock App SDK Overview.
API description
- (void)getPasswordListWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
pageNumber:(NSInteger)pageNumber
pageSize:(NSInteger)pageSize
success:(ThingLockPasswordSuccessList)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
pageNumber | The page number. |
pageSize | The number of items returned per page. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared getPasswordListWithSiteId:siteId
deviceId:self.devId
pageNumber:1
pageSize:20
success:^(NSArray<ThingLockPasswordModel *> * _Nullable list, NSInteger totalSize) {
} failure:^(NSError *error) {
}];
API description
- (void)createOnceOfflinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
name:(NSString *)name
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
name | The name of the password. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared createOnceOfflinePasswordWithSiteId:SiteManager.shared.siteId
deviceId:self.devId
name:alertC.textFields.firstObject.text
success:^{
} failure:^(NSError *error) {
}];
API description
The lock must be online to create a permanent online password.
- (void)createPermanentOnlinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
name:(NSString *)name
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
name | The name of the password. |
success | The success callback. |
failure | The failure callback. |
Example
See Connect to a lock for device connection.
[ThingLockPasswordManager.shared createPermanentOnlinePasswordWithSiteId:SiteManager.shared.siteId
deviceId:self.devId
name:alertC.textFields.firstObject.text
success:^{
} failure:^(NSError *error) {
}];
API description
- (void)createLimitOfflinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
name:(NSString *)name
effectiveTimeInterval:(NSTimeInterval)effectiveTimeInterval
invalidTimeInterval:(NSTimeInterval)invalidTimeInterval
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
name | The name of the password. |
effectiveTimeInterval | The time when the e-key becomes active, in seconds. It is timestamped at the top of the hour. For example, for 15:32, pass 15:00. |
invalidTimeInterval | The time when the e-key expires, in seconds. It is timestamped at the top of the hour. For example, for 18:24, pass 18:00. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared createLimitOfflinePasswordWithSiteId:SiteManager.shared.siteId
deviceId:self.devId
name:self.passwordNameLabel.text
effectiveTimeInterval:effectiveTime
invalidTimeInterval:invalidTime
success:^{
} failure:^(NSError *error) {
}];
API description
The lock must be online to create a time-limited online password.
- (void)createLimitOnlinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
name:(NSString *)name
effectiveTimeInterval:(NSTimeInterval)effectiveTimeInterval
invalidTimeInterval:(NSTimeInterval)invalidTimeInterval
workingDay:(NSString *)workingDay
startTime:(NSString *)startTime
endTime:(NSString *)endTime
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
name | The name of the password. |
effectiveTimeInterval | The time when the e-key becomes active, in seconds. It is timestamped at the top of the hour. For example, for 15:32, pass 15:00. |
invalidTimeInterval | The time when the e-key expires, in seconds. It is timestamped at the top of the hour. For example, for 18:24, pass 18:00. |
workingDay | The schedule, for example, 1011111 , from Sunday to Saturday. 0 indicates the schedule is off, while 1 indicates it is on. |
startTime | The start time, for example, 07:00. |
endTime | The end time, for example, 19:00. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared createLimitOnlinePasswordWithSiteId:SiteManager.shared.siteId
deviceId:self.devId
name:self.passwordNameLabel.text
effectiveTimeInterval:effectiveTime
invalidTimeInterval:invalidTime
workingDay:workingDay
startTime:startMinute
endTime:endMinute
success:^{
[self dismissViewControllerAnimated:YES completion:NULL];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpatePasswordList" object:nil];
} failure:^(NSError *error) {
}];
API description
- (void)removeOnceOfflinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared removeOnceOfflinePasswordWithSiteId:siteId
deviceId:self.devId
passwordId:passwordId
success:^{
} failure:^(NSError *error) {
}];
API description
The lock must be online to delete a permanent online password.
- (void)removeOnlinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
lockId:(NSString *)lockId
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
lockId | The lock ID. |
success | The success callback. |
failure | The failure callback. |
Example
You can get the lockId
from password details.
[ThingLockPasswordManager.shared removeOnceOfflinePasswordWithSiteId:siteId
deviceId:self.devId
passwordId:passwordId
success:^{
[
} failure:^(NSError *error) {
}];
API description
- (void)removeLimitOfflinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
success:(ThingSuccessString)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
success | The success callback. |
failure | The failure callback. |
Example
When users delete a time-limited offline password, they will receive a clear code in the callback. They must manually enter the clear code on the lock to completely delete the respective password.
[ThingLockPasswordManager.shared removeLimitOfflinePasswordWithSiteId:siteId
deviceId:self.devId
passwordId:passwordId
success:^(NSString *result) {
} failure:^(NSError *error) {
}];
API description
The lock must be online to delete a time-limited online password.
- (void)removeOnlinePasswordWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
lockId:(NSString *)lockId
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
lockId | The lock ID. |
success | The success callback. |
failure | The failure callback. |
Example
You can get the lockId
from password details.
[ThingLockPasswordManager.shared removeOnceOfflinePasswordWithSiteId:siteId
deviceId:self.devId
passwordId:passwordId
success:^{
[
} failure:^(NSError *error) {
}];
API description
- (void)getPasswordDetailWithSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
success:(ThingLockPasswordSuccess)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared getPasswordDetailWithSiteId:siteId
deviceId:self.devId
passwordId:self.password_id
success:^(ThingLockPasswordModel * _Nullable passwordModel) {
} failure:^(NSError *error) {
}];
API description
- (void)modifyPasswordSiteId:(long long)siteId
deviceId:(NSString *)deviceId
passwordId:(NSString *)passwordId
passwordName:(NSString *)passwordName
success:(ThingSuccessID)success
failure:(ThingFailureError)failure;
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
deviceId | The device ID. |
passwordId | The password ID. |
passwordName | The name of the password. |
success | The success callback. |
failure | The failure callback. |
Example
[ThingLockPasswordManager.shared modifyPasswordSiteId:SiteManager.shared.siteId
deviceId:self.devId
passwordId:self.passwordModel.passwordId
passwordName:self.passwordModel.passwordName success:^(id result) {
} failure:^(NSError *error) {
}];
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback