Skip to content

Commit 179781a

Browse files
authored
Fix return type for dataservice-api functions. (#507)
Updated the return type `any` => `Response` for functions: `ArtifactsApi::putArtifactFileUsingPUT`, `BlobApi::cancelMultipartUpload`, `BlobApi::deleteBlob`, `IndexApi::insertIndexes`, `IndexApi::performUpdate`, `VolatileBlobApi::deleteVolatileBlob`, `VolatileBlobApi::putVolatileBlob`. Updated CHANGLOG.ms and versions. Relates-To: OLPSUP-19972 Signed-off-by: Oleksii Zubko <ext-oleksii.zubko@here.com> Signed-off-by: Oleksii Zubko <ext-oleksii.zubko@here.com>
1 parent 79ed7fb commit 179781a

File tree

15 files changed

+104
-38
lines changed

15 files changed

+104
-38
lines changed

@here/olp-sdk-authentication/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@here/olp-sdk-authentication",
3-
"version": "1.12.2",
3+
"version": "1.13.0",
44
"description": "Wrapper around the HERE Authentication and Authorization REST API obtaining short-lived access tokens that are used to authenticate requests to HERE services.",
55
"main": "index.js",
66
"browser": "index.web.js",
@@ -49,7 +49,7 @@
4949
},
5050
"license": "Apache-2.0",
5151
"dependencies": {
52-
"@here/olp-sdk-core": "^1.7.1",
52+
"@here/olp-sdk-core": "^1.8.0",
5353
"@here/olp-sdk-fetch": "^1.9.0",
5454
"properties-reader": "^0.3.1"
5555
},

