001package com.plivo.api;
002
003import com.plivo.api.models.account.Account;
004import com.plivo.api.models.account.AccountUpdateResponse;
005import com.plivo.api.models.account.AccountUpdater;
006import com.plivo.api.models.account.Subaccount;
007import com.plivo.api.models.account.SubaccountCreateResponse;
008import com.plivo.api.models.account.SubaccountCreator;
009import com.plivo.api.models.account.SubaccountUpdateResponse;
010import com.plivo.api.models.account.SubaccountUpdater;
011import com.plivo.api.models.account.SubaccountDeleter;
012import com.plivo.api.models.address.Address;
013import com.plivo.api.models.address.AddressCreateResponse;
014import com.plivo.api.models.address.AddressCreator;
015import com.plivo.api.models.address.AddressUpdateResponse;
016import com.plivo.api.models.address.AddressUpdater;
017import com.plivo.api.models.application.Application;
018import com.plivo.api.models.application.ApplicationCreateResponse;
019import com.plivo.api.models.application.ApplicationCreator;
020import com.plivo.api.models.application.ApplicationUpdateResponse;
021import com.plivo.api.models.application.ApplicationUpdater;
022import com.plivo.api.models.base.ListResponse;
023import com.plivo.api.models.call.CallCreateResponse;
024import com.plivo.api.models.call.CallCreator;
025import com.plivo.api.models.call.CallUpdateResponse;
026import com.plivo.api.models.call.CallUpdater;
027import com.plivo.api.models.call.LiveCall;
028import com.plivo.api.models.call.LiveCallListResponse;
029import com.plivo.api.models.call.QueuedCall;
030import com.plivo.api.models.call.QueuedCallListResponse;
031import com.plivo.api.models.call.actions.CallDtmfCreateResponse;
032import com.plivo.api.models.call.actions.CallDtmfCreator;
033import com.plivo.api.models.call.actions.CallPlayCreateResponse;
034import com.plivo.api.models.call.actions.CallPlayCreator;
035import com.plivo.api.models.call.actions.CallRecordCreateResponse;
036import com.plivo.api.models.call.actions.CallRecordCreator;
037import com.plivo.api.models.call.actions.CallSpeakCreateResponse;
038import com.plivo.api.models.call.actions.CallSpeakCreator;
039import com.plivo.api.models.conference.Conference;
040import com.plivo.api.models.conference.ConferenceList;
041import com.plivo.api.models.conference.ConferenceMemberActionResponse;
042import com.plivo.api.models.conference.ConferenceMemberPlayCreator;
043import com.plivo.api.models.conference.ConferenceMemberSpeakCreator;
044import com.plivo.api.models.conference.ConferenceRecordCreateResponse;
045import com.plivo.api.models.endpoint.Endpoint;
046import com.plivo.api.models.endpoint.EndpointCreateResponse;
047import com.plivo.api.models.endpoint.EndpointCreator;
048import com.plivo.api.models.endpoint.EndpointUpdateResponse;
049import com.plivo.api.models.endpoint.EndpointUpdater;
050import com.plivo.api.models.identity.Identity;
051import com.plivo.api.models.identity.IdentityCreateResponse;
052import com.plivo.api.models.identity.IdentityCreator;
053import com.plivo.api.models.identity.IdentityUpdateResponse;
054import com.plivo.api.models.identity.IdentityUpdater;
055import com.plivo.api.models.message.Message;
056import com.plivo.api.models.message.MessageCreateResponse;
057import com.plivo.api.models.message.MessageCreator;
058import com.plivo.api.models.node.*;
059import com.plivo.api.models.number.Number;
060import com.plivo.api.models.number.NumberCreateResponse;
061import com.plivo.api.models.number.NumberCreator;
062import com.plivo.api.models.number.NumberUpdateResponse;
063import com.plivo.api.models.number.NumberUpdater;
064import com.plivo.api.models.number.PhoneNumber;
065import com.plivo.api.models.number.PhoneNumberCreateResponse;
066import com.plivo.api.models.number.PhoneNumberCreator;
067import com.plivo.api.models.phlo.Phlo;
068import com.plivo.api.models.phlo.PhloRunGetterResponse;
069import com.plivo.api.models.phlo.PhloUpdateResponse;
070import com.plivo.api.models.pricing.Pricing;
071import com.plivo.api.models.recording.Recording;
072import java.util.Map;
073import okhttp3.ResponseBody;
074import retrofit2.Call;
075import retrofit2.http.Body;
076import retrofit2.http.DELETE;
077import retrofit2.http.GET;
078import retrofit2.http.Headers;
079import retrofit2.http.POST;
080import retrofit2.http.Path;
081import retrofit2.http.Query;
082import retrofit2.http.QueryMap;
083import retrofit2.http.HTTP;
084
085public interface PlivoAPIService {
086
087  // Address
088  @POST("Account/{authId}/Verification/Address/")
089  Call<AddressCreateResponse> addressCreate(@Path("authId") String authId,
090                                            @Body AddressCreator addressCreator);
091
092  @GET("Account/{authId}/Verification/Address/")
093  Call<ListResponse<Address>> addressList(@Path("authId") String authId,
094                                          @QueryMap Map<String, Object> addressListRequest);
095
096  @GET("Account/{authId}/Verification/Address/{addressId}/")
097  Call<Address> addressGet(@Path("authId") String authId, @Path("addressId") String addressId);
098
099  @POST("Account/{authId}/Verification/Address/{addressId}/")
100  Call<AddressUpdateResponse> addressUpdate(@Path("authId") String authId,
101                                            @Path("addressId") String addressId, @Body AddressUpdater addressUpdater);
102
103  @DELETE("Account/{authId}/Verification/Address/{addressId}/")
104  Call<ResponseBody> addressDelete(@Path("authId") String authId, @Path("addressId") String addressId);
105
106  // Application
107  @POST("Account/{authId}/Application/")
108  Call<ApplicationCreateResponse> applicationCreate(@Path("authId") String authId,
109    @Body ApplicationCreator application);
110
111  @GET("Account/{authId}/Application/")
112  Call<ListResponse<Application>> applicationList(@Path("authId") String authId,
113    @QueryMap Map<String, Object> applicationListRequest);
114
115  @GET("Account/{authId}/Application/{appId}/")
116  Call<Application> applicationGet(@Path("authId") String authId, @Path("appId") String appId);
117
118  @POST("Account/{authId}/Application/{appId}/")
119  Call<ApplicationUpdateResponse> applicationUpdate(@Path("authId") String authId,
120    @Path("appId") String appId, @Body ApplicationUpdater application);
121
122  @DELETE("Account/{authId}/Application/{appId}/")
123  Call<ResponseBody> applicationDelete(@Path("authId") String authId, @Path("appId") String appId);
124
125  // Account
126  @GET("Account/{authId}/")
127  Call<Account> accountGet(@Path("authId") String authId);
128
129  @POST("Account/{authId}/")
130  Call<AccountUpdateResponse> accountModify(@Path("authId") String authId,
131    @Body AccountUpdater accountUpdater);
132
133  @POST("Account/{authId}/Subaccount/")
134  Call<SubaccountCreateResponse> subaccountCreate(@Path("authId") String authId,
135    @Body SubaccountCreator subaccountCreator);
136
137  @POST("Account/{authId}/Subaccount/{subauthId}/")
138  Call<SubaccountUpdateResponse> subaccountModify(@Path("authId") String authId,
139    @Path("subauthId") String subauthId, @Body SubaccountUpdater subaccount);
140
141  @GET("Account/{authId}/Subaccount/{subauthId}/")
142  Call<Subaccount> subaccountGet(@Path("authId") String authId,
143    @Path("subauthId") String subauthId);
144
145  @GET("Account/{authId}/Subaccount/")
146  Call<ListResponse<Subaccount>> subaccountList(@Path("authId") String authId,
147    @Query("limit") Integer limit, @Query("offset") Integer offset);
148
149  @HTTP(method = "DELETE", path= "Account/{authId}/Subaccount/{subauthId}/", hasBody = true)
150  Call<ResponseBody> subaccountDelete(@Path("authId") String authId,
151    @Path("subauthId") String subauthId, @Body SubaccountDeleter subaccount);
152
153  // Call
154  @POST("Account/{authId}/Call/")
155  Call<CallCreateResponse> callCreate(@Path("authId") String authId,
156    @Body CallCreator callCreator);
157
158  @GET("Account/{authId}/Call/")
159  Call<ListResponse<com.plivo.api.models.call.Call>> callList(@Path("authId") String authId,
160    @QueryMap Map<String, Object> callListRequest);
161
162  @GET("Account/{authId}/Call/{callId}/")
163  Call<com.plivo.api.models.call.Call> callGet(@Path("authId") String authId,
164    @Path("callId") String callId);
165
166  @POST("Account/{authId}/Call/{callId}/")
167  Call<CallUpdateResponse> callUpdate(@Path("authId") String authId,
168    @Path("callId") String callId, @Body CallUpdater callUpdater);
169
170  @DELETE("Account/{authId}/Call/{callId}/")
171  Call<ResponseBody> callDelete(@Path("authId") String authId, @Path("callId") String callId);
172
173  @GET("Account/{authId}/Call/?status=live")
174  Call<LiveCallListResponse> liveCallListGet(@Path("authId") String authId, @QueryMap Map<String, Object> callListRequest);
175
176  @GET("Account/{authId}/Call/{callId}/?status=live")
177  Call<LiveCall> liveCallGet(@Path("authId") String authId, @Path("callId") String callId);
178
179  @GET("Account/{authId}/Call/?status=queued")
180  Call<QueuedCallListResponse> queuedCallListGet(@Path("authId") String authId);
181
182  @GET("Account/{authId}/Call/{callId}/?status=queued")
183  Call<QueuedCall> queuedCallGet(@Path("authId") String authId, @Path("callId") String callId);
184
185  @POST("Account/{authId}/Call/{callId}/Record/")
186  Call<CallRecordCreateResponse> callRecordCreate(@Path("authId") String authId,
187    @Path("callId") String callId, @Body
188    CallRecordCreator callRecordCreator);
189
190  @DELETE("Account/{authId}/Call/{callId}/Record/")
191  Call<ResponseBody> callRecordDelete(@Path("authId") String authId, @Path("callId") String callId);
192
193  @POST("Account/{authId}/Call/{callId}/Play/")
194  Call<CallPlayCreateResponse> callPlayCreate(@Path("authId") String authId,
195    @Path("callId") String callId, @Body
196    CallPlayCreator callPlayCreator);
197
198  @DELETE("Account/{authId}/Call/{callId}/Play/")
199  Call<ResponseBody> callPlayDelete(@Path("authId") String authId, @Path("callId") String callId);
200
201  @POST("Account/{authId}/Call/{callId}/Speak/")
202  Call<CallSpeakCreateResponse> callSpeakCreate(@Path("authId") String authId,
203    @Path("callId") String callId, @Body
204    CallSpeakCreator callSpeakCreator);
205
206  @DELETE("Account/{authId}/Call/{callId}/Speak/")
207  Call<ResponseBody> callSpeakDelete(@Path("authId") String authId, @Path("callId") String callId);
208
209  @POST("Account/{authId}/Call/{callId}/DTMF/")
210  Call<CallDtmfCreateResponse> callDtmfCreate(@Path("authId") String authId,
211    @Path("callId") String callId, @Body
212    CallDtmfCreator callDtmfCreator);
213
214  // Identity
215  @POST("Account/{authId}/Verification/Identity/")
216  Call<IdentityCreateResponse> identityCreate(@Path("authId") String authId,
217                                              @Body IdentityCreator identitycreator);
218
219  @GET("Account/{authId}/Verification/Identity/")
220  Call<ListResponse<Identity>> identityList(@Path("authId") String authId,
221                                            @QueryMap Map<String, Object> identityListRequest);
222
223  @GET("Account/{authId}/Verification/Identity/{id}/")
224  Call<Identity> identityGet(@Path("authId") String authId, @Path("id") String id);
225
226  @DELETE("Account/{authId}/Verification/Identity/{id}/")
227  Call<ResponseBody> identityDelete(@Path("authId") String authId, @Path("id") String number);
228
229  @POST("Account/{authId}/Verification/Identity/{id}/")
230  Call<IdentityUpdateResponse> identityUpdate(@Path("authId") String authId, @Path("id") String identityId, @Body IdentityUpdater identityUpdater);
231
232  // Message
233  @POST("Account/{authId}/Message/")
234  Call<MessageCreateResponse> messageSend(@Path("authId") String authId,
235    @Body MessageCreator messageCreator);
236
237  @GET("Account/{authId}/Message/")
238  Call<ListResponse<Message>> messageList(@Path("authId") String authId,
239    @QueryMap Map<String, Object> messageListRequest);
240
241  @GET("Account/{authId}/Message/{id}/")
242  Call<Message> messageGet(@Path("authId") String authId, @Path("id") String id);
243
244  // Number
245
246  @GET("Account/{authId}/Number/")
247  Call<ListResponse<Number>> numberList(@Path("authId") String authId,
248    @QueryMap Map<String, Object> params);
249
250  @GET("Account/{authId}/Number/{number}/")
251  Call<Number> numberGet(@Path("authId") String authId, @Path("number") String number);
252
253  @POST("Account/{authId}/Number/")
254  Call<NumberCreateResponse> numberCreate(@Path("authId") String authId,
255    @Body NumberCreator numberCreator);
256
257  @POST("Account/{authId}/Number/{number}/")
258  Call<NumberUpdateResponse> numberUpdate(@Path("authId") String authId,
259    @Path("number") String number, @Body NumberUpdater numberUpdater);
260
261  @DELETE("Account/{authId}/Number/{number}/")
262  Call<ResponseBody> numberDelete(@Path("authId") String authId, @Path("number") String number);
263
264  @GET("Account/{authId}/PhoneNumber/")
265  Call<ListResponse<PhoneNumber>> phoneNumberList(@Path("authId") String authId, @QueryMap Map<String, Object> params);
266
267  @POST("Account/{authId}/PhoneNumber/{number}/")
268  Call<PhoneNumberCreateResponse> phoneNumberCreate(@Path("authId") String authId,
269    @Path("number") String number, @Body
270    PhoneNumberCreator creator);
271
272  // Recording
273
274  @GET("Account/{authId}/Recording/")
275  Call<ListResponse<Recording>> recordingList(@Path("authId") String authId,
276    @QueryMap Map<String, Object> params);
277
278  @GET("Account/{authId}/Recording/{recordingId}/")
279  Call<Recording> recordingGet(@Path("authId") String authId,
280    @Path("recordingId") String recordingId);
281
282  @DELETE("Account/{authId}/Recording/{recordingId}/")
283  Call<ResponseBody> recordingDelete(@Path("authId") String authId,
284    @Path("recordingId") String recordingId);
285
286  // Endpoint
287
288  @POST("Account/{authId}/Endpoint/")
289  Call<EndpointCreateResponse> endpointCreate(@Path("authId") String authId,
290    @Body EndpointCreator endpointCreator);
291
292  @GET("Account/{authId}/Endpoint/")
293  Call<ListResponse<Endpoint>> endpointList(@Path("authId") String authId,
294    @QueryMap Map<String, Object> params);
295
296  @GET("Account/{authId}/Endpoint/{endpointId}/")
297  Call<Endpoint> endpointGet(@Path("authId") String authId, @Path("endpointId") String endpointId);
298
299  @POST("Account/{authId}/Endpoint/{endpointId}/")
300  Call<EndpointUpdateResponse> endpointUpdate(@Path("authId") String authId,
301    @Path("endpointId") String endpointId, @Body
302    EndpointUpdater endpointUpdater);
303
304  @DELETE("Account/{authId}/Endpoint/{endpointId}/")
305  Call<ResponseBody> endpointDelete(@Path("authId") String authId,
306    @Path("endpointId") String endpointId);
307
308  // Conference
309
310  @GET("Account/{authId}/Conference/")
311  Call<ConferenceList> conferenceListGet(@Path("authId") String authId);
312
313  @GET("Account/{authId}/Conference/{conferenceName}/")
314  Call<Conference> conferenceGet(@Path("authId") String authId,
315    @Path("conferenceName") String conferenceName);
316
317  @DELETE("Account/{authId}/Conference/")
318  Call<ResponseBody> conferenceDeleteAll(@Path("authId") String authId);
319
320  @DELETE("Account/{authId}/Conference/{conferenceName}/")
321  Call<ResponseBody> conferenceDelete(@Path("authId") String authId,
322    @Path("conferenceName") String conferenceName);
323
324  @DELETE("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/")
325  Call<ConferenceMemberActionResponse> conferenceMemberDelete(@Path("authId") String authId,
326    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
327
328  // Required as there is no body
329  @Headers("Content-Type: application/json")
330  @POST("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Kick/")
331  Call<ConferenceMemberActionResponse> conferenceMemberKickCreate(@Path("authId") String authId,
332    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
333
334  // Required as there is no body
335  @Headers("Content-Type: application/json")
336  @POST("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Mute/")
337  Call<ConferenceMemberActionResponse> conferenceMemberMuteCreate(@Path("authId") String authId,
338    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
339
340  @DELETE("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Mute/")
341  Call<ResponseBody> conferenceMemberMuteDelete(@Path("authId") String authId,
342    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
343
344  @POST("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Play/")
345  Call<ConferenceMemberActionResponse> conferenceMemberPlayCreate(@Path("authId") String authId,
346    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId,
347    @Body ConferenceMemberPlayCreator conferenceMemberPlayCreator);
348
349  @DELETE("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Play/")
350  Call<ResponseBody> conferenceMemberPlayDelete(@Path("authId") String authId,
351    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
352
353  @POST("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Speak/")
354  Call<ConferenceMemberActionResponse> conferenceMemberSpeakCreate(@Path("authId") String authId,
355    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId,
356    @Body ConferenceMemberSpeakCreator conferenceMemberSpeakCreator);
357
358  @DELETE("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Speak/")
359  Call<ResponseBody> conferenceMemberSpeakDelete(@Path("authId") String authId,
360    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
361
362  // Required as there is no body
363  @Headers("Content-Type: application/json")
364  @POST("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Deaf/")
365  Call<ConferenceMemberActionResponse> conferenceMemberDeafCreate(@Path("authId") String authId,
366    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
367
368  @DELETE("Account/{authId}/Conference/{conferenceName}/Member/{memberId}/Deaf/")
369  Call<ResponseBody> conferenceMemberDeafDelete(@Path("authId") String authId,
370    @Path("conferenceName") String conferenceName, @Path("memberId") String memberId);
371
372  // Required as there is no body
373  @Headers("Content-Type: application/json")
374  @POST("Account/{authId}/Conference/{conferenceName}/Record/")
375  Call<ConferenceRecordCreateResponse> conferenceRecordCreate(@Path("authId") String authId,
376    @Path("conferenceName") String conferenceName);
377
378  @DELETE("Account/{authId}/Conference/{conferenceName}/Record/")
379  Call<ResponseBody> conferenceRecordDelete(@Path("authId") String authId,
380    @Path("conferenceName") String conferenceName);
381
382  // Pricing
383
384  @GET("Account/{authId}/Pricing/")
385  Call<Pricing> pricingGet(@Path("authId") String authId, @Query("country_iso") String countryIso);
386
387  @DELETE("Account/{authId}/Request/{requestUuid}/")
388  Call<ResponseBody> requestDelete(@Path("authId") String authId, @Path("requestUuid") String requestUuid);
389
390  // PHLO - server is different from plivo server. Need content-type setting for POST
391  @GET("phlo/{phloId}")
392  Call<Phlo> phloGet(@Path("phloId") String phloId);
393
394  @GET("phlo/{phloId}/runs/{runId}")
395  Call<PhloRunGetterResponse> phloRunGet(@Path("phloId") String phloId, @Path("runId") String runId);
396
397  @Headers("Content-Type: application/json")
398  @POST("phlo/{phloId}/{nodeType}/{nodeId}")
399  Call<MultiPartyCallUpdateResponse> nodeAction(@Path("phloId") String phloId,
400                                                @Path("nodeType") NodeType nodeType,
401                                                @Path("nodeId") String nodeId,
402                                                @Body MultiPartyCallUpdatePayload payload);
403
404  @Headers("Content-Type: application/json")
405  @POST("phlo/{phloId}/{nodeType}/{nodeId}/members/{memberId}")
406  Call<MultiPartyCallUpdateResponse> memberAction(@Path("phloId") String phloId,
407                                        @Path("nodeType") NodeType nodeType,
408                                        @Path("nodeId") String nodeId,
409                                        @Path("memberId") String memberId,
410                                        @Body MultiPartyCallUpdatePayload payload);
411
412  @GET("phlo/{phloId}/{nodeType}/{nodeId}")
413  Call<MultiPartyCall> multiPartyCallGet(@Path("phloId") String phloId,
414                                         @Path("nodeType") NodeType nodeType,
415                                         @Path("nodeId") final String nodeId);
416
417  @Headers("Content-Type: application/json")
418  @POST("account/{authId}/phlo/{phloId}")
419  Call<PhloUpdateResponse> runPhlo(@Path("authId") String authId,
420                                   @Path("phloId") String phloId,
421                                   @Body Map<String, Object> payload);}