UNPKG

@vulog/aima-user

Version:

User management — profiles, personal information, labels, billing groups, and service registration.

20 lines (16 loc) 596 B
import { Client } from '@vulog/aima-client'; import { z } from 'zod'; import { User } from './types'; export const getUserByEmail = async (client: Client, email: string): Promise<User> => { const result = z.string().trim().min(1).email().safeParse(email); if (!result.success) { throw new TypeError('Invalid args', { cause: result.error.issues, }); } return client .get<User>( `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/usernames/${encodeURIComponent(result.data)}` ) .then(({ data }) => data); };