Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update this SDK to be inline with current API docs #1

Open
findchris opened this issue Mar 3, 2017 · 3 comments
Open

Update this SDK to be inline with current API docs #1

findchris opened this issue Mar 3, 2017 · 3 comments

Comments

@findchris
Copy link

For example, there's a call to POST /spaces/:id/events for reserving a room, but this SDK appears not to support it.

Am I missing something? I'd expect to be able to do:

robin.api.spaces.events.create(spaceId, eventData)
@findchris
Copy link
Author

I looked around, didn't see anything, so here's a patch.

@zachdunn
Copy link

zachdunn commented Mar 3, 2017

Thanks for the report. We're due for some spring cleaning on this SDK's convenience methods.

In the meantime, you can call endpoints without direct support via the following convention:

sdk.api.POST(`/events/${eventID}`, params).then(response => response.getData());
sdk.api.GET(`/events/${eventID}`).then(response => response.getData());
// etc.

Ref:

  • https://github.com/robinpowered/robin-js-sdk#instantiation-with-a-default-options-object
  • /**
    * Implement HTTP request methods, to make requests easier
    */
    RequestBase.prototype.GET = function (path, params) {
    return this.sendRequest(path, 'GET', params);
    };
    RequestBase.prototype.HEAD = function (path, params) {
    return this.sendRequest(path, 'HEAD', params);
    };
    RequestBase.prototype.POST = function (path, data) {
    return this.sendRequest(path, 'POST', data);
    };
    RequestBase.prototype.PUT = function (path, data) {
    return this.sendRequest(path, 'PUT', data);
    };
    RequestBase.prototype.PATCH = function (path, data) {
    return this.sendRequest(path, 'PATCH', data);
    };
    RequestBase.prototype.DELETE = function (path, data) {
    return this.sendRequest(path, 'DELETE', data);
    };
    RequestBase.prototype.OPTIONS = function (path, data) {
    return this.sendRequest(path, 'OPTIONS', data);
    };

@findchris
Copy link
Author

👍 on adding the /free-busy/spaces endpoint as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants