mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 01:31:45 +00:00
Add Leads
This commit is contained in:
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
import { Company } from "./Company";
|
||||
import { Avatar, LocationData, Segment, SocialProfile, Tag } from './User';
|
||||
|
||||
export type LeadIdentifier = { "id": string } | { "user_id": string };
|
||||
|
||||
export interface Lead {
|
||||
"type": "user" | "contact",
|
||||
readonly "id": string,
|
||||
"user_id": string | null,
|
||||
"email": string | null,
|
||||
"app_id"?: string,
|
||||
"phone": string | null,
|
||||
"name": string | null,
|
||||
readonly "updated_at": number,
|
||||
"last_seen_ip": string | null,
|
||||
"unsubscribed_from_emails": boolean,
|
||||
"last_request_at": number | null,
|
||||
"signed_up_at": number | null,
|
||||
readonly "created_at": number,
|
||||
"session_count": number,
|
||||
"user_agent_data": string | null,
|
||||
"pseudonym": string | null,
|
||||
"anonymous": boolean,
|
||||
"custom_attributes": {
|
||||
[key: string]: any
|
||||
},
|
||||
"avatar": Avatar,
|
||||
"location_data": LocationData | {},
|
||||
"social_profiles": {
|
||||
"type": "social_profile.list",
|
||||
"social_profiles": SocialProfile[]
|
||||
},
|
||||
"companies": {
|
||||
"type": "company.list",
|
||||
"companies": Company[]
|
||||
},
|
||||
"segments": {
|
||||
"type": "segment.list",
|
||||
"segments": Segment[]
|
||||
|
||||
},
|
||||
"tags": {
|
||||
"type": "tag.list",
|
||||
"tags": Tag[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface List {
|
||||
"type": "user.list",
|
||||
"total_count": number,
|
||||
"contacts": Lead[],
|
||||
"pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number }
|
||||
}
|
||||
Vendored
+29
-2
@@ -6,6 +6,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { List as UserList, User, UserIdentifier } from './User';
|
||||
import { List as LeadList, Lead, LeadIdentifier } from './Lead';
|
||||
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';
|
||||
@@ -33,6 +34,8 @@ export class Client {
|
||||
companies: Companies;
|
||||
tags: Tags;
|
||||
events: Events;
|
||||
contacts: Leads;
|
||||
leads: Leads;
|
||||
}
|
||||
|
||||
export class ApiResponse<T> extends IncomingMessage {
|
||||
@@ -51,8 +54,8 @@ export class Users {
|
||||
find(identifier: UserIdentifier): Promise<ApiResponse<User>>;
|
||||
find(identifier: UserIdentifier, cb: callback<ApiResponse<User>>): void;
|
||||
|
||||
list(): Promise<ApiResponse<User>>;
|
||||
list(cb: callback<ApiResponse<User>>): void;
|
||||
list(): Promise<ApiResponse<UserList>>;
|
||||
list(cb: callback<ApiResponse<UserList>>): void;
|
||||
|
||||
listBy(params: {tag_id?: string, segment_id?: string}): Promise<ApiResponse<UserList>>;
|
||||
listBy(params: {tag_id?: string, segment_id?: string}, cb: callback<ApiResponse<UserList>>): void;
|
||||
@@ -69,6 +72,30 @@ export class Users {
|
||||
requestPermanentDeletionByParams(identifier: UserIdentifier, cb: callback<{ id: number }>): void;
|
||||
}
|
||||
|
||||
export class Leads {
|
||||
create(user: Partial<Lead>): Promise<ApiResponse<Lead>>;
|
||||
create(user: Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
update(user: UserIdentifier & Partial<Lead>): Promise<ApiResponse<Lead>>;
|
||||
update(user: UserIdentifier & Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
list(): Promise<ApiResponse<LeadList>>;
|
||||
list(cb: callback<ApiResponse<LeadList>>): void;
|
||||
|
||||
listBy(params: { email?: string, tag_id?: string, segment_id?: string }): Promise<ApiResponse<LeadList>>;
|
||||
listBy(params: { email?: string, tag_id?: string, segment_id?: string }, cb: callback<ApiResponse<LeadList>>): void;
|
||||
|
||||
find(identifier: LeadIdentifier): Promise<ApiResponse<Lead>>
|
||||
find(identifier: LeadIdentifier, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
delete(id: string): Promise<ApiResponse<Lead>>;
|
||||
delete(id: string, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
convert(params: { contact: LeadIdentifier, user: UserIdentifier }): Promise<ApiResponse<Lead>>;
|
||||
convert(params: { contact: LeadIdentifier, user: UserIdentifier }, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
}
|
||||
|
||||
export class Companies {
|
||||
create(company: CompanyIdentifier & Partial<Company>): Promise<ApiResponse<Company>>;
|
||||
create(company: CompanyIdentifier & Partial<Company>, cb: callback<ApiResponse<Company>>): void;
|
||||
|
||||
Reference in New Issue
Block a user