-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: changes in list, search and tags (#1394)
added listing for tags, filter for seach and list, support for old and new response in search
- Loading branch information
Showing
11 changed files
with
191 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { getCAIPAddress, getAPIBaseUrls, getQueryParams } from '../helpers'; | ||
import Constants, { ENV } from '../constants'; | ||
import { axiosGet } from '../utils/axiosUtil'; | ||
import CONSTANTS from '../constantsV2'; | ||
|
||
/** | ||
* GET v1/channels/tags/all | ||
*/ | ||
export type GetAllTagsOptionsType = { | ||
page?: number; | ||
limit?: number; | ||
order?: string; | ||
filter?:string; | ||
env?: ENV; | ||
}; | ||
|
||
/** | ||
* Returns the tags available based on the filter provided | ||
*/ | ||
export const getAllTags = async (options: GetAllTagsOptionsType) => { | ||
const { | ||
page=1, | ||
limit=10, | ||
order=CONSTANTS.FILTER.CHANNEL_LIST.ORDER.DESCENDING, | ||
filter=CONSTANTS.FILTER.TAGS.PUSH, | ||
env = Constants.ENV.PROD, | ||
} = options || {}; | ||
|
||
const API_BASE_URL = getAPIBaseUrls(env); | ||
const apiEndpoint = `${API_BASE_URL}/v1/channels`; | ||
const queryObj = { | ||
page, | ||
limit, | ||
order, | ||
filter, | ||
} | ||
const requestUrl = `${apiEndpoint}/tags/all?${getQueryParams(queryObj)}`; | ||
return await axiosGet(requestUrl) | ||
.then((response) => response.data?.tags) | ||
.catch((err) => { | ||
console.error(`[EPNS-SDK] - API ${requestUrl}: `, err); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getChannels } from '../../../src/lib/channels/getChannels'; | ||
import { ENV } from '../../../src/lib/constants'; | ||
import { expect } from 'chai'; | ||
|
||
describe('PUSH_CHANNELS.getChannels', () => { | ||
it('Should fetch channels based on the filter', async () => { | ||
const res = await getChannels({ | ||
filter: 80002, | ||
env: ENV.DEV, | ||
}); | ||
console.log(res); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { search } from '../../../src/lib/channels/search'; | ||
import { ENV } from '../../../src/lib/constants'; | ||
import { expect } from 'chai'; | ||
|
||
describe('PUSH_CHANNELS.search', () => { | ||
it('Should fetch channels based on the filter', async () => { | ||
const res = await search({ | ||
filter: 80002, | ||
env: ENV.DEV, | ||
query: "Node" | ||
}); | ||
console.log(res); | ||
}); | ||
|
||
it.only('Should fetch channels based on the filter in new format', async () => { | ||
const res = await search({ | ||
filter: 80002, | ||
env: ENV.DEV, | ||
query: "Node", | ||
oldFormat: false | ||
}); | ||
console.log(res); | ||
}); | ||
}); |
Oops, something went wrong.