@here/olp-sdk-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@here/olp-sdk-core",
3-
"version": "1.7.1",
3+
"version": "1.8.0",
44
"description": "Core features of the HERE Data Platform",
55
"main": "index.js",
66
"browser": "index.web.js",
@@ -50,7 +50,7 @@
5050
"license": "Apache-2.0",
5151
"dependencies": {
5252
"@here/olp-sdk-fetch": "^1.9.0",
53-
"@here/olp-sdk-dataservice-api": "^1.12.2"
53+
"@here/olp-sdk-dataservice-api": "^1.13.0"
5454
},
5555
"devDependencies": {
5656
"@types/chai": "^4.2.7",

@here/olp-sdk-dataservice-api/lib/artifact-api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 HERE Europe B.V.
2+
* Copyright (C) 2019-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -341,7 +341,7 @@ export async function getArtifactUsingGET(
341341
export async function putArtifactFileUsingPUT(
342342
builder: RequestBuilder,
343343
params: { artifactHrn: string; fileName: string; file: string }
344-
): Promise<any> {
344+
): Promise<Response> {
345345
const baseUrl = "/artifact/{artifactHrn}/{fileName}"
346346
.replace("{artifactHrn}", UrlBuilder.toString(params["artifactHrn"]))
347347
.replace("{fileName}", UrlBuilder.toString(params["fileName"]));
@@ -358,7 +358,7 @@ export async function putArtifactFileUsingPUT(
358358
options.body = JSON.stringify(params["file"]);
359359
}
360360

361-
return builder.request<any>(urlBuilder, options);
361+
return builder.requestBlob(urlBuilder, options);
362362
}
363363

364364
/**

@here/olp-sdk-dataservice-api/lib/blob-api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 HERE Europe B.V.
2+
* Copyright (C) 2019-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -207,7 +207,7 @@ export async function cancelMultipartUpload(
207207
multiPartToken: string;
208208
billingTag?: string;
209209
}
210-
): Promise<any> {
210+
): Promise<Response> {
211211
const baseUrl = "/layers/{layerId}/data/{dataHandle}/multiparts/{multiPartToken}"
212212
.replace("{layerId}", UrlBuilder.toString(params["layerId"]))
213213
.replace("{dataHandle}", UrlBuilder.toString(params["dataHandle"]))
@@ -225,7 +225,7 @@ export async function cancelMultipartUpload(
225225
headers
226226
};
227227

228-
return builder.request<any>(urlBuilder, options);
228+
return builder.requestBlob(urlBuilder, options);
229229
}
230230

231231
/**
@@ -284,7 +284,7 @@ export async function deleteBlob(
284284
dataHandle: string;
285285
billingTag?: string;
286286
}
287-
): Promise<any> {
287+
): Promise<Response> {
288288
const baseUrl = "/layers/{layerId}/data/{dataHandle}"
289289
.replace("{layerId}", UrlBuilder.toString(params["layerId"]))
290290
.replace("{dataHandle}", UrlBuilder.toString(params["dataHandle"]));
@@ -298,7 +298,7 @@ export async function deleteBlob(
298298
headers
299299
};
300300

301-
return builder.request<any>(urlBuilder, options);
301+
return builder.requestBlob(urlBuilder, options);
302302
}
303303

304304
/**

@here/olp-sdk-dataservice-api/lib/index-api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 HERE Europe B.V.
2+
* Copyright (C) 2019-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ export async function insertIndexes(
9494
indexes: Index[];
9595
layerID: string;
9696
}
97-
): Promise<any> {
97+
): Promise<Response> {
9898
const baseUrl = "/layers/{layerID}".replace(
9999
"{layerID}",
100100
UrlBuilder.toString(params["layerID"])
@@ -112,7 +112,7 @@ export async function insertIndexes(
112112
options.body = JSON.stringify(params["indexes"]);
113113
}
114114

115-
return builder.request<any>(urlBuilder, options);
115+
return builder.requestBlob(urlBuilder, options);
116116
}
117117

118118
/**
@@ -167,7 +167,7 @@ export async function performUpdate(
167167
layerID: string;
168168
request: UpdateIndexRequest;
169169
}
170-
): Promise<any> {
170+
): Promise<Response> {
171171
const baseUrl = "/layers/{layerID}".replace(
172172
"{layerID}",
173173
UrlBuilder.toString(params["layerID"])
@@ -185,5 +185,5 @@ export async function performUpdate(
185185
options.body = JSON.stringify(params["request"]);
186186
}
187187

188-
return builder.request<any>(urlBuilder, options);
188+
return builder.requestBlob(urlBuilder, options);
189189
}

@here/olp-sdk-dataservice-api/lib/volatile-blob-api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 HERE Europe B.V.
2+
* Copyright (C) 2019-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -121,7 +121,7 @@ export async function deleteVolatileBlob(
121121
dataHandle: string;
122122
billingTag?: string;
123123
}
124-
): Promise<any> {
124+
): Promise<Response> {
125125
const baseUrl = "/layers/{layerId}/data/{dataHandle}"
126126
.replace("{layerId}", UrlBuilder.toString(params["layerId"]))
127127
.replace("{dataHandle}", UrlBuilder.toString(params["dataHandle"]));
@@ -135,7 +135,7 @@ export async function deleteVolatileBlob(
135135
headers
136136
};
137137

138-
return builder.request<any>(urlBuilder, options);
138+
return builder.requestBlob(urlBuilder, options);
139139
}
140140

141141
/**
@@ -191,7 +191,7 @@ export async function putVolatileBlob(
191191
body: string;
192192
billingTag?: string;
193193
}
194-
): Promise<any> {
194+
): Promise<Response> {
195195
const baseUrl = "/layers/{layerId}/data/{dataHandle}"
196196
.replace("{layerId}", UrlBuilder.toString(params["layerId"]))
197197
.replace("{dataHandle}", UrlBuilder.toString(params["dataHandle"]));
@@ -209,5 +209,5 @@ export async function putVolatileBlob(
209209
options.body = JSON.stringify(params["body"]);
210210
}
211211

212-
return builder.request<any>(urlBuilder, options);
212+
return builder.requestBlob(urlBuilder, options);
213213
}

@here/olp-sdk-dataservice-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@here/olp-sdk-dataservice-api",
3-
"version": "1.12.2",
3+
"version": "1.13.0",
44
"description": "Generated from the OpenAPI specification of the HERE Open Location Platform Data API",
55
"main": "index.js",
66
"typings": "index",

@here/olp-sdk-dataservice-api/test/ArtifactApi.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -127,7 +127,7 @@ describe("ArtifactApi", function() {
127127
};
128128
const builder = {
129129
baseUrl: "http://mocked.url",
130-
request: async (urlBuilder: UrlBuilder, options: any) => {
130+
requestBlob: async (urlBuilder: UrlBuilder, options: any) => {
131131
expect(urlBuilder.url).to.be.equal(
132132
"http://mocked.url/artifact/mocked-artifactHrn/mocked-fileName"
133133
);

@here/olp-sdk-dataservice-api/test/BlobApi.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ describe("BlobApi", function() {
3838
};
3939
const builder = {
4040
baseUrl: "http://mocked.url",
41-
request: async (urlBuilder: UrlBuilder, options: any) => {
41+
requestBlob: async (urlBuilder: UrlBuilder, options: any) => {
4242
expect(urlBuilder.url).to.be.equal(
4343
"http://mocked.url/layers/mocked-id/data/mocked-datahandle/multiparts/mocked-multiPartToken?billingTag=mocked-billingTag"
4444
);
@@ -122,7 +122,7 @@ describe("BlobApi", function() {
122122
};
123123
const builder = {
124124
baseUrl: "http://mocked.url",
125-
request: async (urlBuilder: UrlBuilder, options: any) => {
125+
requestBlob: async (urlBuilder: UrlBuilder, options: any) => {
126126
expect(urlBuilder.url).to.be.equal(
127127
"http://mocked.url/layers/mocked-id/data/mocked-datahandle?billingTag=mocked-billingTag"
128128
);

@here/olp-sdk-dataservice-api/test/IndexApi.test.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,49 @@ describe("IndexApi", function() {
6565
assert.equal(response.data && response.data.length, 2);
6666
expect(response).to.be.equal(mockedResponse);
6767
});
68+
69+
it("Should performUpdate provide data", async function() {
70+
const params = {
71+
layerID: "mocked-id",
72+
request: {}
73+
};
74+
const builder = {
75+
baseUrl: "http://mocked.url",
76+
requestBlob: async (urlBuilder: UrlBuilder, options: any) => {
77+
expect(urlBuilder.url).to.be.equal(
78+
"http://mocked.url/layers/mocked-id"
79+
);
80+
expect(options.method).to.be.equal("PUT");
81+
return Promise.resolve("success");
82+
}
83+
};
84+
const result = await IndexApi.performUpdate(
85+
(builder as unknown) as RequestBuilder,
86+
params
87+
);
88+
expect(result).to.be.equal("success");
89+
});
90+
91+
it("Should insertIndexes provide data", async function() {
92+
const params = {
93+
layerID: "mocked-id",
94+
indexes: [{ id: "test-index" }]
95+
};
96+
const builder = {
97+
baseUrl: "http://mocked.url",
98+
requestBlob: async (urlBuilder: UrlBuilder, options: any) => {
99+
expect(urlBuilder.url).to.be.equal(
100+
"http://mocked.url/layers/mocked-id"
101+
);
102+
expect(options.method).to.be.equal("POST");
103+
expect(options.body).equals(JSON.stringify(params.indexes));
104+
return Promise.resolve("success");
105+
}
106+
};
107+
const result = await IndexApi.insertIndexes(
108+
(builder as unknown) as RequestBuilder,
109+
params
110+
);
111+
expect(result).to.be.equal("success");
112+
});
68113
});

0 commit comments

Comments
 (0)