Skip to content

Commit 9a4c9f8

Browse files
author
awstools
committed
feat(client-connect): This release introduces an API for changing the current agent status of a user in Connect.
1 parent 943533d commit 9a4c9f8

File tree

9 files changed

+426
-74
lines changed

9 files changed

+426
-74
lines changed

clients/client-connect/src/Connect.ts

+41
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ import {
443443
ListUserHierarchyGroupsCommandOutput,
444444
} from "./commands/ListUserHierarchyGroupsCommand";
445445
import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "./commands/ListUsersCommand";
446+
import {
447+
PutUserStatusCommand,
448+
PutUserStatusCommandInput,
449+
PutUserStatusCommandOutput,
450+
} from "./commands/PutUserStatusCommand";
446451
import {
447452
ReleasePhoneNumberCommand,
448453
ReleasePhoneNumberCommandInput,
@@ -3803,6 +3808,42 @@ export class Connect extends ConnectClient {
38033808
}
38043809
}
38053810

3811+
/**
3812+
* <p>Changes the current status of a user or agent in Amazon Connect.
3813+
* If the agent is currently handling a contact, this sets the agent's next status.</p>
3814+
* <p>For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/metrics-agent-status.html">Agent status</a>
3815+
* and <a href="https://docs.aws.amazon.com/connect/latest/adminguide/set-next-status.html">Set your next status</a>
3816+
* in the <i>Amazon Connect Administrator Guide</i>.</p>
3817+
*/
3818+
public putUserStatus(
3819+
args: PutUserStatusCommandInput,
3820+
options?: __HttpHandlerOptions
3821+
): Promise<PutUserStatusCommandOutput>;
3822+
public putUserStatus(
3823+
args: PutUserStatusCommandInput,
3824+
cb: (err: any, data?: PutUserStatusCommandOutput) => void
3825+
): void;
3826+
public putUserStatus(
3827+
args: PutUserStatusCommandInput,
3828+
options: __HttpHandlerOptions,
3829+
cb: (err: any, data?: PutUserStatusCommandOutput) => void
3830+
): void;
3831+
public putUserStatus(
3832+
args: PutUserStatusCommandInput,
3833+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: PutUserStatusCommandOutput) => void),
3834+
cb?: (err: any, data?: PutUserStatusCommandOutput) => void
3835+
): Promise<PutUserStatusCommandOutput> | void {
3836+
const command = new PutUserStatusCommand(args);
3837+
if (typeof optionsOrCb === "function") {
3838+
this.send(command, optionsOrCb);
3839+
} else if (typeof cb === "function") {
3840+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
3841+
this.send(command, optionsOrCb || {}, cb);
3842+
} else {
3843+
return this.send(command, optionsOrCb);
3844+
}
3845+
}
3846+
38063847
/**
38073848
* <p>Releases a phone number previously claimed to an Amazon Connect instance.</p>
38083849
*/

clients/client-connect/src/ConnectClient.ts

