-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
3,496 additions
and
3,169 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
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
// the unique id for a chat or the receivers's wallet ddress or domain name | ||
export const CHAT_ID = | ||
'34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4'; | ||
export const CHAT_ID = 'allen.bnb'; |
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,38 @@ | ||
import { | ||
getCAIPAddress, | ||
getAPIBaseUrls | ||
} from '../helpers'; | ||
import Constants, { ENV } from '../constants'; | ||
import { axiosGet } from '../utils/axiosUtil'; | ||
|
||
/** | ||
* GET v1/channels/${channelAddressInCAIP}/tags | ||
*/ | ||
export type GetTagsOptionsType = { | ||
/** address of the channel */ | ||
channel: string; | ||
env?: ENV; | ||
} | ||
|
||
/** | ||
* Returns the list of tags associated with the channel | ||
*/ | ||
export const getTags = async ( | ||
options : GetTagsOptionsType | ||
) => { | ||
const { | ||
channel, | ||
env = Constants.ENV.PROD, | ||
} = options || {}; | ||
|
||
const _channel = await getCAIPAddress(env, channel, 'Channel'); | ||
const API_BASE_URL = getAPIBaseUrls(env); | ||
const apiEndpoint = `${API_BASE_URL}/v1/channels`; | ||
const requestUrl = `${apiEndpoint}/${_channel}/tags`; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { getAPIBaseUrls, getQueryParams, getLimit } from '../helpers'; | ||
import Constants, {ENV} from '../constants'; | ||
import { axiosGet } from '../utils/axiosUtil'; | ||
|
||
/** | ||
* GET /v1/channels/search/ | ||
* optional params: page=(1)&limit=(20{min:1}{max:30})&query=(searchquery) | ||
*/ | ||
|
||
export type SearchChannelTagsOptionsType = { | ||
query: string; | ||
env?: ENV; | ||
page?: number; | ||
limit?: number; | ||
} | ||
|
||
export const searchTags = async ( | ||
options: SearchChannelTagsOptionsType | ||
) => { | ||
const { | ||
query, | ||
env = Constants.ENV.LOCAL, | ||
page = Constants.PAGINATION.INITIAL_PAGE, | ||
limit = Constants.PAGINATION.LIMIT, | ||
} = options || {}; | ||
|
||
if (!query) throw Error('"query" not provided!'); | ||
const API_BASE_URL = getAPIBaseUrls(env); | ||
const apiEndpoint = `${API_BASE_URL}/v1/channels/search/tags`; | ||
const queryObj = { | ||
page, | ||
limit: getLimit(limit), | ||
query: query | ||
}; | ||
const requestUrl = `${apiEndpoint}?${getQueryParams(queryObj)}`; | ||
return axiosGet(requestUrl) | ||
.then((response) => response.data.channels) | ||
.catch((err) => { | ||
console.error(`[Push 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
Oops, something went wrong.