autoinspector 2.2.0 → 2.4.0

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoinspector",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Autoinspector API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,5 +4,7 @@ export declare class Template {
4
4
  private readonly httpClient;
5
5
  constructor(httpClient: HTTPClient);
6
6
  list(input?: ITemplateListInput): Promise<ITemplate[]>;
7
+ listWithOAuth(token: string): Promise<ITemplate[]>;
8
+ preview(input?: ITemplateListInput): Promise<ITemplate[]>;
7
9
  retrieve(templateId: string): Promise<ITemplate[]>;
8
10
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Template = void 0;
13
+ const build_oauth_header_1 = require("../utils/build-oauth-header");
13
14
  class Template {
14
15
  constructor(httpClient) {
15
16
  this.httpClient = httpClient;
@@ -23,6 +24,24 @@ class Template {
23
24
  });
24
25
  });
25
26
  }
27
+ listWithOAuth(token) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return yield this.httpClient.makeRequest({
30
+ method: 'GET',
31
+ path: '/inspection/template/oauth/list/all',
32
+ headers: (0, build_oauth_header_1.buildOAuthHeader)(token),
33
+ });
34
+ });
35
+ }
36
+ preview(input = {}) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ return yield this.httpClient.makeRequest({
39
+ method: 'GET',
40
+ path: '/inspection/template/preview',
41
+ params: input,
42
+ });
43
+ });
44
+ }
26
45
  retrieve(templateId) {
27
46
  return __awaiter(this, void 0, void 0, function* () {
28
47
  return yield this.httpClient.makeRequest({
@@ -94,6 +94,12 @@ export interface IGetInspection {
94
94
  inspectionId: string;
95
95
  }
96
96
  export declare type InspectionTargets = 'product' | 'identity' | 'custom';
97
+ export interface IInspectionInput {
98
+ value?: any;
99
+ label: string;
100
+ type: ITemplateInputTypes;
101
+ identifier: string;
102
+ }
97
103
  export interface IInspectionSection {
98
104
  images: IImage[];
99
105
  extraImages: {
@@ -103,12 +109,7 @@ export interface IInspectionSection {
103
109
  _id: string;
104
110
  src: string;
105
111
  }[];
106
- inputs: {
107
- value?: any;
108
- label: string;
109
- type: ITemplateInputTypes;
110
- identifier: string;
111
- }[];
112
+ inputs: IInspectionInput[];
112
113
  }
113
114
  export interface IProduct extends IInspectionSection {
114
115
  type: InspectionType;
@@ -1,5 +1,5 @@
1
1
  import { IConsumer } from './consumer';
2
- import { IImageDamage, InspectionStatus, InspectionType, InspectionVeredict, IProduct, IValidation } from './inspection';
2
+ import { IImageDamage, IInspectionInput, InspectionStatus, InspectionType, InspectionVeredict, IProduct, IValidation } from './inspection';
3
3
  export declare type IWebhookEvents = 'inspection_started' | 'image_processed' | 'inspection_blocked' | 'inspection_completed' | 'inspection_reviewed';
4
4
  export interface IWebhookProducer {
5
5
  companyId: string;
@@ -58,9 +58,11 @@ export interface IWebhookInspectionCompleted extends IWebhookEvent<{
58
58
  products: IProduct[];
59
59
  identity: IConsumer & {
60
60
  images: IWebhookImage[];
61
+ inputs: IInspectionInput[];
61
62
  extraImages: IWebhookImage[];
62
63
  };
63
64
  custom: {
65
+ inputs: IInspectionInput[];
64
66
  images: IWebhookImage[];
65
67
  extraImages: IWebhookImage[];
66
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoinspector",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Autoinspector API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",