Skip to content

Commit 193fb73

Browse files
authored
fix(specs): getApiKeyResponse, multipleBatch, partialUpdateObject (#889)
1 parent 144fb62 commit 193fb73

File tree

12 files changed

+65
-30
lines changed

12 files changed

+65
-30
lines changed

specs/common/responses/common.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ createdAt:
1313
type: string
1414
description: Date of creation (ISO-8601 format).
1515

16+
createdAtTimestamp:
17+
type: integer
18+
format: int64
19+
description: Time of the event expressed in milliseconds since the Unix epoch.
20+
1621
updatedAt:
1722
type: string
1823
description: Date of last update (ISO-8601 format).

specs/search/paths/keys/common/schemas.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ apiKey:
99
default: []
1010
items:
1111
$ref: '#/acl'
12-
1312
description:
1413
type: string
1514
description: A comment used to identify a key more easily in the dashboard. It is not interpreted by the API.
@@ -47,20 +46,24 @@ apiKey:
4746

4847
keyString:
4948
type: string
50-
description: Key string.
49+
description: The API key.
50+
51+
getApiKeyResponse:
52+
allOf:
53+
- $ref: '#/baseGetApiKeyResponse'
54+
- $ref: '#/apiKey'
5155

52-
createdAtObject:
56+
baseGetApiKeyResponse:
5357
type: object
54-
required:
55-
- createdAt
58+
additionalProperties: false
5659
properties:
60+
value:
61+
$ref: '#/keyString'
5762
createdAt:
58-
$ref: '../../../../common/responses/common.yml#/createdAt'
59-
60-
key:
61-
allOf:
62-
- $ref: '#/apiKey'
63-
- $ref: '#/createdAtObject'
63+
$ref: '../../../../common/responses/common.yml#/createdAtTimestamp'
64+
required:
65+
- key
66+
- createdAt
6467

6568
addApiKeyResponse:
6669
type: object
@@ -75,6 +78,21 @@ addApiKeyResponse:
7578
- createdAt
7679

7780
acl:
81+
description: |
82+
List of rights for the API key. The following rights can be used:
83+
84+
addObject: allows to add/update an object in the index (copy/move index are also allowed with this right).
85+
analytics: allows to retrieve the analytics through the Analytics API.
86+
browse: allows to retrieve all index content via the browse API.
87+
deleteIndex: allows to delete or clear index content.
88+
deleteObject: allows to delete objects from the index.
89+
editSettings: allows to change index settings.
90+
listIndexes: allows to list all accessible indices.
91+
logs: allows to get the logs.
92+
recommendation: Allows usage of the Personalization dashboard and the Recommendation API.
93+
search: allows to search the index.
94+
seeUnretrievableAttributes: disable unretrievableAttributes feature for all operations returning records.
95+
settings: allows to get index settings.
7896
type: string
7997
enum:
8098
- addObject

specs/search/paths/keys/key.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ get:
1212
content:
1313
application/json:
1414
schema:
15-
$ref: 'common/schemas.yml#/key'
15+
$ref: 'common/schemas.yml#/getApiKeyResponse'
1616
'400':
1717
$ref: '../../../common/responses/BadRequest.yml'
1818
'402':

specs/search/paths/keys/keys.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get:
2020
type: array
2121
description: List of api keys.
2222
items:
23-
$ref: 'common/schemas.yml#/key'
23+
$ref: 'common/schemas.yml#/getApiKeyResponse'
2424
'400':
2525
$ref: '../../../common/responses/BadRequest.yml'
2626
'402':

specs/search/paths/objects/common/schemas.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ builtInOperation:
4040
- _operation
4141
- value
4242

43-
attributeOrBuiltInOperation:
43+
attributeToUpdate:
4444
oneOf:
4545
- $ref: '#/attribute'
4646
- $ref: '#/builtInOperation'

specs/search/paths/objects/getObjects.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ post:
3939
indexName:
4040
type: string
4141
description: name of the index containing the object.
42+
required:
43+
- requests
4244
responses:
4345
'200':
4446
description: OK

specs/search/paths/objects/multipleBatch.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ post:
2929
indexName:
3030
type: string
3131
description: Index to target for this operation.
32+
required:
33+
- action
34+
- body
35+
- indexName
36+
required:
37+
- requests
3238
responses:
3339
'200':
3440
description: OK
@@ -42,8 +48,13 @@ post:
4248
taskID:
4349
type: object
4450
description: List of tasksIDs per index.
51+
additionalProperties:
52+
$ref: '../../../common/responses/common.yml#/taskID'
4553
objectIDs:
4654
$ref: '../../../common/responses/common.yml#/objectIDs'
55+
required:
56+
- taskID
57+
- objectIDs
4758
'400':
4859
$ref: '../../../common/responses/BadRequest.yml'
4960
'402':

specs/search/paths/objects/partialUpdate.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ post:
2929
type: array
3030
items:
3131
type: object
32-
title: attributeToUpdate
3332
description: Attribute to update.
3433
additionalProperties:
35-
$ref: 'common/schemas.yml#/attributeOrBuiltInOperation'
34+
$ref: 'common/schemas.yml#/attributeToUpdate'
3635
responses:
3736
'200':
3837
$ref: '../../../common/responses/UpdatedAtWithObjectId.yml'

templates/java/api.mustache

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public class {{classname}} extends ApiClient {
340340
* @param timeout The function to decide how long to wait between retries. min(retries * 200, 5000) by default. (optional)
341341
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
342342
*/
343-
public Key waitForApiKey(
343+
public GetApiKeyResponse waitForApiKey(
344344
ApiKeyOperation operation,
345345
String key,
346346
ApiKey apiKey,
@@ -358,7 +358,7 @@ public class {{classname}} extends ApiClient {
358358
() -> {
359359
return this.getApiKey(key, requestOptions);
360360
},
361-
(Key respKey) -> {
361+
(GetApiKeyResponse respKey) -> {
362362
// we need to convert to an ApiKey object to use the `equals` method
363363
ApiKey sameType = new ApiKey()
364364
.setAcl(respKey.getAcl())
@@ -378,7 +378,7 @@ public class {{classname}} extends ApiClient {
378378
}
379379

380380
// bypass lambda restriction to modify final object
381-
final Key[] addedKey = new Key[] { null };
381+
final GetApiKeyResponse[] addedKey = new GetApiKeyResponse[] { null };
382382

383383
// check the status of the getApiKey method
384384
TaskUtils.retryUntil(
@@ -421,7 +421,7 @@ public class {{classname}} extends ApiClient {
421421
* @param timeout The function to decide how long to wait between retries. min(retries * 200, 5000) by default. (optional)
422422
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
423423
*/
424-
public Key waitForApiKey(ApiKeyOperation operation, String key, int maxRetries, IntUnaryOperator timeout, RequestOptions requestOptions) {
424+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, int maxRetries, IntUnaryOperator timeout, RequestOptions requestOptions) {
425425
return this.waitForApiKey(operation, key, null, maxRetries, timeout, requestOptions);
426426
}
427427
@@ -434,7 +434,7 @@ public class {{classname}} extends ApiClient {
434434
* @param apiKey Necessary to know if an `update` operation has been processed, compare fields of the response with it.
435435
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
436436
*/
437-
public Key waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey, RequestOptions requestOptions) {
437+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey, RequestOptions requestOptions) {
438438
return this.waitForApiKey(operation, key, apiKey, TaskUtils.DEFAULT_MAX_RETRIES, TaskUtils.DEFAULT_TIMEOUT, requestOptions);
439439
}
440440
@@ -446,7 +446,7 @@ public class {{classname}} extends ApiClient {
446446
* @param key The `key` that has been added, deleted or updated.
447447
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
448448
*/
449-
public Key waitForApiKey(ApiKeyOperation operation, String key, RequestOptions requestOptions) {
449+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, RequestOptions requestOptions) {
450450
return this.waitForApiKey(operation, key, null, TaskUtils.DEFAULT_MAX_RETRIES, TaskUtils.DEFAULT_TIMEOUT, requestOptions);
451451
}
452452
@@ -460,7 +460,7 @@ public class {{classname}} extends ApiClient {
460460
* @param maxRetries The maximum number of retry. 50 by default. (optional)
461461
* @param timeout The function to decide how long to wait between retries. min(retries * 200, 5000) by default. (optional)
462462
*/
463-
public Key waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey, int maxRetries, IntUnaryOperator timeout) {
463+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey, int maxRetries, IntUnaryOperator timeout) {
464464
return this.waitForApiKey(operation, key, apiKey, maxRetries, timeout, null);
465465
}
466466
@@ -473,7 +473,7 @@ public class {{classname}} extends ApiClient {
473473
* @param maxRetries The maximum number of retry. 50 by default. (optional)
474474
* @param timeout The function to decide how long to wait between retries. min(retries * 200, 5000) by default. (optional)
475475
*/
476-
public Key waitForApiKey(ApiKeyOperation operation, String key, int maxRetries, IntUnaryOperator timeout) {
476+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, int maxRetries, IntUnaryOperator timeout) {
477477
return this.waitForApiKey(operation, key, null, maxRetries, timeout, null);
478478
}
479479
@@ -485,7 +485,7 @@ public class {{classname}} extends ApiClient {
485485
* @param key The `key` that has been added, deleted or updated.
486486
* @param apiKey Necessary to know if an `update` operation has been processed, compare fields of the response with it.
487487
*/
488-
public Key waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey) {
488+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key, ApiKey apiKey) {
489489
return this.waitForApiKey(operation, key, apiKey, TaskUtils.DEFAULT_MAX_RETRIES, TaskUtils.DEFAULT_TIMEOUT, null);
490490
}
491491
@@ -496,7 +496,7 @@ public class {{classname}} extends ApiClient {
496496
* @param operation The `operation` that was done on a `key`. (ADD or DELETE only)
497497
* @param key The `key` that has been added, deleted or updated.
498498
*/
499-
public Key waitForApiKey(ApiKeyOperation operation, String key) {
499+
public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key) {
500500
return this.waitForApiKey(operation, key, null, TaskUtils.DEFAULT_MAX_RETRIES, TaskUtils.DEFAULT_TIMEOUT, null);
501501
}
502502
{{/isSearchClient}}

templates/javascript/clients/client/api/helpers.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ waitForApiKey(
5656
Math.min(retryCount * 200, 5000),
5757
}: WaitForApiKeyOptions,
5858
requestOptions?: RequestOptions
59-
): Promise<ApiError | Key> {
59+
): Promise<ApiError | GetApiKeyResponse> {
6060
let retryCount = 0;
61-
const baseIteratorOptions: IterableOptions<ApiError | Key> = {
61+
const baseIteratorOptions: IterableOptions<ApiError | GetApiKeyResponse> = {
6262
aggregator: () => (retryCount += 1),
6363
error: {
6464
validate: () => retryCount >= maxRetries,

templates/javascript/clients/client/model/clientMethodProps.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export type WaitForTaskOptions = WaitForOptions<GetTaskResponse> & {
7474
taskID: number;
7575
};
7676

77-
export type WaitForApiKeyOptions = WaitForOptions<Key> & {
77+
export type WaitForApiKeyOptions = WaitForOptions<GetApiKeyResponse> & {
7878
/**
7979
* The API Key.
8080
*/

tests/CTS/methods/requests/search/partialUpdateObject.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"parameters": {
44
"indexName": "theIndexName",
55
"objectID": "uniqueID",
6-
"attributeOrBuiltInOperation": [
6+
"attributeToUpdate": [
77
{
88
"id1": "test",
99
"id2": {

0 commit comments

Comments
 (0)