User API implementation into the PHP Client for Makerlog

in #utopian-io6 years ago

User API implementation into the PHP Client for Makerlog

<p dir="auto"><center><br /> <img src="https://images.hive.blog/768x0/https://github.com/pcsg/pcsg-makerlog-php-client/raw/master/makerlog-php-client.png" srcset="https://images.hive.blog/768x0/https://github.com/pcsg/pcsg-makerlog-php-client/raw/master/makerlog-php-client.png 1x, https://images.hive.blog/1536x0/https://github.com/pcsg/pcsg-makerlog-php-client/raw/master/makerlog-php-client.png 2x" /><br /> <p dir="auto">The Makerlog client can now go slowly to version 1. :-) <p dir="auto">As already mentioned in the last posts, I develop the PHP client for Makerlog in my spare time. Makerlog is the dead-simple task log that helps you stay productive and ship faster. There you can meet other makers and share your progress. <p dir="auto">The last days I finished the User API, the last puzzle piece to fully utilize the API of Makerlog. In the next days I will bring the documentation up to date but the implementation of the users is now finished. <h4>Repository <ul> <li><span><a href="https://github.com/pcsg/pcsg-makerlog-php-client" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pcsg/pcsg-makerlog-php-client <li>Licence: GPL-3.0+ <h3>New Features <h4>What feature(s) did you add? <ul> <li>I implemented the complete user API. <li><code>/users/ GET POST <li><code>/users/{username}/ GET POST PATCH DELETE <li><code>/users/{username}/activity_graph/ <li><code>/users/{username}/embed/ <li><code>/users/{username}/follow/ <li><code>/users/{username}/is_following/ <li><code>/users/{username}/products/ <li><code>/users/{username}/recent_tasks/ <li><code>/users/{username}/stats/ <li><code>/users/{username}/stats_embed/ <li><code>/users/{username}/unfollow/ <li><code>/users/{username}/wrapped/ <li><code>/users/{username}/wrapped_image/ <h4>How did you implement it/them? <p dir="auto">The implementation is done with the following commits: <ul> <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/564ec7cb1405dbe23a51fbc1c41f660ba2835a09" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">564ec7c <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/2d3a1ffcac2efd3d2060aaa0ca8b327006849226" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">2d3a1ff <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/631516b5ce9c198bc529f0bab257eafa16c0be87" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">631516b <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/8d8909dbc62562fb50cc94ce4939195d22384b8f" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">8d8909d <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/7b1fbace393fa036fb887b3f30f90944d24b180f" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">7b1fbac <p dir="auto">Like in the last posts, I will go into the API a little bit. The complete API documentation is available under: <ul> <li><span><a href="https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/users.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/users.md <li><span><a href="https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/user.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/user.md <p dir="auto">The users are the core of the API. Therefore the implementation has become a bit more. Basically I have implemented some optimizations so that the same requests are not executed multiple times unnecessarily. <p dir="auto">If a user is now instantiated, there is no performance problem if the products are fetched from this user. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUNzc6HcZt3bVmRsEGJS4PnompVJyJVp3hqvGavJXP69B/user-1.png" alt="user-1.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUNzc6HcZt3bVmRsEGJS4PnompVJyJVp3hqvGavJXP69B/user-1.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmUNzc6HcZt3bVmRsEGJS4PnompVJyJVp3hqvGavJXP69B/user-1.png 2x" /> <p dir="auto">In this way you can now work with users as easily as possible. Because each user object has different methods for accessing the user data, it is easy to read and work with them. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmVNHGrUEbYaZfdL9fdF9McXH6WxPfjPuLBF2fbCArXjDu/user-2.png" alt="user-2.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmVNHGrUEbYaZfdL9fdF9McXH6WxPfjPuLBF2fbCArXjDu/user-2.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmVNHGrUEbYaZfdL9fdF9McXH6WxPfjPuLBF2fbCArXjDu/user-2.png 2x" /> <p dir="auto">Besides the individual user, the tasks are the heart of Makerlog. For example, you want to automatically vote for some tasks of a user, you are now able to this via the user's Task API. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUr6f9w8KWhZ8cuLj2N5CfgR2bU8m5q5spcdKPTHjcFjT/user-3.png" alt="user-3.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUr6f9w8KWhZ8cuLj2N5CfgR2bU8m5q5spcdKPTHjcFjT/user-3.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmUr6f9w8KWhZ8cuLj2N5CfgR2bU8m5q5spcdKPTHjcFjT/user-3.png 2x" /> <p dir="auto">With the latest update it is now completely possible to change users, access user data and respond to user tasks. <p dir="auto">As a little delicacy I also implemented the latest API changes directly. Makerlog has introduced some new features today that address the Streak. Makerlog has set itself the goal to support the productity, but since the streak forces you to do things seven days a week, the streak went against the goal of makerlog. <p dir="auto">Today in Makerlog a new functionality were introduced because of this misconception. It is something like rest time and this functionality allows you to set the weekend in such a way, that it is not calculated to the streak. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmYk6kHFT7eQDEbMXmoBwthTtQWmXZ3fXFQYrsV8MqjSG4/user-4.png" alt="user-4.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmYk6kHFT7eQDEbMXmoBwthTtQWmXZ3fXFQYrsV8MqjSG4/user-4.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmYk6kHFT7eQDEbMXmoBwthTtQWmXZ3fXFQYrsV8MqjSG4/user-4.png 2x" /> <p dir="auto">This was just a small overview of the new User API. Be curious about the documentation, which I will extend more and more in the next days. <h4>GitHub Account <ul> <li><span><a href="https://github.com/dehenne" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/dehenne <h5>Future <p dir="auto">For version 1 a complete documentation of the users is missing now. I did about 50%, so I will write the rest in the next days and will publish the client in version 1. <p dir="auto">That was it for today already, I hope I could give a little insight into the PHP client of Makerlog. <p dir="auto">Have fun in Makerlog and thanks for reading,<br /> Hen
Sort:  

