Skip to content

Commit 3b51e72

Browse files
committed
Get user statusses implemented
1 parent ccdf72e commit 3b51e72

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $auth_url = $t->getAuthUrl();
5151
*/
5252
5353
//Request the bearer token
54-
$token_info = $t->getAccessToken("7c47d0c636314a1dff2142323b0104a74edf91884856dc0f78148f848d475136");
54+
$token_info = $t->getAccessToken("7c47d0c636314a1dff21reryyy5edf91884856dc0f78148f848d475136");
5555
5656
/**
5757
* The above '$token_info' will now be an array with the info like below. (If successfull)
@@ -80,4 +80,12 @@ $user_info = $t->getUser("vangelier@hotmail.com", "MySecretP@ssW0rd");
8080
*/
8181
$followers = $t->authenticate("vangelier@hotmail.com", "MySecretP@ssW0rd")
8282
->getFollowers();
83+
84+
/**
85+
* Get user statusses
86+
*/
87+
$statusses = $t->authenticate("vangelier@hotmail.com", "MySecretP@ssW0rd")
88+
->getStatuses();
89+
90+
8391
```

example.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828

2929
//Request the bearer token
30-
$token_info = $t->getAccessToken("7c47d0c636314a1dff2142323b0104a74edf91884856dc0f78148f848d475136");
30+
$token_info = $t->getAccessToken("7c47d0c636314a1dff21reryyy5edf91884856dc0f78148f848d475136");
3131

3232
/**
3333
* The above '$token_info' will now be an array with the info like below. (If successfull)
@@ -55,4 +55,11 @@
5555
* Get user followers / following
5656
*/
5757
$followers = $t->authenticate("vangelier@hotmail.com", "MySecretP@ssW0rd")
58-
->getFollowers();
58+
->getFollowers();
59+
60+
/**
61+
* Get user statusses
62+
*/
63+
$statusses = $t->authenticate("vangelier@hotmail.com", "MySecretP@ssW0rd")
64+
->getStatuses();
65+

theCodingCompany/Mastodon.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,25 @@ public function getFollowing(){
138138
return false;
139139
}
140140

141+
/**
142+
* Get current user's statuses
143+
*/
144+
public function getStatuses(){
145+
if($this->mastodon_user_id > 0){
146+
147+
//Create our object
148+
$http = HttpRequest::Instance($this->getApiURL());
149+
$statusses = $http::Get(
150+
"api/v1/accounts/{$this->mastodon_user_id}/statuses",
151+
null,
152+
$this->getHeaders()
153+
);
154+
if(is_array($statusses) && count($statusses) > 0){
155+
return $statusses;
156+
}
157+
158+
}
159+
return false;
160+
}
161+
141162
}

0 commit comments

Comments
 (0)