-
Notifications
You must be signed in to change notification settings - Fork 25
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
added merge functionality to javascript client sdk #217
Conversation
Hello @PJGitLan and thanks for this contribution. For the "eclipsefdn/eca" check you will have to create an Eclipse account and sign the ECA (Eclipse Contributor Agreement), as also noted in the CONTRIBUTING.md - and sign your commit with the email address registered in your Eclipse account. |
c3b76d9
to
7f735bc
Compare
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.
Thanks @PJGitLan for the contribution.
I added some remarks / wishes for changing inline.
Good that you added "some" merge functionality to the JS SDK. 👍
However, it would be nice if we go into that direction in the JS SDK to support PATCH / merge, that all levels are supported.
Do you think you can also address all other levels (where currently only "PUT" is available in the client)?
From the top of my head:
- merge Thing
- merge Thing attributes
- merge Thing attribute
- merge Features (all)
- merge Feature (single)
- merge Feature desired properties
That way the complete "merge" would be available in the JS client and not only a small selected subpart.
@@ -51,6 +51,19 @@ export abstract class RequestSender { | |||
}); | |||
} | |||
|
|||
public fetchMergeRequest<T>(options: ParseRequest<T>): Promise<MergeResponse<T>> { | |||
return this.fetchRequest(options).then(response => { | |||
if (response.status === 204) { |
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.
As far as I remember a PATCH / merge could also create a new feature or property ..
So IMO checking for the status code 201 is missing here.
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 should be resolved by using fetchPutRequest()
javascript/lib/api/src/client/request-factory/request-sender.ts
Outdated
Show resolved
Hide resolved
javascript/lib/api/src/client/request-factory/websocket-request-sender.ts
Outdated
Show resolved
Hide resolved
17cd4db
to
91165cb
Compare
I added further merge functionality and solved previous remarks |
@@ -142,6 +172,17 @@ export interface HttpThingsHandle extends ThingsHandle { | |||
*/ | |||
putPolicyId(thingId: string, policyId: string, options?: MatchOptions): Promise<PutResponse<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.
Any reason why policyId and definition are only used for http-requests and not for websocket-requests?
d732853
to
84de897
Compare
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.
Thanks, that looks very promising 👍
I added some remarks, mainly about the js-doc, which were copy&pasted without adjustment at some places.
I like the added enums, but we then already should use them everywhere to get the JS client in a better shape slowly :)
Signed-off-by: Pieter-Jan Lanneer <[email protected]>
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.
@PJGitLan the changes look good to me, very nice 👍
Great that you did the extra changes to completely support "merge". Thank you for the contribution.
Hi @thjaeckle, no problem. Any idea when version 3.2.0 will be published? |
Today 😉 |
No description provided.