updateTermsAccepted method
Future<UpdateTermsAcceptedResponse>
updateTermsAccepted(
- String userId,
- UpdateTermsAcceptedRequest params
Implementation
Future<UpdateTermsAcceptedResponse> updateTermsAccepted(String userId, UpdateTermsAcceptedRequest params) async {
final url = Uri.parse('${_wepinBaseUrl}user/$userId/terms-accepted');
final jsonRequestBody = jsonEncode(params.toJson());
final response = await http.patch(
url,
headers: headers,
body: jsonRequestBody,
);
if (response.statusCode >= 200 && response.statusCode < 300) {
final responseBody = jsonDecode(response.body);
return UpdateTermsAcceptedResponse.fromJson(responseBody);
} else {
throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
}
}