open-index/open-npm huggingface dataset:
npm package: @jolie/influxdb
Description: Connector Jolie for InfluxDB
Author: Balint Maschio
Latest version: 0.0.9

# jolie-influxdb


This is the Jolie language influx connector 

# Installation

```jpm add @jolie/influxdb```

# Usage

```from @jolie.influxdb.jolie-influxdb import InfluxDBConnector```

# Operations 

```jolie

interface InfluxDBInterface{
RequestResponse:
  connect (ConnectRequest)(ConnectResponse),
  write(WriteRequest)(WriteResponse),
  query(QueryRequest)(QueryResponse)
}
```

## connect

This operation allows your service to connect to the to your instance of InfluxDB
 
 ```jolie
type ConnectRequest:void{
  token:string
  org:string
  url:string
  bucket:string
}
 ```

example

 ```jolie
    connect@influxdb({
        token = "I0kn4_sybERDjvNrG44LWsDax6ozSNsDvcVewqyIn3WlEJ1c6K37pUOGK7K6d7EJHhZh8iQEcpBFWJzz5O1fqg=="
        org = "org"
        url = "http://localhost:8086"
        bucket = "test"
    })()
 ```

## write

This operation allows the user to write on InfluxDB

 ```jolie
type WriteRequest:void {
 measurement:string
 values*:void{
   time?:long
   fields:undefined
 }
}
 ```
example 

 ```jolie
    write@influxdb({
        measurement = "example"
        values.fields.sensor1= 100
        values.fields.sensor2= 2.0
    })()
 ```

the time can be express as long epoc value if not present like in the example the connector with
assign the current in time

## query
```jolie
type QueryRequest:void{
 .query:string
}
```
the query uses influxDB query format
example

```jolie
query@influxdb({
          query = "from(bucket: \"test\") |> range(start: -1h) |> filter(fn: (r) => r[\"_measurement\"] == \"example\")" 
        })(responseQuery)
```

the response type is

```jolie
type QueryResponse:void{
  tables*:void{
      values*:void{
        time?:long
        field:undefined
      }
  }
}
```