From 562214ee843018482491a67ce76cbb02cc3c42f8 Mon Sep 17 00:00:00 2001 From: Chris Moyer Date: Mon, 23 Sep 2019 13:19:26 -0400 Subject: [PATCH] SecuredApiOptions can contain any search parameter (#38502) And restrictIndexes can be an array of strings, rather than just a single string See https://www.algolia.com/doc/api-reference/api-methods/generate-secured-api-key/ --- types/algoliasearch/algoliasearch-tests.ts | 9 +++++++++ types/algoliasearch/index.d.ts | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 4f94855782..aaffd1dfca 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -62,6 +62,15 @@ let _algoliaSecuredApiOptions: SecuredApiOptions = { userToken: '', }; +let _algoliaSecuredApiOptionsAdvanced: SecuredApiOptions = { + filters: '', + validUntil: 0, + restrictIndices: ['', ''], + userToken: '', + attributesToRetrieve: ['foo', 'bar'], + restrictSearchableAttributes: [''], +}; + let _algoliaIndexSettings: IndexSettings = { attributesToIndex: [''], attributesForFaceting: [''], diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 0553fbc7e8..fadd2aae83 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -12,6 +12,7 @@ // Peter Esenwa // Samuel Bodin // Richard Scotten +// Chris Moyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -998,8 +999,10 @@ declare namespace algoliasearch { } /** * Describes the options used when generating new api keys + * + * @see https://www.algolia.com/doc/api-reference/api-methods/generate-secured-api-key/ */ - interface SecuredApiOptions { + interface SecuredApiOptions extends QueryParameters { /** * Filter the query with numeric, facet or/and tag filters * default: "" @@ -1012,7 +1015,7 @@ declare namespace algoliasearch { /** * Restricts the key to a list of index names allowed for the secured API key */ - restrictIndices?: string; + restrictIndices?: string | string[]; /** * Allows you to restrict a single user to performing a maximum of N API calls per hour */