Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add keys endpoints to search client #41

Merged
merged 15 commits into from
Dec 16, 2021
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export type AddApiKeyResponse = {
/**
* Key string.
*/
key: string;
/**
* Date of creation (ISO-8601 format).
*/
createdAt: Date;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Api Key object.
*/
export type ApiKey = {
/**
* Set of permissions associated with the key.
*/
acl: ApiKey.AclEnum[];
/**
* A comment used to identify a key more easily in the dashboard. It is not interpreted by the API.
*/
description?: string;
/**
* Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed.
*/
indexes?: string[];
/**
* Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced.
*/
maxHitsPerQuery?: number;
/**
* Maximum number of API calls per hour allowed from a given IP address or a user token.
*/
maxQueriesPerIPPerHour?: number;
/**
* URL-encoded query string. Force some query parameters to be applied for each query made with this API key.
*/
queryParameters?: string;
/**
* Restrict this new API key to specific referers. If empty or blank, defaults to all referers.
*/
referers?: string[];
/**
* Validity limit for this key in seconds. The key will automatically be removed after this period of time.
*/
validity?: number;
};

export namespace ApiKey {
export enum AclEnum {
AddObject = 'addObject',
Analytics = 'analytics',
Browse = 'browse',
DeleteObject = 'deleteObject',
DeleteIndex = 'deleteIndex',
EditSettings = 'editSettings',
ListIndexes = 'listIndexes',
Logs = 'logs',
Personalization = 'personalization',
Recommendation = 'recommendation',
Search = 'search',
SeeUnretrievableAttributes = 'seeUnretrievableAttributes',
damcou marked this conversation as resolved.
Show resolved Hide resolved
Settings = 'settings',
Usage = 'usage',
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type CreatedAtObject = {
/**
* Date of creation (ISO-8601 format).
*/
createdAt: Date;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type DeleteApiKeyResponse = {
/**
* Date of deletion (ISO-8601 format).
*/
deletedAt: Date;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { ApiKey } from './apiKey';
import type { CreatedAtObject } from './createdAtObject';

export type KeyObject = ApiKey & CreatedAtObject;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type KeyObjectAllOf = {
damcou marked this conversation as resolved.
Show resolved Hide resolved
/**
* Date of creation (ISO-8601 format).
*/
createdAt: Date;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { KeyObject } from './keyObject';

export type ListApiKeysResponse = {
/**
* List of api keys.
*/
keys: KeyObject[];
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/* eslint-disable no-param-reassign */
import type { RequestOptions } from '../utils/types';

export * from './addApiKeyResponse';
export * from './apiKey';
export * from './baseIndexSettings';
export * from './baseSearchParams';
export * from './baseSearchResponse';
export * from './baseSearchResponseFacetsStats';
export * from './batchObject';
export * from './batchResponse';
export * from './clearAllSynonymsResponse';
export * from './createdAtObject';
export * from './deleteApiKeyResponse';
export * from './deleteIndexResponse';
export * from './deleteSynonymResponse';
export * from './errorBase';
Expand All @@ -19,6 +23,8 @@ export * from './highlightResult';
export * from './index';
export * from './indexSettings';
export * from './indexSettingsAsSearchParams';
export * from './keyObject';
export * from './listApiKeysResponse';
export * from './listIndicesResponse';
export * from './multipleQueries';
export * from './multipleQueriesObject';
Expand All @@ -41,6 +47,7 @@ export * from './setSettingsResponse';
export * from './snippetResult';
export * from './synonymHit';
export * from './synonymHitHighlightResult';
export * from './updateApiKeyResponse';

export interface Authentication {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export type UpdateApiKeyResponse = {
/**
* Key string.
*/
key: string;
/**
* Date of last update (ISO-8601 format).
*/
updatedAt: Date;
};
Loading