InvokableScriptsAPI

public class 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.

  • Create a script.

    Declaration

    Swift

    public func createScript(createRequest: ScriptCreateRequest,
                             responseQueue: DispatchQueue = .main,
                             completion: @escaping (
                                     _ result: Swift.Result<Script?, InfluxDBClient.InfluxDBError>) -> Void)

    Parameters

    createRequest

    The script to create.

    responseQueue

    The queue on which api response is dispatched.

    completion

    completion handler to receive the created Script or the error object

  • Create a script.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func createScript(createRequest: ScriptCreateRequest,
                             responseQueue: DispatchQueue = .main) async throws -> Script?

    Parameters

    createRequest

    The script to create.

    responseQueue

    The queue on which api response is dispatched.

    Return Value

    Script

  • Update a script.

    Declaration

    Swift

    public func updateScript(scriptId: String,
                             updateRequest: ScriptUpdateRequest,
                             responseQueue: DispatchQueue = .main,
                             completion: @escaping (
                                     _ result: Swift.Result<Script?, InfluxDBClient.InfluxDBError>) -> Void)

    Parameters

    scriptId

    The ID of the script to update. (required)

    updateRequest

    Script updates to apply (required)

    responseQueue

    The queue on which api response is dispatched.

    completion

    completion handler to receive the updated Script or the error object

  • Update a script.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func updateScript(scriptId: String,
                             updateRequest: ScriptUpdateRequest,
                             responseQueue: DispatchQueue = .main) async throws -> Script?

    Parameters

    scriptId

    The ID of the script to update. (required)

    updateRequest

    Script updates to apply (required)

    responseQueue

    The queue on which api response is dispatched.

    Return Value

    Script

  • List scripts

    Declaration

    Swift

    public func findScripts(limit: Int? = nil,
                            offset: Int? = nil,
                            responseQueue: DispatchQueue = .main,
                            completion: @escaping (
                                    _ result: Swift.Result<Scripts?, InfluxDBClient.InfluxDBError>) -> Void)

    Parameters

    limit

    (query) The number of scripts to return. (optional)

    offset

    (query) The offset for pagination. (optional)

    responseQueue

    The queue on which api response is dispatched.

    completion

    completion handler to receive the list of Scripts or the error object

  • List scripts

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func findScripts(limit: Int? = nil,
                            offset: Int? = nil,
                            responseQueue: DispatchQueue = .main) async throws -> Scripts?

    Parameters

    limit

    (query) The number of scripts to return. (optional)

    offset

    (query) The offset for pagination. (optional)

    responseQueue

    The queue on which api response is dispatched.

    Return Value

    Scripts

  • Delete a script

    Declaration

    Swift

    public func deleteScript(scriptId: String,
                             responseQueue: DispatchQueue = .main,
                             completion: @escaping (
                                     _ result: Swift.Result<Void, InfluxDBClient.InfluxDBError>) -> Void)
  • Delete a script

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func deleteScript(scriptId: String,
                             responseQueue: DispatchQueue = .main) async throws
  • Invoke asynchronously a script and return result as a Cursor<FluxRecord>.

    Declaration

    Swift

    public func invokeScript(scriptId: String,
                             params: [String: String]? = nil,
                             responseQueue: DispatchQueue = .main,
                             completion: @escaping (
                                     _ result: Swift.Result<QueryAPI.FluxRecordCursor, InfluxDBClient.InfluxDBError>)
                             -> Void)

    Parameters

    scriptId

    The ID of the script to invoke. (required)

    params

    params represent key/value pairs parameters to be injected into script

    responseQueue

    The queue on which api response is dispatched.

    completion

    completion handler to receive the Swift.Result

  • Invoke asynchronously a script and return result as a Cursor<FluxRecord>.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func invokeScript(scriptId: String,
                             params: [String: String]? = nil,
                             responseQueue: DispatchQueue = .main) async throws -> QueryAPI.FluxRecordCursor

    Parameters

    scriptId

    The ID of the script to invoke. (required)

    params

    params represent key/value pairs parameters to be injected into script

    responseQueue

    The queue on which api response is dispatched.

    Return Value

    Cursor<FluxRecord>

  • Invoke asynchronously a script and return result as a Data.

    Declaration

    Swift

    public func invokeScriptRaw(scriptId: String,
                                params: [String: String]? = nil,
                                responseQueue: DispatchQueue = .main,
                                completion: @escaping (
                                        _ result: Swift.Result<Data, InfluxDBClient.InfluxDBError>) -> Void)

    Parameters

    scriptId

    The ID of the script to invoke. (required)

    params

    params represent key/value pairs parameters to be injected into script

    responseQueue

    The queue on which api response is dispatched.

    completion

    completion handler to receive the Swift.Result

  • Invoke asynchronously a script and return result as a Data.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func invokeScriptRaw(scriptId: String,
                                params: [String: String]? = nil,
                                responseQueue: DispatchQueue = .main) async throws -> Data

    Parameters

    scriptId

    The ID of the script to invoke. (required)

    params

    params represent key/value pairs parameters to be injected into script

    responseQueue

    The queue on which api response is dispatched.

    Return Value

    Data