hoodiehq / hoodie-account-client

:dog: Account client API for the browser
https://hoodiehq.github.io/hoodie-account-client
Apache License 2.0
11 stars 24 forks source link

Add options.id to constructor #33

Closed gr2m closed 8 years ago

gr2m commented 8 years ago

We need support a client-generated ID for our account for Hoodie, as the account ID will be set to hoodie.id, and hoodie.id gets generated upon first initialisation. JSON API explicitly supports client-generated resource IDs

So what we want is this

var account = new Account({
  url: 'https://example.com/api'
  id: 'abc4567'
}) 

account.signUp({
  username: 'pat',
  password: 'secret'
})

to send this request

### Sign Up [PUT /session/account]
+ Request (application/vnd.api+json)

    + Headers

            Accept: application/vnd.api+json

    + Body

            {
                "data": {
                    "type": "account",
                    "id": "abc4567",
                    "attributes": {
                        "username": "john-doe",
                        "password": "secret"
                    }
                }
            }
gr2m commented 8 years ago

closed via #45