-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
awstools
committed
May 5, 2022
1 parent
6506e14
commit d1a2c61
Showing
8 changed files
with
538 additions
and
194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
61 changes: 61 additions & 0 deletions
61
clients/client-kendra/src/pagination/ListGroupsOlderThanOrderingIdPaginator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
61 changes: 61 additions & 0 deletions
61
clients/client-kendra/src/pagination/ListQuerySuggestionsBlockListsPaginator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
61
clients/client-kendra/src/pagination/ListThesauriPaginator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.