var tamber = require('tamber')('project_key', 'engine_key');
var max_age = 86400; // seconds in a day
var min_created = new Date() / 1000 - max_age;
tamber.discover.recommended({
user: "user_rlox8k927z7p",
filter: {
gt: [
{property: "created"},
min_created
]
}
}).then(items => items.forEach(i => console.log(i)))
.catch(err => console.log("Request failed with error:", err));
package main
import (
tamber "github.com/tamber/tamber-go"
"github.com/tamber/tamber-go/discover"
"fmt"
"time"
)
func main() {
tamber.DefaultEngineKey = "engine_key"
maxAge := time.Duration(24 * time.Hour)
minCreated := time.Now().Add(-maxAge).Unix()
recs, info, err := discover.Recommended(&tamber.DiscoverRecommendedParams{
User: tamber.IdString("user_rlox8k927z7p"),
Filter: map[string]interface{}{
"gt": []interface{}{
map[string]interface{}{
"property": "created",
},
minCreated,
},
},
})
for _, rec := range *recs {
fmt.Printf("%+v\n", rec)
}
}
require 'tamber'
Tamber.engine_key = 'engine_key'
min_created = Time.now.to_i - 86400
begin
d = Tamber::Discover.recommended(
:user => 'user_rlox8k927z7p',
:filter => {
:gt => [
{"property" => "created"},
min_created
]
}
)
d.each { |rec| puts "item: #{rec.item}, created: #{rec.item_created}, score: #{rec.score}"}
rescue TamberError => error
puts error.message
end
# get timestamp 1day ago
$ date -v-1d -j -f "%a %b %d %T %Z %Y" "`date`" "+%s"
# use response for min_created value
$ curl https://api.tamber.com/v1/discover/recommended \
-u :engine_key \
-d user=user_rlox8k927z7p \
-d filter='{"gt":[{"property":"created"}, min_created]}'
import com.tamber.Tamber;
import com.tamber.exception.TamberException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public class TamberExample {
public static void main() {
Tamber tamber = new Tamber("project_key", "engine_key");
HashMap<String, Object> discoverParams = new HashMap<String, Object>();
discoverParams.put("user", "user_rlox8k927z7p");
HashMap<String, Object> filter = new HashMap<String, Object>();
List<Object> createdFilter = new ArrayList<Object>();
HashMap<String, String> prop = new HashMap<String, String>();
prop.put("property", "created");
createdFilter.add(prop);
createdFilter.add(1592301489);
filter.put("gt", createdFilter);
discoverParams.put("filter", filter);
JSONObject resp = new JSONObject();
try {
resp = tamber.discover.recommended(discoverParams);
} catch (TamberException e) {
System.out.println(String.format("%s=%s", e.getClass().getName(), e.getMessage()));
}
}
}
import tamber
import time
tamber.engine_key = 'engine_key'
min_created = time.time() - 86400 # seconds in a day
recs = tamber.Discover.recommended(
user='user_rlox8k927z7p',
filter=str(Gt(Property('created'), min_created))
)
for rec in recs:
print "item:%s created:%s score:%s\n" % (rec['item'], rec['item_created'], rec['score'])