Country
Provides information about a country, such as its name, ISO code, endonym, and currency.
Type Definition
type Country {
id: Int
name: String
endonymName: String
isoCode: String
currency: Currency
}Fields
| Field | Type | Nullable | Description | Relationship |
|---|---|---|---|---|
id | Int | Yes | Unique identifier for this country. | None |
name | String | Yes | Display name of this country. | None |
endonymName | String | Yes | Endonym (local) name of this country, if available. | None |
isoCode | String | Yes | ISO 3166-1 alpha-2 code for this country. | None |
currency | Currency | Yes | Currency object for this country. | Related to Currency |
Relationships
- currency: This field links to the
Currencyobject type, representing the currency used in the country. You can traverse this relationship to access currency-specific details such as currency code, symbol, or name.
Usage Examples
Basic Query
{
country {
id
name
endonymName
isoCode
currency {
id
name
isoCode
}
}
}Field Selection
{
country {
name
isoCode
}
}Nested Queries
{
country {
name
currency {
name
isoCode
}
}
}Filtering and Sorting
The Country type itself does not define filtering or sorting fields. Filtering and sorting should be applied at the query level where countries are fetched, depending on the API’s query capabilities.
For example, if a query supports filtering countries by isoCode or sorting by name, it might look like this:
query GetCountries($filterIsoCode: String, $sortByName: SortOrder) {
countries(filter: { isoCode: $filterIsoCode }, sort: { name: $sortByName }) {
id
name
isoCode
}
}Note: Replace SortOrder and filtering arguments with the actual schema definitions if available.
Implements
The Country type does not explicitly implement any interfaces in the current schema.
Connections
No connection fields are defined on the Country type itself.
Related Types
- Currency: Represents the currency used by the country. Accessed via the
currencyfield onCountry.
Best Practices
- When querying for country data, select only the fields you need to optimize response size and improve performance.
- Use the
isoCodefield for consistent country identification across systems. - Traverse the
currencyrelationship to retrieve currency details rather than duplicating currency information. - Always handle nullable fields gracefully, as many fields on
Countryare optional and may returnnull. - For large lists of countries, apply filtering and sorting at the query level to reduce payload size and improve client-side performance.
Notes
- The
Countryobject fields are all optional, so clients should implement null checks to avoid runtime errors. - The
currencyfield is a computed relationship that resolves to the associatedCurrencyobject for the country. - This API currently requires no authentication, but this may change in future versions. Plan your integration accordingly.
- Caching country data on the client side can improve performance, as country information changes infrequently.
- There are no computed or derived fields beyond the
currencyrelationship in this type. - No field arguments are defined on the
Countrytype fields. All fields are accessed directly without parameters.
Last updated on