call static method

void call(
  1. String endpoint,
  2. Map<String, dynamic> data,
  3. OnResult andThen
)

Don't use it, it's only for internal use. It calls the API-routes for authentication so that later your request to yield a socket does not get blocked.

Implementation

static void call(String endpoint, Map<String, dynamic> data, OnResult andThen) async {
  String jsonData = jsonEncode(data);
  String signature = await generateHmac(jsonData, LocalitySocialCloud.getAppSecret());
  http.post(
    Uri.https(TeleRepo.teleURL, endpoint),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
      'X-App-ID': LocalitySocialCloud.getAppID(),
      'X-Signature': signature,
    },
    body: jsonData,
  ).then((response)
  {
    if (response.statusCode == 200) {
      andThen(true,jsonDecode(response.body));
    } else {
      andThen(false,{});
    }
  });
}