graphdb
Version:
Javascript client library supporting GraphDB and RDF4J REST API.
102 lines (101 loc) • 3.74 kB
TypeScript
export = GetQueryPayload;
/**
* Payload object holding common request parameters applicable for
* the query endpoint and SPARQL query as well.
*
* The SPARQL query and parameters "queryType" and "responseType" are mandatory
*
* The content type parameter, which is used for setting the HTTP Content-Type
* header, can be one of the following:
* - <code>application/x-www-form-urlencoded</code>
* - <code>application/sparql-query</code>
*
* @class
* @author Mihail Radkov
* @author Svilen Velikov
*/
declare class GetQueryPayload extends QueryPayload {
/**
* @param {string} [queryLn] the query language that is used for the query.
* @return {GetQueryPayload}
* @throws {Error} if the query language is not one of {@link QueryLanguage}
*/
setQueryLn(queryLn?: string): GetQueryPayload;
/**
* Populates an optional $key:value binding in the payload. Existing bindings
* will be overridden.
*
* @param {string} [binding] A variable binding name which may appear in the
* query and can be bound to a specific value provided outside
* of the actual query.
* @param {string} [value] A variable's binding value. See the binding comment
* @return {GetQueryPayload}
* @throws {Error} if the binding or the value is not a string
*/
addBinding(binding?: string, value?: string): GetQueryPayload;
/**
* @param {boolean} [distinct] Specifies if only distinct query solutions
* should be returned.
* @return {GetQueryPayload}
* @throws {Error} if the parameter is not a boolean
*/
setDistinct(distinct?: boolean): GetQueryPayload;
/**
* @param {number} limit specifies the maximum number of query solutions to
* return.
* @return {GetQueryPayload}
* @throws {Error} if the limit is not a non negative number
*/
setLimit(limit: number): GetQueryPayload;
/**
* @param {number} [offset] Specifies the number of query solutions to skip.
* @return {GetQueryPayload}
* @throws {Error} if the offset is not a non negative number
*/
setOffset(offset?: number): GetQueryPayload;
/**
* Verifies that responseType is one of the expected types.
*
* @private
* @param {string} responseType
* @param {Array<string>} formats
* @return {boolean} true if responseType is one of the expected types and
* false otherwise.
*/
private isResponseTypeSupported;
/**
* A mandatory parameter which is used for resolving the Accept http header
* required by the RDF store.
*
* @param {string} responseType
* @return {GetQueryPayload}
* @throws {Error} if the response type is not one of {@link RDFMimeType}
*/
setResponseType(responseType: string): GetQueryPayload;
responseType: string;
/**
* @return {string} response type which was populated in this payload.
*/
getResponseType(): string;
/**
* A mandatory parameter used for resolving request headers and resolving
* the response parsers.
*
* @param {QueryType} queryType
* @return {GetQueryPayload}
* @throws {Error} if the query type is not one of {@link QueryType}
*/
setQueryType(queryType: QueryType): GetQueryPayload;
queryType: string;
/**
* @return {string} query type which was populated in this payload. The value
* is one of the {@link QueryType} enum values.
*/
getQueryType(): string;
/**
* @inheritDoc
*/
getSupportedContentTypes(): string[];
}
import QueryPayload = require("../query/query-payload");
import QueryType = require("../query/query-type");