UNPKG

amocrm-client

Version:
99 lines (86 loc) 3.05 kB
import { CustomFieldFilter, RangeFilter, StatusFilter } from "./common"; import { ICustomFieldValue } from "./custom_field"; import { ICriteria, IEmbedded, IEntityAttributes, ISelfLinkResponse } from "./api"; import { ICatalogElement } from "../api/models"; import { ITag } from "../api/models"; import { ICompany } from "../api/models"; import { IContact } from "../api/models"; type LeadWithString = "catalog_elements" | "is_price_modified_by_robot" | "loss_reason" | "contacts" | "only_deleted" | "source_id"; export type LeadWith = Array<LeadWithString> | LeadWithString; export type LeadCriteria = Partial<ICriteria<Partial<LeadFilter>, LeadWith>>; export type EmbeddedLead = Partial<ILeadAttributes>; export type LeadCreateCriteria = Partial<Omit<ILeadAttributes, "id" | "_links" | "account_id" | "is_deleted" | "group_id">> export type LeadCreateResult = Omit<ILeadAttributes, "account_id"> export type LeadUpdateCriteria = LeadCreateCriteria & Pick<ILeadAttributes, "id"> export 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; }