Re: [Specifications] [client-interface] Suggestion for browser-like client API

That's more how I started with heracles. You can start with any resource URL and get a Hydra resource object with `hydra:stuff` mapped to nice JS getters. It will be possible to define custom extension so that it won't be necessary to work with full URIs name.

Here's the direction I want to go

```
import {Hydra} from 'heracles';

Hydra.loadResource('http://example.com/user/tpluscode')
  .then(res => {
    // contains the entrypoint, supported classes and operations, and other Api Doc stuff.
    var apiDocs = res.apiDocumentation;
    
    // same as res['@id']
    var id = res.id; 
   
    // let's assume the operation is available
   var op = res.operations["http://example.com/vocab#updateName"];

    return op.invoke({
        'name': 'Tomasz'
    });
  }).then(doSomethingWithTheOperationResult);
```

As you see there is no state. Or rather, there are only Hydra resource

On the other hand it now dawns on me that I intend to create a Hydra library and not a client right?

-- 
GitHub Notification of comment by tpluscode
Please view or discuss this issue at https://github.com/HydraCG/Specifications/pull/111#issuecomment-289296539 using your GitHub account

Received on Sunday, 26 March 2017 16:45:13 UTC