Skip to main content
Published: September 11 2008, 9:56:00 PMUpdated: August 08 2022, 1:51:34 PM

How do I determine if an item is ended in my WatchList in GetMyeBayBuying?

Detailed Description  

 You can check the Item.TimeLeft property to determine if the item in question is ended. For ended listings, the time left is PT0S (zero seconds).

  In Java SDK Jaxb version, ItemType.getTimeLeft() is returned in Duration java object.  ItemType.getTimeLeft().getSign() returns 0 for ended item :

 Here is the sample GetMyeBayBuying code:

        DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[]{
            DetailLevelCodeType.RETURN_ALL
        };
        GetMyeBayBuyingCall gmes = new GetMyeBayBuyingCall(apiContext);
        gmes.setDetailLevel(detailLevels);
        ItemListCustomizationType ilct = new ItemListCustomizationType();
        gmes.setWatchList(ilct);
        try {
            gmes.getMyeBayBuying();
            PaginatedItemArrayType returnedWonList = gmes.getReturnedWatchList();
            if (returnedWonList !=null){
                ItemArrayType iat = returnedWonList.getItemArray();
                ItemType[] items =  iat.getItem();
                for (ItemType item : items){
                    Duration duration =item.getTimeLeft();
                    //  0 if the duration is zero, and 1 if the duration is positive.
                    if ( duration.getSign()==0){
                      // item is ended
                      // your business logic goes here

                   }
                }       
            }  
        } catch (Exception e) {
            // handle exception here
        }

How well did this answer your question?
Answers others found helpful