autoinspector 1.0.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.
Files changed (96) hide show
  1. package/.eslintrc.json +22 -0
  2. package/.prettierrc.json +7 -0
  3. package/README.md +79 -0
  4. package/build-sdk.sh +4 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +4 -0
  7. package/dist/package.json +44 -0
  8. package/dist/resources/Autoinspector.d.ts +18 -0
  9. package/dist/resources/Autoinspector.js +39 -0
  10. package/dist/resources/Goods.d.ts +33 -0
  11. package/dist/resources/Goods.js +49 -0
  12. package/dist/resources/HTTPClient.d.ts +32 -0
  13. package/dist/resources/HTTPClient.js +87 -0
  14. package/dist/resources/Helper.d.ts +4 -0
  15. package/dist/resources/Helper.js +14 -0
  16. package/dist/resources/Image.d.ts +19 -0
  17. package/dist/resources/Image.js +42 -0
  18. package/dist/resources/Inspections.d.ts +51 -0
  19. package/dist/resources/Inspections.js +69 -0
  20. package/dist/resources/Machinery.d.ts +37 -0
  21. package/dist/resources/Machinery.js +53 -0
  22. package/dist/resources/OAuth20.d.ts +37 -0
  23. package/dist/resources/OAuth20.js +52 -0
  24. package/dist/resources/OAuthUser.d.ts +36 -0
  25. package/dist/resources/OAuthUser.js +53 -0
  26. package/dist/resources/People.d.ts +31 -0
  27. package/dist/resources/People.js +47 -0
  28. package/dist/resources/Vehicle.d.ts +32 -0
  29. package/dist/resources/Vehicle.js +48 -0
  30. package/dist/test/autoinspector.spec.d.ts +0 -0
  31. package/dist/test/autoinspector.spec.js +1 -0
  32. package/dist/types/api.d.ts +12 -0
  33. package/dist/types/api.js +2 -0
  34. package/dist/types/authenticatedUser.d.ts +65 -0
  35. package/dist/types/authenticatedUser.js +2 -0
  36. package/dist/types/autoinspector.d.ts +6 -0
  37. package/dist/types/autoinspector.js +2 -0
  38. package/dist/types/colors.d.ts +1 -0
  39. package/dist/types/colors.js +2 -0
  40. package/dist/types/configuration.d.ts +27 -0
  41. package/dist/types/configuration.js +2 -0
  42. package/dist/types/consumer.d.ts +14 -0
  43. package/dist/types/consumer.js +2 -0
  44. package/dist/types/goods.d.ts +55 -0
  45. package/dist/types/goods.js +2 -0
  46. package/dist/types/http.d.ts +21 -0
  47. package/dist/types/http.js +2 -0
  48. package/dist/types/image.d.ts +14 -0
  49. package/dist/types/image.js +2 -0
  50. package/dist/types/inspection.d.ts +90 -0
  51. package/dist/types/inspection.js +2 -0
  52. package/dist/types/machinery.d.ts +64 -0
  53. package/dist/types/machinery.js +2 -0
  54. package/dist/types/oauth20.d.ts +19 -0
  55. package/dist/types/oauth20.js +2 -0
  56. package/dist/types/pagination.d.ts +20 -0
  57. package/dist/types/pagination.js +2 -0
  58. package/dist/types/people.d.ts +45 -0
  59. package/dist/types/people.js +2 -0
  60. package/dist/types/producer.d.ts +4 -0
  61. package/dist/types/producer.js +2 -0
  62. package/dist/types/productMethods.d.ts +5 -0
  63. package/dist/types/productMethods.js +2 -0
  64. package/dist/types/vehicle.d.ts +116 -0
  65. package/dist/types/vehicle.js +2 -0
  66. package/index.ts +3 -0
  67. package/package.json +44 -0
  68. package/resources/Autoinspector.ts +39 -0
  69. package/resources/Goods.ts +52 -0
  70. package/resources/HTTPClient.ts +97 -0
  71. package/resources/Helper.ts +13 -0
  72. package/resources/Image.ts +45 -0
  73. package/resources/Inspections.ts +77 -0
  74. package/resources/Machinery.ts +56 -0
  75. package/resources/OAuth20.ts +69 -0
  76. package/resources/OAuthUser.ts +62 -0
  77. package/resources/People.ts +49 -0
  78. package/resources/Vehicle.ts +51 -0
  79. package/tsconfig.json +13 -0
  80. package/types/api.ts +15 -0
  81. package/types/authenticatedUser.ts +71 -0
  82. package/types/autoinspector.ts +7 -0
  83. package/types/colors.ts +10 -0
  84. package/types/configuration.ts +28 -0
  85. package/types/consumer.ts +15 -0
  86. package/types/goods.ts +102 -0
  87. package/types/http.ts +24 -0
  88. package/types/image.ts +77 -0
  89. package/types/inspection.ts +190 -0
  90. package/types/machinery.ts +106 -0
  91. package/types/oauth20.ts +23 -0
  92. package/types/pagination.ts +22 -0
  93. package/types/people.ts +58 -0
  94. package/types/producer.ts +4 -0
  95. package/types/productMethods.ts +7 -0
  96. package/types/vehicle.ts +148 -0
