PageSourceSearch

https://smrtbld.ai/js/api/contacts.js

js smrtbld.ai collected 2026-10-05 15:10:58 UTC 1,739 bytes, 41 lines download raw bytes

1import { ApiClient } from './base.js';
2import { suppliersApi } from './suppliers.js';
3
4const api = new ApiClient();
5
6export const contactsApi = {
7    // ========================================
8    // CONTACT-SPECIFIC METHODS
9    // ========================================
10
11    /**
12     * Get all company contacts (with optional division filter)
13     * @param {number} [divisionId]
14     * @returns {Promise<Object>} { Results: [...] }
15     */
16    getAll: (divisionId = null) => {
17        let url = 'smrtbuild/suppliers/companycontacts';
18        if (divisionId) url += `?divisionId=${divisionId}`;
19        return api.get(url);
20    },
21    /** Get contact details by ID */
22    getById: (id, options = {}) => api.get(`smrtbuild/contacts/${id}`, options),
23    /** Get all contacts for a specific supplier */
24    getBySupplierId: (supplierId, options = {}) => api.get(`smrtbuild/contacts/supplier/${supplierId}`, options),
25    /** Create a new contact */
26    create: (data) => api.post('smrtbuild/contacts', data),
27    /** Update an existing contact */
28    update: (id, data) => api.put(`smrtbuild/contacts/${id}`, data),
29    /** Archive a contact */
30    archive: (id) => api.post(`smrtbuild/contacts/${id}/archive`, {}),
31
32    // ========================================
33    // COMPANY (SUPPLIER) METHODS — delegated to suppliersApi
34    // ========================================
35
36    getCompanyById: (id, options = {}) => suppliersApi.getById(id, options),
37    createCompany: (data) => suppliersApi.create(data),
38    updateCompany: (id, data) => suppliersApi.update(id, data),
39    archiveCompany: (id) => suppliersApi.archive(id),
40    updateDefaultAssignments: (id, assignments) => suppliersApi.updateDefaultAssignments(id, assignments),
41};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.