-
Notifications
You must be signed in to change notification settings - Fork 11
[ZL-796] - Support Rest API migration #42
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
Conversation
…core/js-sdk into Remove_Dependencies
lib/client.ts
Outdated
| return url; | ||
| }; | ||
|
|
||
| private version = (apiVersion: string = 'v1.0'): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to process '' (passed empty string from the client code) as default behaviour (v1.0) or we should throw an error in this case? (as now)
lib/client.ts
Outdated
|
|
||
| private url = (endpoint: Endpoint): string => | ||
| notNil(endpoint) && (endpoint.constructor === String || endpoint instanceof String) ? | ||
| `${this.host}${endpoint}` : // TODO: Do we want to allow this. Version will not be handled for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably one of the main questions for code review.
My vision: JS-SDK should not support the endpoint instanceof String login anymore
|
LGTM |
…ders being sent on all requests
|
@njbbaer @gilmcquillan updated to send the sdk version in the headers. Let me know what you think about the naming. |
| }, | ||
| "author": "Procore Tech <insights@procore.com> (http://procore.com)", | ||
| "license": "ISC", | ||
| "license": "MIT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nb: Might actually be Procore Development License, see here, but that's a topic for legal I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Taking this PR over, so a bit unsure about this change. @Varomir @gilmcquillan any reason that the license here changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the rest of our open source libraries use MIT, I think we should use that here as well.
Ruby SDK, MIT: https://github.com/procore/ruby-sdk/blob/master/LICENSE.txt
Blueprinter, MIT: https://github.com/procore/blueprinter/blob/master/MIT-LICENSE
Sift, MIT: https://github.com/procore/sift/blob/master/MIT-LICENSE
I will open up a discussion with legal around what license we should be using.
|
@bross I've got a compilation error after |
Thanks for pointing this out @Varomir After some investigation, this appears to be a side effect of importing |
… use this directory since we are importing the version from package.json and the path is relative, so the compiled structure changes
…core/js-sdk into ZL-796-update-Procore-JS-SDK-to-Rest
Ticket: ZL-796
Description
This PR changes how the JS-SDK handles API versions, to support easy migration from the legacy API Vapid to the new versioned API Rest. Read more about the Rest versioned API in our: Confluence pages.
An optional
versioncan now be passed from the library client-side or defaultrest/v1.0will be applied.The API version can be specified at the time of the request.
procore.get({base: '/me'})https://app.procore.com/rest/v1.0/meprocore.get({base: '/me', version: 'v1.1'})https://app.procore.com/rest/v1.1/meprocore.get({base: '/me', version: 'vapid'})https://app.procore.com/vapid/me