UNPKG

attio-js

Version:

Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.

106 lines (100 loc) 3.83 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { listsCreate } from "../funcs/listsCreate.js"; import { listsGet } from "../funcs/listsGet.js"; import { listsListAll } from "../funcs/listsListAll.js"; import { listsUpdate } from "../funcs/listsUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { GetV2ListsResponse } from "../models/operations/getv2lists.js"; import { GetV2ListsListRequest, GetV2ListsListResponse, } from "../models/operations/getv2listslist.js"; import { PatchV2ListsListRequest, PatchV2ListsListResponse, } from "../models/operations/patchv2listslist.js"; import { PostV2ListsRequest, PostV2ListsResponse, } from "../models/operations/postv2lists.js"; import { unwrapAsync } from "../types/fp.js"; export class Lists extends ClientSDK { /** * List all lists * * @remarks * List all lists that your access token has access to. lists are returned in the order that they are sorted in the sidebar. * * Required scopes: `list_configuration:read`. */ async listAll( options?: RequestOptions, ): Promise<GetV2ListsResponse> { return unwrapAsync(listsListAll( this, options, )); } /** * Create a list * * @remarks * Creates a new list. * * Once you have your list, add attributes to it using the [Create attribute](/reference/post_v2-target-identifier-attributes) API, and add records to it using the [Add records to list](/reference/post_v2-lists-list-entries) API. * * New lists must specify which records can be added with the `parent_object` parameter which accepts either an object slug or an object ID. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters. * * Please note that new lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member-level access for lists. * * Required scopes: `list_configuration:read-write`. */ async create( request: PostV2ListsRequest, options?: RequestOptions, ): Promise<PostV2ListsResponse> { return unwrapAsync(listsCreate( this, request, options, )); } /** * Get a list * * @remarks * Gets a single list in your workspace that your access token has access to. * * Required scopes: `list_configuration:read`. */ async get( request: GetV2ListsListRequest, options?: RequestOptions, ): Promise<GetV2ListsListResponse> { return unwrapAsync(listsGet( this, request, options, )); } /** * Update a list * * @remarks * Updates an existing list. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters. Please note that lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member level access for lists. Changing the parent object of a list is not possible through the API as it can have unintended side-effects that should be considered carefully. If you wish to carry out a parent object change you should do so through the UI. * * Required scopes: `list_configuration:read-write`. */ async update( request: PatchV2ListsListRequest, options?: RequestOptions, ): Promise<PatchV2ListsListResponse> { return unwrapAsync(listsUpdate( this, request, options, )); } }