Skip to content

Commit 95d7e18

Browse files
🤖 Merge PR DefinitelyTyped#74107 [sparql-http-client] Add parameters to QueryOptions by @giacomoronconiobda
1 parent 33aeb06 commit 95d7e18

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

‎types/sparql-http-client/index.d.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ export {
2020
StreamStore,
2121
};
2222

23-
export interface QueryOptions {
23+
export interface BaseQueryOptions {
2424
headers?: HeadersInit;
2525
operation?: "get" | "postUrlencoded" | "postDirect";
26+
parameters?: { [key: string]: undefined | string | string[] };
27+
}
28+
29+
export interface QueryOptions extends BaseQueryOptions {
30+
defaultGraph?: string | string[];
31+
namedGraph?: string | string[];
32+
}
33+
34+
export interface UpdateOptions extends BaseQueryOptions {
35+
usingGraph?: string | string[];
36+
usingNamedGraph?: string | string[];
2637
}
2738

2839
export interface Query<RAsk = unknown, RConstruct = unknown, RSelect = unknown, RUpdate = unknown> {
2940
ask(query: string, options?: QueryOptions): RAsk;
3041
construct(query: string, options?: QueryOptions): RConstruct;
3142
select(query: string, options?: QueryOptions): RSelect;
32-
update(query: string, options?: QueryOptions): RUpdate;
43+
update(query: string, options?: UpdateOptions): RUpdate;
3344
}
3445

3546
export interface Store<Q extends BaseQuad> {

‎types/sparql-http-client/package.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/sparql-http-client",
4-
"version": "3.0.9999",
4+
"version": "3.1.9999",
55
"type": "module",
66
"projects": [
77
"https://github.com/bergos/sparql-http-client"
@@ -21,6 +21,10 @@
2121
{
2222
"name": "Ludovic Muller",
2323
"githubUsername": "ludovicm67"
24+
},
25+
{
26+
"name": "Giacomo Ronconi",
27+
"githubUsername": "giacomoronconiobda"
2428
}
2529
]
2630
}

‎types/sparql-http-client/sparql-http-client-tests.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ interface TestQuad extends Quad {
1414

1515
const endpointUrl = "";
1616
const query = "";
17+
const defaultGraph = "";
18+
const namedGraph = "";
19+
const parameters = { key1: "value1", key2: ["value2a", "value2b"] };
1720
const factory: Environment<DataFactory<TestQuad> | DatasetCoreFactory<TestQuad>> = <any> {};
1821
const headers: HeadersInit = <any> {};
1922
const password: string = <any> {};
@@ -256,3 +259,10 @@ function initFromInstance() {
256259
const parsingClient = new ParsingClient(client);
257260
const simpleClient = new SimpleClient(client);
258261
}
262+
263+
function testParameters() {
264+
const client = new SimpleClient({
265+
endpointUrl,
266+
});
267+
client.query.select(query, { defaultGraph, namedGraph, parameters });
268+
}

0 commit comments

Comments
 (0)