+3
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ import {
314314
ListUserHierarchyGroupsCommandOutput,
315315
} from "./commands/ListUserHierarchyGroupsCommand";
316316
import { ListUsersCommandInput, ListUsersCommandOutput } from "./commands/ListUsersCommand";
317+
import { PutUserStatusCommandInput, PutUserStatusCommandOutput } from "./commands/PutUserStatusCommand";
317318
import { ReleasePhoneNumberCommandInput, ReleasePhoneNumberCommandOutput } from "./commands/ReleasePhoneNumberCommand";
318319
import {
319320
ResumeContactRecordingCommandInput,
@@ -565,6 +566,7 @@ export type ServiceInputTypes =
565566
| ListUseCasesCommandInput
566567
| ListUserHierarchyGroupsCommandInput
567568
| ListUsersCommandInput
569+
| PutUserStatusCommandInput
568570
| ReleasePhoneNumberCommandInput
569571
| ResumeContactRecordingCommandInput
570572
| SearchAvailablePhoneNumbersCommandInput
@@ -710,6 +712,7 @@ export type ServiceOutputTypes =
710712
| ListUseCasesCommandOutput
711713
| ListUserHierarchyGroupsCommandOutput
712714
| ListUsersCommandOutput
715+
| PutUserStatusCommandOutput
713716
| ReleasePhoneNumberCommandOutput
714717
| ResumeContactRecordingCommandOutput
715718
| SearchAvailablePhoneNumbersCommandOutput
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
3+
import { Command as $Command } from "@aws-sdk/smithy-client";
4+
import {
5+
FinalizeHandlerArguments,
6+
Handler,
7+
HandlerExecutionContext,
8+
HttpHandlerOptions as __HttpHandlerOptions,
9+
MetadataBearer as __MetadataBearer,
10+
MiddlewareStack,
11+
SerdeContext as __SerdeContext,
12+
} from "@aws-sdk/types";
13+
14+
import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
15+
import { PutUserStatusRequest, PutUserStatusResponse } from "../models/models_0";
16+
import {
17+
deserializeAws_restJson1PutUserStatusCommand,
18+
serializeAws_restJson1PutUserStatusCommand,
19+
} from "../protocols/Aws_restJson1";
20+
21+
export interface PutUserStatusCommandInput extends PutUserStatusRequest {}
22+
export interface PutUserStatusCommandOutput extends PutUserStatusResponse, __MetadataBearer {}
23+
24+
/**
25+
* <p>Changes the current status of a user or agent in Amazon Connect.
26+
* If the agent is currently handling a contact, this sets the agent's next status.</p>
27+
* <p>For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/metrics-agent-status.html">Agent status</a>
28+
* and <a href="https://docs.aws.amazon.com/connect/latest/adminguide/set-next-status.html">Set your next status</a>
29+
* in the <i>Amazon Connect Administrator Guide</i>.</p>
30+
* @example
31+
* Use a bare-bones client and the command you need to make an API call.
32+
* ```javascript
33+
* import { ConnectClient, PutUserStatusCommand } from "@aws-sdk/client-connect"; // ES Modules import
34+
* // const { ConnectClient, PutUserStatusCommand } = require("@aws-sdk/client-connect"); // CommonJS import
35+
* const client = new ConnectClient(config);
36+
* const command = new PutUserStatusCommand(input);
37+
* const response = await client.send(command);
38+
* ```
39+
*
40+
* @see {@link PutUserStatusCommandInput} for command's `input` shape.
41+
* @see {@link PutUserStatusCommandOutput} for command's `response` shape.
42+
* @see {@link ConnectClientResolvedConfig | config} for ConnectClient's `config` shape.
43+
*
44+
*/
45+
export class PutUserStatusCommand extends $Command<
46+
PutUserStatusCommandInput,
47+
PutUserStatusCommandOutput,
48+
ConnectClientResolvedConfig
49+
> {
50+
// Start section: command_properties
51+
// End section: command_properties
52+
53+
constructor(readonly input: PutUserStatusCommandInput) {
54+
// Start section: command_constructor
55+
super();
56+
// End section: command_constructor
57+
}
58+
59+
/**
60+
* @internal
61+
*/
62+
resolveMiddleware(
63+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
64+
configuration: ConnectClientResolvedConfig,
65+
options?: __HttpHandlerOptions
66+
): Handler<PutUserStatusCommandInput, PutUserStatusCommandOutput> {
67+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
68+
69+
const stack = clientStack.concat(this.middlewareStack);
70+
71+
const { logger } = configuration;
72+
const clientName = "ConnectClient";
73+
const commandName = "PutUserStatusCommand";
74+
const handlerExecutionContext: HandlerExecutionContext = {
75+
logger,
76+
clientName,
77+
commandName,
78+
inputFilterSensitiveLog: PutUserStatusRequest.filterSensitiveLog,
79+
outputFilterSensitiveLog: PutUserStatusResponse.filterSensitiveLog,
80+
};
81+
const { requestHandler } = configuration;
82+
return stack.resolve(
83+
(request: FinalizeHandlerArguments<any>) =>
84+
requestHandler.handle(request.request as __HttpRequest, options || {}),
85+
handlerExecutionContext
86+
);
87+
}
88+
89+
private serialize(input: PutUserStatusCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
90+
return serializeAws_restJson1PutUserStatusCommand(input, context);
91+
}
92+
93+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<PutUserStatusCommandOutput> {
94+
return deserializeAws_restJson1PutUserStatusCommand(output, context);
95+
}
96+
97+
// Start section: command_body_extra
98+
// End section: command_body_extra
99+
}

clients/client-connect/src/commands/SearchAvailablePhoneNumbersCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {
1212
} from "@aws-sdk/types";
1313

1414
import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
15-
import { SearchAvailablePhoneNumbersRequest } from "../models/models_0";
16-
import { SearchAvailablePhoneNumbersResponse } from "../models/models_1";
15+
import { SearchAvailablePhoneNumbersRequest, SearchAvailablePhoneNumbersResponse } from "../models/models_1";
1716
import {
1817
deserializeAws_restJson1SearchAvailablePhoneNumbersCommand,
1918
serializeAws_restJson1SearchAvailablePhoneNumbersCommand,

clients/client-connect/src/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export * from "./ListTagsForResourceCommand";
9393
export * from "./ListUseCasesCommand";
9494
export * from "./ListUserHierarchyGroupsCommand";
9595
export * from "./ListUsersCommand";
96+
export * from "./PutUserStatusCommand";
9697
export * from "./ReleasePhoneNumberCommand";
9798
export * from "./ResumeContactRecordingCommand";
9899
export * from "./SearchAvailablePhoneNumbersCommand";

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

+36-70
Original file line numberDiff line numberDiff line change
@@ -7922,133 +7922,99 @@ export namespace ListUsersResponse {
79227922
});
79237923
}
79247924

