Mainflux.mainflux/version.go

32 lines
675 B
Go
Raw Normal View History

// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package mainflux
import (
"encoding/json"
"net/http"
)
const version string = "0.11.0"
MF-757 - Add support for explicit content type (#771) * Add format to raw message and content type mapping Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format as part of content type header Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format to content-type header for WS adapter Add format as part of content-type and add support for content-type header and query parameter. Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for format and content-type in MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format and content-type to CoAP adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add documentation for content type and format Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add comments to MQTT code Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Fix SenML JSON CoAP code type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the adapters Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the docs Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format field from MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update content type to be optional Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for CBOR content type in the normalizer Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update docs for MQTT content type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
2019-07-25 08:22:28 +08:00
// VersionInfo contains version endpoint response.
type VersionInfo struct {
MF-757 - Add support for explicit content type (#771) * Add format to raw message and content type mapping Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format as part of content type header Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format to content-type header for WS adapter Add format as part of content-type and add support for content-type header and query parameter. Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for format and content-type in MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format and content-type to CoAP adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add documentation for content type and format Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add comments to MQTT code Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Fix SenML JSON CoAP code type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the adapters Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the docs Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format field from MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update content type to be optional Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for CBOR content type in the normalizer Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update docs for MQTT content type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
2019-07-25 08:22:28 +08:00
// Service contains service name.
Service string `json:"service"`
MF-757 - Add support for explicit content type (#771) * Add format to raw message and content type mapping Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format as part of content type header Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format to content-type header for WS adapter Add format as part of content-type and add support for content-type header and query parameter. Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for format and content-type in MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format and content-type to CoAP adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add documentation for content type and format Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add comments to MQTT code Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Fix SenML JSON CoAP code type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the adapters Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the docs Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format field from MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update content type to be optional Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for CBOR content type in the normalizer Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update docs for MQTT content type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
2019-07-25 08:22:28 +08:00
// Version contains service current version value.
Version string `json:"version"`
}
// Version exposes an HTTP handler for retrieving service version.
func Version(service string) http.HandlerFunc {
return http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
res := VersionInfo{service, version}
data, _ := json.Marshal(res)
rw.Write(data)
})
}