Skip to content

Commit

Permalink
feat(client-connect): This release introduces an API for changing the…
Browse files Browse the repository at this point in the history
… current agent status of a user in Connect.
  • Loading branch information
awstools committed Apr 28, 2022
1 parent 943533d commit 9a4c9f8
Show file tree
Hide file tree
Showing 9 changed files with 426 additions and 74 deletions.
41 changes: 41 additions & 0 deletions clients/client-connect/src/Connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ import {
ListUserHierarchyGroupsCommandOutput,
} from "./commands/ListUserHierarchyGroupsCommand";
import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "./commands/ListUsersCommand";
import {
PutUserStatusCommand,
PutUserStatusCommandInput,
PutUserStatusCommandOutput,
} from "./commands/PutUserStatusCommand";
import {
ReleasePhoneNumberCommand,
ReleasePhoneNumberCommandInput,
Expand Down Expand Up @@ -3803,6 +3808,42 @@ export class Connect extends ConnectClient {
}
}

/**
* <p>Changes the current status of a user or agent in Amazon Connect.
* If the agent is currently handling a contact, this sets the agent's next status.</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/metrics-agent-status.html">Agent status</a>
* and <a href="https://docs.aws.amazon.com/connect/latest/adminguide/set-next-status.html">Set your next status</a>
* in the <i>Amazon Connect Administrator Guide</i>.</p>
*/
public putUserStatus(
args: PutUserStatusCommandInput,
options?: __HttpHandlerOptions
): Promise<PutUserStatusCommandOutput>;
public putUserStatus(
args: PutUserStatusCommandInput,
cb: (err: any, data?: PutUserStatusCommandOutput) => void
): void;
public putUserStatus(
args: PutUserStatusCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: PutUserStatusCommandOutput) => void
): void;
public putUserStatus(
args: PutUserStatusCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: PutUserStatusCommandOutput) => void),
cb?: (err: any, data?: PutUserStatusCommandOutput) => void
): Promise<PutUserStatusCommandOutput> | void {
const command = new PutUserStatusCommand(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>Releases a phone number previously claimed to an Amazon Connect instance.</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 @@ -314,6 +314,7 @@ import {
ListUserHierarchyGroupsCommandOutput,
} from "./commands/ListUserHierarchyGroupsCommand";
import { ListUsersCommandInput, ListUsersCommandOutput } from "./commands/ListUsersCommand";
import { PutUserStatusCommandInput, PutUserStatusCommandOutput } from "./commands/PutUserStatusCommand";
import { ReleasePhoneNumberCommandInput, ReleasePhoneNumberCommandOutput } from "./commands/ReleasePhoneNumberCommand";
import {
ResumeContactRecordingCommandInput,
Expand Down Expand Up @@ -565,6 +566,7 @@ export type ServiceInputTypes =
| ListUseCasesCommandInput
| ListUserHierarchyGroupsCommandInput
| ListUsersCommandInput
| PutUserStatusCommandInput
| ReleasePhoneNumberCommandInput
| ResumeContactRecordingCommandInput
| SearchAvailablePhoneNumbersCommandInput
Expand Down Expand Up @@ -710,6 +712,7 @@ export type ServiceOutputTypes =
| ListUseCasesCommandOutput
| ListUserHierarchyGroupsCommandOutput
| ListUsersCommandOutput
| PutUserStatusCommandOutput
| ReleasePhoneNumberCommandOutput
| ResumeContactRecordingCommandOutput
| SearchAvailablePhoneNumbersCommandOutput
Expand Down
99 changes: 99 additions & 0 deletions clients/client-connect/src/commands/PutUserStatusCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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 { PutUserStatusRequest, PutUserStatusResponse } from "../models/models_0";
import {
deserializeAws_restJson1PutUserStatusCommand,
serializeAws_restJson1PutUserStatusCommand,
} from "../protocols/Aws_restJson1";

export interface PutUserStatusCommandInput extends PutUserStatusRequest {}
export interface PutUserStatusCommandOutput extends PutUserStatusResponse, __MetadataBearer {}

/**
* <p>Changes the current status of a user or agent in Amazon Connect.
* If the agent is currently handling a contact, this sets the agent's next status.</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/metrics-agent-status.html">Agent status</a>
* and <a href="https://docs.aws.amazon.com/connect/latest/adminguide/set-next-status.html">Set your next status</a>
* in the <i>Amazon Connect Administrator Guide</i>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ConnectClient, PutUserStatusCommand } from "@aws-sdk/client-connect"; // ES Modules import
* // const { ConnectClient, PutUserStatusCommand } = require("@aws-sdk/client-connect"); // CommonJS import
* const client = new ConnectClient(config);
* const command = new PutUserStatusCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link PutUserStatusCommandInput} for command's `input` shape.
* @see {@link PutUserStatusCommandOutput} for command's `response` shape.
* @see {@link ConnectClientResolvedConfig | config} for ConnectClient's `config` shape.
*
*/
export class PutUserStatusCommand extends $Command<
PutUserStatusCommandInput,
PutUserStatusCommandOutput,
ConnectClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

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

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

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

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

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
} from "@aws-sdk/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { SearchAvailablePhoneNumbersRequest } from "../models/models_0";
import { SearchAvailablePhoneNumbersResponse } from "../models/models_1";
import { SearchAvailablePhoneNumbersRequest, SearchAvailablePhoneNumbersResponse } from "../models/models_1";
import {
deserializeAws_restJson1SearchAvailablePhoneNumbersCommand,
serializeAws_restJson1SearchAvailablePhoneNumbersCommand,
Expand Down
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 @@ -93,6 +93,7 @@ export * from "./ListTagsForResourceCommand";
export * from "./ListUseCasesCommand";
export * from "./ListUserHierarchyGroupsCommand";
export * from "./ListUsersCommand";
export * from "./PutUserStatusCommand";
export * from "./ReleasePhoneNumberCommand";
export * from "./ResumeContactRecordingCommand";
export * from "./SearchAvailablePhoneNumbersCommand";
Expand Down
106 changes: 36 additions & 70 deletions clients/client-connect/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7922,133 +7922,99 @@ export namespace ListUsersResponse {
});
}

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

export interface PutUserStatusRequest {
/**
* <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the
* request.</p>
*/
ClientToken?: string;
}

export namespace ReleasePhoneNumberRequest {
/**
* @internal
* <p>The identifier of the user.</p>
*/
export const filterSensitiveLog = (obj: ReleasePhoneNumberRequest): any => ({
...obj,
});
}
UserId: string | undefined;

export interface ResumeContactRecordingRequest {
/**
* <p>The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance.</p>
*/
InstanceId: string | undefined;

/**
* <p>The identifier of the contact.</p>
*/
ContactId: string | undefined;

/**
* <p>The identifier of the contact. This is the identifier of the contact associated with the
* first interaction with the contact center.</p>
* <p>The identifier of the agent status.</p>
*/
InitialContactId: string | undefined;
AgentStatusId: string | undefined;
}

export namespace ResumeContactRecordingRequest {
export namespace PutUserStatusRequest {
/**
* @internal
*/
export const filterSensitiveLog = (obj: ResumeContactRecordingRequest): any => ({
export const filterSensitiveLog = (obj: PutUserStatusRequest): any => ({
...obj,
});
}

export interface ResumeContactRecordingResponse {}
export interface PutUserStatusResponse {}

export namespace ResumeContactRecordingResponse {
export namespace PutUserStatusResponse {
/**
* @internal
*/
export const filterSensitiveLog = (obj: ResumeContactRecordingResponse): any => ({
export const filterSensitiveLog = (obj: PutUserStatusResponse): any => ({
...obj,
});
}

export interface SearchAvailablePhoneNumbersRequest {
export interface ReleasePhoneNumberRequest {
/**
* <p>The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to.</p>
* <p>A unique identifier for the phone number.</p>
*/
TargetArn: string | undefined;
PhoneNumberId: string | undefined;

/**
* <p>The ISO country code.</p>
* <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the
* request.</p>
*/
PhoneNumberCountryCode: PhoneNumberCountryCode | string | undefined;
ClientToken?: string;
}

export namespace ReleasePhoneNumberRequest {
/**
* <p>The type of phone number.</p>
* @internal
*/
PhoneNumberType: PhoneNumberType | string | undefined;
export const filterSensitiveLog = (obj: ReleasePhoneNumberRequest): any => ({
...obj,
});
}

export interface ResumeContactRecordingRequest {
/**
* <p>The prefix of the phone number. If provided, it must contain <code>+</code> as part of the country code.</p>
* <p>The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance.</p>
*/
PhoneNumberPrefix?: string;
InstanceId: string | undefined;

/**
* <p>The maximum number of results to return per page.</p>
* <p>The identifier of the contact.</p>
*/
MaxResults?: number;
ContactId: string | undefined;

/**
* <p>The token for the next set of results. Use the value returned in the previous
* response in the next request to retrieve the next set of results.</p>
* <p>The identifier of the contact. This is the identifier of the contact associated with the
* first interaction with the contact center.</p>
*/
NextToken?: string;
InitialContactId: string | undefined;
}

export namespace SearchAvailablePhoneNumbersRequest {
export namespace ResumeContactRecordingRequest {
/**
* @internal
*/
export const filterSensitiveLog = (obj: SearchAvailablePhoneNumbersRequest): any => ({
export const filterSensitiveLog = (obj: ResumeContactRecordingRequest): any => ({
...obj,
});
}

/**
* <p>Information about available phone numbers.</p>
*/
export interface AvailableNumberSummary {
/**
* <p>The phone number. Phone numbers are formatted <code>[+] [country code] [subscriber number including area code]</code>.</p>
*/
PhoneNumber?: string;

/**
* <p>The ISO country code.</p>
*/
PhoneNumberCountryCode?: PhoneNumberCountryCode | string;

/**
* <p>The type of phone number.</p>
*/
PhoneNumberType?: PhoneNumberType | string;
}
export interface ResumeContactRecordingResponse {}

export namespace AvailableNumberSummary {
export namespace ResumeContactRecordingResponse {
/**
* @internal
*/
export const filterSensitiveLog = (obj: AvailableNumberSummary): any => ({
export const filterSensitiveLog = (obj: ResumeContactRecordingResponse): any => ({
...obj,
});
}
Loading

0 comments on commit 9a4c9f8

Please sign in to comment.