Skip to content

Commit e4eb3a4

Browse files
authored
feat: add keys endpoints to search client (#41)
1 parent 752da0e commit e4eb3a4

31 files changed

+759
-52
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export type AddApiKeyResponse = {
2+
/**
3+
* Key string.
4+
*/
5+
key: string;
6+
/**
7+
* Date of creation (ISO-8601 format).
8+
*/
9+
createdAt: Date;
10+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Api Key object.
3+
*/
4+
export type ApiKey = {
5+
/**
6+
* Set of permissions associated with the key.
7+
*/
8+
acl: ApiKey.AclEnum[];
9+
/**
10+
* A comment used to identify a key more easily in the dashboard. It is not interpreted by the API.
11+
*/
12+
description?: string;
13+
/**
14+
* Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed.
15+
*/
16+
indexes?: string[];
17+
/**
18+
* Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced.
19+
*/
20+
maxHitsPerQuery?: number;
21+
/**
22+
* Maximum number of API calls per hour allowed from a given IP address or a user token.
23+
*/
24+
maxQueriesPerIPPerHour?: number;
25+
/**
26+
* URL-encoded query string. Force some query parameters to be applied for each query made with this API key.
27+
*/
28+
queryParameters?: string;
29+
/**
30+
* Restrict this new API key to specific referers. If empty or blank, defaults to all referers.
31+
*/
32+
referers?: string[];
33+
/**
34+
* Validity limit for this key in seconds. The key will automatically be removed after this period of time.
35+
*/
36+
validity?: number;
37+
};
38+
39+
export namespace ApiKey {
40+
export enum AclEnum {
41+
AddObject = 'addObject',
42+
Analytics = 'analytics',
43+
Browse = 'browse',
44+
DeleteObject = 'deleteObject',
45+
DeleteIndex = 'deleteIndex',
46+
EditSettings = 'editSettings',
47+
ListIndexes = 'listIndexes',
48+
Logs = 'logs',
49+
Personalization = 'personalization',
50+
Recommendation = 'recommendation',
51+
Search = 'search',
52+
SeeUnretrievableAttributes = 'seeUnretrievableAttributes',
53+
Settings = 'settings',
54+
Usage = 'usage',
55+
}
56+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type CreatedAtObject = {
2+
/**
3+
* Date of creation (ISO-8601 format).
4+
*/
5+
createdAt: Date;
6+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type DeleteApiKeyResponse = {
2+
/**
3+
* Date of deletion (ISO-8601 format).
4+
*/
5+
deletedAt: Date;
6+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { ApiKey } from './apiKey';
2+
import type { CreatedAtObject } from './createdAtObject';
3+
4+
export type KeyObject = ApiKey & CreatedAtObject;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type KeyObjectAllOf = {
2+
/**
3+
* Date of creation (ISO-8601 format).
4+
*/
5+
createdAt: Date;
6+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { KeyObject } from './keyObject';
2+
3+
export type ListApiKeysResponse = {
4+
/**
5+
* List of api keys.
6+
*/
7+
keys: KeyObject[];
8+
};

clients/algoliasearch-client-javascript/client-search/model/models.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
/* eslint-disable no-param-reassign */
22
import type { RequestOptions } from '../utils/types';
33

4+
export * from './addApiKeyResponse';
5+
export * from './apiKey';
46
export * from './baseIndexSettings';
57
export * from './baseSearchParams';
68
export * from './baseSearchResponse';
79
export * from './baseSearchResponseFacetsStats';
810
export * from './batchObject';
911
export * from './batchResponse';
1012
export * from './clearAllSynonymsResponse';
13+
export * from './createdAtObject';
14+
export * from './deleteApiKeyResponse';
1115
export * from './deleteIndexResponse';
1216
export * from './deleteSynonymResponse';
1317
export * from './errorBase';
@@ -19,6 +23,8 @@ export * from './highlightResult';
1923
export * from './index';
2024
export * from './indexSettings';
2125
export * from './indexSettingsAsSearchParams';
26+
export * from './keyObject';
27+
export * from './listApiKeysResponse';
2228
export * from './listIndicesResponse';
2329
export * from './multipleQueries';
2430
export * from './multipleQueriesObject';
@@ -41,6 +47,7 @@ export * from './setSettingsResponse';
4147
export * from './snippetResult';
4248
export * from './synonymHit';
4349
export * from './synonymHitHighlightResult';
50+
export * from './updateApiKeyResponse';
4451

4552
export interface Authentication {
4653
/**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export type UpdateApiKeyResponse = {
2+
/**
3+
* Key string.
4+
*/
5+
key: string;
6+
/**
7+
* Date of last update (ISO-8601 format).
8+
*/
9+
updatedAt: Date;
10+
};

0 commit comments

Comments
 (0)