7digital / SevenDigital.Api.Wrapper

A fluent c# wrapper for the 7digital API
MIT License
16 stars 29 forks source link

RequestToken and AccessToken ForUser method is confusing #235

Closed gregsochanik closed 6 years ago

gregsochanik commented 8 years ago

The ForUser(string,string) method could do with being made less confusing. It currently just accepts 2 string parameters, and the name doesn't really mean anything.

I propose something like:

var requestToken = Api<RequestToken>.Create
    .Please();

.... authorise request token ....

var accessToken = Api<AccessToken>.Create
    .WithToken(RequestToken requestToken)
    .Please()

var usersLocker = Api<Locker>.Create
    .WithToken(AccessToken accessToken)
    .Please()

Where WithToken only accepts either RequestToken or AccessToken depending on the Api, which can be achieved using Interfaces as we do with the rest of the wrapper.

Relates to issue #234