Skip to content

Commit

Permalink
feat(client-kendra): AWS Kendra now supports hierarchical facets for …
Browse files Browse the repository at this point in the history
  • Loading branch information
awstools committed May 5, 2022
1 parent 6506e14 commit d1a2c61
Show file tree
Hide file tree
Showing 8 changed files with 538 additions and 194 deletions.
390 changes: 218 additions & 172 deletions clients/client-kendra/src/models/models_0.ts

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions clients/client-kendra/src/pagination/ListFaqsPaginator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// smithy-typescript generated code
import { Paginator } from "@aws-sdk/types";

import { ListFaqsCommand, ListFaqsCommandInput, ListFaqsCommandOutput } from "../commands/ListFaqsCommand";
import { Kendra } from "../Kendra";
import { KendraClient } from "../KendraClient";
import { KendraPaginationConfiguration } from "./Interfaces";

/**
* @private
*/
const makePagedClientRequest = async (
client: KendraClient,
input: ListFaqsCommandInput,
...args: any
): Promise<ListFaqsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFaqsCommand(input), ...args);
};
/**
* @private
*/
const makePagedRequest = async (
client: Kendra,
input: ListFaqsCommandInput,
...args: any
): Promise<ListFaqsCommandOutput> => {
// @ts-ignore
return await client.listFaqs(input, ...args);
};
export async function* paginateListFaqs(
config: KendraPaginationConfiguration,
input: ListFaqsCommandInput,
...additionalArguments: any
): Paginator<ListFaqsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFaqsCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof Kendra) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof KendraClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Kendra | KendraClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// smithy-typescript generated code
import { Paginator } from "@aws-sdk/types";

import {
ListGroupsOlderThanOrderingIdCommand,
ListGroupsOlderThanOrderingIdCommandInput,
ListGroupsOlderThanOrderingIdCommandOutput,
} from "../commands/ListGroupsOlderThanOrderingIdCommand";
import { Kendra } from "../Kendra";
import { KendraClient } from "../KendraClient";
import { KendraPaginationConfiguration } from "./Interfaces";

/**
* @private
*/
const makePagedClientRequest = async (
client: KendraClient,
input: ListGroupsOlderThanOrderingIdCommandInput,
...args: any
): Promise<ListGroupsOlderThanOrderingIdCommandOutput> => {
// @ts-ignore
return await client.send(new ListGroupsOlderThanOrderingIdCommand(input), ...args);
};
/**
* @private
*/
const makePagedRequest = async (
client: Kendra,
input: ListGroupsOlderThanOrderingIdCommandInput,
...args: any
): Promise<ListGroupsOlderThanOrderingIdCommandOutput> => {
// @ts-ignore
return await client.listGroupsOlderThanOrderingId(input, ...args);
};
export async function* paginateListGroupsOlderThanOrderingId(
config: KendraPaginationConfiguration,
input: ListGroupsOlderThanOrderingIdCommandInput,
...additionalArguments: any
): Paginator<ListGroupsOlderThanOrderingIdCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListGroupsOlderThanOrderingIdCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof Kendra) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof KendraClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Kendra | KendraClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// smithy-typescript generated code
import { Paginator } from "@aws-sdk/types";

import {
ListQuerySuggestionsBlockListsCommand,
ListQuerySuggestionsBlockListsCommandInput,
ListQuerySuggestionsBlockListsCommandOutput,
} from "../commands/ListQuerySuggestionsBlockListsCommand";
import { Kendra } from "../Kendra";
import { KendraClient } from "../KendraClient";
import { KendraPaginationConfiguration } from "./Interfaces";

/**
* @private
*/
const makePagedClientRequest = async (
client: KendraClient,
input: ListQuerySuggestionsBlockListsCommandInput,
...args: any
): Promise<ListQuerySuggestionsBlockListsCommandOutput> => {
// @ts-ignore
return await client.send(new ListQuerySuggestionsBlockListsCommand(input), ...args);
};
/**
* @private
*/
const makePagedRequest = async (
client: Kendra,
input: ListQuerySuggestionsBlockListsCommandInput,
...args: any
): Promise<ListQuerySuggestionsBlockListsCommandOutput> => {
// @ts-ignore
return await client.listQuerySuggestionsBlockLists(input, ...args);
};
export async function* paginateListQuerySuggestionsBlockLists(
config: KendraPaginationConfiguration,
input: ListQuerySuggestionsBlockListsCommandInput,
...additionalArguments: any
): Paginator<ListQuerySuggestionsBlockListsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListQuerySuggestionsBlockListsCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof Kendra) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof KendraClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Kendra | KendraClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
61 changes: 61 additions & 0 deletions clients/client-kendra/src/pagination/ListThesauriPaginator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// smithy-typescript generated code
import { Paginator } from "@aws-sdk/types";

import {
ListThesauriCommand,
ListThesauriCommandInput,
ListThesauriCommandOutput,
} from "../commands/ListThesauriCommand";
import { Kendra } from "../Kendra";
import { KendraClient } from "../KendraClient";
import { KendraPaginationConfiguration } from "./Interfaces";

/**
* @private
*/
const makePagedClientRequest = async (
client: KendraClient,
input: ListThesauriCommandInput,
...args: any
): Promise<ListThesauriCommandOutput> => {
// @ts-ignore
return await client.send(new ListThesauriCommand(input), ...args);
};
/**
* @private
*/
const makePagedRequest = async (
client: Kendra,
input: ListThesauriCommandInput,
...args: any
): Promise<ListThesauriCommandOutput> => {
// @ts-ignore
return await client.listThesauri(input, ...args);
};
export async function* paginateListThesauri(
config: KendraPaginationConfiguration,
input: ListThesauriCommandInput,
...additionalArguments: any
): Paginator<ListThesauriCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListThesauriCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof Kendra) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof KendraClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Kendra | KendraClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
4 changes: 4 additions & 0 deletions clients/client-kendra/src/pagination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ export * from "./ListDataSourcesPaginator";
export * from "./ListEntityPersonasPaginator";
export * from "./ListExperienceEntitiesPaginator";
export * from "./ListExperiencesPaginator";
export * from "./ListFaqsPaginator";
export * from "./ListGroupsOlderThanOrderingIdPaginator";
export * from "./ListIndicesPaginator";
export * from "./ListQuerySuggestionsBlockListsPaginator";
export * from "./ListThesauriPaginator";
7 changes: 7 additions & 0 deletions clients/client-kendra/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5710,6 +5710,9 @@ const serializeAws_json1_1Facet = (input: Facet, context: __SerdeContext): any =
return {
...(input.DocumentAttributeKey !== undefined &&
input.DocumentAttributeKey !== null && { DocumentAttributeKey: input.DocumentAttributeKey }),
...(input.Facets !== undefined &&
input.Facets !== null && { Facets: serializeAws_json1_1FacetList(input.Facets, context) }),
...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
};
};

Expand Down Expand Up @@ -8520,6 +8523,10 @@ const deserializeAws_json1_1DocumentAttributeValueCountPair = (
output.DocumentAttributeValue !== undefined && output.DocumentAttributeValue !== null
? deserializeAws_json1_1DocumentAttributeValue(output.DocumentAttributeValue, context)
: undefined,
FacetResults:
output.FacetResults !== undefined && output.FacetResults !== null
? deserializeAws_json1_1FacetResultList(output.FacetResults, context)
: undefined,
} as any;
};

Expand Down
Loading

0 comments on commit d1a2c61

Please sign in to comment.