Skip to content

Commit

Permalink
feat: change plugin api response
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadch91 committed Jan 19, 2025
1 parent 072e5c3 commit 7be4063
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
20 changes: 18 additions & 2 deletions services/integration/api/integration-types/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,20 @@ func (a *API) ListPlugins(c echo.Context) error {
var items = []models.IntegrationPlugin{}
for _, plugin := range plugins {
items = append(items, models.IntegrationPlugin{
PluginId: plugin.PluginID,
ID: plugin.ID,
PluginID: plugin.PluginID,
IntegrationType: plugin.IntegrationType.String(),
InstallState: string(plugin.InstallState),
OperationalStatus: string(plugin.OperationalStatus),
OperationalStatusUpdates: plugin.OperationalStatusUpdates,
URL: plugin.URL,
Tier: plugin.Tier,
Description: plugin.Description,
Icon: plugin.Icon,
Availability: plugin.Availability,
SourceCode: plugin.SourceCode,
PackageType: plugin.PackageType,
DescriberURL: plugin.DescriberURL,
})
}
totalCount := len(items)
Expand Down Expand Up @@ -595,12 +603,20 @@ func (a *API) GetPlugin(c echo.Context) error {
}

return c.JSON(http.StatusOK, models.IntegrationPlugin{
PluginId: plugin.PluginID,
ID: plugin.ID,
PluginID: plugin.PluginID,
IntegrationType: plugin.IntegrationType.String(),
InstallState: string(plugin.InstallState),
OperationalStatus: string(plugin.OperationalStatus),
OperationalStatusUpdates: plugin.OperationalStatusUpdates,
URL: plugin.URL,
Tier: plugin.Tier,
Description: plugin.Description,
Icon: plugin.Icon,
Availability: plugin.Availability,
SourceCode: plugin.SourceCode,
PackageType: plugin.PackageType,
DescriberURL: plugin.DescriberURL,
})
}

Expand Down
28 changes: 21 additions & 7 deletions services/integration/api/models/integration_plugin.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
package models



type IntegrationPlugin struct {
PluginId string `json:"plugin_id"`
IntegrationType string `json:"integration_type"`
InstallState string `json:"install_state"`
OperationalStatus string `json:"operational_state"`
OperationalStatusUpdates []string `json:"operational_status_updates"`
URL string `json:"url"`
ID int `json:"id"`
PluginID string `json:"plugin_id"`
IntegrationType string `json:"integration_type"`
Name string `json:"name"`
Tier string `json:"tier"`
Description string `json:"description"`
Icon string `json:"icon"`
Availability string `json:"availability"`
SourceCode string `json:"source_code"`
PackageType string `json:"package_type"`
InstallState string `json:"install_state"`
OperationalStatus string `json:"operational_status"`
URL string `json:"url"`
DescriberURL string `json:"describer_url"`
DescriberTag string `json:"describer_tag"`

OperationalStatusUpdates []string


}

type IntegrationPluginListResponse struct {
Items []IntegrationPlugin `json:"items"`
TotalCount int `json:"total_count"`
}
}

0 comments on commit 7be4063

Please sign in to comment.