Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hive-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-js
Commits
1ab90f1d
Commit
1ab90f1d
authored
4 years ago
by
Mahdi Yari
Browse files
Options
Downloads
Patches
Plain Diff
example for get trending tags
parent
32f56c9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!17
update readme
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/README.md
+39
-0
39 additions, 0 deletions
doc/README.md
with
39 additions
and
0 deletions
doc/README.md
+
39
−
0
View file @
1ab90f1d
...
@@ -103,11 +103,50 @@ hive.api.cancelAllSubscriptions(function(err, result) {
...
@@ -103,11 +103,50 @@ hive.api.cancelAllSubscriptions(function(err, result) {
## Tags
## Tags
### Get Trending Tags
### Get Trending Tags
Returns a list of the currently trending tags in descending order by value.
```
```
hive.api.getTrendingTags(afterTag, limit, function(err, result) {
hive.api.getTrendingTags(afterTag, limit, function(err, result) {
console.log(err, result);
console.log(err, result);
});
});
```
```
|Parameter|Description|Datatype|Notes|
|---|---|---|---|
|afterTag|The name of the last tag to begin from|String|Use the empty string
`''`
to start the list. Subsequent calls can use the last tag name|
|limit|The maximum number of tags to return|Integer||
|function()|Your callback|function|Tip: use
`console.log(err, result)`
to see the result|
Call Example:
```
js
hive
.
api
.
getTrendingTags
(
''
,
2
,
function
(
err
,
result
)
{
console
.
log
(
err
,
result
);
});
```
Return Example:
```
js
[
{
name
:
''
,
total_payouts
:
'
37610793.383 SBD
'
,
net_votes
:
4211122
,
top_posts
:
411832
,
comments
:
1344461
,
trending
:
'
5549490701
'
},
{
name
:
'
life
'
,
total_payouts
:
'
8722947.658 SBD
'
,
net_votes
:
1498401
,
top_posts
:
127103
,
comments
:
54049
,
trending
:
'
570954588
'
}
]
```
Using the Result:
```
js
// Extract tags from the result into an array of tag name strings
var
f
=
result
.
map
(
function
(
item
)
{
return
item
.
name
;
});
console
.
log
(
f
);
// Get the last tag for subsequent calls to `getTrendingTags`
// or use: f[f.length - 1] if you used the extraction code above.
var
lastKnownTag
=
result
[
result
.
length
-
1
].
name
;
// Use the last known tag to get the next group of tags
hive
.
api
.
TrendingTags
(
lastKnownTag
,
2
,
function
(
err
,
result
)
{
console
.
log
(
err
,
result
);
});
```
See also:
[
getTrendingCategories
](
#get-trending-categories
)
### Get Discussions By Trending
### Get Discussions By Trending
```
```
hive.api.getDiscussionsByTrending(query, function(err, result) {
hive.api.getDiscussionsByTrending(query, function(err, result) {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment