dalux-build-api 1.0.1 → 1.1.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/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "dalux-build-api",
3
- "version": "1.0.1",
4
- "description": "Node.js client for the Dalux Build API",
5
- "main": "src/index.js",
6
- "files": [
7
- "src",
8
- "README.md"
9
- ],
10
- "scripts": {
11
- "test": "jest --coverage",
12
- "build": "npm pack",
13
- "pack:check": "npm pack --dry-run",
14
- "release:check": "npm test && npm run pack:check"
15
- },
16
- "keywords": [
17
- "dalux",
18
- "build",
19
- "api",
20
- "client",
21
- "construction"
22
- ],
23
- "author": "",
24
- "license": "MIT",
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/bruadam/Dalux-Build-API.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/bruadam/Dalux-Build-API/issues"
31
- },
32
- "homepage": "https://github.com/bruadam/Dalux-Build-API#readme",
33
- "publishConfig": {
34
- "access": "public"
35
- },
36
- "dependencies": {
37
- "axios": "^1.7.7"
38
- },
39
- "devDependencies": {
40
- "axios-mock-adapter": "^2.1.0",
41
- "jest": "^29.7.0"
42
- },
43
- "jest": {
44
- "testEnvironment": "node"
45
- }
46
- }
1
+ {
2
+ "name": "dalux-build-api",
3
+ "version": "1.1.0",
4
+ "description": "Node.js client for the Dalux Build API",
5
+ "main": "src/index.js",
6
+ "files": [
7
+ "src",
8
+ "README.md"
9
+ ],
10
+ "scripts": {
11
+ "test": "jest --coverage",
12
+ "build": "npm pack",
13
+ "pack:check": "npm pack --dry-run",
14
+ "release:check": "npm test && npm run pack:check"
15
+ },
16
+ "keywords": [
17
+ "dalux",
18
+ "build",
19
+ "api",
20
+ "client",
21
+ "construction"
22
+ ],
23
+ "author": "",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/bruadam/Dalux-Build-API.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/bruadam/Dalux-Build-API/issues"
31
+ },
32
+ "homepage": "https://github.com/bruadam/Dalux-Build-API#readme",
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "axios": "^1.7.7"
38
+ },
39
+ "devDependencies": {
40
+ "axios-mock-adapter": "^2.1.0",
41
+ "jest": "^29.7.0"
42
+ },
43
+ "jest": {
44
+ "testEnvironment": "node"
45
+ }
46
+ }
@@ -1,60 +1,60 @@
1
- 'use strict';
2
-
3
- /**
4
- * API methods for managing companies on a project.
5
- */
6
- class CompaniesApi {
7
- /**
8
- * @param {import('../apiClient')} apiClient
9
- */
10
- constructor(apiClient) {
11
- this._client = apiClient;
12
- }
13
-
14
- /**
15
- * Get companies on a project.
16
- * GET /3.1/projects/{projectId}/companies
17
- * @param {string} projectId
18
- * @param {object} [params]
19
- * @returns {Promise<object>}
20
- */
21
- listProjectCompanies(projectId, params = {}) {
22
- return this._client.get(`/3.1/projects/${projectId}/companies`, params);
23
- }
24
-
25
- /**
26
- * Get a specific company on a project.
27
- * GET /3.0/projects/{projectId}/companies/{companyId}
28
- * @param {string} projectId
29
- * @param {string} companyId
30
- * @returns {Promise<object>}
31
- */
32
- getProjectCompany(projectId, companyId) {
33
- return this._client.get(`/3.0/projects/${projectId}/companies/${companyId}`);
34
- }
35
-
36
- /**
37
- * Add a company to a project.
38
- * POST /3.1/projects/{projectId}/companies
39
- * @param {string} projectId
40
- * @param {object} body
41
- * @returns {Promise<object>}
42
- */
43
- createProjectCompany(projectId, body) {
44
- return this._client.post(`/3.1/projects/${projectId}/companies`, body);
45
- }
46
-
47
- /**
48
- * Update a company on a project.
49
- * PATCH /3.0/projects/{projectId}/companies/{companyId}
50
- * @param {string} projectId
51
- * @param {string} companyId
52
- * @param {object} body
53
- * @returns {Promise<object>}
54
- */
55
- updateProjectCompany(projectId, companyId, body) {
56
- return this._client.patch(`/3.0/projects/${projectId}/companies/${companyId}`, body);
57
- }
58
- }
59
-
60
- module.exports = CompaniesApi;
1
+ 'use strict';
2
+
3
+ /**
4
+ * API methods for managing companies on a project.
5
+ */
6
+ class CompaniesApi {
7
+ /**
8
+ * @param {import('../apiClient')} apiClient
9
+ */
10
+ constructor(apiClient) {
11
+ this._client = apiClient;
12
+ }
13
+
14
+ /**
15
+ * Get companies on a project.
16
+ * GET /3.1/projects/{projectId}/companies
17
+ * @param {string} projectId
18
+ * @param {object} [params]
19
+ * @returns {Promise<object>}
20
+ */
21
+ listProjectCompanies(projectId, params = {}) {
22
+ return this._client.get(`/3.1/projects/${projectId}/companies`, params);
23
+ }
24
+
25
+ /**
26
+ * Get a specific company on a project.
27
+ * GET /3.0/projects/{projectId}/companies/{companyId}
28
+ * @param {string} projectId
29
+ * @param {string} companyId
30
+ * @returns {Promise<object>}
31
+ */
32
+ getProjectCompany(projectId, companyId) {
33
+ return this._client.get(`/3.0/projects/${projectId}/companies/${companyId}`);
34
+ }
35
+
36
+ /**
37
+ * Add a company to a project.
38
+ * POST /3.1/projects/{projectId}/companies
39
+ * @param {string} projectId
40
+ * @param {object} body
41
+ * @returns {Promise<object>}
42
+ */
43
+ createProjectCompany(projectId, body) {
44
+ return this._client.post(`/3.1/projects/${projectId}/companies`, body);
45
+ }
46
+
47
+ /**
48
+ * Update a company on a project.
49
+ * PATCH /3.0/projects/{projectId}/companies/{companyId}
50
+ * @param {string} projectId
51
+ * @param {string} companyId
52
+ * @param {object} body
53
+ * @returns {Promise<object>}
54
+ */
55
+ updateProjectCompany(projectId, companyId, body) {
56
+ return this._client.patch(`/3.0/projects/${projectId}/companies/${companyId}`, body);
57
+ }
58
+ }
59
+
60
+ module.exports = CompaniesApi;
@@ -1,108 +1,108 @@
1
- 'use strict';
2
-
3
- /**
4
- * API methods for the company catalog.
5
- */
6
- class CompanyCatalogApi {
7
- /**
8
- * @param {import('../apiClient')} apiClient
9
- */
10
- constructor(apiClient) {
11
- this._client = apiClient;
12
- }
13
-
14
- /**
15
- * Get companies registered in the company catalog.
16
- * GET /2.2/companyCatalog
17
- * @param {object} [params]
18
- * @returns {Promise<object>}
19
- */
20
- getCompanies(params = {}) {
21
- return this._client.get('/2.2/companyCatalog', params);
22
- }
23
-
24
- /**
25
- * Get a specific company from the catalog.
26
- * GET /1.2/companyCatalog/{catalogCompanyId}
27
- * @param {string} catalogCompanyId
28
- * @returns {Promise<object>}
29
- */
30
- getCompany(catalogCompanyId) {
31
- return this._client.get(`/1.2/companyCatalog/${catalogCompanyId}`);
32
- }
33
-
34
- /**
35
- * Add a company to the catalog.
36
- * POST /2.2/companyCatalog
37
- * @param {object} body
38
- * @returns {Promise<object>}
39
- */
40
- createCompany(body) {
41
- return this._client.post('/2.2/companyCatalog', body);
42
- }
43
-
44
- /**
45
- * Update a company in the catalog.
46
- * PATCH /2.1/companyCatalog/{catalogCompanyId}
47
- * @param {string} catalogCompanyId
48
- * @param {object} body
49
- * @returns {Promise<object>}
50
- */
51
- updateCompany(catalogCompanyId, body) {
52
- return this._client.patch(`/2.1/companyCatalog/${catalogCompanyId}`, body);
53
- }
54
-
55
- /**
56
- * Get metadata of a specific company from the catalog.
57
- * GET /1.0/companyCatalog/{catalogCompanyId}/metadata
58
- * @param {string} catalogCompanyId
59
- * @returns {Promise<object>}
60
- */
61
- listCompanyMetadata(catalogCompanyId) {
62
- return this._client.get(`/1.0/companyCatalog/${catalogCompanyId}/metadata`);
63
- }
64
-
65
- /**
66
- * Get all metadata available for a PATCH company-catalog operation.
67
- * GET /1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings
68
- * @param {string} catalogCompanyId
69
- * @returns {Promise<object>}
70
- */
71
- listCompanyMetadataMappings(catalogCompanyId) {
72
- return this._client.get(`/1.0/companyCatalog/${catalogCompanyId}/metadata/1.0/mappings`);
73
- }
74
-
75
- /**
76
- * Get available values for metadata in a PATCH company-catalog operation.
77
- * GET /1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings/{key}/values
78
- * @param {string} catalogCompanyId
79
- * @param {string} key
80
- * @returns {Promise<object>}
81
- */
82
- listCompanyMetadataValues(catalogCompanyId, key) {
83
- return this._client.get(
84
- `/1.0/companyCatalog/${catalogCompanyId}/metadata/1.0/mappings/${key}/values`,
85
- );
86
- }
87
-
88
- /**
89
- * Get all metadata available for a POST company-catalog operation.
90
- * GET /1.0/companyCatalog/metadata/1.0/mappings
91
- * @returns {Promise<object>}
92
- */
93
- listMetadataMappingsForCompanies() {
94
- return this._client.get('/1.0/companyCatalog/metadata/1.0/mappings');
95
- }
96
-
97
- /**
98
- * Get available values for metadata in a POST company-catalog operation.
99
- * GET /1.0/companyCatalog/metadata/1.0/mappings/{key}/values
100
- * @param {string} key
101
- * @returns {Promise<object>}
102
- */
103
- listMetadataValuesForCompanies(key) {
104
- return this._client.get(`/1.0/companyCatalog/metadata/1.0/mappings/${key}/values`);
105
- }
106
- }
107
-
108
- module.exports = CompanyCatalogApi;
1
+ 'use strict';
2
+
3
+ /**
4
+ * API methods for the company catalog.
5
+ */
6
+ class CompanyCatalogApi {
7
+ /**
8
+ * @param {import('../apiClient')} apiClient
9
+ */
10
+ constructor(apiClient) {
11
+ this._client = apiClient;
12
+ }
13
+
14
+ /**
15
+ * Get companies registered in the company catalog.
16
+ * GET /2.2/companyCatalog
17
+ * @param {object} [params]
18
+ * @returns {Promise<object>}
19
+ */
20
+ getCompanies(params = {}) {
21
+ return this._client.get('/2.2/companyCatalog', params);
22
+ }
23
+
24
+ /**
25
+ * Get a specific company from the catalog.
26
+ * GET /1.2/companyCatalog/{catalogCompanyId}
27
+ * @param {string} catalogCompanyId
28
+ * @returns {Promise<object>}
29
+ */
30
+ getCompany(catalogCompanyId) {
31
+ return this._client.get(`/1.2/companyCatalog/${catalogCompanyId}`);
32
+ }
33
+
34
+ /**
35
+ * Add a company to the catalog.
36
+ * POST /2.2/companyCatalog
37
+ * @param {object} body
38
+ * @returns {Promise<object>}
39
+ */
40
+ createCompany(body) {
41
+ return this._client.post('/2.2/companyCatalog', body);
42
+ }
43
+
44
+ /**
45
+ * Update a company in the catalog.
46
+ * PATCH /2.1/companyCatalog/{catalogCompanyId}
47
+ * @param {string} catalogCompanyId
48
+ * @param {object} body
49
+ * @returns {Promise<object>}
50
+ */
51
+ updateCompany(catalogCompanyId, body) {
52
+ return this._client.patch(`/2.1/companyCatalog/${catalogCompanyId}`, body);
53
+ }
54
+
55
+ /**
56
+ * Get metadata of a specific company from the catalog.
57
+ * GET /1.0/companyCatalog/{catalogCompanyId}/metadata
58
+ * @param {string} catalogCompanyId
59
+ * @returns {Promise<object>}
60
+ */
61
+ listCompanyMetadata(catalogCompanyId) {
62
+ return this._client.get(`/1.0/companyCatalog/${catalogCompanyId}/metadata`);
63
+ }
64
+
65
+ /**
66
+ * Get all metadata available for a PATCH company-catalog operation.
67
+ * GET /1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings
68
+ * @param {string} catalogCompanyId
69
+ * @returns {Promise<object>}
70
+ */
71
+ listCompanyMetadataMappings(catalogCompanyId) {
72
+ return this._client.get(`/1.0/companyCatalog/${catalogCompanyId}/metadata/1.0/mappings`);
73
+ }
74
+
75
+ /**
76
+ * Get available values for metadata in a PATCH company-catalog operation.
77
+ * GET /1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings/{key}/values
78
+ * @param {string} catalogCompanyId
79
+ * @param {string} key
80
+ * @returns {Promise<object>}
81
+ */
82
+ listCompanyMetadataValues(catalogCompanyId, key) {
83
+ return this._client.get(
84
+ `/1.0/companyCatalog/${catalogCompanyId}/metadata/1.0/mappings/${key}/values`,
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Get all metadata available for a POST company-catalog operation.
90
+ * GET /1.0/companyCatalog/metadata/1.0/mappings
91
+ * @returns {Promise<object>}
92
+ */
93
+ listMetadataMappingsForCompanies() {
94
+ return this._client.get('/1.0/companyCatalog/metadata/1.0/mappings');
95
+ }
96
+
97
+ /**
98
+ * Get available values for metadata in a POST company-catalog operation.
99
+ * GET /1.0/companyCatalog/metadata/1.0/mappings/{key}/values
100
+ * @param {string} key
101
+ * @returns {Promise<object>}
102
+ */
103
+ listMetadataValuesForCompanies(key) {
104
+ return this._client.get(`/1.0/companyCatalog/metadata/1.0/mappings/${key}/values`);
105
+ }
106
+ }
107
+
108
+ module.exports = CompanyCatalogApi;
@@ -1,37 +1,37 @@
1
- 'use strict';
2
-
3
- /**
4
- * API methods for file areas on a project.
5
- */
6
- class FileAreasApi {
7
- /**
8
- * @param {import('../apiClient')} apiClient
9
- */
10
- constructor(apiClient) {
11
- this._client = apiClient;
12
- }
13
-
14
- /**
15
- * Retrieve the file areas on the given project.
16
- * GET /5.1/projects/{projectId}/file_areas
17
- * @param {string} projectId
18
- * @param {object} [params]
19
- * @returns {Promise<object>}
20
- */
21
- getFileAreas(projectId, params = {}) {
22
- return this._client.get(`/5.1/projects/${projectId}/file_areas`, params);
23
- }
24
-
25
- /**
26
- * Retrieve a specific file area.
27
- * GET /1.0/projects/{projectId}/file_areas/{fileAreaId}
28
- * @param {string} projectId
29
- * @param {string} fileAreaId
30
- * @returns {Promise<object>}
31
- */
32
- getFileArea(projectId, fileAreaId) {
33
- return this._client.get(`/1.0/projects/${projectId}/file_areas/${fileAreaId}`);
34
- }
35
- }
36
-
37
- module.exports = FileAreasApi;
1
+ 'use strict';
2
+
3
+ /**
4
+ * API methods for file areas on a project.
5
+ */
6
+ class FileAreasApi {
7
+ /**
8
+ * @param {import('../apiClient')} apiClient
9
+ */
10
+ constructor(apiClient) {
11
+ this._client = apiClient;
12
+ }
13
+
14
+ /**
15
+ * Retrieve the file areas on the given project.
16
+ * GET /5.1/projects/{projectId}/file_areas
17
+ * @param {string} projectId
18
+ * @param {object} [params]
19
+ * @returns {Promise<object>}
20
+ */
21
+ getFileAreas(projectId, params = {}) {
22
+ return this._client.get(`/5.1/projects/${projectId}/file_areas`, params);
23
+ }
24
+
25
+ /**
26
+ * Retrieve a specific file area.
27
+ * GET /1.0/projects/{projectId}/file_areas/{fileAreaId}
28
+ * @param {string} projectId
29
+ * @param {string} fileAreaId
30
+ * @returns {Promise<object>}
31
+ */
32
+ getFileArea(projectId, fileAreaId) {
33
+ return this._client.get(`/1.0/projects/${projectId}/file_areas/${fileAreaId}`);
34
+ }
35
+ }
36
+
37
+ module.exports = FileAreasApi;
@@ -1,31 +1,31 @@
1
- 'use strict';
2
-
3
- /**
4
- * API methods for file revision content.
5
- */
6
- class FileRevisionsApi {
7
- /**
8
- * @param {import('../apiClient')} apiClient
9
- */
10
- constructor(apiClient) {
11
- this._client = apiClient;
12
- }
13
-
14
- /**
15
- * Retrieve content of a specific file revision.
16
- * GET /2.0/projects/{projectId}/file_areas/{fileAreaId}/files/{fileId}/revisions/{fileRevisionId}/content
17
- * @param {string} projectId
18
- * @param {string} fileAreaId
19
- * @param {string} fileId
20
- * @param {string} fileRevisionId
21
- * @returns {Promise<Buffer>} Raw binary content
22
- */
23
- getFileRevisionContent(projectId, fileAreaId, fileId, fileRevisionId) {
24
- return this._client.get(
25
- `/2.0/projects/${projectId}/file_areas/${fileAreaId}/files/${fileId}/revisions/${fileRevisionId}/content`,
26
- {},
27
- );
28
- }
29
- }
30
-
31
- module.exports = FileRevisionsApi;
1
+ 'use strict';
2
+
3
+ /**
4
+ * API methods for file revision content.
5
+ */
6
+ class FileRevisionsApi {
7
+ /**
8
+ * @param {import('../apiClient')} apiClient
9
+ */
10
+ constructor(apiClient) {
11
+ this._client = apiClient;
12
+ }
13
+
14
+ /**
15
+ * Retrieve content of a specific file revision.
16
+ * GET /2.0/projects/{projectId}/file_areas/{fileAreaId}/files/{fileId}/revisions/{fileRevisionId}/content
17
+ * @param {string} projectId
18
+ * @param {string} fileAreaId
19
+ * @param {string} fileId
20
+ * @param {string} fileRevisionId
21
+ * @returns {Promise<Buffer>} Raw binary content
22
+ */
23
+ getFileRevisionContent(projectId, fileAreaId, fileId, fileRevisionId) {
24
+ return this._client.get(
25
+ `/2.0/projects/${projectId}/file_areas/${fileAreaId}/files/${fileId}/revisions/${fileRevisionId}/content`,
26
+ {},
27
+ );
28
+ }
29
+ }
30
+
31
+ module.exports = FileRevisionsApi;