Skip to content

Adds missing filtering options for post and messages #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/api/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {DEFAULT_SERVER} from './base'
export async function get_messages(
{ api_server = DEFAULT_SERVER, pagination = 200, page=1,
message_type = null, content_types = null,
refs = null, addresses = null, tags = null, hashes = null} = {}) {
refs = null, addresses = null, tags = null, hashes = null, channels = null, start_date = null, end_date = null} = {}) {
let params = {
'pagination': pagination,
'page': page
Expand All @@ -27,6 +27,15 @@ export async function get_messages(

if (hashes !== null)
params.hashes = hashes.join(',')

if (channels != null)
params.channels = channels.join(',')

if (start_date !== null)
params.startDate = start_date

if (end_date !== null)
params.endDate = end_date

let response = await axios.get(`${api_server}/api/v0/messages.json`, {
'params': params
Expand Down
11 changes: 10 additions & 1 deletion src/api/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const shajs = require('sha.js')
export async function get_posts(
types, {
api_server = DEFAULT_SERVER, pagination = 200, page=1,
refs = null, addresses = null, tags = null, hashes = null} = {}) {
refs = null, addresses = null, tags = null, hashes = null, channels = null, start_date = null, end_date = null} = {}) {
let params = {
'types': types,
'pagination': pagination,
Expand All @@ -26,6 +26,15 @@ export async function get_posts(
if (hashes !== null)
params.hashes = hashes.join(',')

if (channels != null)
params.channels = channels.join(',')

if (start_date !== null)
params.startDate = start_date

if (end_date !== null)
params.endDate = end_date

let response = await axios.get(`${api_server}/api/v0/posts.json`, {
'params': params
})
Expand Down