changePassword method

Implementation

Future<GenericServerResponse> changePassword(GenericServerInput<BeaChangePasswordInput>? input) async {
  GenericServerResponse genericServerResponse = new GenericServerResponse();
  try{

    if(input == null){
      throw new Exception("Input not found.");
    }

    String url = UrlUtils.getUrl(_baseUrl, UrlUtils.URL_CHANGE_PASSWORD);

    String jsonInput = jsonEncode(input.input!.toJson());

    Response response = await bsm!.genericBeaHttpPost(url, jsonInput);
    int? statusCode = response.statusCode;

    switch(statusCode){
      case 200:
        genericServerResponse.data = "OK";
        break;
      case 500:
        var res = response.data['error'];
        BeaError? error = res == null ? res : BeaError.fromJson(res);
        if (error != null) {
          genericServerResponse.beaError = error;
        } else {
          genericServerResponse.beaError = new BeaError("Unknown Error", 0, "");
        }
        break;
      case 401:
        genericServerResponse.beaSession = new BeaSession(true);
        break;
    }
  }on Exception catch (e){
    print('Error change BEA Password');
    FLog.error(
        className: this.runtimeType.toString(),
        methodName: "changePassword",
        text: 'Error change BEA Password - $e');
    throw e;
  }

  return genericServerResponse;
}