7925-
export interface ReleasePhoneNumberRequest {
7926-
/**
7927-
* <p>A unique identifier for the phone number.</p>
7928-
*/
7929-
PhoneNumberId: string | undefined;
7930-
7925+
export interface PutUserStatusRequest {
79317926
/**
7932-
* <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the
7933-
* request.</p>
7934-
*/
7935-
ClientToken?: string;
7936-
}
7937-
7938-
export namespace ReleasePhoneNumberRequest {
7939-
/**
7940-
* @internal
7927+
* <p>The identifier of the user.</p>
79417928
*/
7942-
export const filterSensitiveLog = (obj: ReleasePhoneNumberRequest): any => ({
7943-
...obj,
7944-
});
7945-
}
7929+
UserId: string | undefined;
79467930

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

79537936
/**
7954-
* <p>The identifier of the contact.</p>
7955-
*/
7956-
ContactId: string | undefined;
7957-
7958-
/**
7959-
* <p>The identifier of the contact. This is the identifier of the contact associated with the
7960-
* first interaction with the contact center.</p>
7937+
* <p>The identifier of the agent status.</p>
79617938
*/
7962-
InitialContactId: string | undefined;
7939+
AgentStatusId: string | undefined;
79637940
}
79647941

7965-
export namespace ResumeContactRecordingRequest {
7942+
export namespace PutUserStatusRequest {
79667943
/**
79677944
* @internal
79687945
*/
7969-
export const filterSensitiveLog = (obj: ResumeContactRecordingRequest): any => ({
7946+
export const filterSensitiveLog = (obj: PutUserStatusRequest): any => ({
79707947
...obj,
79717948
});
79727949
}
79737950

7974-
export interface ResumeContactRecordingResponse {}
7951+
export interface PutUserStatusResponse {}
79757952

7976-
export namespace ResumeContactRecordingResponse {
7953+
export namespace PutUserStatusResponse {
79777954
/**
79787955
* @internal
79797956
*/
7980-
export const filterSensitiveLog = (obj: ResumeContactRecordingResponse): any => ({
7957+
export const filterSensitiveLog = (obj: PutUserStatusResponse): any => ({
79817958
...obj,
79827959
});
79837960
}
79847961

7985-
export interface SearchAvailablePhoneNumbersRequest {
7962+
export interface ReleasePhoneNumberRequest {
79867963
/**
7987-
* <p>The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to.</p>
7964+
* <p>A unique identifier for the phone number.</p>
79887965
*/
7989-
TargetArn: string | undefined;
7966+
PhoneNumberId: string | undefined;
79907967

79917968
/**
7992-
* <p>The ISO country code.</p>
7969+
* <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the
7970+
* request.</p>
79937971
*/
7994-
PhoneNumberCountryCode: PhoneNumberCountryCode | string | undefined;
7972+
ClientToken?: string;
7973+
}
79957974

7975+
export namespace ReleasePhoneNumberRequest {
79967976
/**
7997-
* <p>The type of phone number.</p>
7977+
* @internal
79987978
*/
7999-
PhoneNumberType: PhoneNumberType | string | undefined;
7979+
export const filterSensitiveLog = (obj: ReleasePhoneNumberRequest): any => ({
7980+
...obj,
7981+
});
7982+
}
80007983

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

80067990
/**
8007-
* <p>The maximum number of results to return per page.</p>
7991+
* <p>The identifier of the contact.</p>
80087992
*/
8009-
MaxResults?: number;
7993+
ContactId: string | undefined;
80107994

80117995
/**
8012-
* <p>The token for the next set of results. Use the value returned in the previous
8013-
* response in the next request to retrieve the next set of results.</p>
7996+
* <p>The identifier of the contact. This is the identifier of the contact associated with the
7997+
* first interaction with the contact center.</p>
80147998
*/
8015-
NextToken?: string;
7999+
InitialContactId: string | undefined;
80168000
}
80178001

8018-
export namespace SearchAvailablePhoneNumbersRequest {
8002+
export namespace ResumeContactRecordingRequest {
80198003
/**
80208004
* @internal
80218005
*/
8022-
export const filterSensitiveLog = (obj: SearchAvailablePhoneNumbersRequest): any => ({
8006+
export const filterSensitiveLog = (obj: ResumeContactRecordingRequest): any => ({
80238007
...obj,
80248008
});
80258009
}
80268010

8027-
/**
8028-
* <p>Information about available phone numbers.</p>
8029-
*/
8030-
export interface AvailableNumberSummary {
8031-
/**
8032-
* <p>The phone number. Phone numbers are formatted <code>[+] [country code] [subscriber number including area code]</code>.</p>
8033-
*/
8034-
PhoneNumber?: string;
8035-
8036-
/**
8037-
* <p>The ISO country code.</p>
8038-
*/
8039-
PhoneNumberCountryCode?: PhoneNumberCountryCode | string;
8040-
8041-
/**
8042-
* <p>The type of phone number.</p>
8043-
*/
8044-
PhoneNumberType?: PhoneNumberType | string;
8045-
}
8011+
export interface ResumeContactRecordingResponse {}
80468012

8047-
export namespace AvailableNumberSummary {
8013+
export namespace ResumeContactRecordingResponse {
80488014
/**
80498015
* @internal
80508016
*/
8051-
export const filterSensitiveLog = (obj: AvailableNumberSummary): any => ({
8017+
export const filterSensitiveLog = (obj: ResumeContactRecordingResponse): any => ({
80528018
...obj,
80538019
});
80548020
}

0 commit comments

Comments
 (0)