schema method

Future<(UResponse<UDbTableSchemaResponse>?, UEmptyResponse?, String?)> schema({
  1. required UDbAdminSchemaParams p,
  2. required dynamic onOk(
    1. UResponse<UDbTableSchemaResponse> r
    ),
  3. required dynamic onError(
    1. UEmptyResponse e
    ),
  4. required dynamic onException(
    1. String e
    ),
})

Implementation

Future<(UResponse<UDbTableSchemaResponse>?, UEmptyResponse?, String?)> schema({
  required UDbAdminSchemaParams p,
  required Function(UResponse<UDbTableSchemaResponse> r) onOk,
  required Function(UEmptyResponse e) onError,
  required Function(String e) onException,
}) async {
  (UResponse<UDbTableSchemaResponse>?, UEmptyResponse?, String?) result = (null, null, null);
  await UHttpClient.send(
    method: "POST",
    endpoint: "${U.baseUrl}/DbAdmin/Schema",
    body: p.toMap().add("apiKey", U.apiKey).add("token", ULocalStorage.getToken()),
    onSuccess: (Response r) {
      final UResponse<UDbTableSchemaResponse> ok = UResponse<UDbTableSchemaResponse>.fromJson(r.body, (dynamic i) => UDbTableSchemaResponse.fromMap(i));
      result = (ok, null, null);
      onOk(ok);
    },
    onError: (Response r) {
      final UEmptyResponse err = UEmptyResponse.fromJson(r.body);
      result = (null, err, null);
      onError(err);
    },
    onException: (String e) {
      result = (null, null, e);
      onException(e);
    },
  );
  return result;
}