>
> That being said, any API client that requires three API calls to login
> should be beat over the head with a fail stick, but there are many cases
> where performing some workflow might require multiple api calls. The API
> clients should work out a single function of "doSomethingAwesome(param1,
> pararm1)" when it's in fact performing multiple API steps because it makes
> sense for end users, or I guess developers in this case.
>

Just to flesh this out with an obvious example that came to mind. There are
three "addCharm"-ish API calls.

addCharm [1]
addCharmWithAuthorization [2]
addLocalCharm [3]

Writing an API client in Python or other languages I'd want to provide a
single addCharm method that just made the right API call to Juju based on
the arguments provided. If you provided a macaroon  from a current logged
in session, I'd make a addCharmWithAuthorization. If you passed a local
'./xxxx' path as the charm url then I'd call out with addLocalCharm.
There's no need to push the complexity of those three different calls to
the end user of the API client.

My understanding is that we need three distinct calls in the API because of
Go and the way that these things need to be declared/defined. However,
pushing that down into API clients is pushing implementation details (Go in
this case) down into clients in other languages where this would not be so
required.

1: https://godoc.org/github.com/juju/juju/api#Client.AddCharm
2:
https://godoc.org/github.com/juju/juju/api#Client.AddCharmWithAuthorization
3: https://godoc.org/github.com/juju/juju/api#Client.AddLocalCharm
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to