Skip to content

Commit

Permalink
add full fledged HTTP client
Browse files Browse the repository at this point in the history
  • Loading branch information
aeberhart committed Mar 21, 2024
1 parent 7a7bcdf commit 5b1c15b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
31 changes: 31 additions & 0 deletions dashjoin-core/src/main/java/org/dashjoin/function/Credentials.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.dashjoin.function;

import org.dashjoin.model.JsonSchema;

/**
* allows storing credentials for OpenJson etc.
*/
public class Credentials extends AbstractConfigurableFunction<Void, Void> {

/**
* optional HTTP basic authentication user name
*/
@JsonSchema(style = {"width", "400px"})
public String username;

/**
* optional HTTP basic authentication password
*/
@JsonSchema(widget = "password", style = {"width", "400px"})
public String password;

@Override
public Void run(Void arg) throws Exception {
return null;
}

@Override
public Class<Void> getArgumentClass() {
return Void.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ org.dashjoin.expression.ExpressionService$Traverse
org.dashjoin.expression.ExpressionService$Incoming
org.dashjoin.expression.ExpressionService$Call
org.dashjoin.function.Email
org.dashjoin.function.Credentials
org.dashjoin.function.RestJson
org.dashjoin.function.ConsoleLog
org.dashjoin.function.CollectMetadata
Expand Down
10 changes: 10 additions & 0 deletions dashjoin-docs/docs/developer-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ Return value

* expression result

#### Credentials

Allows saving credentials that can be references by other functions.

Configuration:

* username: credential username
* password: credential password

### Mapping Functions

Mapping functions are specialized functions that have no invocation parameters and outputs.
Expand Down Expand Up @@ -723,6 +732,7 @@ streamJson | $streamJson(url, jsonPointer) | Parses JSON at the url and splits i
streamXml | $streamXml(url, jsonPointer) | Parses XML at the url, converts it to JSON, and splits it at the [json pointer](https://datatracker.ietf.org/doc/html/rfc6901) location
streamCsv | $streamCsv(url, options) | Parses CSV at the url and splits it at the record boundaries. By default, CSV is parsed as RFC4180. Options can be provided, where the key is a "with" method like withDelimiter and the value is the argument. Please see the [documentation](https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html) for more details.
streamDb | $streamDb(database, table) | Streams records from the database table specified
curl | $curl(method, url, data?, headers?) | Full fledged HTTP client. Use {"Authorization": credential} to reference a credential set defined in functions
openJson | $openJson(url) | Parses JSON at the url
openCsv | $openCsv(url, options) | Parses CSV at the url and converts it to JSON. By default, CSV is parsed as RFC4180. Options can be provided, where the key is a "with" method like withDelimiter and the value is the argument. Please see the [documentation](https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html) for more details.
openXml | $openXml(url, arrays) | Parses XML at the url and converts it to JSON. In this process, openXml guesses which XML tags need to be converted to arrays and which become simple fields. This process might produce inconsistent results when the XML tree contains lists with single entries. To avoid this, you can optionally pass a list of tag names that must be arrays.
Expand Down

0 comments on commit 5b1c15b

Please sign in to comment.