@@ -0,0 +1,37 @@
1
+ import { IUpdateResourceResponse } from '../types/api';
2
+ import { ICreateInspectionOutput } from '../types/inspection';
3
+ import { ICreateMachineryInspection, IUpdateMachineryInspection } from '../types/machinery';
4
+ import { IProductMethods } from '../types/productMethods';
5
+ import { HTTPClient } from './HTTPClient';
6
+ import { Image } from './Image';
7
+ /**
8
+ * @classdesc Represents the class that handle all the requests related to an inspection of type machinery.
9
+ * @class
10
+ */
11
+ export declare class Machinery extends Image implements IProductMethods {
12
+ private readonly httpClient;
13
+ constructor(httpClient: HTTPClient);
14
+ /**
15
+ * Create an inspection of type machinery
16
+ * @param input - An object that contains the essential information for create an inspection.
17
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
18
+ * @param {Object} input.machinery - Represents the machinery to be attached to the inspection.
19
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
20
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
21
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
22
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
23
+ * data or an Error with the problem.
24
+ */
25
+ create(input: ICreateMachineryInspection): Promise<ICreateInspectionOutput>;
26
+ /**
27
+ * Update a machinery inspection.
28
+ * @param input - An object with the values to update.
29
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
30
+ * @param {String} input.productId - Represents the unique identifier of the machinery.
31
+ * @param {Object} input.machinery - Represents the machinery to be attached to the inspection.
32
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
33
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
34
+ * data or an Error with the problem.
35
+ */
36
+ update(input: IUpdateMachineryInspection): Promise<IUpdateResourceResponse>;
37
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Machinery = void 0;
4
+ const Helper_1 = require("./Helper");
5
+ const Image_1 = require("./Image");
6
+ /**
7
+ * @classdesc Represents the class that handle all the requests related to an inspection of type machinery.
8
+ * @class
9
+ */
10
+ class Machinery extends Image_1.Image {
11
+ constructor(httpClient) {
12
+ super(httpClient);
13
+ this.httpClient = httpClient;
14
+ }
15
+ /**
16
+ * Create an inspection of type machinery
17
+ * @param input - An object that contains the essential information for create an inspection.
18
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
19
+ * @param {Object} input.machinery - Represents the machinery to be attached to the inspection.
20
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
21
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
22
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
23
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
24
+ * data or an Error with the problem.
25
+ */
26
+ create(input) {
27
+ return this.httpClient.makeRequest({
28
+ method: 'POST',
29
+ path: `/inspection/machinery`,
30
+ body: input,
31
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
32
+ });
33
+ }
34
+ /**
35
+ * Update a machinery inspection.
36
+ * @param input - An object with the values to update.
37
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
38
+ * @param {String} input.productId - Represents the unique identifier of the machinery.
39
+ * @param {Object} input.machinery - Represents the machinery to be attached to the inspection.
40
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
41
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
42
+ * data or an Error with the problem.
43
+ */
44
+ update(input) {
45
+ return this.httpClient.makeRequest({
46
+ method: 'PUT',
47
+ path: `/inspection/machinery/${input.productId}`,
48
+ body: input,
49
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
50
+ });
51
+ }
52
+ }
53
+ exports.Machinery = Machinery;
@@ -0,0 +1,37 @@
1
+ import { IExchangeCodeForAccessToken, IExchangeCodeForAccessTokenOutput, IOAuth20Credentials, IRefreshAccessToken, IRefreshAccessTokenOutput } from '../types/oauth20';
2
+ import { HTTPClient } from './HTTPClient';
3
+ import { OAuthUser } from './OAuthUser';
4
+ /**
5
+ * @classdesc Represents the class that has the responsability for make the request to every endpoint about oauth.
6
+ * @class
7
+ */
8
+ export declare class OAuth20 {
9
+ private readonly httpClient;
10
+ private credentials;
11
+ user: OAuthUser;
12
+ /**
13
+ * Create OAuth20 instance to implement and execute methods in another class.
14
+ * @constructor
15
+ * @param httpClient - The httpClient that needs to be injected in the constructor. This is done by this way for inherit the http configuration from the Autoinspector constructor.
16
+ * @param credentials - An object with the neccessary credentials for interact with oauth endpoints.
17
+ * @param {String} credentials.clientappId - Represents the identification value that is generated when register an application into Autoinspector Dashboard.
18
+ * @param {String} credentials.clientSecret - Represents the token that is generated when register an application in Autoinspector Dashboard. It's an sensitive key. so it will only be exported/used in back channel.
19
+ */
20
+ constructor(httpClient: HTTPClient, credentials: Partial<IOAuth20Credentials>);
21
+ /**
22
+ * Exchange some authorization code for a valid access_token.
23
+ * @param input - An object that contains the essential information for make the trade.
24
+ * @param {String} input.code - Represents the code received from Autoinspector in callbackURL.
25
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
26
+ * data or an Error with the problem.
27
+ */
28
+ exchangeCodeForAccessToken(input: IExchangeCodeForAccessToken): Promise<IExchangeCodeForAccessTokenOutput>;
29
+ /**
30
+ * Refresh some access_token for obtain a new one. This is useful for keep a long-term access_token.
31
+ * @param input - An object that contains the essential information refresh the token.
32
+ * @param {String} input.refreshToken - Represents the refresh token received when exchanged the code for an access_token.
33
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
34
+ * data or an Error with the problem.
35
+ */
36
+ refreshAccessToken(input: IRefreshAccessToken): Promise<IRefreshAccessTokenOutput>;
37
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth20 = void 0;
4
+ const OAuthUser_1 = require("./OAuthUser");
5
+ /**
6
+ * @classdesc Represents the class that has the responsability for make the request to every endpoint about oauth.
7
+ * @class
8
+ */
9
+ class OAuth20 {
10
+ /**
11
+ * Create OAuth20 instance to implement and execute methods in another class.
12
+ * @constructor
13
+ * @param httpClient - The httpClient that needs to be injected in the constructor. This is done by this way for inherit the http configuration from the Autoinspector constructor.
14
+ * @param credentials - An object with the neccessary credentials for interact with oauth endpoints.
15
+ * @param {String} credentials.clientappId - Represents the identification value that is generated when register an application into Autoinspector Dashboard.
16
+ * @param {String} credentials.clientSecret - Represents the token that is generated when register an application in Autoinspector Dashboard. It's an sensitive key. so it will only be exported/used in back channel.
17
+ */
18
+ constructor(httpClient, credentials) {
19
+ this.httpClient = httpClient;
20
+ this.credentials = credentials;
21
+ this.user = new OAuthUser_1.OAuthUser(httpClient);
22
+ }
23
+ /**
24
+ * Exchange some authorization code for a valid access_token.
25
+ * @param input - An object that contains the essential information for make the trade.
26
+ * @param {String} input.code - Represents the code received from Autoinspector in callbackURL.
27
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
28
+ * data or an Error with the problem.
29
+ */
30
+ exchangeCodeForAccessToken(input) {
31
+ return this.httpClient.makeRequest({
32
+ method: 'POST',
33
+ path: '/account/oauth/exchange_code',
34
+ body: Object.assign(Object.assign({}, input), this.credentials),
35
+ });
36
+ }
37
+ /**
38
+ * Refresh some access_token for obtain a new one. This is useful for keep a long-term access_token.
39
+ * @param input - An object that contains the essential information refresh the token.
40
+ * @param {String} input.refreshToken - Represents the refresh token received when exchanged the code for an access_token.
41
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
42
+ * data or an Error with the problem.
43
+ */
44
+ refreshAccessToken(input) {
45
+ return this.httpClient.makeRequest({
46
+ method: 'POST',
47
+ path: '/account/oauth/refresh_token',
48
+ body: Object.assign(Object.assign({}, input), this.credentials),
49
+ });
50
+ }
51
+ }
52
+ exports.OAuth20 = OAuth20;
@@ -0,0 +1,36 @@
1
+ import { IAuthenticatedUserListInspections, IListAuthenticatedUserInspectionsOutput, IListMemberships, IListMembershipsOutput } from '../types/authenticatedUser';
2
+ import { HTTPClient } from './HTTPClient';
3
+ import { Inspections } from './Inspections';
4
+ /**
5
+ * @classdesc Represents the class that contains the methods/actions availables that somebody can do using the access_token received in the oauth 2.0 authorization code flow.
6
+ * @class
7
+ */
8
+ export declare class OAuthUser {
9
+ private readonly httpClient;
10
+ inspections: Inspections;
11
+ constructor(httpClient: HTTPClient);
12
+ /**
13
+ * List all the inspections with a couple of filters.
14
+ * @param input - An object that contains the information for make the request.
15
+ * @param {String} input.scope - Indicates if the inspections to retrieve will be where the user authenticated is the producer or where the users created by the user authenticated invite before.
16
+ * @param {String} input.accessToken - Represents the token that belongs to the authenticated user.
17
+ * @param input.params - An object that contains the filters.
18
+ * @param {String} input.params.from - Represents the base date in ISO format of the inspections to retrieve.
19
+ * @param {String} input.params.to - Represents the limit date in ISO format of the inspections to retrieve.
20
+ * @param {String} input.params.result - Represents the result that inspections to retrieve should have.
21
+ * @param {String} input.params.search - Represents a general search that will match with the consumer: identification, firstName and email.
22
+ * @param {String} input.params.status - Represents the status that inspections to retrieve should have.
23
+ * @param {Number} input.params.page - Represents the specific page that you want to retrieve the inspections.
24
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
25
+ * data or an Error with the problem.
26
+ */
27
+ listInspections(input: IAuthenticatedUserListInspections): Promise<IListAuthenticatedUserInspectionsOutput[]>;
28
+ /**
29
+ * List all the memberships accepted by the user authenticated related with companies.
30
+ * @param input - An object that contains the information for make the request.
31
+ * @param {String} input.accessToken - Represents the token that belongs to the authenticated user.
32
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
33
+ * data or an Error with the problem.
34
+ */
35
+ listMemberships(input: IListMemberships): Promise<IListMembershipsOutput>;
36
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthUser = void 0;
4
+ const Helper_1 = require("./Helper");
5
+ const Inspections_1 = require("./Inspections");
6
+ /**
7
+ * @classdesc Represents the class that contains the methods/actions availables that somebody can do using the access_token received in the oauth 2.0 authorization code flow.
8
+ * @class
9
+ */
10
+ class OAuthUser {
11
+ constructor(httpClient) {
12
+ this.httpClient = httpClient;
13
+ this.inspections = new Inspections_1.Inspections(httpClient);
14
+ }
15
+ /**
16
+ * List all the inspections with a couple of filters.
17
+ * @param input - An object that contains the information for make the request.
18
+ * @param {String} input.scope - Indicates if the inspections to retrieve will be where the user authenticated is the producer or where the users created by the user authenticated invite before.
19
+ * @param {String} input.accessToken - Represents the token that belongs to the authenticated user.
20
+ * @param input.params - An object that contains the filters.
21
+ * @param {String} input.params.from - Represents the base date in ISO format of the inspections to retrieve.
22
+ * @param {String} input.params.to - Represents the limit date in ISO format of the inspections to retrieve.
23
+ * @param {String} input.params.result - Represents the result that inspections to retrieve should have.
24
+ * @param {String} input.params.search - Represents a general search that will match with the consumer: identification, firstName and email.
25
+ * @param {String} input.params.status - Represents the status that inspections to retrieve should have.
26
+ * @param {Number} input.params.page - Represents the specific page that you want to retrieve the inspections.
27
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
28
+ * data or an Error with the problem.
29
+ */
30
+ listInspections(input) {
31
+ return this.httpClient.makeRequest({
32
+ method: 'GET',
33
+ path: `/inspection/${input.scope}?membershipId=${input.membershipId}`,
34
+ params: input.params,
35
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
36
+ });
37
+ }
38
+ /**
39
+ * List all the memberships accepted by the user authenticated related with companies.
40
+ * @param input - An object that contains the information for make the request.
41
+ * @param {String} input.accessToken - Represents the token that belongs to the authenticated user.
42
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
43
+ * data or an Error with the problem.
44
+ */
45
+ listMemberships(input) {
46
+ return this.httpClient.makeRequest({
47
+ method: 'GET',
48
+ path: `/account/membership/authenticated`,
49
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
50
+ });
51
+ }
52
+ }
53
+ exports.OAuthUser = OAuthUser;
@@ -0,0 +1,31 @@
1
+ import { IUpdateResourceResponse } from '../types/api';
2
+ import { ICreateInspectionOutput } from '../types/inspection';
3
+ import { ICreatePeopleInspection, IUpdatePeopleInspection } from '../types/people';
4
+ import { IProductMethods } from '../types/productMethods';
5
+ import { HTTPClient } from './HTTPClient';
6
+ import { Image } from './Image';
7
+ export declare class People extends Image implements IProductMethods {
8
+ private readonly httpClient;
9
+ constructor(httpClient: HTTPClient);
10
+ /**
11
+ * Create an inspection of type people
12
+ * @param input - An object that contains the essential information for create an inspection.
13
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
14
+ * @param {Object} input.people - Represents the people to be attached to the inspection.
15
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
16
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
17
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
18
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
19
+ * data or an Error with the problem.
20
+ */
21
+ create(input: ICreatePeopleInspection): Promise<ICreateInspectionOutput>;
22
+ /**
23
+ * Update an inspection of type people
24
+ * @param input - An object that contains the essential information for create an inspection.
25
+ * @param {Object} input.consumer - Represents the user who do the inspection.
26
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
27
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
28
+ * data or an Error with the problem.
29
+ */
30
+ update(input: IUpdatePeopleInspection): Promise<IUpdateResourceResponse>;
31
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.People = void 0;
4
+ const Helper_1 = require("./Helper");
5
+ const Image_1 = require("./Image");
6
+ class People extends Image_1.Image {
7
+ constructor(httpClient) {
8
+ super(httpClient);
9
+ this.httpClient = httpClient;
10
+ }
11
+ /**
12
+ * Create an inspection of type people
13
+ * @param input - An object that contains the essential information for create an inspection.
14
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
15
+ * @param {Object} input.people - Represents the people to be attached to the inspection.
16
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
17
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
18
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
19
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
20
+ * data or an Error with the problem.
21
+ */
22
+ create(input) {
23
+ return this.httpClient.makeRequest({
24
+ method: 'POST',
25
+ path: `/inspection/people`,
26
+ body: input,
27
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
28
+ });
29
+ }
30
+ /**
31
+ * Update an inspection of type people
32
+ * @param input - An object that contains the essential information for create an inspection.
33
+ * @param {Object} input.consumer - Represents the user who do the inspection.
34
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
35
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
36
+ * data or an Error with the problem.
37
+ */
38
+ update(input) {
39
+ return this.httpClient.makeRequest({
40
+ method: 'PUT',
41
+ path: `/inspection/people/${input.productId}`,
42
+ body: input,
43
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
44
+ });
45
+ }
46
+ }
47
+ exports.People = People;
@@ -0,0 +1,32 @@
1
+ import { IUpdateResourceResponse } from '../types/api';
2
+ import { ICreateInspectionOutput } from '../types/inspection';
3
+ import { IProductMethods } from '../types/productMethods';
4
+ import { ICreateVehicleInspection, IUpdateVehicleInspection } from '../types/vehicle';
5
+ import { HTTPClient } from './HTTPClient';
6
+ import { Image } from './Image';
7
+ export declare class Vehicle extends Image implements IProductMethods {
8
+ private readonly httpClient;
9
+ constructor(httpClient: HTTPClient);
10
+ /**
11
+ * Create an inspection of type vehicle
12
+ * @param input - An object that contains the essential information for create an inspection.
13
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
14
+ * @param {Object} input.vehicle - Represents the vehicle to be attached to the inspection.
15
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
16
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
17
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
18
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
19
+ * data or an Error with the problem.
20
+ */
21
+ create(input: ICreateVehicleInspection): Promise<ICreateInspectionOutput>;
22
+ /**
23
+ * Update an inspection of type vehicle.
24
+ * @param input - An object that contains the essential information for create an inspection.
25
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
26
+ * @param {Object} input.vehicle - Represents the vehicle to be attached to the inspection.
27
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
28
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
29
+ * data or an Error with the problem.
30
+ */
31
+ update(input: IUpdateVehicleInspection): Promise<IUpdateResourceResponse>;
32
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Vehicle = void 0;
4
+ const Helper_1 = require("./Helper");
5
+ const Image_1 = require("./Image");
6
+ class Vehicle extends Image_1.Image {
7
+ constructor(httpClient) {
8
+ super(httpClient);
9
+ this.httpClient = httpClient;
10
+ }
11
+ /**
12
+ * Create an inspection of type vehicle
13
+ * @param input - An object that contains the essential information for create an inspection.
14
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
15
+ * @param {Object} input.vehicle - Represents the vehicle to be attached to the inspection.
16
+ * @param {String} input.mode - Represents the mode of the inspection. See more details: {@link https://www.autoinspector.com.ar/docs/api/start#inspection_mode}
17
+ * @param {String} input.kindOf - Represents the template that inspection will have. This only matters if the input.mode is normal.
18
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
19
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
20
+ * data or an Error with the problem.
21
+ */
22
+ create(input) {
23
+ return this.httpClient.makeRequest({
24
+ method: 'POST',
25
+ path: `/inspection/vehicle`,
26
+ body: input,
27
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
28
+ });
29
+ }
30
+ /**
31
+ * Update an inspection of type vehicle.
32
+ * @param input - An object that contains the essential information for create an inspection.
33
+ * @param {Object} input.consumer - Represents the consumer who will do the inspection.
34
+ * @param {Object} input.vehicle - Represents the vehicle to be attached to the inspection.
35
+ * @param {Object} input.metadata - Represents a dinamic object where you can store any key-value pairs.
36
+ * @return {Promise} - Returns a Promise that, when fulfilled, will either return an JSON Object with the requested
37
+ * data or an Error with the problem.
38
+ */
39
+ update(input) {
40
+ return this.httpClient.makeRequest({
41
+ method: 'PUT',
42
+ path: `/inspection/vehicle/${input.productId}`,
43
+ body: input,
44
+ headers: Helper_1.Helper.buildOptionalHeaders(input.accessToken),
45
+ });
46
+ }
47
+ }
48
+ exports.Vehicle = Vehicle;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,12 @@
1
+ export interface IAPISucessResponse {
2
+ message: string;
3
+ }
4
+ export interface IAutoinspectorError {
5
+ code: string;
6
+ status: number;
7
+ detail: string;
8
+ }
9
+ export declare type APIMethods = 'POST' | 'GET' | 'PUT' | 'DELETE';
10
+ export interface IUpdateResourceResponse {
11
+ message: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,65 @@
1
+ import { InspectionStatus, InspectionVeredict } from './inspection';
2
+ export interface IListInspections {
3
+ from: Date;
4
+ to: Date;
5
+ veredict: InspectionVeredict;
6
+ search: string;
7
+ status: InspectionStatus;
8
+ page: number;
9
+ }
10
+ export interface IAuthenticatedUserCommonParams {
11
+ accessToken: string;
12
+ }
13
+ export interface IAuthenticatedUserListInspections extends IAuthenticatedUserCommonParams {
14
+ scope: 'all' | 'mine';
15
+ params: IListInspections;
16
+ membershipId: string;
17
+ }
18
+ export interface IPaginationOutput {
19
+ hasNextPage: boolean;
20
+ hasPrevPage: boolean;
21
+ limit: number;
22
+ nextPage?: number;
23
+ page: number;
24
+ pagingCounter: number;
25
+ prevPage?: number;
26
+ totalDocs: number;
27
+ totalPages: number;
28
+ }
29
+ export interface IInspectionItemOutput {
30
+ accessCode: string;
31
+ consumer: {
32
+ firstName: string;
33
+ identification: string;
34
+ lastName: string;
35
+ };
36
+ createdAt: string;
37
+ id: string;
38
+ producer: {
39
+ companyId: string;
40
+ user: {
41
+ _id: string;
42
+ username: string;
43
+ };
44
+ userId: string;
45
+ };
46
+ status: string;
47
+ type: string;
48
+ _id: string;
49
+ }
50
+ export interface IListAuthenticatedUserInspectionsOutput {
51
+ pagination: IPaginationOutput;
52
+ inspection: IInspectionItemOutput[];
53
+ }
54
+ export interface IListMemberships extends IAuthenticatedUserCommonParams {
55
+ }
56
+ export interface ICompany {
57
+ logo: string;
58
+ societyReason: string;
59
+ }
60
+ export interface IMembershipItem {
61
+ role: string;
62
+ company: ICompany;
63
+ _id: string;
64
+ }
65
+ export declare type IListMembershipsOutput = IMembershipItem[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { IOAuth20Credentials } from './oauth20';
2
+ export interface IAutoinspector {
3
+ apikey: string;
4
+ timeout?: number;
5
+ oauthCredentials?: IOAuth20Credentials;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare type Colors = 'yellow' | 'blue' | 'white' | 'gold' | 'grey' | 'orange' | 'black' | 'red' | 'green';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ export interface IConfigurationCommonValidations {
2
+ /**
3
+ * Date: Validation that verifies the image/photo taken is between an range of time defined by Autoinspector.
4
+ */
5
+ date: IConfiguration;
6
+ /**
7
+ * Distance: Validation that verifies the distance between each photo taken is not more than certain threshold.
8
+ */
9
+ distance: IConfiguration;
10
+ /**
11
+ * Recaptured: Validation that verifies the image taken is not recaptured or fake.
12
+ */
13
+ recaptured: IConfiguration;
14
+ }
15
+ /**
16
+ * Represents the object that indicates if some validation has to run and if its required for approve the image.
17
+ */
18
+ export interface IConfiguration {
19
+ /**
20
+ * required: `Set the validation as required for approve the image. That means, if some validation has the required setted and it was not approved, the image will be disapproved.`
21
+ */
22
+ required: boolean;
23
+ /**
24
+ * required: `Set the validation to be considered at the moment of run the validations. You can have some validation not required but yes for run.`
25
+ */
26
+ run: boolean;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ export declare type Sex = 0 | 1 | 2 | 9;
2
+ export interface IConsumer {
3
+ firstName: string;
4
+ lastName: string;
5
+ identification: string;
6
+ email: string;
7
+ birthdate?: string;
8
+ sex?: Sex;
9
+ phone?: string;
10
+ state?: string;
11
+ country?: string;
12
+ city?: string;
13
+ address?: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });