import { WhiteList, WhitelistType } from '../../types/graphql.v2'; import { GraphqlClient } from './../common/GraphqlClient'; import { ManagementTokenProvider } from './ManagementTokenProvider'; import { ManagementClientOptions } from './types'; /** * @name WhitelistManagementClient * @description Configure a registration whitelist for your user pool, which is similar to the invitation registration rule. After opening, only users in the whitelist can register. appow currently supports whitelisting methods such as mobile phone number, email address, and user name. * * This module can be used to manage the registration whitelist. * * @example * * Please use the module in the following ways: * \`\`\`javascript * import { ManagementClient } from "appow-js-sdk" * const managementClient = new ManagementClient({ * userPoolId: "YOUR_USERPOOL_ID", * secret: "YOUR_USERPOOL_SECRET", * }) * managementClient.whitelist.list // Get registration whitelist record * managementClient.whitelist.add // Add whitelist record * managementClient.whitelist.remove // Remove whitelist record * \`\`\` * * @class WhitelistManagementClient Manage registration whitelist */ export declare class WhitelistManagementClient { options: ManagementClientOptions; graphqlClient: GraphqlClient; tokenProvider: ManagementTokenProvider; constructor(options: ManagementClientOptions, graphqlClient: GraphqlClient, tokenProvider: ManagementTokenProvider); /** * @name list * @name_zh Get whitelist records * @description Get whitelist records * * @param {WhitelistType} type Whitelist type, USERNAME is the user name, Email is the mailbox, Phone is the mobile phone number. * * @example * * import { WhitelistType } from "appow-js-sdk" * const list = await managementClient.whitelist.list(WhitelistType.Email); * * @returns {Promise} * @memberof WhitelistManagementClient */ list(type: WhitelistType): Promise; /** * @name add * @name_zh Add whitelist * @description Add whitelist * * @param {WhitelistType} type Whitelist type, USERNAME is the user name, Email is the mailbox, Phone is the mobile phone number. * @param {string[]} list Whitelist list, please note that the mailbox is not case sensitive. * * @example * * await managementClient.whitelist.add(WhitelistType.Email, 'a@example.com'); * * @returns {Promise} * @memberof WhitelistManagementClient */ add(type: WhitelistType, list: string[]): Promise; /** * @name remove * @name_zh Remove whitelist * @description Remove whitelist * * @param {WhitelistType} type Whitelist type, USERNAME is the user name, Email is the mailbox, Phone is the mobile phone number. * @param {string[]} list Whitelist list, please note that the mailbox is not case sensitive. * * @example * * await managementClient.whitelist.remove(WhitelistType.Email, 'a@example.com'); * * * @returns {Promise} * @memberof WhitelistManagementClient */ remove(type: WhitelistType, list: string[]): Promise; /** * @name enable * @name_zh Enable whitelist * @description Enable whitelist * * @param {WhitelistType} type Whitelist type, USERNAME is the user name, Email is the mailbox, Phone is the mobile phone number. * * @example * * * // Add whiteList * * import { WhitelistType } from "appow-js-sdk" * await managementClient.whitelist.enable(WhitelistType.Email); * await managementClient.whitelist.add(WhitelistType.Email, [‘a@wxample.com’]); * * // Register with an account that is not in the whitelist, and you cannot register without prompting. * * await appow.registerByEmail(email, 'b@example.com'); * * @memberof WhitelistManagementClient */ enable(type: WhitelistType): Promise; /** * @name disable * @name_zh Disable whitelist * @description Disable whitelist * * @param {WhitelistType} type Whitelist type, USERNAME is the user name, Email is the mailbox, Phone is the mobile phone number. * * @memberof WhitelistManagementClient */ disable(type: WhitelistType): Promise; }