@edgeiq/edgeiq-api-js 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import { PaginationFilter } from '../models';
2
- import { BulkResponse, PaginatedBulkResponses, BulkResponsesFilters } from './models';
2
+ import { BulkResponse, PaginatedBulkResponses, BulkResponsesFilters, PaginatedBulkResponseStatuses } from './models';
3
3
  interface BulkResponsesInterface {
4
4
  list(filters?: BulkResponsesFilters, pagination?: PaginationFilter): Promise<PaginatedBulkResponses>;
5
5
  getOneById(id: string): Promise<BulkResponse>;
6
+ getBulkResponseStatuses(id: string, pagination?: PaginationFilter): Promise<PaginatedBulkResponseStatuses>;
6
7
  }
7
8
  export declare const BulkResponses: BulkResponsesInterface;
8
9
  export {};
@@ -55,4 +55,35 @@ export const BulkResponses = class extends BaseModelClass {
55
55
  }
56
56
  });
57
57
  }
58
+ static getBulkResponseStatuses(id, pagination) {
59
+ var _a, _b, _c, _d;
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ try {
62
+ this.logAction(`Listing bulk responses statuses for bulk repsonse with id: ${id}.\n And pagination ${pagination !== null && pagination !== void 0 ? pagination : '{}'}`);
63
+ const axios = EdgeIQAPI.getAxios();
64
+ const result = yield axios.get(Endpoints.bulkResponseStatus, {
65
+ params: parseFilters({
66
+ bulk_response_id: {
67
+ operator: 'eq',
68
+ value: id,
69
+ },
70
+ }, pagination),
71
+ });
72
+ return {
73
+ statuses: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
74
+ pagination: {
75
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
76
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
77
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
78
+ },
79
+ };
80
+ }
81
+ catch (error) {
82
+ if (isApiError(error)) {
83
+ throw error;
84
+ }
85
+ throw error;
86
+ }
87
+ });
88
+ }
58
89
  };
@@ -32,14 +32,25 @@ export interface BulkResponseStatus {
32
32
  export interface BulkResponse extends Base {
33
33
  type: string;
34
34
  total: number;
35
+ failures: number;
36
+ successes: number;
35
37
  command_id?: string;
36
38
  bulk_response_statuses: (BulkResponseStatus | undefined)[];
37
39
  generate_child_command_executions: boolean;
38
40
  }
39
41
  export interface BulkResponsesFilters extends Filters {
42
+ total?: Filter;
43
+ failures?: Filter;
44
+ successes?: Filter;
45
+ bulk_response_id?: Filter;
40
46
  type?: Filter;
47
+ status?: Filter;
41
48
  }
42
49
  export interface PaginatedBulkResponses {
43
50
  bulkResponses: BulkResponse[];
44
51
  pagination: Pagination;
45
52
  }
53
+ export interface PaginatedBulkResponseStatuses {
54
+ statuses: BulkResponseStatus[];
55
+ pagination: Pagination;
56
+ }
@@ -56,6 +56,7 @@ export declare const getAttachMessage: (model: string, action: string, baseModel
56
56
  export declare const BaseEndpoints: {
57
57
  auth: string;
58
58
  bulkResponse: string;
59
+ bulkResponseStatus: string;
59
60
  notification: string;
60
61
  command: string;
61
62
  commandExecution: string;
@@ -108,6 +109,7 @@ export declare const Endpoints: {
108
109
  tokenResetRequest: string;
109
110
  passwordReset: string;
110
111
  bulkResponse: string;
112
+ bulkResponseStatus: string;
111
113
  notification: string;
112
114
  file: string;
113
115
  command: string;
package/dist/constants.js CHANGED
@@ -58,6 +58,7 @@ export const getAttachMessage = (model, action, baseModel) => {
58
58
  export const BaseEndpoints = {
59
59
  auth: 'user',
60
60
  bulkResponse: 'bulk_responses',
61
+ bulkResponseStatus: 'bulk_response_statuses',
61
62
  notification: 'notifications',
62
63
  command: 'commands',
63
64
  commandExecution: 'command_executions',
@@ -110,6 +111,7 @@ export const Endpoints = {
110
111
  tokenResetRequest: `${BaseEndpoints.auth}/api_token_reset`,
111
112
  passwordReset: `${BaseEndpoints.auth}/password_reset`,
112
113
  bulkResponse: `${BaseEndpoints.bulkResponse}`,
114
+ bulkResponseStatus: `${BaseEndpoints.bulkResponseStatus}`,
113
115
  notification: `${BaseEndpoints.notification}`,
114
116
  file: `${BaseEndpoints.file}`,
115
117
  command: `${BaseEndpoints.command}`,
@@ -31,7 +31,7 @@ export const parseFilters = (filters, pagination, noPagination = false) => {
31
31
  };
32
32
  const processFilter = (key, filter, result) => {
33
33
  if (filter) {
34
- if (key === 'search') {
34
+ if (key === 'search' || key === 'lazy_loading') {
35
35
  result[key] = filter.value;
36
36
  }
37
37
  else if (!Array.isArray(filter)) {
package/dist/models.d.ts CHANGED
@@ -24,6 +24,7 @@ export interface Filters {
24
24
  updated_at?: Filter;
25
25
  user_id?: Filter;
26
26
  filters?: Filter[];
27
+ lazy_loading?: Filter;
27
28
  }
28
29
  export interface Base {
29
30
  _id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",