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

com.twilio.sdk.resource.list.NotificationList Maven / Gradle / Ivy

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

import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.resource.ListResource;
import com.twilio.sdk.resource.instance.Notification;

import java.util.Map;

// TODO: Auto-generated Javadoc
/**
 * The Class NotificationList.
 *
 * For more information see https://www.twilio.com/docs/api/rest/notification
 */
public class NotificationList extends ListResource {

	private String requestCallSid;

	/**
	 * Instantiates a new notification list.
	 *
	 * @param client the client
	 */
	public NotificationList(TwilioRestClient client) {
		super(client);
	}

	/**
	 * Instantiates a new notification list.
	 *
	 * @param client the client
	 * @param callSid the sid of the parent call
	 */
	public NotificationList(TwilioRestClient client, String callSid) {
		super(client);
		this.requestCallSid = callSid;
	}

	/**
	 * Instantiates a new notification list.
	 *
	 * @param client the client
	 * @param callSid the sid of the parent call
	 * @param filters the filters
	 */
	public NotificationList(TwilioRestClient client, String callSid, Map filters) {
		super(client, filters);
		this.requestCallSid = callSid;
	}

	/**
	 * Instantiates a new notification list.
	 *
	 * @param client the client
	 * @param filters the filters
	 */
	public NotificationList(TwilioRestClient client, Map filters) {
		super(client, filters);
	}

	/* (non-Javadoc)
	 * @see com.twilio.sdk.resource.Resource#getResourceLocation()
	 */
	@Override
	protected String getResourceLocation() {
		if (this.requestCallSid != null) {
			return "/" + TwilioRestClient.DEFAULT_VERSION +
				"/Accounts/" + this.getRequestAccountSid() +
				"/Calls/" + this.getRequestCallSid() +
				"/Notifications.json";
		} else {
			return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
					+ this.getRequestAccountSid() + "/Notifications.json";
		}
	}

	/* (non-Javadoc)
	 * @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
	 */
	@Override
	protected Notification makeNew(TwilioRestClient client,
			Map params) {
		return new Notification(client, params);
	}

	/* (non-Javadoc)
	 * @see com.twilio.sdk.resource.ListResource#getListKey()
	 */
	@Override
	protected String getListKey() {
		return "notifications";
	}

	/**
	 * Gets the call sid of the notification *if* it was initially referenced
	 * as the child of a message
	 *
	 * @return the call sid of the parent call
	 */
	public String getRequestCallSid() {
		return this.requestCallSid;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy