Skip to content

Commit

Permalink
feat(client-connect): This release adds SearchUsers API which can be …
Browse files Browse the repository at this point in the history
…used to search for users with a Connect Instance
  • Loading branch information
awstools committed Apr 25, 2022
1 parent 0660dd0 commit 15544b5
Show file tree
Hide file tree
Showing 10 changed files with 1,194 additions and 19 deletions.
27 changes: 27 additions & 0 deletions clients/client-connect/src/Connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ import {
SearchAvailablePhoneNumbersCommandInput,
SearchAvailablePhoneNumbersCommandOutput,
} from "./commands/SearchAvailablePhoneNumbersCommand";
import { SearchUsersCommand, SearchUsersCommandInput, SearchUsersCommandOutput } from "./commands/SearchUsersCommand";
import {
SearchVocabulariesCommand,
SearchVocabulariesCommandInput,
Expand Down Expand Up @@ -3901,6 +3902,32 @@ export class Connect extends ConnectClient {
}
}

/**
* <p>Searches users in an Amazon Connect instance, with optional filtering.</p>
*/
public searchUsers(args: SearchUsersCommandInput, options?: __HttpHandlerOptions): Promise<SearchUsersCommandOutput>;
public searchUsers(args: SearchUsersCommandInput, cb: (err: any, data?: SearchUsersCommandOutput) => void): void;
public searchUsers(
args: SearchUsersCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: SearchUsersCommandOutput) => void
): void;
public searchUsers(
args: SearchUsersCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SearchUsersCommandOutput) => void),
cb?: (err: any, data?: SearchUsersCommandOutput) => void
): Promise<SearchUsersCommandOutput> | void {
const command = new SearchUsersCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Searches for vocabularies within a specific Amazon Connect instance using <code>State</code>, <code>NameStartsWith</code>, and <code>LanguageCode</code>.</p>
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-connect/src/ConnectClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ import {
SearchAvailablePhoneNumbersCommandInput,
SearchAvailablePhoneNumbersCommandOutput,
} from "./commands/SearchAvailablePhoneNumbersCommand";
import { SearchUsersCommandInput, SearchUsersCommandOutput } from "./commands/SearchUsersCommand";
import { SearchVocabulariesCommandInput, SearchVocabulariesCommandOutput } from "./commands/SearchVocabulariesCommand";
import { StartChatContactCommandInput, StartChatContactCommandOutput } from "./commands/StartChatContactCommand";
import {
Expand Down Expand Up @@ -567,6 +568,7 @@ export type ServiceInputTypes =
| ReleasePhoneNumberCommandInput
| ResumeContactRecordingCommandInput
| SearchAvailablePhoneNumbersCommandInput
| SearchUsersCommandInput
| SearchVocabulariesCommandInput
| StartChatContactCommandInput
| StartContactRecordingCommandInput
Expand Down Expand Up @@ -711,6 +713,7 @@ export type ServiceOutputTypes =
| ReleasePhoneNumberCommandOutput
| ResumeContactRecordingCommandOutput
| SearchAvailablePhoneNumbersCommandOutput
| SearchUsersCommandOutput
| SearchVocabulariesCommandOutput
| StartChatContactCommandOutput
| StartContactRecordingCommandOutput
Expand Down
95 changes: 95 additions & 0 deletions clients/client-connect/src/commands/SearchUsersCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { SearchUsersRequest, SearchUsersResponse } from "../models/models_1";
import {
deserializeAws_restJson1SearchUsersCommand,
serializeAws_restJson1SearchUsersCommand,
} from "../protocols/Aws_restJson1";

export interface SearchUsersCommandInput extends SearchUsersRequest {}
export interface SearchUsersCommandOutput extends SearchUsersResponse, __MetadataBearer {}

/**
* <p>Searches users in an Amazon Connect instance, with optional filtering.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ConnectClient, SearchUsersCommand } from "@aws-sdk/client-connect"; // ES Modules import
* // const { ConnectClient, SearchUsersCommand } = require("@aws-sdk/client-connect"); // CommonJS import
* const client = new ConnectClient(config);
* const command = new SearchUsersCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link SearchUsersCommandInput} for command's `input` shape.
* @see {@link SearchUsersCommandOutput} for command's `response` shape.
* @see {@link ConnectClientResolvedConfig | config} for ConnectClient's `config` shape.
*
*/
export class SearchUsersCommand extends $Command<
SearchUsersCommandInput,
SearchUsersCommandOutput,
ConnectClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: SearchUsersCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ConnectClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<SearchUsersCommandInput, SearchUsersCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "ConnectClient";
const commandName = "SearchUsersCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: SearchUsersRequest.filterSensitiveLog,
outputFilterSensitiveLog: SearchUsersResponse.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: SearchUsersCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1SearchUsersCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<SearchUsersCommandOutput> {
return deserializeAws_restJson1SearchUsersCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-connect/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export * from "./ListUsersCommand";
export * from "./ReleasePhoneNumberCommand";
export * from "./ResumeContactRecordingCommand";
export * from "./SearchAvailablePhoneNumbersCommand";
export * from "./SearchUsersCommand";
export * from "./SearchVocabulariesCommand";
export * from "./StartChatContactCommand";
export * from "./StartContactRecordingCommand";
Expand Down
15 changes: 7 additions & 8 deletions clients/client-connect/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ export namespace ClaimPhoneNumberRequest {

export interface ClaimPhoneNumberResponse {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId?: string;

Expand Down Expand Up @@ -3408,7 +3408,7 @@ export namespace DescribeInstanceStorageConfigResponse {

export interface DescribePhoneNumberRequest {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId: string | undefined;
}
Expand Down Expand Up @@ -3702,7 +3702,7 @@ export enum PhoneNumberType {
*/
export interface ClaimedPhoneNumberSummary {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId?: string;

Expand Down Expand Up @@ -3758,8 +3758,7 @@ export namespace ClaimedPhoneNumberSummary {

export interface DescribePhoneNumberResponse {
/**
* <p>Information about a phone number that's been claimed to your Amazon Connect instance.
* </p>
* <p>Information about a phone number that's been claimed to your Amazon Connect instance.</p>
*/
ClaimedPhoneNumberSummary?: ClaimedPhoneNumberSummary;
}
Expand Down Expand Up @@ -4705,7 +4704,7 @@ export namespace DisassociateLexBotRequest {

export interface DisassociatePhoneNumberContactFlowRequest {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId: string | undefined;

Expand Down Expand Up @@ -6921,7 +6920,7 @@ export namespace ListPhoneNumbersV2Request {
*/
export interface ListPhoneNumbersSummary {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId?: string;

Expand Down Expand Up @@ -7925,7 +7924,7 @@ export namespace ListUsersResponse {

export interface ReleasePhoneNumberRequest {
/**
* <p>The identifier of the phone number.</p>
* <p>A unique identifier for the phone number.</p>
*/
PhoneNumberId: string | undefined;

Expand Down
Loading

0 comments on commit 15544b5

Please sign in to comment.