apiGetWithTokenUrl method

Future apiGetWithTokenUrl(
  1. String url, {
  2. Map<String, String>? params,
  3. bool returnPayloadOnly = true,
})

Implementation

Future<dynamic> apiGetWithTokenUrl(String url, {Map<String, String>? params, bool returnPayloadOnly = true}) async {
  if (this.config != null && this.config.host != null) {
    if (_session != null && _session!.token != null) {
      if (params == null) params = Map();
      params["access_token"] = _session!.token!;
    }

    var uri = Uri.parse(this.config.host + url);
    if (params != null) uri = uri.replace(queryParameters: params);

    debug("apiGet URL: ${uri.toString()} With params: ${uri.queryParameters.toString()}");

    return http.get(uri).then((res) => processResponse(res, returnPayloadOnly));
  } else  {
    return Future.error(VasatError("No vasat configuration or host found",status: 8000));
  }

}