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

in utopian-io •  7 years ago  (edited)

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

It helped me too

  ·  7 years ago 

Thanks for your contribution!

i enjoy your post! thanks

Hey @helo I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x