Record Class HttpSourceConfig
- Record Components:
url- the URL; may contain${ENV_VAR}references; must not be blankmethod- the HTTP method (GET, POST or QUERY — Relix is read-only); must not be nullheaders- static request headers; may be emptyextract- how to locate records in the response body; absent means the JSON-file default (top-level array or object)paginate- optional pagination parameter mapping; absent means unpaginatedcolumns- the ordered column specifications; may be empty, which selects an open (schema-on-read) sourcebody- the request body (forPOST/QUERYreads, e.g. a GraphQL/search query); absent means no bodyauth- an authentication shorthand; absent means none (or expressed via a rawAuthorizationheader)
- All Implemented Interfaces:
SourceConfig
Full example:
source current_weather from http {
url: "https://api.openweathermap.org/data/2.5/weather",
method: GET,
headers: { "Accept": "application/json" },
auth: apikey("X-API-Key", "${WEATHER_API_KEY}"),
extract: json("$.items"),
schema: {
temp: NUMBER at "$.main.temp",
condition: STRING at "$.weather[0].description"
}
};
The schema block is optional: when omitted the
source is open (schema-on-read) — each record becomes a document row
navigated by JSONPath at query time. When present, the source is a closed,
typed relation whose columns are extracted by their at "$.path"
bindings.
The extract spec is also optional: when omitted the response body
is parsed as JSON and a top-level array (or single object) is treated as the
records, exactly like a local JSON file source.
Header, URL, body, and auth values may contain ${VAR} placeholders. They
are resolved when a query runs, from the selected environment in the command-line
tool and through the resolver an embedding session was built with
(Relix.Builder.placeholders), and the declaration keeps the placeholder.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpSourceConfig(String url, HttpMethod method, Map<String, String> headers, ExtractSpec extract, Optional<PaginateSpec> paginate, List<ColumnSpec> columns) Back-compatible convenience constructor with a required (non-optional) extract spec and no body/auth — retained so existing callers and fixtures compile unchanged.HttpSourceConfig(String url, HttpMethod method, Map<String, String> headers, Optional<ExtractSpec> extract, Optional<PaginateSpec> paginate, List<ColumnSpec> columns, Optional<String> body, Optional<AuthSpec> auth) Creates an instance of aHttpSourceConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionauth()Returns the value of theauthrecord component.body()Returns the value of thebodyrecord component.columns()Returns the value of thecolumnsrecord component.final booleanIndicates whether some other object is "equal to" this one.extract()Returns the value of theextractrecord component.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.booleanisOpen()Returnstrueif this source declares no columns and is therefore an open (schema-on-read) source whose rows are navigated by JSONPath.method()Returns the value of themethodrecord component.paginate()Returns the value of thepaginaterecord component.final StringtoString()Returns a string representation of this record class.url()Returns the value of theurlrecord component.
-
Constructor Details
-
HttpSourceConfig
public HttpSourceConfig(String url, HttpMethod method, Map<String, String> headers, Optional<ExtractSpec> extract, Optional<PaginateSpec> paginate, List<ColumnSpec> columns, Optional<String> body, Optional<AuthSpec> auth) Creates an instance of aHttpSourceConfigrecord class.- Parameters:
url- the value for theurlrecord componentmethod- the value for themethodrecord componentheaders- the value for theheadersrecord componentextract- the value for theextractrecord componentpaginate- the value for thepaginaterecord componentcolumns- the value for thecolumnsrecord componentbody- the value for thebodyrecord componentauth- the value for theauthrecord component
-
HttpSourceConfig
public HttpSourceConfig(String url, HttpMethod method, Map<String, String> headers, ExtractSpec extract, Optional<PaginateSpec> paginate, List<ColumnSpec> columns) Back-compatible convenience constructor with a required (non-optional) extract spec and no body/auth — retained so existing callers and fixtures compile unchanged.- Parameters:
url- the URLmethod- the HTTP methodheaders- static request headersextract- the extract specpaginate- optional pagination mappingcolumns- the column specifications (may be empty for an open source)
-
-
Method Details
-
isOpen
public boolean isOpen()Returnstrueif this source declares no columns and is therefore an open (schema-on-read) source whose rows are navigated by JSONPath.- Returns:
- whether the source is open
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
url
Returns the value of theurlrecord component.- Returns:
- the value of the
urlrecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
extract
Returns the value of theextractrecord component.- Returns:
- the value of the
extractrecord component
-
paginate
Returns the value of thepaginaterecord component.- Returns:
- the value of the
paginaterecord component
-
columns
Returns the value of thecolumnsrecord component.- Returns:
- the value of the
columnsrecord component
-
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-
auth
Returns the value of theauthrecord component.- Returns:
- the value of the
authrecord component
-