{"action":"created","comment":{"url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/comments/191976884","pull_request_review_id":124656454,"id":191976884,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MTk3Njg4NA==","diff_hunk":"@@ -1,28 +1,109 @@\n-# Get posts with filter\n+# Get posts using filters & tags\n+\n+Query for the most recent posts having a specific tag, using a Steem filter\n \n This tutorial pulls a list of the posts from different tags or filters and displays them.\n+Tags and filters are different. It's important to understand them.\n+\n+## Intro\n+\n+Tags & Filters are two different.\n+\n+A `tag` in Steem is much like a tag in Gmail, or Twitter. It's a way to describe a\n+post as being relevant to a particular topic. Posts may have up to five tags on them, but there are limits when\n+querying (more on this later).\n+\n+A `filter` in Steem is a kind of built-in 'view' or ordering of posts. You can use the following filters:\n+`trending`, `hot`, `new`, `active`, and `promoted`. You'll get a feel for the subtleties of each as you create your\n+application.\n+\n+## Steps\n+\n+1.  [**UI**](#UI) - A brief description of the UI and inputting our query values\n+1.  [**Construct query**](#Construct-query) - Assemble the information from the UI into our `filter` & `query`\n+1.  [**API call**](#API-call) - Make the call to Steem\n+1.  [**Handle response**](#Handle-response) - Accept the response in a promise callback, then render the results\n+1.  [**Example post object**](#Example-post-object) - An example post object from the response list\n+\n+#### 1. UI <a name=\"UI\"></a>\n+\n+The source HTML for our UI can be found in [public/index.html](./public/index.html)\n+\n+There are three input components to the UI.\n+\n+*   Filters: where we select one of the five built in filter types.\n+\n+    `<select id=\"filters\" class=\"form-control\" >...`\n+\n+*   Tag: where we type in a _single_, arbitrary tag. (The Steem blockchain does not support searching on multiple tags)\n+\n+    `<input id=\"tag\" class=\"form-control\"/>`\n \n-## Filters\n+*   Get Posts: It's a button. You click it, and we move on to assembling our post.\n+    `<button class=\"btn btn-primary\" onclick=\"getPosts()\">Get Posts</button>`\n \n-In Steem there are built-in filters `trending`, `hot`, `new`, `active`, `promoted` etc. which helps us to get list of posts. `client.database.getDiscussions(filter, query)` first argument of this function is one of above filter and library fetches posts from those filters.\n+![Step-01-UI.png](images/Step-01-UI.png)\n \n-## Query (tag, limit)\n+#### 2. Construct query <a name=\"Construct-query\"></a>\n \n-Second argument of `getDisccusions` function is query.\n+The filter and query are constructed within the async, globally available function `getPosts`\n \n-*   You can add a tag to filter the posts that you receive from the server, if this field is empty string it will fetch from full list of posts in that selected filter.\n-*   You can also limit the number of results you would like to receive from the query\n+The `limit` property you see below limits the total number of posts we'll get back to something\n+managable. In this case, five.\n \n ```javascript\n-var query = {\n-    tag: 'steem', // This tag is used to filter the results by a specific post tag\n-    limit: 5, // This limit allows us to limit the number of results returned to 5\n+const filter = document.getElementById('filters').value;\n+const query = {\n+    tag: document.getElementById('tag').value,\n+    limit: 5,\n };\n ```\n \n-## Query Result\n+#### 3. API call <a name=\"API-call\"></a>\n \n-The result returned form the service is a `JSON` object with the following properties:\n+The api call itself is fairly simple. We use `getDiscussions`.\n+The first argument, filter, is a simple string.\n+The second argument is our query object.\n+Like most of dsteem's api functions, `getDiscussions` returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n+\n+```javascript\n+client.database\n+    .getDiscussions(filter, query)\n+    .th..\n+```\n+\n+#### 4. Handle response <a name=\"Handle-response\"></a>\n+\n+When the promise returned by `getDiscussions` completes successfully, the function we pass to `.then()`\n+iterates over the entries response, and constructs html from it.\n+\n+```javascript\n+...ery)","path":"tutorials/04_get_posts/README.md","position":93,"original_position":93,"commit_id":"9b408ab676ed6f93e4fd3e08f86cf75d0710ac34","original_commit_id":"9b408ab676ed6f93e4fd3e08f86cf75d0710ac34","user":{"login":"inertia186","id":494368,"node_id":"MDQ6VXNlcjQ5NDM2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/494368?v=4","gravatar_id":"","url":"https://api.github.com/users/inertia186","html_url":"https://github.com/inertia186","followers_url":"https://api.github.com/users/inertia186/followers","following_url":"https://api.github.com/users/inertia186/following{/other_user}","gists_url":"https://api.github.com/users/inertia186/gists{/gist_id}","starred_url":"https://api.github.com/users/inertia186/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inertia186/subscriptions","organizations_url":"https://api.github.com/users/inertia186/orgs","repos_url":"https://api.github.com/users/inertia186/repos","events_url":"https://api.github.com/users/inertia186/events{/privacy}","received_events_url":"https://api.github.com/users/inertia186/received_events","type":"User","site_admin":false},"body":"Is this intentional?\r\n\r\n![image](https://user-images.githubusercontent.com/494368/40758485-691925c2-6442-11e8-8364-826b0af01c1f.png)\r\n","created_at":"2018-05-31T02:48:39Z","updated_at":"2018-05-31T02:48:39Z","html_url":"https://github.com/steemit/devportal-tutorials-js/pull/78#discussion_r191976884","pull_request_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/comments/191976884"},"html":{"href":"https://github.com/steemit/devportal-tutorials-js/pull/78#discussion_r191976884"},"pull_request":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78","id":191472830,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNDcyODMw","html_url":"https://github.com/steemit/devportal-tutorials-js/pull/78","diff_url":"https://github.com/steemit/devportal-tutorials-js/pull/78.diff","patch_url":"https://github.com/steemit/devportal-tutorials-js/pull/78.patch","issue_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/78","number":78,"state":"open","locked":false,"title":"69 readme structure","user":{"login":"relativityboy","id":599528,"node_id":"MDQ6VXNlcjU5OTUyOA==","avatar_url":"https://avatars2.githubusercontent.com/u/599528?v=4","gravatar_id":"","url":"https://api.github.com/users/relativityboy","html_url":"https://github.com/relativityboy","followers_url":"https://api.github.com/users/relativityboy/followers","following_url":"https://api.github.com/users/relativityboy/following{/other_user}","gists_url":"https://api.github.com/users/relativityboy/gists{/gist_id}","starred_url":"https://api.github.com/users/relativityboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relativityboy/subscriptions","organizations_url":"https://api.github.com/users/relativityboy/orgs","repos_url":"https://api.github.com/users/relativityboy/repos","events_url":"https://api.github.com/users/relativityboy/events{/privacy}","received_events_url":"https://api.github.com/users/relativityboy/received_events","type":"User","site_admin":false},"body":"Closes #69 ","created_at":"2018-05-30T14:28:00Z","updated_at":"2018-05-31T02:48:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15a7c0e92a47c7358bcbe271d617444f8a5aa848","assignee":null,"assignees":[],"requested_reviewers":[{"login":"roboza","id":6512004,"node_id":"MDQ6VXNlcjY1MTIwMDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6512004?v=4","gravatar_id":"","url":"https://api.github.com/users/roboza","html_url":"https://github.com/roboza","followers_url":"https://api.github.com/users/roboza/followers","following_url":"https://api.github.com/users/roboza/following{/other_user}","gists_url":"https://api.github.com/users/roboza/gists{/gist_id}","starred_url":"https://api.github.com/users/roboza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboza/subscriptions","organizations_url":"https://api.github.com/users/roboza/orgs","repos_url":"https://api.github.com/users/roboza/repos","events_url":"https://api.github.com/users/roboza/events{/privacy}","received_events_url":"https://api.github.com/users/roboza/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":937434092,"node_id":"MDU6TGFiZWw5Mzc0MzQwOTI=","url":"https://api.github.com/repos/steemit/devportal-tutorials-js/labels/priority/high","name":"priority/high","color":"d93f0b","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78/commits","review_comments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78/comments","review_comment_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/78/comments","statuses_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/statuses/9b408ab676ed6f93e4fd3e08f86cf75d0710ac34","head":{"label":"steemit:69-readme-structure","ref":"69-readme-structure","sha":"9b408ab676ed6f93e4fd3e08f86cf75d0710ac34","user":{"login":"steemit","id":17434692,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NDM0Njky","avatar_url":"https://avatars3.githubusercontent.com/u/17434692?v=4","gravatar_id":"","url":"https://api.github.com/users/steemit","html_url":"https://github.com/steemit","followers_url":"https://api.github.com/users/steemit/followers","following_url":"https://api.github.com/users/steemit/following{/other_user}","gists_url":"https://api.github.com/users/steemit/gists{/gist_id}","starred_url":"https://api.github.com/users/steemit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steemit/subscriptions","organizations_url":"https://api.github.com/users/steemit/orgs","repos_url":"https://api.github.com/users/steemit/repos","events_url":"https://api.github.com/users/steemit/events{/privacy}","received_events_url":"https://api.github.com/users/steemit/received_events","type":"Organization","site_admin":false},"repo":{"id":125127449,"node_id":"MDEwOlJlcG9zaXRvcnkxMjUxMjc0NDk=","name":"devportal-tutorials-js","full_name":"steemit/devportal-tutorials-js","owner":{"login":"steemit","id":17434692,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NDM0Njky","avatar_url":"https://avatars3.githubusercontent.com/u/17434692?v=4","gravatar_id":"","url":"https://api.github.com/users/steemit","html_url":"https://github.com/steemit","followers_url":"https://api.github.com/users/steemit/followers","following_url":"https://api.github.com/users/steemit/following{/other_user}","gists_url":"https://api.github.com/users/steemit/gists{/gist_id}","starred_url":"https://api.github.com/users/steemit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steemit/subscriptions","organizations_url":"https://api.github.com/users/steemit/orgs","repos_url":"https://api.github.com/users/steemit/repos","events_url":"https://api.github.com/users/steemit/events{/privacy}","received_events_url":"https://api.github.com/users/steemit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/steemit/devportal-tutorials-js","description":"Tutorials for the Developer Portal","fork":false,"url":"https://api.github.com/repos/steemit/devportal-tutorials-js","forks_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/forks","keys_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/teams","hooks_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/hooks","issue_events_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/events{/number}","events_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/events","assignees_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/assignees{/user}","branches_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/branches{/branch}","tags_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/tags","blobs_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/statuses/{sha}","languages_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/languages","stargazers_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/stargazers","contributors_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/contributors","subscribers_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/subscribers","subscription_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/subscription","commits_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/contents/{+path}","compare_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/merges","archive_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/downloads","issues_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues{/number}","pulls_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls{/number}","milestones_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/milestones{/number}","notifications_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/labels{/name}","releases_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/releases{/id}","deployments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/deployments","created_at":"2018-03-13T23:26:42Z","updated_at":"2018-05-30T09:17:22Z","pushed_at":"2018-05-31T02:13:29Z","git_url":"git://github.com/steemit/devportal-tutorials-js.git","ssh_url":"git@github.com:steemit/devportal-tutorials-js.git","clone_url":"https://github.com/steemit/devportal-tutorials-js.git","svn_url":"https://github.com/steemit/devportal-tutorials-js","homepage":null,"size":1659,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":24,"watchers":12,"default_branch":"master"}},"base":{"label":"steemit:master","ref":"master","sha":"1aff793674d03b18c9de61ea5ff41a2c57e9f290","user":{"login":"steemit","id":17434692,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NDM0Njky","avatar_url":"https://avatars3.githubusercontent.com/u/17434692?v=4","gravatar_id":"","url":"https://api.github.com/users/steemit","html_url":"https://github.com/steemit","followers_url":"https://api.github.com/users/steemit/followers","following_url":"https://api.github.com/users/steemit/following{/other_user}","gists_url":"https://api.github.com/users/steemit/gists{/gist_id}","starred_url":"https://api.github.com/users/steemit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steemit/subscriptions","organizations_url":"https://api.github.com/users/steemit/orgs","repos_url":"https://api.github.com/users/steemit/repos","events_url":"https://api.github.com/users/steemit/events{/privacy}","received_events_url":"https://api.github.com/users/steemit/received_events","type":"Organization","site_admin":false},"repo":{"id":125127449,"node_id":"MDEwOlJlcG9zaXRvcnkxMjUxMjc0NDk=","name":"devportal-tutorials-js","full_name":"steemit/devportal-tutorials-js","owner":{"login":"steemit","id":17434692,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NDM0Njky","avatar_url":"https://avatars3.githubusercontent.com/u/17434692?v=4","gravatar_id":"","url":"https://api.github.com/users/steemit","html_url":"https://github.com/steemit","followers_url":"https://api.github.com/users/steemit/followers","following_url":"https://api.github.com/users/steemit/following{/other_user}","gists_url":"https://api.github.com/users/steemit/gists{/gist_id}","starred_url":"https://api.github.com/users/steemit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steemit/subscriptions","organizations_url":"https://api.github.com/users/steemit/orgs","repos_url":"https://api.github.com/users/steemit/repos","events_url":"https://api.github.com/users/steemit/events{/privacy}","received_events_url":"https://api.github.com/users/steemit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/steemit/devportal-tutorials-js","description":"Tutorials for the Developer Portal","fork":false,"url":"https://api.github.com/repos/steemit/devportal-tutorials-js","forks_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/forks","keys_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/teams","hooks_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/hooks","issue_events_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/events{/number}","events_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/events","assignees_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/assignees{/user}","branches_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/branches{/branch}","tags_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/tags","blobs_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/statuses/{sha}","languages_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/languages","stargazers_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/stargazers","contributors_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/contributors","subscribers_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/subscribers","subscription_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/subscription","commits_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/contents/{+path}","compare_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/merges","archive_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/downloads","issues_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues{/number}","pulls_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls{/number}","milestones_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/milestones{/number}","notifications_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/labels{/name}","releases_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/releases{/id}","deployments_url":"https://api.github.com/repos/steemit/devportal-tutorials-js/deployments","created_at":"2018-03-13T23:26:42Z","updated_at":"2018-05-30T09:17:22Z","pushed_at":"2018-05-31T02:13:29Z","git_url":"git://github.com/steemit/devportal-tutorials-js.git","ssh_url":"git@github.com:steemit/devportal-tutorials-js.git","clone_url":"https://github.com/steemit/devportal-tutorials-js.git","svn_url":"https://github.com/steemit/devportal-tutorials-js","homepage":null,"size":1659,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":24,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78"},"html":{"href":"https://github.com/steemit/devportal-tutorials-js/pull/78"},"issue":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/78"},"comments":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/steemit/devportal-tutorials-js/statuses/9b408ab676ed6f93e4fd3e08f86cf75d0710ac34"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"inertia186"}}