-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from JeroenDeDauw/seggregate
Add interfaces
- Loading branch information
Showing
5 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Mediawiki\Api; | ||
|
||
/** | ||
* @since 2.2 | ||
* @licence GNU GPL v2+ | ||
* @author Addshore | ||
* @author Jeroen De Dauw < [email protected] > | ||
*/ | ||
interface ApiRequester { | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param Request $request | ||
* | ||
* @return mixed Normally an array | ||
*/ | ||
public function getRequest( Request $request ); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param Request $request | ||
* | ||
* @return mixed Normally an array | ||
*/ | ||
public function postRequest( Request $request ); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Mediawiki\Api; | ||
|
||
use GuzzleHttp\Promise\PromiseInterface; | ||
|
||
/** | ||
* @since 2.2 | ||
* @licence GNU GPL v2+ | ||
* @author Addshore | ||
* @author Jeroen De Dauw < [email protected] > | ||
*/ | ||
interface AsyncApiRequester { | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param Request $request | ||
* | ||
* @return PromiseInterface | ||
* Normally promising an array, though can be mixed (json_decode result) | ||
* Can throw UsageExceptions or RejectionExceptions | ||
*/ | ||
public function getRequestAsync( Request $request ); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param Request $request | ||
* | ||
* @return PromiseInterface | ||
* Normally promising an array, though can be mixed (json_decode result) | ||
* Can throw UsageExceptions or RejectionExceptions | ||
*/ | ||
public function postRequestAsync( Request $request ); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Mediawiki\Api; | ||
|
||
/** | ||
* @since 2.2 | ||
* @licence GNU GPL v2+ | ||
* @author Addshore | ||
* @author Jeroen De Dauw < [email protected] > | ||
*/ | ||
interface MediawikiApiInterface extends ApiRequester, AsyncApiRequester { | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @return bool|string false or the name of the current user | ||
*/ | ||
public function isLoggedin(); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param ApiUser $apiUser | ||
* | ||
* @throws UsageException | ||
* @return bool success | ||
*/ | ||
public function login( ApiUser $apiUser ); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @return bool success | ||
*/ | ||
public function logout(); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @param string $type | ||
* | ||
* @return string | ||
*/ | ||
public function getToken( $type = 'csrf' ); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* Clears all tokens stored by the api | ||
*/ | ||
public function clearTokens(); | ||
|
||
/** | ||
* @since 2.2 | ||
* | ||
* @return string | ||
*/ | ||
public function getVersion(); | ||
|
||
} |