attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
183 lines (173 loc) • 6.06 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { entriesAssert } from "../funcs/entriesAssert.js";
import { entriesCreate } from "../funcs/entriesCreate.js";
import { entriesDelete } from "../funcs/entriesDelete.js";
import { entriesGetEntry } from "../funcs/entriesGetEntry.js";
import { entriesOverwrite } from "../funcs/entriesOverwrite.js";
import { entriesQuery } from "../funcs/entriesQuery.js";
import { entriesUpdate } from "../funcs/entriesUpdate.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
DeleteV2ListsListEntriesEntryIdRequest,
DeleteV2ListsListEntriesEntryIdResponse,
} from "../models/operations/deletev2listslistentriesentryid.js";
import {
GetV2ListsListEntriesEntryIdRequest,
GetV2ListsListEntriesEntryIdResponse,
} from "../models/operations/getv2listslistentriesentryid.js";
import {
PatchV2ListsListEntriesEntryIdRequest,
PatchV2ListsListEntriesEntryIdResponse,
} from "../models/operations/patchv2listslistentriesentryid.js";
import {
PostV2ListsListEntriesRequest,
PostV2ListsListEntriesResponse,
} from "../models/operations/postv2listslistentries.js";
import {
PostV2ListsListEntriesQueryRequest,
PostV2ListsListEntriesQueryResponse,
} from "../models/operations/postv2listslistentriesquery.js";
import {
PutV2ListsListEntriesRequest,
PutV2ListsListEntriesResponse,
} from "../models/operations/putv2listslistentries.js";
import {
PutV2ListsListEntriesEntryIdRequest,
PutV2ListsListEntriesEntryIdResponse,
} from "../models/operations/putv2listslistentriesentryid.js";
import { unwrapAsync } from "../types/fp.js";
import { EntriesAttributes } from "./entriesattributes.js";
export class Entries extends ClientSDK {
private _attributes?: EntriesAttributes;
get attributes(): EntriesAttributes {
return (this._attributes ??= new EntriesAttributes(this._options));
}
/**
* List entries
*
* @remarks
* Lists entries in a given list, with the option to filter and sort results.
*
* Required scopes: `list_entry:read`, `list_configuration:read`.
*/
async query(
request: PostV2ListsListEntriesQueryRequest,
options?: RequestOptions,
): Promise<PostV2ListsListEntriesQueryResponse> {
return unwrapAsync(entriesQuery(
this,
request,
options,
));
}
/**
* Create an entry (add record to list)
*
* @remarks
* Adds a record to a list as a new list entry. This endpoint will throw on conflicts of unique attributes. Multiple list entries are allowed for the same parent record
*
* Required scopes: `list_entry:read-write`, `list_configuration:read`.
*/
async create(
request: PostV2ListsListEntriesRequest,
options?: RequestOptions,
): Promise<PostV2ListsListEntriesResponse> {
return unwrapAsync(entriesCreate(
this,
request,
options,
));
}
/**
* Assert a list entry by parent
*
* @remarks
* Use this endpoint to create or update a list entry for a given parent record. If an entry with the specified parent record is found, that entry will be updated. If no such entry is found, a new entry will be created instead. If there are multiple entries with the same parent record, this endpoint with return the "MULTIPLE_MATCH_RESULTS" error. When writing to multi-select attributes, all values will be either created or deleted as necessary to match the list of values supplied in the request body.
*
* Required scopes: `list_entry:read-write`, `list_configuration:read`.
*/
async assert(
request: PutV2ListsListEntriesRequest,
options?: RequestOptions,
): Promise<PutV2ListsListEntriesResponse> {
return unwrapAsync(entriesAssert(
this,
request,
options,
));
}
/**
* Get a list entry
*
* @remarks
* Gets a single list entry by its `entry_id`.
*
* Required scopes: `list_entry:read`, `list_configuration:read`.
*/
async getEntry(
request: GetV2ListsListEntriesEntryIdRequest,
options?: RequestOptions,
): Promise<GetV2ListsListEntriesEntryIdResponse> {
return unwrapAsync(entriesGetEntry(
this,
request,
options,
));
}
/**
* Update a list entry (append multiselect values)
*
* @remarks
* Use this endpoint to update list entries by `entry_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: `list_entry:read-write`, `list_configuration:read`.
*/
async update(
request: PatchV2ListsListEntriesEntryIdRequest,
options?: RequestOptions,
): Promise<PatchV2ListsListEntriesEntryIdResponse> {
return unwrapAsync(entriesUpdate(
this,
request,
options,
));
}
/**
* Update a list entry (overwrite multiselect values)
*
* @remarks
* Use this endpoint to update list entries by `entry_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 add multiselect attribute values without removing those value that already exist.
*
* Required scopes: `list_entry:read-write`, `list_configuration:read`.
*/
async overwrite(
request: PutV2ListsListEntriesEntryIdRequest,
options?: RequestOptions,
): Promise<PutV2ListsListEntriesEntryIdResponse> {
return unwrapAsync(entriesOverwrite(
this,
request,
options,
));
}
/**
* Delete a list entry
*
* @remarks
* Deletes a single list entry by its `entry_id`.
*
* Required scopes: `list_entry:read-write`, `list_configuration:read`.
*/
async delete(
request: DeleteV2ListsListEntriesEntryIdRequest,
options?: RequestOptions,
): Promise<DeleteV2ListsListEntriesEntryIdResponse> {
return unwrapAsync(entriesDelete(
this,
request,
options,
));
}
}