use of org.eclipse.smarthome.io.rest.Stream2JSONInputStream in project smarthome by eclipse.
the class BindingResource method getAll.
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get all bindings.", response = BindingInfoDTO.class, responseContainer = "Set")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = BindingInfoDTO.class, responseContainer = "Set") })
public Response getAll(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language) {
final Locale locale = LocaleUtil.getLocale(language);
Set<BindingInfo> bindingInfos = bindingInfoRegistry.getBindingInfos(locale);
return Response.ok(new Stream2JSONInputStream(bindingInfos.stream().map(b -> map(b, locale)))).build();
}
use of org.eclipse.smarthome.io.rest.Stream2JSONInputStream in project smarthome by eclipse.
the class ChannelTypeResource method getAll.
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets all available channel types.", response = ChannelTypeDTO.class, responseContainer = "Set")
@ApiResponses(value = @ApiResponse(code = 200, message = "OK", response = ChannelTypeDTO.class, responseContainer = "Set"))
public Response getAll(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = HttpHeaders.ACCEPT_LANGUAGE) String language) {
Locale locale = LocaleUtil.getLocale(language);
Stream<ChannelTypeDTO> channelStream = channelTypeRegistry.getChannelTypes(locale).stream().map(c -> convertToChannelTypeDTO(c, locale));
return Response.ok(new Stream2JSONInputStream(channelStream)).build();
}
use of org.eclipse.smarthome.io.rest.Stream2JSONInputStream in project smarthome by eclipse.
the class ExtensionResource method getTypes.
@GET
@Path("/types")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get all extension types.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class) })
public Response getTypes(@HeaderParam("Accept-Language") @ApiParam(value = "language") String language) {
logger.debug("Received HTTP GET request at '{}'", uriInfo.getPath());
Locale locale = LocaleUtil.getLocale(language);
Stream<ExtensionType> extensionTypeStream = getAllExtensionTypes(locale).stream().distinct();
return Response.ok(new Stream2JSONInputStream(extensionTypeStream)).build();
}
use of org.eclipse.smarthome.io.rest.Stream2JSONInputStream in project smarthome by eclipse.
the class ThingTypeResource method getAll.
@GET
@RolesAllowed({ Role.USER })
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets all available thing types without config description, channels and properties.", response = StrippedThingTypeDTO.class, responseContainer = "Set")
@ApiResponses(value = @ApiResponse(code = 200, message = "OK", response = StrippedThingTypeDTO.class, responseContainer = "Set"))
public Response getAll(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = HttpHeaders.ACCEPT_LANGUAGE) String language) {
Locale locale = LocaleUtil.getLocale(language);
Stream<StrippedThingTypeDTO> typeStream = thingTypeRegistry.getThingTypes(locale).stream().map(t -> convertToStrippedThingTypeDTO(t, locale));
return Response.ok(new Stream2JSONInputStream(typeStream)).build();
}
Aggregations