Conversation
Codecov Report
@@ Coverage Diff @@
## master #61 +/- ##
==========================================
+ Coverage 60.58% 61.03% +0.44%
==========================================
Files 51 55 +4
Lines 1799 1935 +136
Branches 278 299 +21
==========================================
+ Hits 1090 1181 +91
- Misses 709 754 +45
Continue to review full report at Codecov.
|
graywolf336
left a comment
There was a problem hiding this comment.
I'll review this in more detail later, but I honestly think if we switch the IWebhook to be a class it will be extremely helpful. Like you described to me, it will allow us to provide generic utility/helper functions inside the class that are common things done by developers.
|
@graywolf336 can you provide some examples? |
|
awesome! @graywolf336 for me Interfaces are fine |
src/server/managers/AppWebhook.ts
Outdated
| 'patch', | ||
| ]; | ||
|
|
||
| export class AppWebhook { |
There was a problem hiding this comment.
What's the purpose of having two AppWebhook items within the managers folder? I think should combine them into one and keep the name of it to be AppWebhookManager, unless there's a valid reason I am overlooking.
There was a problem hiding this comment.
I'll take a look ASAP.
I'm planing to change the naming to API instead of Webhooks, what do you think?
There was a problem hiding this comment.
@rodrigok @graywolf336 renamed from webhook to api.
|
@geekgonecrazy awesome, can you remove the docs changes? I'm planning to move docs to a dedicated branch to prevent this mess on PRs as Bradley suggested some time ago. |
This reverts commit fe17e36.
|
@rodrigok done :) |
| * will be generated automatically. | ||
| * @param `X-Auth-Token` | ||
| */ | ||
| // AUTH_TOKEN, |
There was a problem hiding this comment.
What's your plans for this? I see they're commented out, but might want to add some documentation in the code for App developers to let them know that more will be coming in the near future.
There was a problem hiding this comment.
Well, the AUTH_TOKEN is already documented there, the idea is to have options to handle authentication automatically for the apps. But it's not clear the options for me now.
There was a problem hiding this comment.
It's commented out, so it won't show up in the generated docs if I'm not mistaken..yeah I'm not sure the best route to go yet without putting forth much effort in thoughts.
There was a problem hiding this comment.
I don't want to have it in docs since we don't have it implemented yet, it's basically a reminder that we will have more options there.
src/definition/api/IApi.ts
Outdated
| * Path to complete the api URL. Example: https://{your-server-address}/api/apps/public/{your-app-id}/{path} | ||
| * or https://{your-server-address}/api/apps/private/{your-app-id}/{private-hash}/{path} | ||
| */ | ||
| path: string; |
There was a problem hiding this comment.
What would you think about allowing param style route definitions? For example: /contacts/:contactId/numbers would result in the passed in contactId being a param. Maybe this can be a future plan for improvements
There was a problem hiding this comment.
@rodrigok sweet! Maybe you can add some documentation so other developers are aware of it and can make usage of it 😃
| export interface IApiExtend { | ||
| /** | ||
| * Adds an api which can be called by external services lateron. | ||
| * Should an api already exists an error will be thrown. |
There was a problem hiding this comment.
Hmm, to be honest I'm not a fan fo this. If we are allowing them to provide the api, then we need to allow more than one api to be passed in..which in a sense we are, via the apiEndpoints. However, I think this goes against the style of the provideSlashCommand and provideSetting, both of which allow more than one being provided. In my opinion, we need to stick with the same style to ensure a standard is kept and to reduce the amount of possible confusion to the App developers. Maybe we revert back to an interface that the App implements which gets called to return the apiEndpoint informations. Which would work well when installing an App, as the person installing the App will see that the App provides an apiEndpoint which external services will be able to call. And since an App can only implement it once, it would solve the issue along with it could be called after settings which the App developer could read a setting to allow the administrator to configure how it works.
There was a problem hiding this comment.
Idk if I understood your point, but you are able to provide more than one API, mainly if you need different properties like visibility and security. Is that what you were meaning?
There was a problem hiding this comment.
So, you currently can provide more than one? The code documentation states that you can not: "Should an api already exists an error will be thrown."
There was a problem hiding this comment.
By the API we mean an endpoint, you can configure more than one API but containing different endpoints
There was a problem hiding this comment.
So, you can have more than one API but different endpoints? If I call this method more than once, each time containing two different endpoints, will it error out or will it succeed?
|
|
||
| switch (this.api.visibility) { | ||
| case ApiVisibility.PUBLIC: | ||
| this.basePath = `/api/apps/public/${app.getID()}`; |
There was a problem hiding this comment.
@rodrigok what would you think about us making the nameSlug of the Apps to be unique and use it instead of the App's ID? This would help with the transition over to #56 (package.json) to slowly get rid of the usage of the id. As a result, and where the idea came to me from, the "endpoints" and urls generated/provided will be easier to use (and shorter) instead of having a long id in the url.
There was a problem hiding this comment.
I wan't to move the ID to be a unique ID based on name as NPM does, that way we keep using the ID here, just change how the ID would be generated.
There was a problem hiding this comment.
Right, so if we go with the name slug or a special smaller ID such as author:app-name then we could generate shorter urls and that would be a unique ID since the author couldn't have two of the same app names but two people could have the same App name as their author name would be different.
There was a problem hiding this comment.
Yes, but that will be in the future
|
HI @graywolf336 @rodrigok, does your team have a plan to implement the other security level for the API in the next releases? |
|
@meomay503, unfortunately, no, it's not in our short roadmap. |
Closes #12
Rocket.Chat bridge implementation RocketChat/Rocket.Chat#11938
TODO
IMPROVEMENTS
Webhook admin UI

Implementation example