graphdb
Version:
Javascript client library supporting GraphDB and RDF4J REST API.
87 lines (86 loc) • 2.59 kB
TypeScript
export = QueryPayload;
/**
* Base class from which all query payload classes derives.
* Subclasses must implement {@link #getSupportedContentTypes}
* and may override {@link #validatePayload} if additional validation is needed
* according to the subclass.
*
* @abstract
* @class
* @author Mihail Radkov
* @author Svilen Velikov
*/
declare class QueryPayload {
/**
* Holds common request parameters applicable to the query endpoint.
*
* @type {Object}
*/
params: any;
/**
* Holds the SPARQL query to be used in the request to the query endpoint.
*
* @type {string|undefined}
*/
query: string | undefined;
/**
* Holds the content type value to be used in the request to the query
* endpoint. This value will be set as the HTTP 'Content-Type' header when
* sending the request. The value is one of the {@link QueryContentType}
* enum values.
*
* @type {string}
*/
contentType: string;
/**
* @param {boolean} [inference] Specifies whether inferred statements should
* be included in the query evaluation.
* @return {QueryPayload}
*/
setInference(inference?: boolean): QueryPayload;
/**
* @param {number} [timeout] Specifies a maximum query execution time, in
* whole seconds.
* @return {QueryPayload}
*/
setTimeout(timeout?: number): QueryPayload;
/**
* An optional parameter which is used for defining the request Content-Type.
*
* @param {string} [contentType] The value is one of the
* {@link QueryContentType} enum values.
*
* @return {QueryPayload}
*/
setContentType(contentType?: string): QueryPayload;
/**
* @return {string} content type which was populated in this payload.
* The value is one of the {@link QueryContentType} enum values.
*/
getContentType(): string;
/**
*
* @return {Object} the query payload that contains all parameters.
*/
getParams(): any;
/**
* Sets the SPARQL query string to be used.
*
* @param {string} query - The query string to set.
* @return {QueryPayload}
*/
setQuery(query: string): QueryPayload;
/**
* Retrieves the current SPARQL query string.
*
* @return {string} The currently set SPARQL query string.
*/
getQuery(): string;
/**
*
* Validates payload for mandatory and invalid parameters.
*
* @throws {Error} if the payload is misconfigured
*/
validatePayload(): void;
}