001package com.plivo.api.models.call; 002 003import com.plivo.api.models.base.ListResponse; 004import com.plivo.api.models.base.Lister; 005import com.plivo.api.util.PropertyFilter; 006 007public class CallLister extends Lister<Call> { 008 009 private String subaccount; 010 private CallDirection callDirection; 011 private String fromNumber; 012 private String toNumber; 013 private String parentCallUuid; 014 private String hangupSource; 015 private Integer hangupCauseCode; 016 // TODO XXX PropertyFilter 017 private PropertyFilter<Long> billDuration; 018 private PropertyFilter<Long> endTime; 019 020 public String subaccount() { 021 return this.subaccount; 022 } 023 024 public CallDirection callDirection() { 025 return this.callDirection; 026 } 027 028 public String fromNumber() { 029 return this.fromNumber; 030 } 031 032 public String toNumber() { 033 return this.toNumber; 034 } 035 036 public String parentCallUuid(){ 037 return this.parentCallUuid; 038 } 039 040 public String hangupSource() { 041 return hangupSource; 042 } 043 044 public Integer hangupCauseCode() { 045 return hangupCauseCode; 046 } 047 048 public PropertyFilter<Long> billDuration() { 049 return this.billDuration; 050 } 051 052 public PropertyFilter<Long> endTime() { 053 return this.endTime; 054 } 055 056 /** 057 * @param subaccount The id of the subaccount, if call details of the subaccount are needed. 058 */ 059 public CallLister subaccount(final String subaccount) { 060 this.subaccount = subaccount; 061 return this; 062 } 063 064 /** 065 * @param callDirection Filter the results by call direction. The valid inputs are inbound and 066 * outbound. 067 */ 068 public CallLister callDirection(final CallDirection callDirection) { 069 this.callDirection = callDirection; 070 return this; 071 } 072 073 /** 074 * @param fromNumber Filter the results by the number from where the call originated. 075 */ 076 public CallLister fromNumber(final String fromNumber) { 077 this.fromNumber = fromNumber; 078 return this; 079 } 080 081 /** 082 * @param toNumber Filter the results by the number to which the call was made. 083 */ 084 public CallLister toNumber(final String toNumber) { 085 this.toNumber = toNumber; 086 return this; 087 } 088 089 /** 090 * @param parentCallUuid Filter the results by the number to which the call was made. 091 */ 092 public CallLister parentCallUuid(final String parentCallUuid) { 093 this.parentCallUuid = parentCallUuid; 094 return this; 095 } 096 097 /** 098 * @param hangupSource Filter the results by hangup source. 099 */ 100 public CallLister hangupSource(String hangupSource) { 101 this.hangupSource = hangupSource; 102 return this; 103 } 104 105 /** 106 * @param hangupCauseCode Filter the results by hangup cause code. 107 */ 108 public CallLister hangupCauseCode(Integer hangupCauseCode) { 109 this.hangupCauseCode = hangupCauseCode; 110 return this; 111 } 112 113 /** 114 * @param billDuration Filter the results according to billed duration. 115 */ 116 public CallLister billDuration( 117 final PropertyFilter<Long> billDuration) { 118 this.billDuration = billDuration; 119 return this; 120 } 121 122 /** 123 * @param endTime Filter out calls according to the time of completion. 124 */ 125 public CallLister endTime(final PropertyFilter<Long> endTime) { 126 this.endTime = endTime; 127 return this; 128 } 129 130 @Override 131 protected retrofit2.Call<ListResponse<Call>> obtainCall() { 132 return client().getApiService().callList(client().getAuthId(), toMap()); 133 } 134}