attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
122 lines • 5.98 kB
JavaScript
;
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Records = void 0;
const recordsAssert_js_1 = require("../funcs/recordsAssert.js");
const recordsCreate_js_1 = require("../funcs/recordsCreate.js");
const recordsDelete_js_1 = require("../funcs/recordsDelete.js");
const recordsGet_js_1 = require("../funcs/recordsGet.js");
const recordsListAttributeValues_js_1 = require("../funcs/recordsListAttributeValues.js");
const recordsListEntries_js_1 = require("../funcs/recordsListEntries.js");
const recordsPartialUpdate_js_1 = require("../funcs/recordsPartialUpdate.js");
const recordsQuery_js_1 = require("../funcs/recordsQuery.js");
const recordsUpdate_js_1 = require("../funcs/recordsUpdate.js");
const sdks_js_1 = require("../lib/sdks.js");
const fp_js_1 = require("../types/fp.js");
class Records extends sdks_js_1.ClientSDK {
/**
* List records
*
* @remarks
* Lists people, company or other records, with the option to filter and sort results.
*
* Required scopes: `record_permission:read`, `object_configuration:read`.
*/
async query(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsQuery_js_1.recordsQuery)(this, request, options));
}
/**
* Create a record
*
* @remarks
* Creates a new person, company or other record. This endpoint will throw on conflicts of unique attributes. If you would prefer to update records on conflicts, please use the [Assert record endpoint](/reference/put_v2-objects-object-records) instead.
*
* Required scopes: `record_permission:read-write`, `object_configuration:read`.
*/
async create(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsCreate_js_1.recordsCreate)(this, request, options));
}
/**
* Assert a record
*
* @remarks
* Use this endpoint to create or update people, companies and other records. A matching attribute is used to search for existing records. If a record is found with the same value for the matching attribute, that record will be updated. If no record with the same value for the matching attribute is found, a new record will be created instead. If you would like to avoid matching, please use the [Create record endpoint](/reference/post_v2-objects-object-records).
*
* If the matching attribute is a multiselect attribute, new values will be added and existing values will not be deleted. For any other multiselect attribute, all values will be either created or deleted as necessary to match the list of supplied values.
*
* Required scopes: `record_permission:read-write`, `object_configuration:read`.
*/
async assert(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsAssert_js_1.recordsAssert)(this, request, options));
}
/**
* Get a record
*
* @remarks
* Gets a single person, company or other record by its `record_id`.
*
* Required scopes: `record_permission:read`, `object_configuration:read`.
*/
async get(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsGet_js_1.recordsGet)(this, request, options));
}
/**
* Update a record (append multiselect values)
*
* @remarks
* Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the `PUT` endpoint to overwrite or remove multiselect attribute values.
*
* Required scopes: `record_permission:read-write`, `object_configuration:read`.
*/
async partialUpdate(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsPartialUpdate_js_1.recordsPartialUpdate)(this, request, options));
}
/**
* Update a record (overwrite multiselect values)
*
* @remarks
* Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to append multiselect values without removing those that already exist.
*
* Required scopes: `record_permission:read-write`, `object_configuration:read`.
*/
async update(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsUpdate_js_1.recordsUpdate)(this, request, options));
}
/**
* Delete a record
*
* @remarks
* Deletes a single record (e.g. a company or person) by ID.
*
* Required scopes: `object_configuration:read`, `record_permission:read-write`.
*/
async delete(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsDelete_js_1.recordsDelete)(this, request, options));
}
/**
* List record attribute values
*
* @remarks
* Gets all values for a given attribute on a record. If the attribute is historic, this endpoint has the ability to return all historic values using the `show_historic` query param.
*
* Required scopes: `record_permission:read`, `object_configuration:read`.
*/
async listAttributeValues(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsListAttributeValues_js_1.recordsListAttributeValues)(this, request, options));
}
/**
* List record entries
*
* @remarks
* List all entries, across all lists, for which this record is the parent.
*
* Required scopes: `record_permission:read`, `object_configuration:read`, `list_entry:read`.
*/
async listEntries(request, options) {
return (0, fp_js_1.unwrapAsync)((0, recordsListEntries_js_1.recordsListEntries)(this, request, options));
}
}
exports.Records = Records;
//# sourceMappingURL=records.js.map