@trycourier/courier-react-native
Version:
Inbox, Push Notifications, and Preferences for React Native
28 lines (27 loc) • 1.04 kB
JavaScript
import { Modules } from "../Modules";
export class TokenClient {
clientId;
constructor(clientId) {
this.clientId = clientId;
}
/**
* Stores a user token for a specific provider.
* @param props - The properties for storing the user token.
* @param props.token - The token to be stored.
* @param props.provider - The provider associated with the token.
* @param props.device - Optional device information.
* @returns A promise that resolves when the token is successfully stored.
*/
async putUserToken(props) {
await Modules.Client.putUserToken(this.clientId, props.token, props.provider, props.device);
}
/**
* Deletes a user token.
* @param props - The properties for deleting the user token.
* @param props.token - The token to be deleted.
* @returns A promise that resolves when the token is successfully deleted.
*/
async deleteUserToken(props) {
await Modules.Client.deleteUserToken(this.clientId, props.token);
}
}