// Type definitions for intercom-client 2.9 // Project: https://github.com/intercom/intercom-node // Definitions by: Jinesh Shah , Josef Hornych // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 /// import { List as UserList, User, UserIdentifier } from './User'; import { CompanyIdentifier, List as CompanyList, Company } from './Company'; import { TagIdentifier, List as TagList, Tag, TagOper } from './Tag'; import { List as EventList, Event, ListParam as EventListParam } from './Event'; import { Scroll } from './Scroll'; import { IntercomError } from './IntercomError'; import { IncomingMessage } from 'http'; export { IntercomError }; export interface IdentityVerificationOptions { secretKey: string; identifier: string; } export const IdentityVerification: { userHash(opts: IdentityVerificationOptions): string; }; export class Client { constructor(auth: { token: string } | { appId: string, appApiKey: string }); constructor(username: string, password: string); users: Users; companies: Companies; tags: Tags; events: Events; } export class ApiResponse extends IncomingMessage { body: T; } export type callback = ((d: T) => void) | ((err: IntercomError, d: T) => void); export class Users { create(user: Partial): Promise>; create(user: Partial, cb: callback>): void; update(user: UserIdentifier & Partial): Promise>; update(user: UserIdentifier & Partial, cb: callback>): void; find(identifier: UserIdentifier): Promise>; find(identifier: UserIdentifier, cb: callback>): void; list(): Promise>; list(cb: callback>): void; listBy(params: {tag_id?: string, segment_id?: string}): Promise>; listBy(params: {tag_id?: string, segment_id?: string}, cb: callback>): void; scroll: Scroll; archive(): Promise; requestPermanentDeletion(): Promise<{id: number}>; } export class Companies { create(company: CompanyIdentifier & Partial): Promise>; create(company: CompanyIdentifier & Partial, cb: callback>): void; update(company: CompanyIdentifier & Partial): Promise>; update(company: CompanyIdentifier & Partial, cb: callback>): void; find(identifier: CompanyIdentifier): Promise>; find(identifier: CompanyIdentifier, cb: callback>): void; list(): Promise>; list(cb: callback>): void; listBy(params: {tag_id?: string, segment_id?: string}): Promise>; listBy(params: {tag_id?: string, segment_id?: string}, cb: callback>): void; scroll: Scroll; archive(): Promise; } export class Tags { create(tag: Partial): Promise>; create(tag: Partial, cb: callback>): void; tag(tagOper: TagOper): Promise>; tag(tagOper: TagOper, cb: callback>): void; untag(tagOper: TagOper): Promise>; untag(tagOper: TagOper, cb: callback>): void; delete(tag: TagIdentifier): Promise; delete(tag: TagIdentifier, cb: callback): void; list(): Promise>; list(cb: callback>): void; } export class Events { create(event: Partial): Promise; create(event: Partial, cb: callback): void; listBy(params: EventListParam): Promise>; listBy(params: EventListParam, cb: callback>): void; }