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

com.twilio.sdk.resource.list.conversations.ParticipantList Maven / Gradle / Ivy

There is a newer version: 7.0.0-rc-10
Show newest version
package com.twilio.sdk.resource.list.conversations;

import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;

import com.twilio.sdk.TwilioConversationsClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.resource.NextGenListResource;
import com.twilio.sdk.resource.factory.Factory;
import com.twilio.sdk.resource.instance.conversations.Participant;

/**
 * Represents a list of Participants
 * 
 */
public class ParticipantList extends NextGenListResource implements Factory {

	private String conversationSid;

	/**
	 * Instantiates a Participant list
	 * 
	 * @param client the REST client
	 * @param conversationSid the conversation sid, participants belong to
	 */
	public ParticipantList(TwilioConversationsClient client, String conversationSid) {
		super(client);
		this.conversationSid = conversationSid;
	}

	/**
	 * Instantiates a Participant list
	 * 
	 * @param client the REST client
	 * @param filters query parameters
	 * @param conversationSid the conversation sid, the participants belong to
	 */
	public ParticipantList(TwilioConversationsClient client, final Map filters, String conversationSid) {
		super(client, filters);
		this.conversationSid = conversationSid;
	}

	@Override
	public Participant create(Map params)
			throws TwilioRestException {
		TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
		return makeNew(getClient(), response.toMap());
	}

	@Override
	public Participant create(List params)
			throws TwilioRestException {
		TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
		return makeNew(getClient(), response.toMap());
	}

	@Override
	protected Participant makeNew(TwilioConversationsClient client,
			Map params) {
		return new Participant(client, params);
	}

	@Override
	protected String getResourceLocation() {
		return "/" + TwilioConversationsClient.DEFAULT_VERSION + "/Conversations/" + conversationSid + "/Participants";
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy