@Test public void testListScheduledMessages() throws Exception { final MessageList mockedResponse = new MessageList(); MessageBirdService messageBirdServiceMock = mock(MessageBirdService.class); MessageBirdClient messageBirdClientMock = new MessageBirdClient(messageBirdServiceMock); Map<String, Object> filters = new LinkedHashMap<>(); filters.put("status", "scheduled"); when(messageBirdServiceMock.requestList("/messages", filters, null, null, MessageList.class)) .thenReturn(mockedResponse); final MessageList response = messageBirdClientMock.listMessagesFiltered(null, null, filters); assertNotNull(response); assertEquals(response, mockedResponse); }
public MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters) throws UnauthorizedException, GeneralException { verifyOffsetAndLimit(offset, limit); for (String filter : filters.keySet()) { if (!MESSAGE_LIST_FILTERS.contains(filter)) { throw new IllegalArgumentException("Invalid filter name: " + filter); } } return messageBirdService.requestList(MESSAGESPATH, filters, offset, limit, MessageList.class); }
MessageBirdClient { public MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters) throws UnauthorizedException, GeneralException { verifyOffsetAndLimit(offset, limit); for (String filter : filters.keySet()) { if (!MESSAGE_LIST_FILTERS.contains(filter)) { throw new IllegalArgumentException("Invalid filter name: " + filter); } } return messageBirdService.requestList(MESSAGESPATH, filters, offset, limit, MessageList.class); } }
MessageBirdClient { public MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters) throws UnauthorizedException, GeneralException { verifyOffsetAndLimit(offset, limit); for (String filter : filters.keySet()) { if (!MESSAGE_LIST_FILTERS.contains(filter)) { throw new IllegalArgumentException("Invalid filter name: " + filter); } } return messageBirdService.requestList(MESSAGESPATH, filters, offset, limit, MessageList.class); } MessageBirdClient(final MessageBirdService messageBirdService);  MessageBirdClient(final MessageBirdService messageBirdService, List<Feature> features); }
MessageBirdClient { public MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters) throws UnauthorizedException, GeneralException { verifyOffsetAndLimit(offset, limit); for (String filter : filters.keySet()) { if (!MESSAGE_LIST_FILTERS.contains(filter)) { throw new IllegalArgumentException("Invalid filter name: " + filter); } } return messageBirdService.requestList(MESSAGESPATH, filters, offset, limit, MessageList.class); } MessageBirdClient(final MessageBirdService messageBirdService);  MessageBirdClient(final MessageBirdService messageBirdService, List<Feature> features); Balance getBalance(); Hlr getRequestHlr(final BigInteger msisdn, final String reference); Hlr getViewHlr(final String hlrId); MessageResponse sendMessage(final Message message); MessageResponse sendMessage(final String originator, final String body, final List<BigInteger> recipients); MessageResponse sendMessage(final String originator, final String body, final List<BigInteger> recipients, final String reference); MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients); MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients, final String reference); MessageList listMessages(final Integer offset, final Integer limit); MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters); void deleteMessage(final String id); MessageResponse viewMessage(final String id); VoiceMessageResponse sendVoiceMessage(final VoiceMessage voiceMessage); VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients); VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients, final String reference); void deleteVoiceMessage(final String id); VoiceMessageResponse viewVoiceMessage(final String id); VoiceMessageList listVoiceMessages(final Integer offset, final Integer limit); Verify sendVerifyToken(VerifyRequest verifyRequest); Verify sendVerifyToken(String recipient); Verify verifyToken(String id, String token); void deleteVerifyObject(String id); Lookup viewLookup(final Lookup lookup); Lookup viewLookup(final BigInteger phoneNumber); LookupHlr requestLookupHlr(final LookupHlr lookupHlr); LookupHlr requestLookupHlr(final BigInteger phoneNumber, final String reference); LookupHlr viewLookupHlr(final LookupHlr lookupHlr); LookupHlr viewLookupHlr(final BigInteger phoneNumber); VoiceCallFlowList listVoiceCallFlows(final Integer offset, final Integer limit); VoiceCallFlowResponse viewVoiceCallFlow(final String id); VoiceCallFlowResponse sendVoiceCallFlow(final VoiceCallFlowRequest voiceCallFlowRequest); VoiceCallFlowResponse updateVoiceCallFlow(String id, VoiceCallFlowRequest voiceCallFlowRequest); void deleteVoiceCallFlow(final String id); ContactList listContacts(int offset, int limit); ContactList listContacts(); Contact sendContact(final ContactRequest contactRequest); Contact updateContact(final String id, ContactRequest contactRequest); Contact viewContact(final String id); void deleteGroup(final String id); void deleteGroupContact(final String groupId, final String contactId); GroupList listGroups(final int offset, final int limit); GroupList listGroups(); Group sendGroup(final GroupRequest groupRequest); void sendGroupContact(final String groupId, final String[] contactIds); Group updateGroup(final String id, final GroupRequest groupRequest); Group viewGroup(final String id); Conversation viewConversation(final String id); Conversation updateConversation(final String id, final ConversationStatus status); ConversationList listConversations(final int offset, final int limit); ConversationList listConversations(); Conversation startConversation(ConversationStartRequest request); ConversationSendResponse sendMessage(ConversationSendRequest request); ConversationMessageList listConversationMessages(
            final String conversationId,
            final int offset,
            final int limit
    ); ConversationMessageList listConversationMessages(
            final String conversationId
    ); ConversationMessage viewConversationMessage(final String messageId); ConversationMessage sendConversationMessage(
            final String conversationId,
            final ConversationMessageRequest request
    ); void deleteConversationWebhook(final String webhookId); ConversationWebhook sendConversationWebhook(final ConversationWebhookCreateRequest request); ConversationWebhook updateConversationWebhook(final String id, final ConversationWebhookUpdateRequest request); ConversationWebhook viewConversationWebhook(final String webhookId); ConversationWebhookList listConversationWebhooks(final int offset, final int limit); ConversationWebhookList listConversationWebhooks(); VoiceCallResponse sendVoiceCall(final VoiceCall voiceCall); VoiceCallResponseList listAllVoiceCalls(Integer page, Integer pageSize); VoiceCallResponse viewVoiceCall(final String id); void deleteVoiceCall(final String id); VoiceCallLegResponse viewCallLegsByCallId(String callId, Integer page, Integer pageSize); VoiceCallLeg viewCallLegByCallIdAndLegId(final String callId, String legId); RecordingResponse viewRecording(String callID, String legId, String recordingId); String downloadRecording(String callID, String legId, String recordingId, String basePath); RecordingResponse listRecordings(String callID, String legId, final Integer offset, final Integer limit); void deleteRecording(final String callID, final String legID, final String recordingID); TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language); TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, String transcriptionId); TranscriptionResponse listTranscriptions(String callID, String legId, String recordingId, Integer page, Integer pageSize); String downloadTranscription(String callID, String legId, String recordingId, String transcriptionId, String basePath); WebhookResponseData createWebhook(Webhook webhook); WebhookResponseData updateWebhook(String id, Webhook webhook); WebhookResponseData viewWebhook(String id); WebhookList listWebhooks(final Integer offset, final Integer limit); void deleteWebhook(String id); PhoneNumbersResponse listNumbersForPurchase(String countryCode); PhoneNumbersResponse listNumbersForPurchase(String countryCode, PhoneNumbersLookup params); PurchasedNumberCreatedResponse purchaseNumber(String number, String countryCode, int billingIntervalMonths); PurchasedNumbersResponse listPurchasedNumbers(PurchasedNumbersFilter filter); PurchasedNumber viewPurchasedNumber(String number); PurchasedNumber updateNumber(String number, String... tags); void cancelNumber(String number); }
