com.twilio.sdk.resource.list.TranscriptionList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio-java-sdk Show documentation
Show all versions of twilio-java-sdk Show documentation
Release Candidate for Next-Gen Twilio Java Helper Library
package com.twilio.sdk.resource.list;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.resource.ListResource;
import com.twilio.sdk.resource.instance.Transcription;
import java.util.Map;
/**
* The Class TranscriptionList.
*
* For more information see https://www.twilio.com/docs/api/rest/transcription
*/
public class TranscriptionList extends ListResource {
private static String requestCallSid;
private static String requestRecordingSid;
/**
* Instantiates a new transcription list from a call.
*
* @param client
* @param callSid
* @return a call transcription list
*/
public static TranscriptionList callTranscriptionList(final TwilioRestClient client, final String callSid) {
return new TranscriptionList(client, callSid);
}
/**
* Instantiates a new transcription list from a call.
*
* @param client
* @param callSid
* @param filters
* @return a call transcription list
*/
public static TranscriptionList callTranscriptionList(final TwilioRestClient client, final String callSid,
final Map filters) {
return new TranscriptionList(client, callSid, filters);
}
/**
* Instantiates a new transcription list from a recording.
*
* @param client
* @param recordingSid
* @return a call transcription list
*/
public static TranscriptionList recordingTranscriptionList(final TwilioRestClient client,
final String recordingSid) {
TranscriptionList transcriptions = new TranscriptionList(client);
requestRecordingSid = recordingSid;
return transcriptions;
}
/**
* Instantiates a new transcription list from a recording.
*
* @param client
* @param recordingSid
* @param filters
* @return a call transcription list
*/
public static TranscriptionList recordingTranscriptionList(final TwilioRestClient client, final String recordingSid,
final Map filters) {
TranscriptionList transcriptions = new TranscriptionList(client, filters);
requestRecordingSid = recordingSid;
return transcriptions;
}
/**
* Instantiates a new transcription list.
*
* @param client the client
*/
public TranscriptionList(final TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new transcription list.
*
* @param client the client
* @param filters the filters
*/
public TranscriptionList(final TwilioRestClient client, final Map filters) {
super(client, filters);
}
/**
* Instantiates a new transcription list from a call.
*
* @param client the client
* @param callSid the sid of the parent call
*/
public TranscriptionList(final TwilioRestClient client, final String callSid) {
super(client);
requestCallSid = callSid;
}
/**
* Instantiates a new transcription list from a call with filters.
*
* @param client the client
* @param callSid the sid of the parent call
* @param filters the filters
*/
public TranscriptionList(final TwilioRestClient client, final String callSid, final Map filters) {
super(client, filters);
requestCallSid = callSid;
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
*/
@Override
protected String getResourceLocation() {
if (requestCallSid != null) {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() + "/Calls/" + getRequestCallSid() + "/Transcriptions.json";
} else if (requestRecordingSid != null) {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() + "/Recordings/" + requestRecordingSid + "/Transcriptions.json";
} else {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() + "/Transcriptions.json";
}
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
*/
@Override
protected Transcription makeNew(final TwilioRestClient client, final Map params) {
return new Transcription(client, params);
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#getListKey()
*/
@Override
protected String getListKey() {
return "transcriptions";
}
/**
* Gets the call sid of the transcription *if* it was constructed with a call sid.
*
* @return the call sid of the parent call
*/
public String getRequestCallSid() {
return requestCallSid;
}
/**
* Gets the recording sid of the transcription *if* it was constructed with a recording sid.
*
* @return the recording sid of the parent recording
*/
public String getRequestRecordingSid() {
return requestRecordingSid;
}
}