OAuth2 using just OH Rules and myopenhab.org

@rlkoshak I have been using your http request functions quite a bit for other purposes than OAuth, so many thanks for sharing. Anyhow, maybe as an addition you could also implement exceptions for timeout, host not found etc that you can catch - as this is something that I experienced while using it for other services. This would make it more complete?

Example

val Functions$Function2<String, Functions$Function1<HttpsURLConnection, String>, String> queryGithubAPI = [ endpointURL, readResponse |

try {
    val endpoint = new URL(endpointURL)
    val HttpsURLConnection connection = endpoint.openConnection() as HttpsURLConnection
    connection.requestMethod = "GET"
    connection.setDoOutput(true)
    connection.setConnectTimeout(10000); //set timeout to 10 seconds

    val response = readResponse.apply(connection)

    return response;
    } catch (java.net.SocketTimeoutException e) {
        // logWarn("httpAPI_Github", "Timeout " + e.toString)
        return "ERROR TIMEOUT " + e.toString;
    } catch (java.io.IOException e) {
        // logWarn("httpAPI_Github", "IOException " + e.toString)
        return "ERROR IOException " + e.toString;
}
]