Skip to content

Commit

Permalink
Update Readme to use FluentRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
addshore committed Aug 23, 2015
1 parent deb2c40 commit 34180d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ On Packagist:

Use composer to install the library and all its dependencies:

composer require "addwiki/mediawiki-api-base:~0.3.0"
composer require "addwiki/mediawiki-api-base:~1.0"

## Example Usage

Expand All @@ -26,10 +26,10 @@ $api = new MediawikiApi( 'http://localhost/w/api.php' );
$api->login( new ApiUser( 'username', 'password' ) );

// Make a POST request
$api->postRequest( new SimpleRequest( 'purge', array( 'titles' => 'FooBar' ) ) );
$api->postRequest( FluentRequest::factory->setAction( 'purge' )->setParam( 'titles', 'FooBar' ) );

// Make a GET request
$queryResponse = $api->getRequest( new SimpleRequest( 'query', array( 'meta' => 'siteinfo' ) ) );
$queryResponse = $api->getRequest( FluentRequest::factory->setAction( 'query' )->setParam( 'meta', 'siteinfo' ) );

// Make a bad request and catch the error
try{
Expand Down
7 changes: 7 additions & 0 deletions src/FluentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public function getHeaders() {
return $this->headers;
}

/**
* @return self
*/
public static function factory() {
return new self();
}

/**
* @param string $action
*
Expand Down

0 comments on commit 34180d0

Please sign in to comment.