UNPKG

amocrm-client

Version:
88 lines (87 loc) 3.14 kB
import { CustomFieldFilter, Moment, RangeFilter, StatusFilter } from "./common"; import { ICustomFieldValue } from "./custom_field"; import { ICriteria, IEmbedded, IEntityAttributes, ISelfLinkResponse } from "./api"; import { ICatalogElement } from "../api/models/CatalogElement"; import { ITag } from "../api/models/Tag"; import { ICompany } from "../api/models/Company"; import { IContact } from "../api/models/Contact"; declare type LeadWithString = "catalog_elements" | "is_price_modified_by_robot" | "loss_reason" | "contacts" | "only_deleted" | "source_id"; export declare type LeadWith = Array<LeadWithString> | LeadWithString; export declare type LeadCriteria = Partial<ICriteria<Partial<LeadFilter>, LeadWith>>; export declare type EmbeddedLead = Partial<ILeadAttributes>; export declare type LeadCreateCriteria = Partial<Omit<ILeadAttributes, "id" | "_links" | "account_id" | "is_deleted" | "group_id">>; export declare type LeadCreateResult = Omit<ILeadAttributes, "account_id">; export declare type LeadUpdateCriteria = LeadCreateCriteria & Pick<ILeadAttributes, "id">; export declare type LeadUpdateResult = Pick<ILeadAttributes, "id" | "name" | "updated_at" | "_links">; export interface ILeadAttributes extends IEntityAttributes { name: string; price: number; status_id: number; pipeline_id: number; loss_reason_id: number; responsible_user_id: number; group_id: number; created_by: number; updated_by: number; closed_at: Date; closest_task_at: Date; created_at: Date; updated_at: Date; is_deleted: boolean; score: number | null; is_price_modified_by_robot?: boolean; source_id?: string; request_id?: string; custom_fields_values: ICustomFieldValue[]; _embedded: ILeadEmbedded; } export interface PipelineAttributes extends IEntityAttributes { name: string; sort: number; is_main: boolean; is_unsorted_on: boolean; is_archive: boolean; _embedded: { statuses: LeadStatusAttributes[]; }; } export interface LeadStatusAttributes extends IEntityAttributes { id: number; name: string; sort: number; is_editable: boolean; pipeline_id: number; color: string; type: number; } export interface LeadFilter { id: number | number[]; name: string | string[]; price: RangeFilter; statuses: StatusFilter[]; pipeline_id: number | number[]; created_by: number | number[]; updated_by: number | number[]; responsible_user_id: number | number[]; created_at: RangeFilter; updated_at: RangeFilter; closed_at: RangeFilter; closest_task_at: RangeFilter; custom_fields_values: CustomFieldFilter[]; } export interface ILeadEmbedded extends IEmbedded { tags: ITag[]; catalog_elements?: ICatalogElement[]; companies: ICompany[]; loss_reason?: ILossReason[]; contacts?: IContact[]; } export interface ILossReason { id: number; name: string; sort: number; created_at: Date; updated_at: Date; _links: ISelfLinkResponse; } export {};