Interface InvokableScriptsApi


@ThreadSafe public interface InvokableScriptsApi
Use API invokable scripts to create custom InfluxDB API endpoints that query, process, and shape data.

API invokable scripts let you assign scripts to API endpoints and then execute them as standard REST operations in InfluxDB Cloud.

Author:
Jakub Bednar (bednar@github) (03/21/2022 07:54)
  • Method Details

    • createScript

      @Nonnull Script createScript(@Nonnull ScriptCreateRequest createRequest)
      Create a script.
      Parameters:
      createRequest - The script to create. (required)
      Returns:
      The created script.
    • updateScript

      @Nonnull Script updateScript(@Nonnull String scriptId, @Nonnull ScriptUpdateRequest updateRequest)
      Update a script.
      Parameters:
      scriptId - The ID of the script to update. (required)
      updateRequest - Script updates to apply (required)
      Returns:
      The updated script.
    • findScripts

      @Nonnull List<Script> findScripts()
      List scripts.
      Returns:
      scripts
    • findScripts

      @Nonnull List<Script> findScripts(@Nonnull InvokableScriptsQuery query)
      List scripts.
      Parameters:
      query - to filtering results
      Returns:
      scripts
    • deleteScript

      void deleteScript(@Nonnull String scriptId)
      Delete a script.
      Parameters:
      scriptId - The ID of the script to delete. (required)
    • invokeScript

      @Nonnull List<FluxTable> invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params)
      Executes the script and synchronously map whole response to List<FluxTable>.

      NOTE: This method is not intended for large query results. Use invokeScript(String, Map, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      Returns:
      List<FluxTable>
    • invokeScript

      void invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext)
      Executes the script and asynchronously stream FluxRecords to onNext consumer.
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      onNext - the callback to consume the FluxRecord result with capability to discontinue a streaming invocation
    • invokeScript

      void invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the script and asynchronously stream FluxRecords to onNext consumer.
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      onNext - the callback to consume the FluxRecord result with capability to discontinue a streaming invocation
      onError - the callback to consume any error notification
      onComplete - the callback to consume a notification about successfully end of stream
    • invokeScript

      @Nonnull <M> List<M> invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull Class<M> measurementType)
      Executes the script and synchronously map whole response to list of object with given type.

      NOTE: This method is not intended for large query results. Use invokeScript(String, Map, Class, BiConsumer, Consumer, Runnable) for large data streaming.

      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      measurementType - the type of measurement
      Returns:
      List<T>
    • invokeScript

      <M> void invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext)
      Executes the script and asynchronously stream POJO classes to onNext consumer.
      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      measurementType - the type of measurement
      onNext - the callback to consume the mapped Measurements with capability to discontinue a streaming invocation
    • invokeScript

      <M> void invokeScript(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the script and asynchronously stream POJO classes to onNext consumer.
      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      measurementType - the type of measurement
      onNext - the callback to consume the mapped Measurements with capability to discontinue a streaming invocation
      onError - the callback to consume any error notification
      onComplete - the callback to consume a notification about successfully end of stream
    • invokeScriptRaw

      @Nonnull String invokeScriptRaw(@Nonnull String scriptId, @Nullable Map<String,Object> params)
      Executes the script and synchronously map whole response to String result.

      NOTE: This method is not intended for large query results. Use invokeScriptRaw(String, Map, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      Returns:
      the raw response that matched the invocation
    • invokeScriptRaw

      void invokeScriptRaw(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull BiConsumer<Cancellable,String> onResponse)
      Executes the script and asynchronously stream response (line by line) to onResponse.
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      onResponse - callback to consume the response line by line with capability to discontinue a streaming query
    • invokeScriptRaw

      void invokeScriptRaw(@Nonnull String scriptId, @Nullable Map<String,Object> params, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the script and asynchronously stream response (line by line) to onResponse.
      Parameters:
      scriptId - The ID of the script to invoke. (required)
      params - bind parameters
      onResponse - callback to consume the response line by line with capability to discontinue a streaming query
      onError - the callback to consume any error notification
      onComplete - the callback to consume a notification about successfully end of stream