dnsimple / dnsimple-elixir

The DNSimple API client for Elixir.
https://developer.dnsimple.com/
MIT License
50 stars 15 forks source link

Set default value for account_id consistently #8

Closed jacegu closed 8 years ago

jacegu commented 8 years ago

Some functions define a default value for the account_id parameter (account_id \\ Dnsimple.Client.__WILDCARD_ACCOUNT) while others don't define a default value. We should apply one approach or the other consistently.

weppos commented 8 years ago

We can't apply it consistently, because it depends on what the API can offer. Some API methods can detect the account automatically, others can't.

We should default to the wildcard only when the method allows it.

jacegu commented 8 years ago

I didn't know that... Is this explained somewhere in the docs? Are there rules to know which ones are the ones that can use it (besides looking at the developer docs)?

weppos commented 8 years ago

The general rule is that whenever there is a secondary resource attached to account and we have an unique identifier, we are generally able to detect the account from it.

This is the case of reading a contact or a domain. It's not the case of a template (when given by short name), because that's not a completely unique identifier.

The docs should expose such information. For example see https://developer.dnsimple.com/v2/domains/#get

:account    integer The account id or wildcard (_)
jacegu commented 8 years ago

Closing as this is not posible as @weppos explained.