@@ -32,6 +32,8 @@ public class MessageBirdClient {
3232 private static final String MESSAGESPATH = "/messages" ;
3333 private static final String VOICEMESSAGESPATH = "/voicemessages" ;
3434 private static final String VERIFYPATH = "/verify" ;
35+ private static final String LOOKUPPATH = "/lookup" ;
36+ private static final String LOOKUPHLRPATH = "/lookup/%s/hlr" ;
3537 private MessageBirdService messageBirdService ;
3638
3739 public MessageBirdClient (final MessageBirdService messageBirdService ) {
@@ -385,4 +387,124 @@ public void deleteVerifyObject(String id) throws NotFoundException, GeneralExcep
385387 }
386388 messageBirdService .deleteByID (VERIFYPATH , id );
387389 }
390+
391+ /**
392+ * Send a Lookup request
393+ *
394+ * @param Lookup
395+ * @return Lookup
396+ * @throws UnauthorizedException
397+ * @throws GeneralException
398+ * @throws NotFoundException
399+ */
400+ public Lookup viewLookup (final Lookup lookup ) throws UnauthorizedException , GeneralException , NotFoundException {
401+ if (lookup .getPhoneNumber () == null ) {
402+ throw new IllegalArgumentException ("Phonenumber must be specified." );
403+ }
404+ final Map <String , Object > params = new LinkedHashMap <String , Object >();
405+ if (lookup .getCountryCode () != null ) {
406+ params .put ("countryCode" , lookup .getCountryCode ());
407+ }
408+ return messageBirdService .requestByID (LOOKUPPATH , String .valueOf (lookup .getPhoneNumber ()), params , Lookup .class );
409+ }
410+
411+ /**
412+ * Send a Lookup request
413+ *
414+ * @param phonenumber
415+ * @return Lookup
416+ * @throws UnauthorizedException
417+ * @throws GeneralException
418+ */
419+ public Lookup viewLookup (final BigInteger phonenumber ) throws UnauthorizedException , GeneralException , NotFoundException {
420+ if (phonenumber == null ) {
421+ throw new IllegalArgumentException ("Phonenumber must be specified." );
422+ }
423+ final Lookup lookup = new Lookup (phonenumber );
424+ return this .viewLookup (lookup );
425+ }
426+
427+ /**
428+ * Request a Lookup HLR (lookup)
429+ *
430+ * @param LookupHlr
431+ * @return lookupHlr
432+ * @throws UnauthorizedException
433+ * @throws GeneralException
434+ */
435+ public LookupHlr requestLookupHlr (final LookupHlr lookupHlr ) throws UnauthorizedException , GeneralException {
436+ if (lookupHlr .getPhoneNumber () == null ) {
437+ throw new IllegalArgumentException ("Phonenumber must be specified." );
438+ }
439+ if (lookupHlr .getReference () == null ) {
440+ throw new IllegalArgumentException ("Reference must be specified." );
441+ }
442+ final Map <String , Object > payload = new LinkedHashMap <String , Object >();
443+ payload .put ("phoneNumber" , lookupHlr .getPhoneNumber ());
444+ payload .put ("reference" , lookupHlr .getReference ());
445+ if (lookupHlr .getCountryCode () != null ) {
446+ payload .put ("countryCode" , lookupHlr .getCountryCode ());
447+ }
448+ return messageBirdService .sendPayLoad (String .format (LOOKUPHLRPATH , lookupHlr .getPhoneNumber ()), payload , LookupHlr .class );
449+ }
450+
451+ /**
452+ * Request a Lookup HLR (lookup)
453+ *
454+ * @param phonenumber
455+ * @param reference
456+ * @return lookupHlr
457+ * @throws UnauthorizedException
458+ * @throws GeneralException
459+ */
460+ public LookupHlr requestLookupHlr (final BigInteger phonenumber , final String reference ) throws UnauthorizedException , GeneralException {
461+ if (phonenumber == null ) {
462+ throw new IllegalArgumentException ("Phonenumber must be specified." );
463+ }
464+ if (reference == null ) {
465+ throw new IllegalArgumentException ("Reference must be specified." );
466+ }
467+ final LookupHlr lookupHlr = new LookupHlr ();
468+ lookupHlr .setPhoneNumber (phonenumber );
469+ lookupHlr .setReference (reference );
470+ return this .requestLookupHlr (lookupHlr );
471+ }
472+
473+ /**
474+ * View a Lookup HLR (lookup)
475+ *
476+ * @param LookupHlr
477+ * @return LookupHlr
478+ * @throws UnauthorizedException
479+ * @throws GeneralException
480+ * @throws NotFoundException
481+ */
482+ public LookupHlr viewLookupHlr (final LookupHlr lookupHlr ) throws UnauthorizedException , GeneralException , NotFoundException {
483+ if (lookupHlr .getPhoneNumber () == null ) {
484+ throw new IllegalArgumentException ("Phonenumber must be specified" );
485+ }
486+ final Map <String , Object > params = new LinkedHashMap <String , Object >();
487+ if (lookupHlr .getCountryCode () != null ) {
488+ params .put ("countryCode" , lookupHlr .getCountryCode ());
489+ }
490+ return messageBirdService .requestByID (String .format (LOOKUPHLRPATH , lookupHlr .getPhoneNumber ()), "" , params , LookupHlr .class );
491+ }
492+
493+ /**
494+ * View a Lookup HLR (lookup)
495+ *
496+ * @param phonenumber
497+ * @return LookupHlr
498+ * @throws UnauthorizedException
499+ * @throws GeneralException
500+ * @throws NotFoundException
501+ */
502+ public LookupHlr viewLookupHlr (final BigInteger phonenumber ) throws UnauthorizedException , GeneralException , NotFoundException {
503+ if (phonenumber == null ) {
504+ throw new IllegalArgumentException ("Phonenumber must be specified" );
505+ }
506+ final LookupHlr lookupHlr = new LookupHlr ();
507+ lookupHlr .setPhoneNumber (phonenumber );
508+ return this .viewLookupHlr (lookupHlr );
509+ }
388510}
0 commit comments