Class JsonrpcRequest

Direct Known Subclasses:
AddAppInstance.Request, AddAppInstanceRequest, AddEdgeToUserRequest, AppCenterAddDeinstallInstanceHistoryRequest, AppCenterAddInstallInstanceHistoryRequest, AppCenterAddRegisterKeyHistoryRequest, AppCenterAddUnregisterKeyHistoryRequest, AppCenterGetInstalledAppsRequest, AppCenterGetPossibleAppsRequest, AppCenterGetRegisteredKeysRequest, AppCenterInstallAppWithSuppliedKeyRequest, AppCenterIsAppFreeRequest, AppCenterIsKeyApplicableRequest, AppCenterRequest, AuthenticatedRpcRequest, AuthenticateWithPasswordRequest, AuthenticateWithTokenRequest, ChannelExportXlsxRequest, ComponentJsonApiRequest, CreateComponentConfigRequest, DeleteAppInstance.Request, DeleteComponentConfigRequest, EdgeRpcRequest, ExecuteSimulationRequest, ExecuteSystemCommandRequest, ExecuteSystemUpdateRequest, GenericJsonrpcRequest, GetApp.Request, GetAppAssistant.Request, GetAppDescriptor.Request, GetAppInstances.Request, GetApps.Request, GetDevicesRequest, GetEdgeConfigRequest, GetEdgeRequest, GetEdgesChannelsValuesRequest, GetEdgesRequest, GetEdgesStatusRequest, GetFieldNamesRequest, GetMetersRequest, GetModbusProtocolExportXlsxRequest, GetModbusProtocolRequest, GetNetworkConfigRequest, GetScheduleRequest, GetSetupProtocolDataRequest, GetSetupProtocolRequest, GetSystemUpdateStateRequest, GetUserAlertingConfigsRequest, GetUserInformationRequest, LogoutRequest, QueryHistoricTimeseriesDataRequest, QueryHistoricTimeseriesEnergyPerPeriodRequest, QueryHistoricTimeseriesEnergyRequest, QueryHistoricTimeseriesExportXlxsRequest, RegisterUserRequest, SetChannelValueRequest, SetGridConnScheduleRequest, SetNetworkConfigRequest, SetUserAlertingConfigsRequest, SetUserInformationRequest, SubmitSetupProtocolRequest, SubscribeChannelsRequest, SubscribeEdgesChannelsRequest, SubscribeEdgesRequest, SubscribeEdgesRequest, SubscribeSystemLogRequest, SystemUpdateRequest, UpdateAppInstance.Request, UpdateComponentConfigRequest, UpdateUserLanguageRequest, UpdateUserSettingsRequest

public abstract class JsonrpcRequest extends AbstractJsonrpcRequest
Represents a JSON-RPC Request.
 {
   "jsonrpc": "2.0",
   "id": "UUID",
   "method": string,
   "params": {},
   "timeout"?: number, defaults to 60 seconds; negative or zero to disable timeout
 }
 
See Also:
  • Field Details

  • Constructor Details

    • JsonrpcRequest

      public JsonrpcRequest(String method)
      Creates a JsonrpcRequest with random UUID as id and DEFAULT_TIMEOUT_SECONDS timeout.
      Parameters:
      method - the JSON-RPC method
    • JsonrpcRequest

      public JsonrpcRequest(String method, int timeout)
      Creates a JsonrpcRequest with random UUID as id.
      Parameters:
      method - the JSON-RPC method
      timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout
    • JsonrpcRequest

      public JsonrpcRequest(String method, Optional<Integer> timeout)
      Creates a JsonrpcRequest with random UUID as id.
      Parameters:
      method - the JSON-RPC method
      timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout, empty for DEFAULT_TIMEOUT_SECONDS timeout
    • JsonrpcRequest

      public JsonrpcRequest(UUID id, String method, Optional<Integer> timeoutOpt)
      Creates a JsonrpcRequest.
      Parameters:
      id - the JSON-RPC id
      method - the JSON-RPC method
      timeoutOpt - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout, empty for DEFAULT_TIMEOUT_SECONDS timeout
    • JsonrpcRequest

      protected JsonrpcRequest(JsonrpcRequest request, String method)
      Creates a JsonrpcRequest by copying and validating header information.
      • copies id and timeout
      • validates that the method names match
      Parameters:
      request - the template JSON-RPC Request
      method - the JSON-RPC method
    • JsonrpcRequest

      public JsonrpcRequest(UUID id, String method, int timeout)
      Creates a JsonrpcRequest.
      Parameters:
      id - the JSON-RPC id
      method - the JSON-RPC method
      timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout
  • Method Details

    • getId

      public UUID getId()
      Gets the JSON-RPC id.
      Returns:
      the UUID id
    • getTimeout

      public Optional<Integer> getTimeout()
      Gets the max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout.
      Returns:
      the timeout in seconds
    • toJsonObject

      public com.google.gson.JsonObject toJsonObject()
      Description copied from class: JsonrpcMessage
      Gets the JsonObject representation of this JsonrpcMessage.
      Overrides:
      toJsonObject in class AbstractJsonrpcRequest
      Returns:
      a JsonObject