From 8b292b59c57d807c3340dda4fbfd39b90a0abbc5 Mon Sep 17 00:00:00 2001 From: lakshanss Date: Mon, 8 Nov 2021 23:37:43 +0530 Subject: [PATCH] Improve getFileInfo function --- gradle.properties | 2 +- slack/Ballerina.toml | 6 +++--- slack/Dependencies.toml | 2 +- slack/constants.bal | 2 +- slack/utils.bal | 8 ++------ 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 803a3df..c93f42a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group=io.ballerinax.slack -version=2.0.0 +version=2.0.1 ballerinaLangVersion=2.0.0-beta.3 diff --git a/slack/Ballerina.toml b/slack/Ballerina.toml index 641b89d..2c756ab 100644 --- a/slack/Ballerina.toml +++ b/slack/Ballerina.toml @@ -1,7 +1,7 @@ [package] org= "ballerinax" name= "slack" -version= "2.0.0" +version= "2.0.1" export= ["slack", "slack.listener"] license= ["Apache-2.0"] authors = ["Ballerina"] @@ -9,7 +9,7 @@ keywords = ["Communication/Team Chat", "Cost/Freemium"] repository = "https://github.com/ballerina-platform/module-ballerinax-slack" [[platform.java11.dependency]] -path = "../java-wrapper/build/libs/java-wrapper-2.0.0.jar" +path = "../java-wrapper/build/libs/java-wrapper-2.0.1.jar" groupId = "io.ballerinax.slack" artifactId = "java-wrapper" -version = "2.0.0" +version = "2.0.1" diff --git a/slack/Dependencies.toml b/slack/Dependencies.toml index 1cdc914..7e95e34 100644 --- a/slack/Dependencies.toml +++ b/slack/Dependencies.toml @@ -289,7 +289,7 @@ modules = [ [[package]] org = "ballerinax" name = "slack" -version = "2.0.0" +version = "2.0.1" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "jballerina.java"}, diff --git a/slack/constants.bal b/slack/constants.bal index 8b89790..5040648 100644 --- a/slack/constants.bal +++ b/slack/constants.bal @@ -84,5 +84,5 @@ const string LATEST = "&latest="; const string OLDEST = "&oldest="; const string CURSOR = "&cursor="; const string INCLUSIVE = "&inclusive=true"; -const string TYPES = "types="; +const string TYPES = "&types="; const string UTF8 = "UTF8"; diff --git a/slack/utils.bal b/slack/utils.bal index e1d4a25..e69b657 100644 --- a/slack/utils.bal +++ b/slack/utils.bal @@ -376,12 +376,8 @@ isolated function getFileInfo(http:Client slackClient, string fileId) returns @t string url = GET_FILE_INFO_PATH + fileId; http:Response response = check slackClient->get(url); json fileInfo = check response.getJsonPayload(); - var checkOk = check checkOk(fileInfo); - var file = fileInfo.file; - if (file is error) { - return setJsonResError(file); - } - json fileJson = check file; + check checkOk(fileInfo); + json fileJson = check fileInfo.file; convertJsonToCamelCase(fileJson); var fileRec = fileJson.cloneWithType(FileInfo); if (fileRec is error) {