-
Notifications
You must be signed in to change notification settings - Fork 13.7k
feat: adds new endpoint to fetch outbound provider metadata #36424
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c1e3d4d
feat: adds new endpoint to fetch outbound provider metadata
lucas-a-pelegrino 5ec179c
fix: merge conflicts
lucas-a-pelegrino aeddabd
Merge remote-tracking branch 'origin/develop' into feat/CTZ-215
sampaiodiego cb72f78
export multiple endpoints
sampaiodiego a746006
fix: AJV object on response
lucas-a-pelegrino bcd25ef
fix: adds missing import
lucas-a-pelegrino ffba386
docs: adds changeset
lucas-a-pelegrino ecd622e
fix: merge conflicts
lucas-a-pelegrino 9e9bc49
fix: wrong props in AVJ response checkers
lucas-a-pelegrino c1fd92f
docs: updates changeset to match feat context
lucas-a-pelegrino ae156ae
chore: adds bad request response to open api schemas
lucas-a-pelegrino e30ba1b
Merge branch 'feat/CTZ-215' of github.com:RocketChat/Rocket.Chat into…
lucas-a-pelegrino e6d7310
fix: linting issue
lucas-a-pelegrino 4f8e676
chore: renames ajv schemas for pattern definition
lucas-a-pelegrino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@rocket.chat/meteor": minor | ||
| --- | ||
|
|
||
| Adds an endpoint to fetch a Outbound Comms Provider's metadata. |
89 changes: 42 additions & 47 deletions
89
apps/meteor/ee/app/livechat-enterprise/server/api/outbound.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,50 @@ | ||
| import type { IOutboundProvider } from '@rocket.chat/core-typings'; | ||
| import { ajv } from '@rocket.chat/rest-typings'; | ||
|
|
||
| import { API } from '../../../../../app/api/server'; | ||
| import { isGETOutboundProviderParams } from '../outboundcomms/rest'; | ||
| import { | ||
| GETOutboundProvidersResponseSchema, | ||
| isGETOutboundProviderParams, | ||
| IsOutboundProviderBadRequestErrorSchema, | ||
| isOutboundProviderMetadataSchema, | ||
| } from '../outboundcomms/rest'; | ||
| import { outboundMessageProvider } from './lib/outbound'; | ||
| import type { ExtractRoutesFromAPI } from '../../../../../app/api/server/ApiClass'; | ||
|
|
||
| const outboundCommsEndpoints = API.v1.get( | ||
| 'omnichannel/outbound/providers', | ||
| { | ||
| response: { | ||
| 200: ajv.compile<{ providers: IOutboundProvider[] }>({ | ||
| type: 'object', | ||
| properties: { | ||
| providers: { | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| providerId: { | ||
| type: 'string', | ||
| }, | ||
| providerName: { | ||
| type: 'string', | ||
| }, | ||
| supportsTemplates: { | ||
| type: 'boolean', | ||
| }, | ||
| providerType: { | ||
| type: 'string', | ||
| }, | ||
| documentationUrl: { | ||
| type: 'string', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
| const outboundCommsEndpoints = API.v1 | ||
| .get( | ||
| 'omnichannel/outbound/providers', | ||
| { | ||
| response: { | ||
| 200: GETOutboundProvidersResponseSchema, | ||
| 400: IsOutboundProviderBadRequestErrorSchema, | ||
| }, | ||
| query: isGETOutboundProviderParams, | ||
| authRequired: true, | ||
| }, | ||
| query: isGETOutboundProviderParams, | ||
| authRequired: true, | ||
| }, | ||
| async function action() { | ||
| const { type } = this.queryParams; | ||
| async function action() { | ||
| const { type } = this.queryParams; | ||
|
|
||
| const providers = outboundMessageProvider.listOutboundProviders(type); | ||
| return API.v1.success({ | ||
| providers, | ||
| }); | ||
| }, | ||
| ); | ||
| const providers = outboundMessageProvider.listOutboundProviders(type); | ||
| return API.v1.success({ | ||
| providers, | ||
| }); | ||
| }, | ||
| ) | ||
| .get( | ||
| 'omnichannel/outbound/providers/:id/metadata', | ||
| { | ||
| response: { | ||
| 200: isOutboundProviderMetadataSchema, | ||
|
KevLehman marked this conversation as resolved.
Outdated
|
||
| 400: IsOutboundProviderBadRequestErrorSchema, | ||
| }, | ||
| authRequired: true, | ||
| }, | ||
| async function action() { | ||
| const { id } = this.urlParams; | ||
|
|
||
| const providerMetadata = await outboundMessageProvider.getProviderMetadata(id); | ||
| return API.v1.success({ | ||
| metadata: providerMetadata, | ||
| }); | ||
| }, | ||
| ); | ||
|
|
||
| export type OutboundCommsEndpoints = ExtractRoutesFromAPI<typeof outboundCommsEndpoints>; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.