PHP Client of Utopian API - add posts class and bug fixes

Words
210
Reading
1 min
Listen
Play
9y

uap-1.png

Bug Fixes

With PR#2, I updated the readme with install and test commands. This will help other who want to use or develop for the client.

uap-2.png

I fixed moderator class by checking if the property 'total_paid_rewards' exists and it also seems that GetCategory() cannot have no arguments, so I gave it one with some clever little code.

uap-3.png

With PR#3, I fixed a serious inverted parameters of the CallAPI function and corrected the GET implementation of the CallAPI function as well. I also removed the code that was nullifying the params string of my getPosts function.

New Features

With PR#4, I implemented the posts class and in a way this is why I was discovering the bugs above.

Here is some code on how to use it:

require('class.posts.php');
$posts = new Posts();

$data = $posts->GetPosts('limit=10&moderator=helo&sortBy=created');
print_r($data);

$data = $posts->GetTotal();
print_r($data);

$data = $posts->GetList();
print_r($data);

$data = $posts->GetPost('helo','php-client-of-utopian-api-add-composer-and-fix-unit-tests');
print_r($data);

Fork it!
Create your feature branch: git checkout -b my-new-feature
Commit your changes: git commit -am 'Add some feature'
Push to the branch: git push origin my-new-feature
Submit a pull request :D



Posted on Utopian.io - Rewarding Open Source Contributors

PHP Client of Utopian API - add posts class and bug fixes | Ecency