Skip to content

Commit d1a2c61

Browse files
author
awstools
committed
feat(client-kendra): AWS Kendra now supports hierarchical facets for a query. For more information, see https://docs.aws.amazon.com/kendra/latest/dg/filtering.html
1 parent 6506e14 commit d1a2c61

File tree

8 files changed

+538
-194
lines changed

8 files changed

+538
-194
lines changed

clients/client-kendra/src/models/models_0.ts

Lines changed: 218 additions & 172 deletions
Large diffs are not rendered by default.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// smithy-typescript generated code
2+
import { Paginator } from "@aws-sdk/types";
3+
4+
import { ListFaqsCommand, ListFaqsCommandInput, ListFaqsCommandOutput } from "../commands/ListFaqsCommand";
5+
import { Kendra } from "../Kendra";
6+
import { KendraClient } from "../KendraClient";
7+
import { KendraPaginationConfiguration } from "./Interfaces";
8+
9+
/**
10+
* @private
11+
*/
12+
const makePagedClientRequest = async (
13+
client: KendraClient,
14+
input: ListFaqsCommandInput,
15+
...args: any
16+
): Promise<ListFaqsCommandOutput> => {
17+
// @ts-ignore
18+
return await client.send(new ListFaqsCommand(input), ...args);
19+
};
20+
/**
21+
* @private
22+
*/
23+
const makePagedRequest = async (
24+
client: Kendra,
25+
input: ListFaqsCommandInput,
26+
...args: any
27+
): Promise<ListFaqsCommandOutput> => {
28+
// @ts-ignore
29+
return await client.listFaqs(input, ...args);
30+
};
31+
export async function* paginateListFaqs(
32+
config: KendraPaginationConfiguration,
33+
input: ListFaqsCommandInput,
34+
...additionalArguments: any
35+
): Paginator<ListFaqsCommandOutput> {
36+
// ToDo: replace with actual type instead of typeof input.NextToken
37+
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
38+
let hasNext = true;
39+
let page: ListFaqsCommandOutput;
40+
while (hasNext) {
41+
input.NextToken = token;
42+
input["MaxResults"] = config.pageSize;
43+
if (config.client instanceof Kendra) {
44+
page = await makePagedRequest(config.client, input, ...additionalArguments);
45+
} else if (config.client instanceof KendraClient) {
46+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
47+
} else {
48+
throw new Error("Invalid client, expected Kendra | KendraClient");
49+
}
50+
yield page;
51+
const prevToken = token;
52+
token = page.NextToken;
53+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
54+
}
55+
// @ts-ignore
56+
return undefined;
57+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// smithy-typescript generated code
2+
import { Paginator } from "@aws-sdk/types";
3+
4+
import {
5+
ListGroupsOlderThanOrderingIdCommand,
6+
ListGroupsOlderThanOrderingIdCommandInput,
7+
ListGroupsOlderThanOrderingIdCommandOutput,
8+
} from "../commands/ListGroupsOlderThanOrderingIdCommand";
9+
import { Kendra } from "../Kendra";
10+
import { KendraClient } from "../KendraClient";
11+
import { KendraPaginationConfiguration } from "./Interfaces";
12+
13+
/**
14+
* @private
15+
*/
16+
const makePagedClientRequest = async (
17+
client: KendraClient,
18+
input: ListGroupsOlderThanOrderingIdCommandInput,
19+
...args: any
20+
): Promise<ListGroupsOlderThanOrderingIdCommandOutput> => {
21+
// @ts-ignore
22+
return await client.send(new ListGroupsOlderThanOrderingIdCommand(input), ...args);
23+
};
24+
/**
25+
* @private
26+
*/
27+
const makePagedRequest = async (
28+
client: Kendra,
29+
input: ListGroupsOlderThanOrderingIdCommandInput,
30+
...args: any
31+
): Promise<ListGroupsOlderThanOrderingIdCommandOutput> => {
32+
// @ts-ignore
33+
return await client.listGroupsOlderThanOrderingId(input, ...args);
34+
};
35+
export async function* paginateListGroupsOlderThanOrderingId(
36+
config: KendraPaginationConfiguration,
37+
input: ListGroupsOlderThanOrderingIdCommandInput,
38+
...additionalArguments: any
39+
): Paginator<ListGroupsOlderThanOrderingIdCommandOutput> {
40+
// ToDo: replace with actual type instead of typeof input.NextToken
41+
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
42+
let hasNext = true;
43+
let page: ListGroupsOlderThanOrderingIdCommandOutput;
44+
while (hasNext) {
45+
input.NextToken = token;
46+
input["MaxResults"] = config.pageSize;
47+
if (config.client instanceof Kendra) {
48+
page = await makePagedRequest(config.client, input, ...additionalArguments);
49+
} else if (config.client instanceof KendraClient) {
50+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
51+
} else {
52+
throw new Error("Invalid client, expected Kendra | KendraClient");
53+
}
54+
yield page;
55+
const prevToken = token;
56+
token = page.NextToken;
57+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
58+
}
59+
// @ts-ignore
60+
return undefined;
61+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// smithy-typescript generated code
2+
import { Paginator } from "@aws-sdk/types";
3+
4+
import {
5+
ListQuerySuggestionsBlockListsCommand,
6+
ListQuerySuggestionsBlockListsCommandInput,
7+
ListQuerySuggestionsBlockListsCommandOutput,
8+
} from "../commands/ListQuerySuggestionsBlockListsCommand";
9+
import { Kendra } from "../Kendra";
10+
import { KendraClient } from "../KendraClient";
11+
import { KendraPaginationConfiguration } from "./Interfaces";
12+
13+
/**
14+
* @private
15+
*/
16+
const makePagedClientRequest = async (
17+
client: KendraClient,
18+
input: ListQuerySuggestionsBlockListsCommandInput,
19+
...args: any
20+
): Promise<ListQuerySuggestionsBlockListsCommandOutput> => {
21+
// @ts-ignore
22+
return await client.send(new ListQuerySuggestionsBlockListsCommand(input), ...args);
23+
};
24+
/**
25+
* @private
26+
*/
27+
const makePagedRequest = async (
28+
client: Kendra,
29+
input: ListQuerySuggestionsBlockListsCommandInput,
30+
...args: any
31+
): Promise<ListQuerySuggestionsBlockListsCommandOutput> => {
32+
// @ts-ignore
33+
return await client.listQuerySuggestionsBlockLists(input, ...args);
34+
};
35+
export async function* paginateListQuerySuggestionsBlockLists(
36+
config: KendraPaginationConfiguration,
37+
input: ListQuerySuggestionsBlockListsCommandInput,
38+
...additionalArguments: any
39+
): Paginator<ListQuerySuggestionsBlockListsCommandOutput> {
40+
// ToDo: replace with actual type instead of typeof input.NextToken
41+
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
42+
let hasNext = true;
43+
let page: ListQuerySuggestionsBlockListsCommandOutput;
44+
while (hasNext) {
45+
input.NextToken = token;
46+
input["MaxResults"] = config.pageSize;
47+
if (config.client instanceof Kendra) {
48+
page = await makePagedRequest(config.client, input, ...additionalArguments);
49+
} else if (config.client instanceof KendraClient) {
50+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
51+
} else {
52+
throw new Error("Invalid client, expected Kendra | KendraClient");
53+
}
54+
yield page;
55+
const prevToken = token;
56+
token = page.NextToken;
57+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
58+
}
59+
// @ts-ignore
60+
return undefined;
61+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// smithy-typescript generated code
2+
import { Paginator } from "@aws-sdk/types";
3+
4+
import {
5+
ListThesauriCommand,
6+
ListThesauriCommandInput,
7+
ListThesauriCommandOutput,
8+
} from "../commands/ListThesauriCommand";
9+
import { Kendra } from "../Kendra";
10+
import { KendraClient } from "../KendraClient";
11+
import { KendraPaginationConfiguration } from "./Interfaces";
12+
13+
/**
14+
* @private
15+
*/
16+
const makePagedClientRequest = async (
17+
client: KendraClient,
18+
input: ListThesauriCommandInput,
19+
...args: any
20+
): Promise<ListThesauriCommandOutput> => {
21+
// @ts-ignore
22+
return await client.send(new ListThesauriCommand(input), ...args);
23+
};
24+
/**
25+
* @private
26+
*/
27+
const makePagedRequest = async (
28+
client: Kendra,
29+
input: ListThesauriCommandInput,
30+
...args: any
31+
): Promise<ListThesauriCommandOutput> => {
32+
// @ts-ignore
33+
return await client.listThesauri(input, ...args);
34+
};
35+
export async function* paginateListThesauri(
36+
config: KendraPaginationConfiguration,
37+
input: ListThesauriCommandInput,
38+
...additionalArguments: any
39+
): Paginator<ListThesauriCommandOutput> {
40+
// ToDo: replace with actual type instead of typeof input.NextToken
41+
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
42+
let hasNext = true;
43+
let page: ListThesauriCommandOutput;
44+
while (hasNext) {
45+
input.NextToken = token;
46+
input["MaxResults"] = config.pageSize;
47+
if (config.client instanceof Kendra) {
48+
page = await makePagedRequest(config.client, input, ...additionalArguments);
49+
} else if (config.client instanceof KendraClient) {
50+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
51+
} else {
52+
throw new Error("Invalid client, expected Kendra | KendraClient");
53+
}
54+
yield page;
55+
const prevToken = token;
56+
token = page.NextToken;
57+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
58+
}
59+
// @ts-ignore
60+
return undefined;
61+
}

clients/client-kendra/src/pagination/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ export * from "./ListDataSourcesPaginator";
66
export * from "./ListEntityPersonasPaginator";
77
export * from "./ListExperienceEntitiesPaginator";
88
export * from "./ListExperiencesPaginator";
9+
export * from "./ListFaqsPaginator";
10+
export * from "./ListGroupsOlderThanOrderingIdPaginator";
911
export * from "./ListIndicesPaginator";
12+
export * from "./ListQuerySuggestionsBlockListsPaginator";
13+
export * from "./ListThesauriPaginator";

clients/client-kendra/src/protocols/Aws_json1_1.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5710,6 +5710,9 @@ const serializeAws_json1_1Facet = (input: Facet, context: __SerdeContext): any =
57105710
return {
57115711
...(input.DocumentAttributeKey !== undefined &&
57125712
input.DocumentAttributeKey !== null && { DocumentAttributeKey: input.DocumentAttributeKey }),
5713+
...(input.Facets !== undefined &&
5714+
input.Facets !== null && { Facets: serializeAws_json1_1FacetList(input.Facets, context) }),
5715+
...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
57135716
};
57145717
};
57155718

@@ -8520,6 +8523,10 @@ const deserializeAws_json1_1DocumentAttributeValueCountPair = (
85208523
output.DocumentAttributeValue !== undefined && output.DocumentAttributeValue !== null
85218524
? deserializeAws_json1_1DocumentAttributeValue(output.DocumentAttributeValue, context)
85228525
: undefined,
8526+
FacetResults:
8527+
output.FacetResults !== undefined && output.FacetResults !== null
8528+
? deserializeAws_json1_1FacetResultList(output.FacetResults, context)
8529+
: undefined,
85238530
} as any;
85248531
};
85258532

0 commit comments

Comments
 (0)