Thank you for your contribution.

<ol> <li>I think this is a bit verbose <code>$Makerlog->getUsers()->getUserObject('dehenne'); instead, you can do <code>$Makerlog->getUserObject('dehenne'); <li>Your APIs contains a few duplicate pattern, which could be refactored. For example, <code>getRequests(), <code>json_decode, <code>try .. throw <li>As I have always pointed out in your previous contributions, I'd like to see unit tests, which could be perfectly suitable to serve this purpose e.g. API design. <p dir="auto">Your contribution has been evaluated according to <a href="https://join.utopian.io/guidelines" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category. <p dir="auto">To view those questions and the relevant answers related to your post, <a href="https://review.utopian.io/result/3/2-3-2-2-2-2-2-" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">click here. <hr /> <p dir="auto">Need help? Chat with us on <a href="https://discord.gg/uTyJkNm" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Discord. <p dir="auto"><a href="https://join.utopian.io/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">[utopian-moderator]

Thank you for your review, @justyy! Keep up the good work!

to the utopian mod. Sorry, i posted this post accidentally with the company account. I hope this doesn't create a problem.

cheers
Hen

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 8 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

<p dir="auto">I upvoted your contribution because to my mind your post is at least <strong>9 SBD worth and should receive <strong>111 votes. It's now up to the lovely Steemit community to make this come true. <p dir="auto">I am <code>TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, <a href="https://steemit.com/steemit/@trufflepig/weekly-truffle-updates-2019-11" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">you can find an explanation here! <p dir="auto">Have a nice day and sincerely yours,<br /> <img src="https://images.hive.blog/768x0/https://raw.githubusercontent.com/SmokinCaterpillar/TrufflePig/master/img/trufflepig17_small.png" alt="trufflepig" srcset="https://images.hive.blog/768x0/https://raw.githubusercontent.com/SmokinCaterpillar/TrufflePig/master/img/trufflepig17_small.png 1x, https://images.hive.blog/1536x0/https://raw.githubusercontent.com/SmokinCaterpillar/TrufflePig/master/img/trufflepig17_small.png 2x" /><br /> <em><code>TrufflePig

Congratulations @pcsg-dev! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><span><img src="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@pcsg-dev/voted.png?201903240422" srcset="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@pcsg-dev/voted.png?201903240422 1x, https://images.hive.blog/1536x0/https://steemitimages.com/60x70/http://steemitboard.com/@pcsg-dev/voted.png?201903240422 2x" /><td>You received more than 5000 upvotes. Your next target is to reach 6000 upvotes. <p dir="auto"><sub><em>You can view <a href="https://steemitboard.com/@pcsg-dev" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">your badges on your Steem Board and compare to others on the <a href="http://steemitboard.com/ranking/index.php?name=pcsg-dev" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Steem Ranking<br /> <sub><em>If you no longer want to receive notifications, reply to this comment with the word <code>STOP <p dir="auto"><strong><span>Do not miss the last post from <a href="/@steemitboard">@steemitboard: <table><tr><td><a href="https://steemit.com/steem/@steemitboard/happy-birthday-the-steem-blockchain-is-running-for-3-years" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"><img src="https://images.hive.blog/768x0/https://steemitimages.com/64x128/http://u.cubeupload.com/arcange/BG6u6k.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/64x128/http://u.cubeupload.com/arcange/BG6u6k.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/64x128/http://u.cubeupload.com/arcange/BG6u6k.png 2x" /><td><a href="https://steemit.com/steem/@steemitboard/happy-birthday-the-steem-blockchain-is-running-for-3-years" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Happy Birthday! In a few hours, the Steem blockchain will be running for 3 years. <h6><a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Hi @pcsg-dev!



Feel free to join our @steem-ua Discord serverYour post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation! Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!

Hey, @pcsg-dev!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
SteemPlus or Steeditor). Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!