Compare commits

..

No commits in common. "solution/task07" and "main" have entirely different histories.

5 changed files with 16 additions and 49 deletions

View file

@ -14,6 +14,12 @@ import reactor.core.publisher.Mono;
@Service
public class CountryClient {
/*
TODO:
1. Add query document names
2. Assign variables as needed in the query document
*/
private final GraphQlClient graphQlClient;
public CountryClient() {
@ -22,33 +28,25 @@ public class CountryClient {
}
public Mono<Country> getCountryByCountryCode(final String countryCode, final String lang) {
return graphQlClient
.documentName("getCountry")
.variable("countryCode", countryCode)
.variable("lang", lang)
.retrieve("country")
.toEntity(Country.class);
return graphQlClient.documentName("TODO").variable("TODO", "TODO").retrieve("country").toEntity(Country.class);
}
public Mono<List<Country>> getCountriesByCurrency(final String currency) {
return graphQlClient
.documentName("getAllCountriesWithCurrency")
.variable("currency", currency)
.documentName("TODO")
.variable("TODO", "TODO")
.retrieve("countries")
.toEntityList(Country.class);
}
public Mono<List<Continent>> getAllContinents() {
return graphQlClient
.documentName("getAllContinents")
.retrieve("continents")
.toEntityList(Continent.class);
return graphQlClient.documentName("TODO").retrieve("continents").toEntityList(Continent.class);
}
public Mono<Continent> getContinentByCodeWithCountries(final String code) {
return graphQlClient
.documentName("getContinentWithCountries")
.variable("continentCode", code)
.documentName("TODO")
.variable("TODO", "TODO")
.retrieve("continent")
.toEntity(Continent.class);
}

View file

@ -1,6 +1 @@
query getAllContinents {
continents {
name
code
}
}
# TODO add query

View file

@ -1,6 +1 @@
query getAllCountriesWithCurrency($currency: String!) {
countries(filter: {currency: {regex: $currency}}) {
code
name
}
}
# TODO add query

View file

@ -1,10 +1 @@
query getContinentWithCountries($continentCode: ID!) {
continent(code: $continentCode) {
name
code
countries {
name
code
}
}
}
# TODO add query

View file

@ -1,13 +1 @@
query getCountry($countryCode: ID!, $lang: String) {
country(code: $countryCode) {
name(lang: $lang)
capital
emoji
languages {
name
code
}
currencies
phones
}
}
# TODO add query