UNPKG

amocrm-client

Version:
55 lines (46 loc) 2.12 kB
import { ICriteria, IEntityAttributes, IResourceCollection } from "./api"; import { CustomFieldFilter, Moment, PartialWithRequired, RangeFilter } from "./common"; import { ICustomFieldValue } from "./custom_field"; type ContactWithString = "catalog_elements" | "leads" | "customers"; export type ContactWith = Array<ContactWithString> | ContactWithString; export type ContactCriteria = Partial<ICriteria<Partial<ContactFilter>, ContactWith>>; export type EmbeddedContact = Partial<IContactAttributes & { is_main: boolean }>; export type ContactCreateCriteria = Partial<Omit<IContactAttributes, "id" | "_links" | "account_id" | "is_deleted" | "group_id">> export type ContactCreateResult = PartialWithRequired<Omit<IContactAttributes, "account_id">, "name"> export type ContactUpdateCriteria = ContactCreateCriteria & Pick<IContactAttributes, "id"> export type ContactUpdateResult = Pick<IContactAttributes, "id" | "name" | "updated_at" | "_links"> export interface ContactFilter { id: number | number[]; name: string | string[]; 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 IContactAttributes extends IEntityAttributes { name: string; first_name: string; last_name: string; is_main?: boolean | undefined; responsible_user_id: number; group_id: number; created_at: Date; updated_at: Date; updated_by: number; created_by: number; closest_task_at: Date; is_deleted: boolean; is_unsorted: boolean; custom_fields_values: ICustomFieldValue[] | null; _embedded: IContactEmbedded; } export interface IContactEmbedded { tags: IResourceCollection<IEntityAttributes>; catalog_elements?: IResourceCollection<IEntityAttributes>; companies: IResourceCollection<IEntityAttributes>; customers?: IResourceCollection<IEntityAttributes>; }