Skip to content

Commit 27f0d81

Browse files
author
awstools
committed
feat(client-chime-sdk-messaging): This release adds support for searching channels by members via the SearchChannels API, removes required restrictions for Name and Mode in UpdateChannel API and enhances CreateChannel API by exposing member and moderator list as well as channel id as optional parameters.
1 parent 47e52de commit 27f0d81

File tree

10 files changed

+771
-21
lines changed

10 files changed

+771
-21
lines changed

clients/client-chime-sdk-messaging/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ AWS SDK for JavaScript ChimeSDKMessaging Client for Node.js, Browser and React N
1212
<p>The Amazon Chime SDK Messaging APIs in this section allow software developers to send
1313
and receive messages in custom messaging applications. These APIs depend on the frameworks
1414
provided by the Amazon Chime SDK Identity APIs. For more information about the messaging
15-
APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging">Amazon Chime SDK messaging</a>
16-
</p>
15+
APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging.html">Amazon Chime SDK messaging</a>.</p>
1716

1817
## Installing
1918

clients/client-chime-sdk-messaging/src/ChimeSDKMessaging.ts

+39-2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ import {
192192
RedactChannelMessageCommandInput,
193193
RedactChannelMessageCommandOutput,
194194
} from "./commands/RedactChannelMessageCommand";
195+
import {
196+
SearchChannelsCommand,
197+
SearchChannelsCommandInput,
198+
SearchChannelsCommandOutput,
199+
} from "./commands/SearchChannelsCommand";
195200
import {
196201
SendChannelMessageCommand,
197202
SendChannelMessageCommandInput,
@@ -228,8 +233,7 @@ import {
228233
* <p>The Amazon Chime SDK Messaging APIs in this section allow software developers to send
229234
* and receive messages in custom messaging applications. These APIs depend on the frameworks
230235
* provided by the Amazon Chime SDK Identity APIs. For more information about the messaging
231-
* APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging">Amazon Chime SDK messaging</a>
232-
* </p>
236+
* APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging.html">Amazon Chime SDK messaging</a>.</p>
233237
*/
234238
export class ChimeSDKMessaging extends ChimeSDKMessagingClient {
235239
/**
@@ -1774,6 +1778,39 @@ export class ChimeSDKMessaging extends ChimeSDKMessagingClient {
17741778
}
17751779
}
17761780

1781+
/**
1782+
* <p>Allows an <code>AppInstanceUser</code> to search the channels that they belong to. The <code>AppInstanceUser</code> can search by membership or external ID.
1783+
* An <code>AppInstanceAdmin</code> can search across all channels within the <code>AppInstance</code>.</p>
1784+
*/
1785+
public searchChannels(
1786+
args: SearchChannelsCommandInput,
1787+
options?: __HttpHandlerOptions
1788+
): Promise<SearchChannelsCommandOutput>;
1789+
public searchChannels(
1790+
args: SearchChannelsCommandInput,
1791+
cb: (err: any, data?: SearchChannelsCommandOutput) => void
1792+
): void;
1793+
public searchChannels(
1794+
args: SearchChannelsCommandInput,
1795+
options: __HttpHandlerOptions,
1796+
cb: (err: any, data?: SearchChannelsCommandOutput) => void
1797+
): void;
1798+
public searchChannels(
1799+
args: SearchChannelsCommandInput,
1800+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SearchChannelsCommandOutput) => void),
1801+
cb?: (err: any, data?: SearchChannelsCommandOutput) => void
1802+
): Promise<SearchChannelsCommandOutput> | void {
1803+
const command = new SearchChannelsCommand(args);
1804+
if (typeof optionsOrCb === "function") {
1805+
this.send(command, optionsOrCb);
1806+
} else if (typeof cb === "function") {
1807+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1808+
this.send(command, optionsOrCb || {}, cb);
1809+
} else {
1810+
return this.send(command, optionsOrCb);
1811+
}
1812+
}
1813+
17771814
/**
17781815
* <p>Sends a message to a particular channel that the member is a part of.</p>
17791816
*

clients/client-chime-sdk-messaging/src/ChimeSDKMessagingClient.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ import {
169169
RedactChannelMessageCommandInput,
170170
RedactChannelMessageCommandOutput,
171171
} from "./commands/RedactChannelMessageCommand";
172+
import { SearchChannelsCommandInput, SearchChannelsCommandOutput } from "./commands/SearchChannelsCommand";
172173
import { SendChannelMessageCommandInput, SendChannelMessageCommandOutput } from "./commands/SendChannelMessageCommand";
173174
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
174175
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
@@ -223,6 +224,7 @@ export type ServiceInputTypes =
223224
| ListTagsForResourceCommandInput
224225
| PutChannelMembershipPreferencesCommandInput
225226
| RedactChannelMessageCommandInput
227+
| SearchChannelsCommandInput
226228
| SendChannelMessageCommandInput
227229
| TagResourceCommandInput
228230
| UntagResourceCommandInput
@@ -270,6 +272,7 @@ export type ServiceOutputTypes =
270272
| ListTagsForResourceCommandOutput
271273
| PutChannelMembershipPreferencesCommandOutput
272274
| RedactChannelMessageCommandOutput
275+
| SearchChannelsCommandOutput
273276
| SendChannelMessageCommandOutput
274277
| TagResourceCommandOutput
275278
| UntagResourceCommandOutput
@@ -435,8 +438,7 @@ export interface ChimeSDKMessagingClientResolvedConfig extends ChimeSDKMessaging
435438
* <p>The Amazon Chime SDK Messaging APIs in this section allow software developers to send
436439
* and receive messages in custom messaging applications. These APIs depend on the frameworks
437440
* provided by the Amazon Chime SDK Identity APIs. For more information about the messaging
438-
* APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging">Amazon Chime SDK messaging</a>
439-
* </p>
441+
* APIs, see <a href="https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging.html">Amazon Chime SDK messaging</a>.</p>
440442
*/
441443
export class ChimeSDKMessagingClient extends __Client<
442444
__HttpHandlerOptions,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import {
16+
ChimeSDKMessagingClientResolvedConfig,
17+
ServiceInputTypes,
18+
ServiceOutputTypes,
19+
} from "../ChimeSDKMessagingClient";
20+
import { SearchChannelsRequest, SearchChannelsResponse } from "../models/models_0";
21+
import {
22+
deserializeAws_restJson1SearchChannelsCommand,
23+
serializeAws_restJson1SearchChannelsCommand,
24+
} from "../protocols/Aws_restJson1";
25+
26+
export interface SearchChannelsCommandInput extends SearchChannelsRequest {}
27+
export interface SearchChannelsCommandOutput extends SearchChannelsResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Allows an <code>AppInstanceUser</code> to search the channels that they belong to. The <code>AppInstanceUser</code> can search by membership or external ID.
31+
* An <code>AppInstanceAdmin</code> can search across all channels within the <code>AppInstance</code>.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { ChimeSDKMessagingClient, SearchChannelsCommand } from "@aws-sdk/client-chime-sdk-messaging"; // ES Modules import
36+
* // const { ChimeSDKMessagingClient, SearchChannelsCommand } = require("@aws-sdk/client-chime-sdk-messaging"); // CommonJS import
37+
* const client = new ChimeSDKMessagingClient(config);
38+
* const command = new SearchChannelsCommand(input);
39+
* const response = await client.send(command);
40+
* ```
41+
*
42+
* @see {@link SearchChannelsCommandInput} for command's `input` shape.
43+
* @see {@link SearchChannelsCommandOutput} for command's `response` shape.
44+
* @see {@link ChimeSDKMessagingClientResolvedConfig | config} for ChimeSDKMessagingClient's `config` shape.
45+
*
46+
*/
47+
export class SearchChannelsCommand extends $Command<
48+
SearchChannelsCommandInput,
49+
SearchChannelsCommandOutput,
50+
ChimeSDKMessagingClientResolvedConfig
51+
> {
52+
// Start section: command_properties
53+
// End section: command_properties
54+
55+
constructor(readonly input: SearchChannelsCommandInput) {
56+
// Start section: command_constructor
57+
super();
58+
// End section: command_constructor
59+
}
60+
61+
/**
62+
* @internal
63+
*/
64+
resolveMiddleware(
65+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
66+
configuration: ChimeSDKMessagingClientResolvedConfig,
67+
options?: __HttpHandlerOptions
68+
): Handler<SearchChannelsCommandInput, SearchChannelsCommandOutput> {
69+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
70+
71+
const stack = clientStack.concat(this.middlewareStack);
72+
73+
const { logger } = configuration;
74+
const clientName = "ChimeSDKMessagingClient";
75+
const commandName = "SearchChannelsCommand";
76+
const handlerExecutionContext: HandlerExecutionContext = {
77+
logger,
78+
clientName,
79+
commandName,
80+
inputFilterSensitiveLog: SearchChannelsRequest.filterSensitiveLog,
81+
outputFilterSensitiveLog: SearchChannelsResponse.filterSensitiveLog,
82+
};
83+
const { requestHandler } = configuration;
84+
return stack.resolve(
85+
(request: FinalizeHandlerArguments<any>) =>
86+
requestHandler.handle(request.request as __HttpRequest, options || {}),
87+
handlerExecutionContext
88+
);
89+
}
90+
91+
private serialize(input: SearchChannelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
92+
return serializeAws_restJson1SearchChannelsCommand(input, context);
93+
}
94+
95+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<SearchChannelsCommandOutput> {
96+
return deserializeAws_restJson1SearchChannelsCommand(output, context);
97+
}
98+
99+
// Start section: command_body_extra
100+
// End section: command_body_extra
101+
}

clients/client-chime-sdk-messaging/src/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export * from "./ListChannelsModeratedByAppInstanceUserCommand";
3737
export * from "./ListTagsForResourceCommand";
3838
export * from "./PutChannelMembershipPreferencesCommand";
3939
export * from "./RedactChannelMessageCommand";
40+
export * from "./SearchChannelsCommand";
4041
export * from "./SendChannelMessageCommand";
4142
export * from "./TagResourceCommand";
4243
export * from "./UntagResourceCommand";

clients/client-chime-sdk-messaging/src/models/models_0.ts

+119-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface AppInstanceUserMembershipSummary {
2424
Type?: ChannelMembershipType | string;
2525

2626
/**
27-
* <p>The time at which a message was last read.</p>
27+
* <p>The time at which an <code>AppInstanceUser</code> last marked a channel as read.</p>
2828
*/
2929
ReadMarkerTimestamp?: Date;
3030
}
@@ -1047,7 +1047,7 @@ export interface PushNotificationPreferences {
10471047
AllowNotifications: AllowNotifications | string | undefined;
10481048

10491049
/**
1050-
* <p>The simple JSON object used to send a subset of a push notification to the requsted member.</p>
1050+
* <p>The simple JSON object used to send a subset of a push notification to the requested member.</p>
10511051
*/
10521052
FilterRule?: string;
10531053
}
@@ -1464,6 +1464,21 @@ export interface CreateChannelRequest {
14641464
* <p>The <code>AppInstanceUserArn</code> of the user that makes the API call.</p>
14651465
*/
14661466
ChimeBearer: string | undefined;
1467+
1468+
/**
1469+
* <p>The ID of the channel in the request.</p>
1470+
*/
1471+
ChannelId?: string;
1472+
1473+
/**
1474+
* <p>The ARNs of the channel members in the request.</p>
1475+
*/
1476+
MemberArns?: string[];
1477+
1478+
/**
1479+
* <p>The ARNs of the channel moderators in the request.</p>
1480+
*/
1481+
ModeratorArns?: string[];
14671482
}
14681483

14691484
export namespace CreateChannelRequest {
@@ -1476,6 +1491,7 @@ export namespace CreateChannelRequest {
14761491
...(obj.Metadata && { Metadata: SENSITIVE_STRING }),
14771492
...(obj.ClientRequestToken && { ClientRequestToken: SENSITIVE_STRING }),
14781493
...(obj.Tags && { Tags: obj.Tags.map((item) => Tag.filterSensitiveLog(item)) }),
1494+
...(obj.ChannelId && { ChannelId: SENSITIVE_STRING }),
14791495
});
14801496
}
14811497

@@ -2587,7 +2603,7 @@ export namespace ListChannelMembershipsForAppInstanceUserRequest {
25872603

25882604
export interface ListChannelMembershipsForAppInstanceUserResponse {
25892605
/**
2590-
* <p>The token passed by previous API calls until all requested users are returned.</p>
2606+
* <p>The information for the requested channel memberships.</p>
25912607
*/
25922608
ChannelMemberships?: ChannelMembershipForAppInstanceUserSummary[];
25932609

@@ -3073,6 +3089,104 @@ export namespace RedactChannelMessageResponse {
30733089
});
30743090
}
30753091

3092+
export enum SearchFieldKey {
3093+
MEMBERS = "MEMBERS",
3094+
}
3095+
3096+
export enum SearchFieldOperator {
3097+
EQUALS = "EQUALS",
3098+
INCLUDES = "INCLUDES",
3099+
}
3100+
3101+
/**
3102+
* <p>A <code>Field</code> of the channel that you want to search.</p>
3103+
*/
3104+
export interface SearchField {
3105+
/**
3106+
* <p>An <code>enum</code> value that indicates the key to search the channel on. <code>MEMBERS</code> allows you to search channels based on memberships. You can use it with the <code>EQUALS</code>
3107+
* operator to get channels whose memberships are equal to the specified values, and with the <code>INCLUDES</code> operator to get channels whose memberships include the specified values.</p>
3108+
*/
3109+
Key: SearchFieldKey | string | undefined;
3110+
3111+
/**
3112+
* <p>The values that you want to search for, a list of strings. The values must be <code>AppInstanceUserArns</code> specified as a list of strings.</p>
3113+
* <note>
3114+
* <p>This operation isn't supported for <code>AppInstanceUsers</code> with large number of memberships.</p>
3115+
* </note>
3116+
*/
3117+
Values: string[] | undefined;
3118+
3119+
/**
3120+
* <p>The operator used to compare field values, currently <code>EQUALS</code> or <code>INCLUDES</code>. Use the <code>EQUALS</code> operator to find channels whose memberships equal the specified values.
3121+
* Use the <code>INCLUDES</code> operator to find channels whose memberships include the specified values.</p>
3122+
*/
3123+
Operator: SearchFieldOperator | string | undefined;
3124+
}
3125+
3126+
export namespace SearchField {
3127+
/**
3128+
* @internal
3129+
*/
3130+
export const filterSensitiveLog = (obj: SearchField): any => ({
3131+
...obj,
3132+
});
3133+
}
3134+
3135+
export interface SearchChannelsRequest {
3136+
/**
3137+
* <p>The <code>AppInstanceUserArn</code> of the user making the API call.</p>
3138+
*/
3139+
ChimeBearer?: string;
3140+
3141+
/**
3142+
* <p>A list of the <code>Field</code> objects in the channel being searched.</p>
3143+
*/
3144+
Fields: SearchField[] | undefined;
3145+
3146+
/**
3147+
* <p>The maximum number of channels that you want returned.</p>
3148+
*/
3149+
MaxResults?: number;
3150+
3151+
/**
3152+
* <p>The token returned from previous API requests until the number of channels is reached.</p>
3153+
*/
3154+
NextToken?: string;
3155+
}
3156+
3157+
export namespace SearchChannelsRequest {
3158+
/**
3159+
* @internal
3160+
*/
3161+
export const filterSensitiveLog = (obj: SearchChannelsRequest): any => ({
3162+
...obj,
3163+
...(obj.NextToken && { NextToken: SENSITIVE_STRING }),
3164+
});
3165+
}
3166+
3167+
export interface SearchChannelsResponse {
3168+
/**
3169+
* <p>A list of the channels in the request.</p>
3170+
*/
3171+
Channels?: ChannelSummary[];
3172+
3173+
/**
3174+
* <p>The token returned from previous API responses until the number of channels is reached.</p>
3175+
*/
3176+
NextToken?: string;
3177+
}
3178+
3179+
export namespace SearchChannelsResponse {
3180+
/**
3181+
* @internal
3182+
*/
3183+
export const filterSensitiveLog = (obj: SearchChannelsResponse): any => ({
3184+
...obj,
3185+
...(obj.Channels && { Channels: obj.Channels.map((item) => ChannelSummary.filterSensitiveLog(item)) }),
3186+
...(obj.NextToken && { NextToken: SENSITIVE_STRING }),
3187+
});
3188+
}
3189+
30763190
export interface SendChannelMessageRequest {
30773191
/**
30783192
* <p>The ARN of the channel.</p>
@@ -3223,12 +3337,12 @@ export interface UpdateChannelRequest {
32233337
/**
32243338
* <p>The name of the channel.</p>
32253339
*/
3226-
Name: string | undefined;
3340+
Name?: string;
32273341

32283342
/**
32293343
* <p>The mode of the update request.</p>
32303344
*/
3231-
Mode: ChannelMode | string | undefined;
3345+
Mode?: ChannelMode | string;
32323346

32333347
/**
32343348
* <p>The metadata for the update request.</p>

0 commit comments

Comments
 (0)