All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.communication.chat.implementation.converters.AddChatParticipantsOptionsConverter Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.communication.chat.implementation.converters;

import com.azure.communication.chat.models.ChatParticipant;

import java.util.ArrayList;
import java.util.List;

/**
 * A converter between {@link com.azure.communication.chat.implementation.models.AddChatParticipantsOptions} and
 * a collection of {@link ChatParticipant}.
 */
public final class AddChatParticipantsOptionsConverter {
    /**
     * Maps from a collection of {@link ChatParticipant} to
     * {@link com.azure.communication.chat.implementation.models.AddChatParticipantsOptions}.
     *
     * @param participants A list of participants to add
     */
    public static com.azure.communication.chat.implementation.models.AddChatParticipantsOptions convert(
        Iterable participants) {

        if (participants == null) {
            return null;
        }
        List targetParticipants = new ArrayList<>();

        participants.forEach(participant -> {
            targetParticipants.add(ChatParticipantConverter.convert(participant));
        });

        com.azure.communication.chat.implementation.models.AddChatParticipantsOptions addChatThreadMembersOptions
            = new com.azure.communication.chat.implementation.models.AddChatParticipantsOptions()
            .setParticipants(targetParticipants);

        return addChatThreadMembersOptions;
    }

    private AddChatParticipantsOptionsConverter() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy