@elasticapi/wpengine-typescript-sdk
Version:
Unofficial TypeScript SDK for the WP Engine API
92 lines • 1.93 kB
TypeScript
/**
* Common validation patterns
*/
export declare const patterns: {
email: RegExp;
uuid: RegExp;
installId: RegExp;
accountId: RegExp;
userId: RegExp;
roles: RegExp;
};
/**
* Validation error class
*/
export declare class ValidationError extends Error {
constructor(message: string);
}
/**
* Input validators
*/
export declare const validators: {
/**
* Validate email address
*/
email(email: string): boolean;
/**
* Validate UUID format
*/
uuid(id: string): boolean;
/**
* Validate install ID format
*/
installId(id: string): boolean;
/**
* Validate account ID format
*/
accountId(id: string): boolean;
/**
* Validate user ID format
*/
userId(id: string): boolean;
/**
* Validate user roles
*/
roles(roles: string): boolean;
/**
* Validate string is not empty
*/
required(value: string, fieldName: string): boolean;
/**
* Validate string length
*/
length(value: string, fieldName: string, min: number, max: number): boolean;
/**
* Validate URL format
*/
url(url: string): boolean;
/**
* Validate credentials
*/
credentials(username?: string, password?: string): boolean;
};
/**
* Validation helper functions
*/
export declare const validate: {
/**
* Validate user input for creating/updating users
*/
userInput(data: {
first_name?: string;
last_name?: string;
email?: string;
roles?: string;
install_ids?: string[];
}): void;
/**
* Validate backup input
*/
backupInput(data: {
description?: string;
notification_emails?: string[];
}): void;
/**
* Validate domain input
*/
domainInput(data: {
name?: string;
primary?: boolean;
}): void;
};
//# sourceMappingURL=validators.d.ts.map