class BasicApiConnection extends ApiConnection {

	public void logout() throws IOException, MediaWikiApiErrorException {
		if (this.loggedIn) {
			Map<String, String> params = new HashMap<>();
			params.put("action", "logout");
			params.put("token", getOrFetchToken("csrf"));
			params.put("format", "json"); // reduce the output
			try {
				sendJsonRequest("POST", params);
			} catch (MediaWikiApiErrorException e) {
				throw new IOException(e.getMessage(), e); //TODO: we should throw a better exception
			}

			this.loggedIn = false;
			this.username = "";
			this.password = "";
		}
	}

	public  BasicApiConnection(String apiBaseUrl);
	@JsonCreator protected  BasicApiConnection(
			@JsonProperty("baseUrl") String apiBaseUrl,
			@JsonProperty("cookies") List<HttpCookieWrapper> cookies,
			@JsonProperty("username") String username,
			@JsonProperty("loggedIn") boolean loggedIn,
			@JsonProperty("tokens") Map<String, String> tokens,
			@JsonProperty("connectTimeout") int connectTimeout,
			@JsonProperty("readTimeout") int readTimeout);

}