-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from YujithIsura/main
build error fixed
- Loading branch information
Showing
2 changed files
with
5 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import ballerina/http; | ||
// import ballerina/http; | ||
import ballerina/graphql; | ||
|
||
public isolated client class Geo_dataClient { | ||
final graphql:Client graphqlClient; | ||
public isolated function init(string serviceUrl, http:ClientConfiguration clientConfig = {}) returns graphql:ClientError? { | ||
public isolated function init(string serviceUrl, graphql:ClientConfiguration clientConfig = {}) returns graphql:ClientError? { | ||
graphql:Client clientEp = check new (serviceUrl, clientConfig); | ||
self.graphqlClient = clientEp; | ||
return; | ||
} | ||
remote isolated function DistrictAndCityByProvince(string name) returns DistrictAndCityByProvinceResponse|graphql:ClientError { | ||
string query = string `query DistrictAndCityByProvince($name:String!) {geo {province(name:$name) {name {name_en} districts {name {name_en} cities {name {name_en}}}}}}`; | ||
map<anydata> variables = {"name": name}; | ||
map<anydata> variables = {"name": name}.cloneReadOnly(); | ||
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); | ||
return <DistrictAndCityByProvinceResponse> check performDataBinding(graphqlResponse, DistrictAndCityByProvinceResponse); | ||
return <DistrictAndCityByProvinceResponse>check performDataBinding(graphqlResponse, DistrictAndCityByProvinceResponse); | ||
} | ||
} |