UNPKG

amocrm-client

Version:
68 lines (67 loc) 2.3 kB
import { ICriteria, IEntityAttributes, IResourceCollection } from "./api"; declare type UserWithString = "role" | "group" | "uuid" | "amojo_id"; declare type UserRoleWithString = "users"; export declare type UserWith = Array<UserWithString> | UserWithString; export declare type UserRoleWith = Array<UserRoleWithString> | UserRoleWithString; export declare type UserCriteria = Pick<ICriteria<never, UserWith>, "with" | "page" | "limit">; export declare type UserRoleCriteria = Pick<ICriteria<never, UserWith>, "with" | "page" | "limit">; export declare type UserCreateCriteria = Omit<IUserAttributes, "id" | "account_id" | "_links"> & { password: string; }; export declare type UserRoleCreateCriteria = Omit<IUserAttributes, "id" | "account_id" | "_links">; export declare type UserRoleUpdateCriteria = Omit<IUserAttributes, "account_id" | "_links">; export interface IUserAttributes extends IEntityAttributes { name: string; email: string; lang: string; rights: IUserRightAttributes; uuid?: null | string; amojo_id?: null | string; } export interface IUserRoleAttributes extends IEntityAttributes { name: string; rights: IRightAttributes; } export interface IUserRightAttributes extends IRightAttributes { is_admin: boolean; is_free: boolean; is_active: boolean; group_id: number | null; role_id: number | null; } export interface IRightAttributes { leads: IRights; contacts: IRights; companies: IRights; tasks: Pick<IRights, "edit" | "delete">; status_rights: IStatusRights[]; catalog_rights: ICatalogRights[]; mail_access: boolean; catalog_access: boolean; } interface IRights { view: RightActionValue; edit: RightActionValue; add: RightActionValue; delete: RightActionValue; export: RightActionValue; } interface IStatusRights { entity_type: string; pipeline_id: number; status_id: number; rights: IRights; } interface ICatalogRights { catalog_id: number; rights: IRights; } declare type RightActionValue = "A" | "G" | "M" | "D"; export interface UserEmbedded { roles?: IResourceCollection<IEntityAttributes>; groups?: { id: number; name: string; }[]; } export {};