geonames-client icon indicating copy to clipboard operation
geonames-client copied to clipboard

Added url as 3rd param

Open georgfranz opened this issue 5 months ago • 6 comments

If you have a commercial service, you can buy a custom subdomain. The url isn't changable from outside, so I have added a 3rd param.

georgfranz avatar Jan 14 '24 16:01 georgfranz

Hey @georgfranz and welcome to the GeoNames Client! I suggest making the 3rd parameter an associative array so we can add various config options without breaking the interface or introducing many setter/getter functions. wdyt?

Aternus avatar Jan 14 '24 19:01 Aternus

Here are the specs from GeoNames:

Yes the domain should be configurable, also the free api support various domain names (example. secure.geonames.org or api.geonames.org)

Premium users have additionally the possibility to add a parameter 'token' to all requests. This is a security feature to make sure nobody else is using the username (such as former employees...)

Best-Availability users have a failover url they could use if the primary end point for a reason is not reachable. Optimally the client library supports this and if some calls in a row end in a timeout it switches for some hours to the failover server. However, this might be too complicate for you to implement, just keep the possibility in mind that the users of your library may want to change the endpoint programmatically without having to restart their application.

Aternus avatar Jan 14 '24 19:01 Aternus

Hey @georgfranz and welcome to the GeoNames Client! I suggest making the 3rd parameter an associative array so we can add various config options without breaking the interface or introducing many setter/getter functions. wdyt?

Hi @Aternus - thanks for your fast reply :-)

Well, what other options do you have in mind? Like langunage / sorting / bias etc.?

Currently I can set all other options from outside - only the url wasn't possbile.

Best, Georg

georgfranz avatar Jan 14 '24 20:01 georgfranz

@georgfranz here's the spec I was thinking about:

  1. Ability to specify apiUrl
  2. Ability to specify fallbackApiUrl
  3. Ability to specify connectionTimeout (will deprecate the need for the set/get of the timeout)
  4. Ability to specify fallbackUrlTrigger. If calls with apiUrl reach connectionTimeout for fallbackUrlTrigger count, use fallbackApiUrl for the next call, then reset to apiUrl and reset the trigger count.

Aternus avatar Jan 16 '24 20:01 Aternus

Hello - is this likely to get merged? We're having TLS trouble with secure.geonames & want to use api.geonames instead

rosspointon avatar Mar 18 '24 14:03 rosspointon

Hello - is this likely to get merged? We're having TLS trouble with secure.geonames & want to use api.geonames instead

For us to merge the PR, please kindly ensure:

  1. The tests for this PR are passing.
  2. The Spec is implemented. Doesn't have to be everything at once, starting with the associative array having the URL is a good start.

Aternus avatar Mar 18 '24 15:03 Aternus