UNPKG

crisp-api

Version:

Crisp API wrapper for Node - official, maintained by Crisp

91 lines (74 loc) 2.15 kB
/* * This file is part of node-crisp-api * * Copyright (c) 2025 Crisp IM SAS * All rights belong to Crisp IM SAS */ /************************************************************************** * IMPORTS ***************************************************************************/ // PROJECT: RESOURCES import BaseResource from "./BaseResource"; /************************************************************************** * INTERFACES ***************************************************************************/ export interface WebsiteVerifyKeyData { data?: WebsiteVerifyKey; } export interface WebsiteVerifySettings { enabled?: boolean; } export interface WebsiteVerifyKey { secret?: string; } export interface WebsiteVerifySettingsUpdate { enabled?: boolean; } /************************************************************************** * CLASSES ***************************************************************************/ /** * Crisp WebsiteVerify Resource */ class WebsiteVerify extends BaseResource { /** * Get Verify Settings */ getVerifySettings(websiteID: string): Promise<WebsiteVerifySettings> { return this.crisp.get( this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"]) ); }; /** * Update Verify Settings */ updateVerifySettings( websiteID: string, settings: WebsiteVerifySettingsUpdate ) { return this.crisp.patch( this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"]), null, settings ); }; /** * Get Verify Key */ getVerifyKey(websiteID: string): Promise<WebsiteVerifyKey> { return this.crisp.get( this.crisp.prepareRestUrl(["website", websiteID, "verify", "key"]) ); }; /** * Roll Verify Key */ rollVerifyKey(websiteID: string) { return this.crisp.post( this.crisp.prepareRestUrl(["website", websiteID, "verify", "key"]), null, null ); }; } /************************************************************************** * EXPORTS ***************************************************************************/ export default WebsiteVerify;