1 import type { ProductParam } from '../apps/product';
2 import { getProductHeaders } from '../apps/product';
3 import type { CLIENT_TYPES } from '../constants';
4 import type { HumanVerificationMethodType } from '../interfaces';
6 export const getUser = () => ({
11 export const queryCreateUser = (
17 Type: CLIENT_TYPES; // 1 = mail, 2 = VPN
19 ReferralIdentifier?: string;
20 ReferralID?: string; // Invite
21 TokenPayment?: string;
23 [key: string]: string;
32 headers: getProductHeaders(product, {
33 endpoint: 'core/v4/users',
38 export const getRecoveryMethods = (Username: string) => ({
39 url: 'core/v4/users/reset',
44 export const queryCreateUserExternal = (
48 TokenType?: HumanVerificationMethodType;
49 Type: CLIENT_TYPES; // 1 = mail, 2 = VPN
51 TokenPayment?: string;
52 TokenPreVerifiedAddress?: string;
54 [key: string]: string;
60 url: 'core/v4/users/external',
63 headers: getProductHeaders(product, {
64 endpoint: 'core/v4/users/external',
69 export const queryUnlock = () => ({
70 url: 'core/v4/users/unlock',
74 export const canDelete = () => ({
75 url: 'core/v4/users/delete',
79 export const deleteUser = (data: { Reason?: string; Feedback?: string; Email?: string }) => ({
80 url: 'core/v4/users/delete',
85 export const unlockPasswordChanges = () => ({
86 url: 'core/v4/users/password',
90 export const lockSensitiveSettings = () => ({
91 url: 'core/v4/users/lock',
95 export const getHumanVerificationMethods = () => ({
96 url: 'core/v4/users/human',
100 export const queryVerificationCode = (
101 Type: 'email' | 'sms',
112 url: 'core/v4/users/code',
114 data: { Type, Destination },
117 export const queryCheckUsernameAvailability = (Name: string, ParseDomain?: boolean) => ({
118 url: 'core/v4/users/available',
120 params: { Name, ParseDomain: ParseDomain ? 1 : 0 },
123 export const queryCheckEmailAvailability = (Name: string) => ({
124 url: 'core/v4/users/availableExternal',
129 export const queryDirectSignupStatus = (
130 Type: CLIENT_TYPES // 1 = mail, 2 = VPN
132 url: 'core/v4/users/direct',
137 export const queryCheckVerificationCode = (
139 TokenType: 'email' | 'sms' | 'invite' | 'coupon' | 'payment',
140 Type: CLIENT_TYPES // 1 = mail, 2 = VPN
142 url: 'core/v4/users/check',
144 data: { Token, TokenType, Type },
147 export const getInvitations = () => ({
148 url: 'core/v4/users/invitations',
152 export const acceptInvitation = (invitationID: string) => ({
153 url: `core/v4/users/invitations/${invitationID}/accept`,
157 export const rejectInvitation = (invitationID: string) => ({
158 url: `core/v4/users/invitations/${invitationID}/reject`,
162 export const disableUser = (data: { JWT: string }) => ({
163 url: `core/v4/users/disable/${data.JWT}`,