jacquagnui / php-twitter

Automatically exported from code.google.com/p/php-twitter
0 stars 0 forks source link

userTimeline() arguments #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The userTimeline() arguments is out of sync with the API, (id, count, since, 
since_id, page) versus (id, user_id, 
screen_name, since_id, max_id, count, page) in the API.

Admittedly, the lack of screen_name and user_id could be put aside as 
implementation details, but the use of $since is 
wrong, and the inclusion of $max_id completes an up to date implementation.

Very quickly (the syntax needs testing but is close to the mark)...

    function userTimeline($id=false, $user_id=false, $screen_name = false, $since_id=false, $max_id = false, $count=20, $page=false)
    {
        if( !in_array( $this->type, array( 'xml','json','rss','atom' ) ) )
            return false;

        $args = array();
        if( $user_id )
            $args['user_id'] = $user_id;
        if( $screen_name )
            $args['screen_name'] = $screen_name;
        if( $since_id )
            $args['since_id'] = (int) $since_id;
        if( $max_id )
            $args['max_id'] = (int) $max_id;
        if( $count )
            $args['count'] = (int) $count;
        if( $page )
            $args['page'] = (int) $page;

        $qs = '';
        if( !empty( $args ) )
            $qs = $this->_glue( $args );

        if( $id === false )
            $request = 'http://twitter.com/statuses/user_timeline.' . $this->type . $qs;
        else
            $request = 'http://twitter.com/statuses/user_timeline/' . rawurlencode($id) . '.' . $this->type . $qs;

        return $this->objectify( $this->process($request) );
    }

Original issue reported on code.google.com by three.e...@gmail.com on 21 May 2009 at 1:29

GoogleCodeExporter commented 8 years ago
r103 fixes in trunk

Original comment by emmenset...@gmail.com on 16 Jun 2009 at 6:26