Skip to content

Commit

Permalink
Add record binding
Browse files Browse the repository at this point in the history
  • Loading branch information
poorna2152 committed Aug 21, 2024
1 parent da4c772 commit 486a10f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/multiple-receive/multiple_receive.bal
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import ballerina/http;
import ballerina/io;
import ballerina/lang.runtime;

type Response record {
record {string 'worker;} args;
};

type Result record {
json|error a;
json|error b;
string|error a;
string|error b;
};

public function main() {
Expand All @@ -22,8 +26,8 @@ public function main() {
io:println(result);
}

function fetch(string url) returns json|error {
function fetch(string url) returns string|error {
http:Client cl = check new (url);
record {map<json> args;} payload = check cl->get("");
return payload.args.'worker;
Response {args: {'worker: 'worker}} = check cl->get("");
return 'worker;
}

0 comments on commit 486a10f

Please sign in to comment.