-
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.
Merge branch 'main' of github.com:push-protocol/push-sdk into alpha
- Loading branch information
Showing
13 changed files
with
30,528 additions
and
21,653 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
Oops, something went wrong.