TypeScript SDK for Rendevo API.
npm install @rendevo/sdkimport { RendevoClient } from '@rendevo/sdk';
const client = new RendevoClient({
baseURL: 'http://localhost:3000/api',
});
const { access_token, user } = await client.auth.login({
email: '[email protected]',
password: 'password123',
});
const me = await client.users.getMe();// Login
await client.auth.login({
email: '[email protected]',
password: 'password123',
});
// Register
await client.auth.register({
email: '[email protected]',
password: 'password123',
firstName: 'John',
lastName: 'Doe',
});
// Forgot Password
await client.auth.forgotPassword({
email: '[email protected]',
});
// Reset Password
await client.auth.resetPassword({
token: 'reset-token',
newPassword: 'newpassword123',
});
// Verify Email
await client.auth.verifyEmail({
token: 'verification-token',
});
// Resend Verification Email
await client.auth.resendVerification({
email: '[email protected]',
});
// Logout
await client.auth.logout({ refreshToken });// Get all users (Admin only)
const users = await client.users.getAll();
// Get user by ID
const user = await client.users.getById('user-id');
// Get current user
const me = await client.users.getMe();
// Update user
const updatedUser = await client.users.update('user-id', {
firstName: 'Jane',
lastName: 'Smith',
});
// Delete user
await client.users.remove('user-id');// Set token manually
client.setToken('your-jwt-token');
// Get current token
const token = client.getToken();
// Clear token
client.clearToken();import { RendevoAPIError } from '@rendevo/sdk';
try {
await client.auth.login({ email, password });
} catch (error) {
if (error instanceof RendevoAPIError) {
console.error('Status:', error.statusCode);
console.error('Message:', error.message);
console.error('Error:', error.response.error);
} else {
console.error('Unexpected error:', error);
}
}import type { User, AuthResponse } from '@rendevo/sdk';
const response: AuthResponse = await client.auth.login({ email, password });
const user: User = response.user;npm install
npm run build
npm testMIT