P E N C I L
Login
Http

  void sync() async {
    final response = await http.put(
        this._getHost() +
            '/api/inventory/team/2/sync/3059eb7a-d616-4656-ab9d-1fd7b6b04a72',
        headers: await _getHeaders(),
        body: convert.jsonEncode({'objects': {}}));
    return _json(response);
  }
  
  dynamic _json(http.Response response) {
    if (response.statusCode == 200) {
      return convert.jsonDecode(response.body);
    }

    print('>>> Request failed with status: ${response.statusCode}.');
    return null;
  }
  
  Future<Map<String, String>> _getHeaders() async {
    final bearer = "Bearer " + await credentialHolder.getAccessToken();
    return {"Content-Type": "application/json", "Authorization": bearer};
  }