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

View file

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

View file

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

View file

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

View file

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