File tree 2 files changed +8
-17
lines changed
2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 1
1
# php-mattermost-driver (v3.7.0)
2
2
3
- Completed Php Driver to interact with the [ Mattermost Web Service API] [ 4 ] .
3
+ Completed Php Driver to interact with the [ Mattermost Web Service API] [ 4 ] .
4
+ Version of the Mattermost server required: 3.7.0
4
5
5
- Version of the Mattermost server required: 3.7.0
6
6
Please read [ the api documentation] [ 1 ] for further information on using this application.
7
7
8
8
## Installation
@@ -31,13 +31,7 @@ Read more about how to install and use Composer on your local machine [here][3].
31
31
]);
32
32
33
33
$driver = new Driver($container);
34
- $login = $driver->authenticate();
35
-
36
- if ($login) {
37
- echo "SUCCESS!";
38
- } else {
39
- echo "SOMETHING WENT WRONG.";
40
- }
34
+ $result = $driver->authenticate();
41
35
```
42
36
43
37
### Check results
@@ -63,7 +57,7 @@ $requestOptions = [
63
57
$result = $driver->getUserModel()->createUser($requestOptions);
64
58
65
59
//Get a user
66
- $res = $driver->getUserModel()->getUserByUsername('username');
60
+ $result = $driver->getUserModel()->getUserByUsername('username');
67
61
```
68
62
69
63
### Team data model
@@ -83,4 +77,4 @@ In Development, coming soon!
83
77
[ 1 ] : https://api.mattermost.com/
84
78
[ 2 ] : http://www.php-fig.org/psr/psr-7/
85
79
[ 3 ] : https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
86
- [ 4 ] : https://about.mattermost.com/
80
+ [ 4 ] : https://about.mattermost.com/
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ public function __construct(Container $container)
62
62
}
63
63
64
64
/**
65
- * @return bool
65
+ * @return null|\Psr\Http\Message\ResponseInterface
66
66
*/
67
67
public function authenticate ()
68
68
{
@@ -75,16 +75,13 @@ public function authenticate()
75
75
/** @var Client $client */
76
76
$ client = $ this ->container ['client ' ];
77
77
$ response = $ client ->post ('/users/login ' , $ options );
78
- $ statusCode = $ response ->getStatusCode ();
79
78
80
- if ($ statusCode == 200 ) {
79
+ if ($ response -> getStatusCode () == 200 ) {
81
80
$ token = $ response ->getHeader ('Token ' )[0 ];
82
81
$ client ->setToken ($ token );
83
-
84
- return true ;
85
82
}
86
83
87
- return false ;
84
+ return $ response ;
88
85
}
89
86
90
87
/**
You can’t perform that action at this time.
0 commit comments