crisp-api
Version:
Crisp API wrapper for Node - official, maintained by Crisp
258 lines (257 loc) • 7.97 kB
TypeScript
/**************************************************************************
* IMPORTS
***************************************************************************/
import BaseResource from "./BaseResource";
/**************************************************************************
* INTERFACES
***************************************************************************/
export interface PeopleStatistics {
total?: number;
}
export interface PeopleSuggestedSegment {
segment?: string;
count?: number;
}
export interface PeopleSuggestedDataKey {
key?: string;
count?: number;
}
export interface PeopleSuggestedEvent {
text?: string;
count?: number;
}
export interface PeopleProfile extends PeopleProfileCard {
people_id?: string;
}
export interface PeopleProfileNew {
people_id?: string;
}
export interface PeopleProfileCard {
email?: string;
person?: PeopleProfileCardPerson;
company?: PeopleProfileCardCompany;
segments?: string[];
notepad?: string;
active?: PeopleProfileCardActive;
score?: number;
created_at?: number;
updated_at?: number;
}
export interface PeopleProfileUpdateCard {
email?: string;
person?: PeopleProfileCardPerson;
company?: PeopleProfileCardCompany;
segments?: string[];
notepad?: string;
active?: number;
}
export interface PeopleProfileCardPerson {
nickname?: string;
avatar?: string;
gender?: string;
phone?: string;
address?: string;
description?: string;
website?: string;
timezone?: number;
profiles?: PeopleProfileCardPersonProfile[];
employment?: PeopleProfileCardPersonEmployment;
geolocation?: PeopleProfileCardGeolocation;
locales?: string[];
}
export interface PeopleProfileCardPersonProfile {
type?: string;
handle?: string;
}
export interface PeopleProfileCardPersonEmployment {
name?: string;
domain?: string;
title?: string;
role?: string;
seniority?: string;
}
export interface PeopleProfileCardCompany {
name?: string;
legal_name?: string;
domain?: string;
url?: string;
description?: string;
timezone?: number;
phones?: string[];
emails?: string[];
geolocation?: PeopleProfileCardGeolocation;
metrics?: PeopleProfileCardCompanyMetrics;
tags?: string[];
}
export interface PeopleProfileCardCompanyMetrics {
employees?: number;
market_cap?: number;
raised?: number;
arr?: number;
}
export interface PeopleProfileCardGeolocation {
country?: string;
region?: string;
city?: string;
coordinates?: PeopleProfileCardGeolocationCoordinates;
}
export interface PeopleProfileCardGeolocationCoordinates {
latitude?: number;
longitude?: number;
}
export interface PeopleProfileCardActive {
now?: boolean;
last?: number;
}
export interface PeopleCampaign {
campaign_id?: string;
type?: string;
name?: string;
created_at?: number;
updated_at?: number;
dispatched_at?: number;
occurred_at?: number;
statistics?: string[];
}
export interface PeopleEvent {
text?: string;
data?: object;
color?: string;
timestamp?: number;
}
export interface PeopleData {
data?: Record<string, boolean | string | number>;
}
export interface PeopleSubscription {
email?: boolean;
}
export interface PeopleSubscriptionUpdate {
email?: boolean;
}
export interface PeopleProfileImportSetup {
url?: string;
mapping?: PeopleProfileImportSetupMapping[];
options?: PeopleProfileImportSetupOptions;
}
export interface PeopleProfileImportSetupMapping {
column?: number;
field?: string;
}
export interface PeopleProfileImportSetupOptions {
column_separator?: string;
skip_header?: boolean;
}
/**************************************************************************
* CLASSES
***************************************************************************/
/**
* Crisp WebsitePeople Resource
* @class
* @classdesc This is the Crisp Website People Resource
*/
declare class WebsitePeople extends BaseResource {
/**
* Get People Statistics
*/
getPeopleStatistics(websiteID: string): Promise<PeopleStatistics>;
/**
* List Suggested People Segments
*/
listSuggestedPeopleSegments(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedSegment[]>;
/**
* Delete Suggested People Segment
*/
deleteSuggestedPeopleSegment(websiteID: string, segment: string): Promise<any>;
/**
* List Suggested People Data Keys
*/
listSuggestedPeopleDataKeys(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedDataKey[]>;
/**
* Delete Suggested People Data Key
*/
deleteSuggestedPeopleDataKey(websiteID: string, key: string): Promise<any>;
/**
* List Suggested People Events
*/
listSuggestedPeopleEvents(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedEvent[]>;
/**
* Delete Suggested People Event
*/
deleteSuggestedPeopleEvent(websiteID: string, text: string): Promise<any>;
/**
* List People Profiles
*/
listPeopleProfiles(websiteID: string, pageNumber?: number, searchField?: string, searchOrder?: string, searchOperator?: string, searchFilter?: string, searchText?: string): Promise<PeopleProfile[]>;
/**
* Add New People Profile
*/
addNewPeopleProfile(websiteID: string, profile: PeopleProfileUpdateCard): Promise<any>;
/**
* Check If People Profile Exists
*/
checkPeopleProfileExists(websiteID: string, peopleID: string): Promise<any>;
/**
* Save People Profile
*/
getPeopleProfile(websiteID: string, peopleID: string): Promise<any>;
/**
* Get People Profile
*/
savePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
/**
* Update People Profile
*/
updatePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
/**
* Remove People Profile
*/
removePeopleProfile(websiteID: string, peopleID: string): Promise<any>;
/**
* List People Conversations
*/
listPeopleConversations(websiteID: string, peopleID: string, pageNumber?: number): Promise<string[]>;
/**
* List People Campaigns
*/
listPeopleCampaigns(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleCampaign[]>;
/**
* Add A People Event
*/
addPeopleEvent(websiteID: string, peopleID: string, peopleEvent: PeopleEvent): Promise<any>;
/**
* List People Events
*/
listPeopleEvents(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleEvent[]>;
/**
* Get People Data
*/
getPeopleData(websiteID: string, peopleID: string): Promise<PeopleData>;
/**
* Save People Data
*/
savePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
/**
* Update People Data
*/
updatePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
/**
* Get People Subscription Status
*/
getPeopleSubscriptionStatus(websiteID: string, peopleID: string): Promise<PeopleSubscription>;
/**
* Update People Subscription Status
*/
updatePeopleSubscriptionStatus(websiteID: string, peopleID: string, peopleSubscription: PeopleSubscriptionUpdate): Promise<any>;
/**
* Export People Profiles
*/
exportPeopleProfiles(websiteID: string): Promise<any>;
/**
* Import People Profiles
*/
importPeopleProfiles(websiteID: string, importSetup: PeopleProfileImportSetup): Promise<any>;
}
/**************************************************************************
* EXPORTS
***************************************************************************/
export default WebsitePeople;