MessageBirdClient { public MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters) throws UnauthorizedException, GeneralException { verifyOffsetAndLimit(offset, limit); for (String filter : filters.keySet()) { if (!MESSAGE_LIST_FILTERS.contains(filter)) { throw new IllegalArgumentException("Invalid filter name: " + filter); } } return messageBirdService.requestList(MESSAGESPATH, filters, offset, limit, MessageList.class); } MessageBirdClient(final MessageBirdService messageBirdService);  MessageBirdClient(final MessageBirdService messageBirdService, List<Feature> features); Balance getBalance(); Hlr getRequestHlr(final BigInteger msisdn, final String reference); Hlr getViewHlr(final String hlrId); MessageResponse sendMessage(final Message message); MessageResponse sendMessage(final String originator, final String body, final List<BigInteger> recipients); MessageResponse sendMessage(final String originator, final String body, final List<BigInteger> recipients, final String reference); MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients); MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients, final String reference); MessageList listMessages(final Integer offset, final Integer limit); MessageList listMessagesFiltered(final Integer offset, final Integer limit, final Map<String, Object> filters); void deleteMessage(final String id); MessageResponse viewMessage(final String id); VoiceMessageResponse sendVoiceMessage(final VoiceMessage voiceMessage); VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients); VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients, final String reference); void deleteVoiceMessage(final String id); VoiceMessageResponse viewVoiceMessage(final String id); VoiceMessageList listVoiceMessages(final Integer offset, final Integer limit); Verify sendVerifyToken(VerifyRequest verifyRequest); Verify sendVerifyToken(String recipient); Verify verifyToken(String id, String token); void deleteVerifyObject(String id); Lookup viewLookup(final Lookup lookup); Lookup viewLookup(final BigInteger phoneNumber); LookupHlr requestLookupHlr(final LookupHlr lookupHlr); LookupHlr requestLookupHlr(final BigInteger phoneNumber, final String reference); LookupHlr viewLookupHlr(final LookupHlr lookupHlr); LookupHlr viewLookupHlr(final BigInteger phoneNumber); VoiceCallFlowList listVoiceCallFlows(final Integer offset, final Integer limit); VoiceCallFlowResponse viewVoiceCallFlow(final String id); VoiceCallFlowResponse sendVoiceCallFlow(final VoiceCallFlowRequest voiceCallFlowRequest); VoiceCallFlowResponse updateVoiceCallFlow(String id, VoiceCallFlowRequest voiceCallFlowRequest); void deleteVoiceCallFlow(final String id); ContactList listContacts(int offset, int limit); ContactList listContacts(); Contact sendContact(final ContactRequest contactRequest); Contact updateContact(final String id, ContactRequest contactRequest); Contact viewContact(final String id); void deleteGroup(final String id); void deleteGroupContact(final String groupId, final String contactId); GroupList listGroups(final int offset, final int limit); GroupList listGroups(); Group sendGroup(final GroupRequest groupRequest); void sendGroupContact(final String groupId, final String[] contactIds); Group updateGroup(final String id, final GroupRequest groupRequest); Group viewGroup(final String id); Conversation viewConversation(final String id); Conversation updateConversation(final String id, final ConversationStatus status); ConversationList listConversations(final int offset, final int limit); ConversationList listConversations(); Conversation startConversation(ConversationStartRequest request); ConversationSendResponse sendMessage(ConversationSendRequest request); ConversationMessageList listConversationMessages(
            final String conversationId,
            final int offset,
            final int limit
    ); ConversationMessageList listConversationMessages(
            final String conversationId
    ); ConversationMessage viewConversationMessage(final String messageId); ConversationMessage sendConversationMessage(
            final String conversationId,
            final ConversationMessageRequest request
    ); void deleteConversationWebhook(final String webhookId); ConversationWebhook sendConversationWebhook(final ConversationWebhookCreateRequest request); ConversationWebhook updateConversationWebhook(final String id, final ConversationWebhookUpdateRequest request); ConversationWebhook viewConversationWebhook(final String webhookId); ConversationWebhookList listConversationWebhooks(final int offset, final int limit); ConversationWebhookList listConversationWebhooks(); VoiceCallResponse sendVoiceCall(final VoiceCall voiceCall); VoiceCallResponseList listAllVoiceCalls(Integer page, Integer pageSize); VoiceCallResponse viewVoiceCall(final String id); void deleteVoiceCall(final String id); VoiceCallLegResponse viewCallLegsByCallId(String callId, Integer page, Integer pageSize); VoiceCallLeg viewCallLegByCallIdAndLegId(final String callId, String legId); RecordingResponse viewRecording(String callID, String legId, String recordingId); String downloadRecording(String callID, String legId, String recordingId, String basePath); RecordingResponse listRecordings(String callID, String legId, final Integer offset, final Integer limit); void deleteRecording(final String callID, final String legID, final String recordingID); TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language); TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, String transcriptionId); TranscriptionResponse listTranscriptions(String callID, String legId, String recordingId, Integer page, Integer pageSize); String downloadTranscription(String callID, String legId, String recordingId, String transcriptionId, String basePath); WebhookResponseData createWebhook(Webhook webhook); WebhookResponseData updateWebhook(String id, Webhook webhook); WebhookResponseData viewWebhook(String id); WebhookList listWebhooks(final Integer offset, final Integer limit); void deleteWebhook(String id); PhoneNumbersResponse listNumbersForPurchase(String countryCode); PhoneNumbersResponse listNumbersForPurchase(String countryCode, PhoneNumbersLookup params); PurchasedNumberCreatedResponse purchaseNumber(String number, String countryCode, int billingIntervalMonths); PurchasedNumbersResponse listPurchasedNumbers(PurchasedNumbersFilter filter); PurchasedNumber viewPurchasedNumber(String number); PurchasedNumber updateNumber(String number, String... tags); void cancelNumber(String number);  }