Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void setConcreteTemplateData(TemplateContext context) {
codedata.version()))
.lsClientLogger(context.lsClientLogger())
.functionResultKind(getFunctionResultKind())
.project(PackageUtil.loadProject(context.workspaceManager(), context.filePath()))
.userModuleInfo(moduleInfo);

NodeKind functionNodeKind = getFunctionNodeKind();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
"symbol": "addItem",
"parentSymbol": "cart",
"org": "nipunaf",
"packageName": "new_connection1",
"module": "new_connection1"
},
"output": {
"id": "31",
"metadata": {
"label": "addItem",
"description": "",
"icon": "https://bcentral-packageicons.azureedge.net/images/nipunaf_null_null.png"
"icon": "https://bcentral-packageicons.azureedge.net/images/nipunaf_new_connection1_null.png"
},
"codedata": {
"node": "METHOD_CALL",
"org": "nipunaf",
"module": "new_connection1",
"packageName": "new_connection1",
"object": "Cart",
"symbol": "addItem",
"isNew": true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"source": "sub_module/main.bal",
"position": {
"line": 3,
"offset": 0
},
"description": "Sample diagram node",
"codedata": {
"node": "REMOTE_ACTION_CALL",
"org": "wso2",
"module": "sub_module.client_module",
"packageName": "sub_module",
"object": "CustomClient",
"symbol": "getData",
"version": "0.1.0",
"parentSymbol": "customClient"
},
"output": {
"id": "31",
"metadata": {
"label": "getData",
"description": "",
"icon": "https://bcentral-packageicons.azureedge.net/images/wso2_sub_module_0.1.0.png"
},
"codedata": {
"node": "REMOTE_ACTION_CALL",
"org": "wso2",
"module": "sub_module.client_module",
"packageName": "sub_module",
"object": "CustomClient",
"symbol": "getData",
"version": "0.1.0",
"isNew": true
},
"returning": false,
"properties": {
"connection": {
"metadata": {
"label": "Connection",
"description": "Connection to use"
},
"valueType": "EXPRESSION",
"valueTypeConstraint": "client_module:CustomClient",
"value": "customClient",
"optional": false,
"editable": false,
"advanced": false,
"hidden": true
},
"path": {
"metadata": {
"label": "Path"
},
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"placeholder": "\"\"",
"optional": false,
"editable": true,
"advanced": false,
"hidden": false,
"codedata": {
"kind": "REQUIRED",
"originalName": "path"
},
"typeMembers": [
{
"type": "string",
"packageInfo": "",
"packageName": "",
"kind": "BASIC_TYPE",
"selected": false
}
]
},
"type": {
"metadata": {
"label": "Result Type",
"description": "Type of the variable"
},
"valueType": "TYPE",
"value": "string",
"placeholder": "var",
"optional": false,
"editable": false,
"advanced": false,
"hidden": false,
"codedata": {}
},
"variable": {
"metadata": {
"label": "Result",
"description": "Name of the result variable"
},
"valueType": "IDENTIFIER",
"value": "stringResult",
"optional": false,
"editable": true,
"advanced": false,
"hidden": false
},
"checkError": {
"metadata": {
"label": "Check Error",
"description": "Trigger error flow"
},
"valueType": "FLAG",
"value": true,
"optional": false,
"editable": true,
"advanced": true,
"hidden": true
}
},
"flags": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"source": "sub_module/main.bal",
"position": {
"line": 3,
"offset": 0
},
"description": "Sample diagram node",
"codedata": {
"node": "RESOURCE_ACTION_CALL",
"org": "wso2",
"module": "sub_module.client_module",
"packageName": "sub_module",
"object": "CustomClient",
"symbol": "get",
"version": "0.1.0",
"parentSymbol": "customClient",
"resourcePath": "/users/[userId]"
},
"output": {
"id": "31",
"metadata": {
"label": "get",
"description": "",
"icon": "https://bcentral-packageicons.azureedge.net/images/wso2_sub_module_0.1.0.png"
},
"codedata": {
"node": "RESOURCE_ACTION_CALL",
"org": "wso2",
"module": "sub_module.client_module",
"packageName": "sub_module",
"object": "CustomClient",
"symbol": "get",
"isNew": true
},
"returning": false,
"properties": {
"connection": {
"metadata": {
"label": "Connection",
"description": "Connection to use"
},
"valueType": "EXPRESSION",
"valueTypeConstraint": "client_module:CustomClient",
"value": "customClient",
"optional": false,
"editable": false,
"advanced": false,
"hidden": true
},
"resourcePath": {
"metadata": {
"label": "Resource Path",
"description": "Resource Path"
},
"valueType": "ACTION_PATH",
"value": "/users/[userId]",
"optional": false,
"editable": false,
"advanced": false,
"hidden": true,
"codedata": {
"originalName": "/users/[userId]"
}
},
"userId": {
"metadata": {
"label": "userId"
},
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"placeholder": "\"\"",
"optional": false,
"editable": true,
"advanced": false,
"hidden": false,
"codedata": {
"kind": "PATH_PARAM",
"originalName": "userId"
},
"typeMembers": []
},
"type": {
"metadata": {
"label": "Result Type",
"description": "Type of the variable"
},
"valueType": "TYPE",
"value": "json",
"placeholder": "var",
"optional": false,
"editable": false,
"advanced": false,
"hidden": true,
"codedata": {}
},
"variable": {
"metadata": {
"label": "Result",
"description": "Name of the result variable"
},
"valueType": "IDENTIFIER",
"value": "jsonResult",
"optional": false,
"editable": true,
"advanced": false,
"hidden": false
},
"checkError": {
"metadata": {
"label": "Check Error",
"description": "Trigger error flow"
},
"valueType": "FLAG",
"value": true,
"optional": false,
"editable": true,
"advanced": true,
"hidden": true
}
},
"flags": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
org = "wso2"
name = "sub_module"
version = "0.1.0"
distribution = "2201.12.9"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import sub_module.client_module;

client_module:CustomClient customClient = check new ("http://localhost:8080");
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ballerina/http;

public function main() {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ballerina/http;

public isolated client class CustomClient {
private final http:Client httpClient;

public isolated function init(string url) returns error? {
self.httpClient = check new (url);
}

remote function getData(string path) returns string|error {
json response = check self.httpClient->get(path);
return response.toString();
}

resource function get users/[string userId]() returns json|error {
return self.httpClient->/users/[userId].get();
}
}
Loading