Skip to content

Commit

Permalink
Merge pull request #13 from eliona-smart-building-assistant/dashboard…
Browse files Browse the repository at this point in the history
…_template_names

Dashboard template names
  • Loading branch information
airvine-leicom authored Apr 13, 2023
2 parents 75bdc36 + 1783bfc commit a67af14
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 47 deletions.
2 changes: 0 additions & 2 deletions apiserver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type ConfigurationApiRouter interface {
// pass the data to a CustomizationApiServicer to perform the required actions, then write the service results to the http response.
type CustomizationApiRouter interface {
GetDashboardTemplateByName(http.ResponseWriter, *http.Request)
GetDashboardTemplateNames(http.ResponseWriter, *http.Request)
}

// SpacesApiRouter defines the required methods for binding the api requests to a responses for the SpacesApi
Expand Down Expand Up @@ -66,7 +65,6 @@ type ConfigurationApiServicer interface {
// and updated with the logic required for the API.
type CustomizationApiServicer interface {
GetDashboardTemplateByName(context.Context, string, string) (ImplResponse, error)
GetDashboardTemplateNames(context.Context) (ImplResponse, error)
}

// SpacesApiServicer defines the api actions for the SpacesApi service
Expand Down
19 changes: 0 additions & 19 deletions apiserver/api_customization.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ func (c *CustomizationApiController) Routes() Routes {
"/v1/dashboard-templates/{dashboard-template-name}",
c.GetDashboardTemplateByName,
},
{
"GetDashboardTemplateNames",
strings.ToUpper("Get"),
"/v1/dashboard-template-names",
c.GetDashboardTemplateNames,
},
}
}

Expand All @@ -81,16 +75,3 @@ func (c *CustomizationApiController) GetDashboardTemplateByName(w http.ResponseW
EncodeJSONResponse(result.Body, &result.Code, w)

}

// GetDashboardTemplateNames - List available dashboard templates
func (c *CustomizationApiController) GetDashboardTemplateNames(w http.ResponseWriter, r *http.Request) {
result, err := c.service.GetDashboardTemplateNames(r.Context())
// If an error occurred, encode the error with the status code
if err != nil {
c.errorHandler(w, r, err, &result)
return
}
// If no error, encode the body and the result code
EncodeJSONResponse(result.Body, &result.Code, w)

}
7 changes: 1 addition & 6 deletions apiservices/api_customization_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ package apiservices

import (
"context"
"thingdust/eliona"
"net/http"
"thingdust/apiserver"
"thingdust/eliona"
)

// CustomizationApiService is a service that implements the logic for the CustomizationApiServicer
Expand All @@ -39,8 +39,3 @@ func (s *CustomizationApiService) GetDashboardTemplateByName(ctx context.Context
return apiserver.ImplResponse{Code: http.StatusNotFound}, nil
}
}

// GetDashboardTemplateNames - List available dashboard templates
func (s *CustomizationApiService) GetDashboardTemplateNames(ctx context.Context) (apiserver.ImplResponse, error) {
return apiserver.Response(http.StatusOK, []string{"Thingdust"}), nil
}
6 changes: 5 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
"de": "Thingdust App"
},
"description": {
"en": "The Thingdust app allows access to data from Thingust spaces and displays this data on the eliona dashboard.",
"en": "The Thingdust app allows access to data from Thingdust spaces and displays this data on the eliona dashboard.",
"de": "Die Thingdust App ermöglicht den Zugriff auf Daten von Thingdust Spaces und stellt die Daten auf der Eliona dashboard dar."
},
"dashboardTemplateNames": [
"Thingdust"
],
"documentationUrl": "https://doc.eliona.io/collection/eliona-apps/externe-apps/thingdust",
"useEnvironment": [ "CONNECTION_STRING", "API_ENDPOINT", "API_TOKEN" ]
}
19 changes: 0 additions & 19 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,6 @@ paths:
type: array
items:
$ref: '#/components/schemas/Space'

/dashboard-template-names:
get:
tags:
- Customization
summary: List available dashboard templates
description: Delivers all names for which the app provides dashboard templates.
operationId: getDashboardTemplateNames
responses:
"200":
description: Successfully returned list of template names
content:
application/json:
schema:
description: Names of available dashboard templates
type: array
items:
description: Name of the dashboard template
type: string

/dashboard-templates/{dashboard-template-name}:
get:
Expand Down

0 comments on commit a67af14

Please sign in to comment.