2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.nuki.internal.dataexchange;
15 import java.util.Collections;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.nuki.internal.dto.BridgeApiListDeviceDto;
23 * The {@link BridgeListResponse} class wraps {@link BridgeApiListDeviceDto} class.
25 * @author Jan Vybíral - Initial contribution
28 public class BridgeListResponse extends NukiBaseResponse {
30 private final List<BridgeApiListDeviceDto> devices;
32 public BridgeListResponse(int status, @Nullable String message, @Nullable List<BridgeApiListDeviceDto> devices) {
33 super(status, message);
34 setSuccess(devices != null);
35 this.devices = devices == null ? Collections.emptyList() : Collections.unmodifiableList(devices);
38 public BridgeListResponse(NukiBaseResponse nukiBaseResponse) {
39 this(nukiBaseResponse.getStatus(), nukiBaseResponse.getMessage(), null);
42 public List<BridgeApiListDeviceDto> getDevices() {
46 public @Nullable BridgeApiListDeviceDto getDevice(String nukiId) {
47 for (BridgeApiListDeviceDto device : this.devices) {
48 if (device.getNukiId().equals(nukiId)) {