2 * Copyright (c) 2010-2024 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.tapocontrol.internal.dto;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import com.google.gson.GsonBuilder;
18 import com.google.gson.annotations.Expose;
20 import io.reactivex.annotations.Nullable;
23 * Holds data sent to device
25 * @author Christian Wild - Initial contribution
28 public record TapoRequest(@Expose String method, @Expose @Nullable Object params,
29 @Expose long requestTimeMils) implements TapoBaseRequestInterface {
32 * Create request with command (method) and data (params) sent to device
34 public TapoRequest(String method, Object params) {
35 this(method, params, System.currentTimeMillis());
39 * Create request with command (method) sent to device
41 public TapoRequest(String method) {
42 this(method, "", System.currentTimeMillis());
45 /***********************************************
47 **********************************************/
50 public String toString() {
54 public String toJson() {
55 return new GsonBuilder().disableHtmlEscaping().excludeFieldsWithoutExposeAnnotation().create().toJson(this);