Last Updated on : 2023-05-25 06:23:46
Server APIs are supported by the ThingSmartRequest
class.
API description
- (void)requestWithApiName:(NSString *)apiName
postData:(nullable NSDictionary *)postData
getData:(nullable NSDictionary *)getData
version:(NSString *)version
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
apiName | The name of an API. |
postData | The request parameters. |
getData | The common parameters. |
version | The version number of an API. |
success | The success callback. |
failure | The failure callback. |
Example
- (void)getCountryList {
// self.request = [ThingSmartRequest alloc] init];
[self.request requestWithApiName:@"tuya.m.country.list" postData:nil version:@"1.0" success:^(id result) {
} failure:^(NSError *error) {
}];
}
API description
Two API methods can be combined in the same API request.
- (void)addMergeRequestWithApiName:(NSString *)apiName
postData:(nullable NSDictionary *)postData
version:(NSString *)version
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
- (void)sendMergeRequestWithGetData:(nullable NSDictionary *)getData
success:(nullable ThingSuccessList)success
failure:(nullable ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
apiName | The name of an API. |
postData | The request parameters. |
version | The version number of an API. |
getData | The common parameters. |
success | The success callback. |
failure | The failure callback. |
Example
- (void)loadHomeDataWithHomeId:(long long)homeId {
// self.request = [ThingSmartRequest alloc] init];
[self.request addMergeRequestWithApiName:@"tuya.m.my.group.mesh.list" postData:@{} version:@"1.0" success:nil failure:nil];
[self.request addApiRequest:@"tuya.m.location.get" postData:@{@"gid": @(homeId)} version:@"2.0" success:nil failure:nil];
[self.request sendMergeRequestWithGetData:@{@"gid": @(homeId)} success:success failure:failure];
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback