Загрузка данных


import { auditApi as api } from "./api";
export const addTagTypes = ["Message", "Calls"] as const;
const injectedRtkApi = api
  .enhanceEndpoints({
    addTagTypes,
  })
  .injectEndpoints({
    endpoints: (build) => ({
      getApiV1Message: build.query<
        GetApiV1MessageApiResponse,
        GetApiV1MessageApiArg
      >({
        query: (queryArg) => ({
          url: `/api/v1/message`,
          params: {
            source: queryArg.source,
            type: queryArg["type"],
            userId: queryArg.userId,
            userIp: queryArg.userIp,
            userLogin: queryArg.userLogin,
            smartroomId: queryArg.smartroomId,
            sortType: queryArg.sortType,
            tmMin: queryArg.tmMin,
            tmMax: queryArg.tmMax,
            limit: queryArg.limit,
            offset: queryArg.offset,
          },
        }),
        providesTags: ["Message"],
      }),
      getApiV1MessageTypes: build.query<
        GetApiV1MessageTypesApiResponse,
        GetApiV1MessageTypesApiArg
      >({
        query: () => ({ url: `/api/v1/message/types` }),
        providesTags: ["Message"],
      }),
      getApiV1MessageCursor: build.query<
        GetApiV1MessageCursorApiResponse,
        GetApiV1MessageCursorApiArg
      >({
        query: (queryArg) => ({
          url: `/api/v1/message/cursor`,
          params: {
            source: queryArg.source,
            type: queryArg["type"],
            userId: queryArg.userId,
            userIp: queryArg.userIp,
            userLogin: queryArg.userLogin,
            smartroomId: queryArg.smartroomId,
            sortType: queryArg.sortType,
            tmMin: queryArg.tmMin,
            tmMax: queryArg.tmMax,
            limit: queryArg.limit,
            cursorId: queryArg.cursorId,
            cursorDate: queryArg.cursorDate,
            direction: queryArg.direction,
          },
        }),
        providesTags: ["Message"],
      }),
      getApiV1MessageCursorCount: build.query<
        GetApiV1MessageCursorCountApiResponse,
        GetApiV1MessageCursorCountApiArg
      >({
        query: (queryArg) => ({
          url: `/api/v1/message/cursorCount`,
          params: {
            source: queryArg.source,
            type: queryArg["type"],
            userId: queryArg.userId,
            userIp: queryArg.userIp,
            userLogin: queryArg.userLogin,
            smartroomId: queryArg.smartroomId,
            sortType: queryArg.sortType,
            tmMin: queryArg.tmMin,
            tmMax: queryArg.tmMax,
            limit: queryArg.limit,
            cursorId: queryArg.cursorId,
            cursorDate: queryArg.cursorDate,
            direction: queryArg.direction,
          },
        }),
        providesTags: ["Message"],
      }),
      getApiV1Call: build.query<GetApiV1CallApiResponse, GetApiV1CallApiArg>({
        query: (queryArg) => ({
          url: `/api/v1/call`,
          params: {
            type: queryArg["type"],
            locationId: queryArg.locationId,
            tmMin: queryArg.tmMin,
            tmMax: queryArg.tmMax,
            limit: queryArg.limit,
            offset: queryArg.offset,
          },
        }),
        providesTags: ["Calls"],
      }),
      getApiV1CallTypes: build.query<
        GetApiV1CallTypesApiResponse,
        GetApiV1CallTypesApiArg
      >({
        query: () => ({ url: `/api/v1/call/types` }),
        providesTags: ["Calls"],
      }),
    }),
    overrideExisting: false,
  });
export { injectedRtkApi as client };
export type GetApiV1MessageApiResponse =
  /** status 200 OK */ MessagesGetResponse;
export type GetApiV1MessageApiArg = {
  /** Сервис (monitoring/auth) */
  source?: Source;
  /** Тип событий */
  type?: string;
  /** UUID пользователя */
  userId?: string;
  /** IP-адрес пользователя */
  userIp?: string;
  /** Логин пользователя */
  userLogin?: string;
  /** UUID внутри smartroom */
  smartroomId?: string;
  /** тип сортировки по дате */
  sortType?: SortType;
  /** минимальный timestamp (время в секундах) */
  tmMin?: number;
  /** максимальный timestamp (время в секундах) */
  tmMax?: number;
  /** Минимальное количество событий на странице */
  limit?: number;
  /** Смещение событий */
  offset?: number;
};
export type GetApiV1MessageTypesApiResponse =
  /** status 200 OK */ MessageTypesResponse;
export type GetApiV1MessageTypesApiArg = void;
export type GetApiV1MessageCursorApiResponse =
  /** status 200 OK */ MessageCursorGetResponse;
export type GetApiV1MessageCursorApiArg = {
  /** Сервис (monitoring/auth) */
  source?: Source;
  /** Тип событий */
  type?: string;
  /** UUID пользователя */
  userId?: string;
  /** IP-адрес пользователя */
  userIp?: string;
  /** Логин пользователя */
  userLogin?: string;
  /** UUID внутри smartroom */
  smartroomId?: string;
  /** тип сортировки по дате */
  sortType?: SortType;
  /** минимальный timestamp */
  tmMin?: string;
  /** максимальный timestamp */
  tmMax?: string;
  /** аксимальное количество событий на странице */
  limit?: number;
  /** Cursor ID (UUID) for pagination. Must be provided together with cursorDate */
  cursorId?: string;
  /** Cursor date timestamp (RFC3339Nano format) for pagination. Must be provided together with cursorId */
  cursorDate?: string;
  /** Pagination direction. Use "next" to get next page (default) or "prev" to get previous page */
  direction?: "next" | "prev";
};
export type GetApiV1MessageCursorCountApiResponse =
  /** status 200 Count of records */ number;
export type GetApiV1MessageCursorCountApiArg = {
  /** Сервис (monitoring/auth) */
  source?: Source;
  /** Тип событий */
  type?: string;
  /** UUID пользователя */
  userId?: string;
  /** IP-адрес пользователя */
  userIp?: string;
  /** Логин пользователя */
  userLogin?: string;
  /** UUID внутри smartroom */
  smartroomId?: string;
  /** тип сортировки по дате */
  sortType?: SortType;
  /** минимальный timestamp */
  tmMin?: string;
  /** максимальный timestamp */
  tmMax?: string;
  /** Минимальное количество событий на странице */
  limit?: number;
  /** Cursor ID (UUID) for pagination. Must be provided together with cursorDate */
  cursorId?: string;
  /** Cursor date timestamp (RFC3339Nano format) for pagination. Must be provided together with cursorId */
  cursorDate?: string;
  /** Pagination direction. Use "next" to get next page (default) or "prev" to get previous page */
  direction?: "next" | "prev";
};
export type GetApiV1CallApiResponse = /** status 200 OK */ CallsGetResponse;
export type GetApiV1CallApiArg = {
  /** Call type */
  type?: string;
  /** Location ID */
  locationId?: string;
  /** min timestamp (time in seconds) */
  tmMin?: number;
  /** max timestamp (time in seconds) */
  tmMax?: number;
  /** Rows number on the page (pagination parameter) */
  limit?: number;
  /** The number of records you wish to skip before selecting records (pagination parameter) */
  offset?: number;
};
export type GetApiV1CallTypesApiResponse =
  /** status 200 OK */ CallTypesResponse;
export type GetApiV1CallTypesApiArg = void;
export type UserRole = "user" | "admin";
export type User = {
  id?: string;
  ip?: string;
  agent?: string;
  fullName?: string;
  logins?: {
    sigma?: string;
    omega?: string;
  };
  emails?: {
    external?: string;
    internal?: string;
  };
  role?: UserRole;
};
export type Message = {
  id?: string;
  user?: User;
  date?: string;
  source?: string;
  type?: string;
  attrs?: object;
};
export type MessagesGetResponse = {
  messages?: Message[];
  total?: number;
};
export type Source =
  | "smartroom-monitoring"
  | "smartroom-auth"
  | "smartroom-notifications";
export type SortType = "desc" | "asc";
export type MessageTypesResponse = {
  types?: (
    | "log_out"
    | "sign_in"
    | "user_register"
    | "user_update"
    | "user_delete"
    | "manufacturer_create"
    | "manufacturer_update"
    | "manufacturer_delete"
    | "controller_create"
    | "controller_update"
    | "controller_delete"
    | "controller_model_create"
    | "controller_model_update"
    | "controller_model_delete"
    | "controller_type_create"
    | "controller_type_update"
    | "controller_type_delete"
    | "device_create"
    | "device_update"
    | "device_delete"
    | "network_device_create"
    | "network_device_update"
    | "network_device_delete"
    | "padlet_create"
    | "padlet_update"
    | "padlet_delete"
    | "offline_device_create"
    | "offline_device_update"
    | "offline_device_delete"
    | "device_type_create"
    | "device_type_update"
    | "device_type_delete"
    | "device_model_create"
    | "device_model_update"
    | "device_model_delete"
    | "padlet_type_create"
    | "padlet_type_update"
    | "padlet_type_delete"
    | "padlet_model_create"
    | "padlet_model_update"
    | "padlet_model_delete"
    | "location_create"
    | "location_update"
    | "location_delete"
    | "location_note_create"
    | "location_note_update"
    | "location_note_delete"
    | "location_ticket_create"
    | "location_ticket_update"
    | "location_ticket_delete"
    | "location_ticket_archive"
    | "service_status_create"
    | "contractor_create"
    | "contractor_update"
    | "contractor_delete"
    | "interface_name_create"
    | "interface_name_update"
    | "interface_name_delete"
    | "interface_value_create"
    | "interface_value_update"
    | "interface_value_delete"
    | "notification_archive"
    | "notification_archive_all"
    | "notification_read"
    | "notification_read_all"
    | "flapping_resolved"
    | "equipment_disable"
    | "equipment_enable"
    | "location_disable"
    | "location_enable"
    | "equipment_token_create"
    | "equipment_token_update"
    | "equipment_token_delete"
    | "equipment_window_create"
    | "location_owner_add"
    | "location_owner_delete"
  )[];
};
export type Cursor = {
  date?: string;
  id: string;
};
export type MessageCursorGetResponse = {
  messages: Message[];
  hasNext: boolean;
  hasPrev: boolean;
  nextCursor?: Cursor | null;
  prevCursor?: Cursor | null;
  total?: number;
};
export type Call = {
  id?: string;
  employee_number?: string;
  destination?: string;
  type?: string;
  location_id?: string;
  attrs?: object;
  date?: string;
};
export type CallsGetResponse = {
  calls?: Call[];
  total?: number;
};
export type CallTypesResponse = {
  types?: (
    | "call_start"
    | "call_end"
    | "call_start_vip"
    | "call_end_vip"
    | "call_start_common"
    | "call_end_common"
  )[];
};
export const {
  useGetApiV1MessageQuery,
  useGetApiV1MessageTypesQuery,
  useGetApiV1MessageCursorQuery,
  useGetApiV1MessageCursorCountQuery,
  useGetApiV1CallQuery,
  useGetApiV1CallTypesQuery,
} = injectedRtkApi;