Commit 29cdfe1c authored by Ikram Haq's avatar Ikram Haq
Browse files

Store service API descriptions in DiscoveredAPIs struct and send response.

parent 20ba6353
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
/*
 * MEC service management realized by CAPIF APIs
 *
 * The ETSI MEC ISG MEC011 MEC Service Management realized by CAPIF APIs described using OpenAPI
 *
 * API version: 3.2.1
 * Contact: cti_support@etsi.org
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

// DiscoveredAPIs represents the structure for discovered APIs
type DiscoveredAPIs struct {
	// ServiceAPIDescriptions is an optional array of service API descriptions as published by the service.
	// NOTE: For the CAPIF_Discover_Service_API, the supportedFeatures attribute of the ServiceAPIDescription data type
	// shall be provided in the HTTP GET response of a successful query.
	// Additionally, supportedFeatures may include one or more supported features as defined in clause 8.1.6.
	ServiceAPIDescriptions []ServiceApiDescription `json:"serviceAPIDescriptions,omitempty"`
}
+5 −2
Original line number Diff line number Diff line
@@ -1825,9 +1825,12 @@ func getServices(w http.ResponseWriter, r *http.Request, appId string) {
		}
		serviceApiDescriptions = append(serviceApiDescriptions, apiDesc)
	}

	// Store the response in the DiscoveredAPIs struct
	discoveredAPIs := DiscoveredAPIs{
		ServiceAPIDescriptions: serviceApiDescriptions,
	}
	// Prepare & send response
	jsonResponse, err := json.Marshal(serviceApiDescriptions)
	jsonResponse, err := json.Marshal(discoveredAPIs)
	if err != nil {
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)