Update Friend List to use User Object

Issue #10 resolved
Michael Johnson created an issue

The friend list should use the User object to return user-specific profile information. Clean up the existing code to use this. Suggested output:

#!

Array(
0:
  friendname: 'name'
  friend_since: 'date'
  profile: User()
...

Comments (5)

  1. Ratan Dhawtal

    'Array(' isn't a json output, I guess that you mean '[' and ']' (json array). The numbers will be named automatically.

    but I really don't get the 'profile: User()' part. Can you just post a real output, I will probably understand this better.

    example:

    [{ "friendname":"Ratan12" , "friend_since":"Unknown"  ....
    
  2. Michael Johnson reporter

    It's just pseudo-output listed in what seemed a logical way for my needs. Output will be an indexed array with each index containing another array/dictionary list with those properties as listed above. The "User()" part is just a stand-in for a user object.

  3. Michael Johnson reporter

    Example JSON Output for the friendlist format:

    [
        {
            "name": "link9us",
            "friend_since": null,
            "profile": {
                "avatar_url": "http://cdn.myanimelist.net/images/userimages/9029.jpg",
                "details": {
                    "last_online": "2 seconds ago",
                    "gender": null,
                    "birthday": null,
                    "location": null,
                    "website": null,
                    "join_date": null,
                    "access_rank": null,
                    "anime_list_views": 0,
                    "manga_list_views": 0,
                    "forum_posts": 0,
                    "aim": null,
                    "comments": 0,
                    "msn": null,
                    "yahoo": null
                },
                "anime_stats": [ ],
                "manga_stats": [ ]
            }
        },
        {
            "name": "chibuki",
            "friend_since": "2007-10-07T15:21:00-0700",
            "profile": {
                "avatar_url": "http://cdn.myanimelist.net/images/userimages/4611.jpg",
                "details": {
                    "last_online": "21 seconds ago",
                    "gender": null,
                    "birthday": null,
                    "location": null,
                    "website": null,
                    "join_date": null,
                    "access_rank": null,
                    "anime_list_views": 0,
                    "manga_list_views": 0,
                    "forum_posts": 0,
                    "aim": null,
                    "comments": 0,
                    "msn": null,
                    "yahoo": null
                },
                "anime_stats": [ ],
                "manga_stats": [ ]
            }
        },
    ...
    

    Basically, the contents of "profile" is a profile (formerly user) object for that user. This will allow clients to re-use any internal objects they have for profiles without having to build another custom object or parser just for that info.

    Time is formatted to ISO8601, which is pretty common and ways to handle are either built-in (see DatatypeFactory's XMLGregorianCalendar for Android - http://blog.denevell.org/android-ISO8601-date-comma-timezone.html) or can be easily parsed if not.

  4. Michael Johnson reporter

    Clean up Friendlist

    Moved to a new, saner data definition for the friend list. User details are now stored in the profile key as a profile datatype. Moved to using ISO8601 datatype for date as it’s more standard in client languages expected to be consumers.

    Fixes #10

    → <<cset b942381bb20f>>

  5. Log in to comment