aws-sdk#Chime TypeScript Examples

The following examples show how to use aws-sdk#Chime. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: meeting.ts    From flect-chime-sdk-demo with Apache License 2.0 5 votes vote down vote up
chime = new Chime({ region: "us-east-1" })
Example #2
Source File: meeting.ts    From flect-chime-sdk-demo with Apache License 2.0 5 votes vote down vote up
createMeeting = async (req: BackendCreateMeetingRequest): Promise<BackendCreateMeetingResponse> => {
    //// (1) check meeting name exist
    const meetingInfo = await getMeetingInfo({ meetingName: req.meetingName });
    if (meetingInfo !== null) {
        return {
            created: false,
            meetingId: meetingInfo.meetingId,
            meetingName: meetingInfo.meetingName,
            ownerId: meetingInfo.metadata.OwnerId,
        };
    }

    //// (2) create meeting in Amazon Chime
    const request: Chime.CreateMeetingRequest = {
        ClientRequestToken: v4(),
        MediaRegion: req.region,
    };
    const newMeetingInfo = await chime.createMeeting(request).promise();

    //// (3) register meeting info in DB
    const date = new Date();
    const now = date.getTime();
    const metadata: Metadata = {
        OwnerId: req.email,
        Region: req.region,
        StartTime: now,
    };
    const item = {
        MeetingName: { S: req.meetingName },
        MeetingId: { S: newMeetingInfo.Meeting!.MeetingId },
        Meeting: { S: JSON.stringify(newMeetingInfo.Meeting) },
        Metadata: { S: JSON.stringify(metadata) },
        TTL: {
            N: "" + getExpireDate(),
        },
    };
    await ddb
        .putItem({
            TableName: meetingTableName,
            Item: item,
        })
        .promise();

    return {
        created: true,
        meetingId: newMeetingInfo.Meeting!.MeetingId!,
        meetingName: req.meetingName,
        ownerId: req.email,
    };
}
Example #3
Source File: message.ts    From flect-chime-sdk-demo with Apache License 2.0 5 votes vote down vote up
chime = new Chime({ region: "us-east-1" })