Last Updated on : 2023-05-22 06:38:25
API description
- (void)getMessageList:(void (^)(NSArray<TuyaSmartMessageListModel *> *list))success
failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback. An array of messages is returned. |
failure | The failure callback. An error message is returned. |
Example
ObjC:
// self.smartMessage = [[TuyaSmartMessage alloc] init];
[self.smartMessage getMessageList:^(NSArray<TuyaSmartMessageListModel *> *list) {
NSLog(@"get message list success:%@", list);
} failure:^(NSError *error) {
NSLog(@"get message list failure:%@", error);
}];
Swift:
smartMessage?.getList({ (list) in
print("get message list success: \(list)")
}, failure: { (error) in
if let e = error {
print("get message list failure: \(e)")
}
})
API description
- (void)getMessageList:(NSInteger)limit
offset:(NSInteger)offset
success:(void (^)(NSArray<TuyaSmartMessageListModel *> *list))success
failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
limit | The maximum number of entries to be returned per page. |
offset | The total number of messages already returned. |
success | The success callback. An array of messages is returned. |
failure | The failure callback. An error message is returned. |
Example
// self.smartMessage = [[TuyaSmartMessage alloc] init];
NSNumber *limit = @15;
NSNumber *offset = @0;
[self.smartMessage getMessageList:limit offset:offset success:^(NSArray<TuyaSmartMessageListModel *> *list) {
NSLog(@"get message list success:%@", list);
} failure:^(NSError *error) {
NSLog(@"get message list failure:%@", error);
}];
API description
- (void)getMessageListWithType:(NSInteger)msgType limit:(NSInteger)limit offset:(NSInteger)offset success:(void (^)(NSArray<TuyaSmartMessageListModel *> *list))success failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
msgType | The type of message. Valid values:
|
limit | The maximum number of entries to be returned per page. |
offset | The total number of messages already returned. |
success | The success callback. An array of messages is returned. |
failure | The failure callback. An error message is returned. |
Example
// self.smartMessage = [[TuyaSmartMessage alloc] init];
NSNumber *limit = @15;
NSNumber *offset = @0;
[self.smartMessage getMessageList:limit offset:offset success:^(NSArray<TuyaSmartMessageListModel *> *list) {
NSLog(@"get message list success:%@", list);
} failure:^(NSError *error) {
NSLog(@"get message list failure:%@", error);
}];
API description
- (void)getMessageDetailListWithType:(NSInteger)msgType msgSrcId:(NSString *)msgSrcId limit:(NSInteger)limit offset:(NSInteger)offset success:(void (^)(NSArray<TuyaSmartMessageListModel *> *list))success failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
msgType | The type of message. Valid values:
|
msgSrcId | The message group ID. |
limit | The maximum number of entries to be returned per page. |
offset | The total number of messages already returned. |
success | The success callback with an array of DND periods returned. |
failure | The failure callback. An error message is returned. |
Example
// self.smartMessage = [[TuyaSmartMessage alloc] init];
NSNumber *limit = @15;
NSNumber *offset = @0;
[self.smartMessage getMessageDetailListWithType:1 msgSrcId:@"xxx" limit offset:offset success:^(NSArray<TuyaSmartMessageListModel *> *list) {
NSLog(@"get message list success:%@", list);
} failure:^(NSError *error) {
NSLog(@"get message list failure:%@", error);
}];
API description
- (void)deleteMessage:(NSArray <NSString *> *)messgeIdList
success:(TYSuccessHandler)success
failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
messgeIdList | The list of IDs for the messages to be deleted. |
success | The success callback. |
failure | The failure callback. An error message is returned. |
Example
ObjC:
// self.smartMessage = [[TuyaSmartMessage alloc] init];
[self.smartMessage deleteMessage:(NSArray <NSString *> *)messgeIdList success:^{
NSLog(@"delete message success");
} failure:^(NSError *error) {
NSLog(@"delete message failure:%@", error);
}];
Swift:
smartMessage?.delete(["messgeIdList"], success: {
print("delete message success")
}, failure: { (error) in
if let e = error {
print("delete message failure: \(e)")
}
})
API description
- (void)deleteMessageWithType:(NSInteger)msgType ids:(NSArray *)ids msgSrcIds:(NSArray *)msgSrcIds success:(TYSuccessHandler)success failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
msgType | The type of message. Valid values:
|
ids | The list of IDs for the messages to be deleted. |
msgSrcIds | The list of alert IDs. A value of nil or @[] represents that alerts are not deleted. |
success | The success callback. |
failure | The failure callback. An error message is returned. |
msgSrcIds
.ids
.The parameters msgSrcIds
and ids
cannot be set in the same request. Otherwise, the specified items in the list of alert details cannot be deleted.
Example
ObjC:
// self.smartMessage = [[TuyaSmartMessage alloc] init];
[self.smartMessage deleteMessageWithType:msgType ids:ids msgSrcIds:nil success:^{
NSLog(@"delete message success");
} failure:^(NSError *error) {
NSLog(@"delete message failure:%@", error);
}];
API description
- (void)getLatestMessageWithSuccess:(TYSuccessDict)success failure:(TYFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback. Data in the dictionary format is returned. The following keys are supported:
|
failure | The failure callback. An error message is returned. |
Example
ObjC:
// self.smartMessage = [[TuyaSmartMessage alloc] init];
[self.smartMessage getLatestMessageWithSuccess:^(NSDictionary *result) {
NSLog(@"get latesMessage success:%@", result);
} failure:^(NSError *error) {
NSLog(@"get message max time failure:%@", error);
}];
Swift:
smartMessage?.getLatestMessageWithSuccess({ (result) in
print("get message max time success :\(result)")
}, failure: { (error) in
if let e = error {
print("get message max time failure: \(e)")
}
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback