Skip to content

fix: add routes to get routing ports & all defined routes#1228

Merged
andrew-welker merged 3 commits into
mainfrom
add-routes
Mar 28, 2025
Merged

fix: add routes to get routing ports & all defined routes#1228
andrew-welker merged 3 commits into
mainfrom
add-routes

Conversation

@andrew-welker
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new Web API request handlers to improve route interrogation capabilities: one for retrieving routing ports associated with a device, and another for listing all defined routes. Additionally, an existing route name has been updated and the protocol for generating URL paths has been changed to HTTPS.

  • Added GetRoutingPortsHandler to respond to device routing port requests.
  • Added GetRoutesHandler to expose the current route collection via a new "apiPaths" endpoint.
  • Updated route “getTielines” to “tielines” and enforced HTTPS in URL generation.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingPortsHandler.cs New handler to fetch and return routing port details for a specified device.
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs New handler to serialize and return the route collection.
src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs Updated routing configuration by changing an existing route name, adding new routes, and forcing HTTPS for generated URLs.
Comments suppressed due to low confidence (2)

src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs:259

  • Forcing the HTTPS protocol may cause issues in environments that require HTTP. Consider making the protocol configurable based on the deployment context.
                ? "$https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{BasePath}"

src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs:20

  • The response content type is set both via the ContentType property and by adding a header explicitly. Consider removing the redundant header assignment to avoid potential conflicts.
            context.Response.Headers.Add("Content-Type", "application/json");

@andrew-welker andrew-welker requested review from Copilot and ndorin March 28, 2025 15:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds two new web API request handlers to support fetching routing ports for a device and retrieving all defined routes. It also updates the route configurations in the EssentialsWebApi to integrate the new endpoints and standardizes URL usage to HTTPS.

  • Introduces GetRoutingPortsHandler to return input/output port keys for a device.
  • Introduces GetRoutesHandler to return route information including the base URL.
  • Updates the EssentialsWebApi route definitions to include the new endpoints and adjust existing routes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingPortsHandler.cs Added handler to fetch routing ports based on deviceKey
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs Added handler to return API route details
src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs Updated route configuration with new endpoints and HTTPS URL formatting
Comments suppressed due to low confidence (1)

src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs:208

  • [nitpick] Consider renaming the 'apiPaths' route to a term like 'routes' to better reflect its purpose and maintain consistency with other endpoint naming conventions.
AddRoute(new HttpCwsRoute("apiPaths") {

@andrew-welker andrew-welker merged commit 65a0743 into main Mar 28, 2025
2 checks passed
@andrew-welker andrew-welker deleted the add-routes branch March 28, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants