Skip to content

Latest commit

 

History

History
186 lines (130 loc) · 12.3 KB

README.md

File metadata and controls

186 lines (130 loc) · 12.3 KB

Threads

(threads)

Overview

Threads are groups of comments on either a record or entry.

Available Operations

  • list - List threads
  • get - Get a thread

list

List threads of comments on a record or list entry.

To view threads on records, you will need the object_configuration:read and record_permission:read scopes.

To view threads on list entries, you will need the list_configuration:read and list_entry:read scopes.

Required scopes: comment:read.

Example Usage

import { Attio } from "attio-js";

const attio = new Attio({
  apiKey: process.env["ATTIO_API_KEY"] ?? "",
});

async function run() {
  const result = await attio.threads.list({
    recordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
    object: "people",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    limit: 10,
    offset: 5,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { threadsList } from "attio-js/funcs/threadsList.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  apiKey: process.env["ATTIO_API_KEY"] ?? "",
});

async function run() {
  const res = await threadsList(attio, {
    recordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
    object: "people",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    limit: 10,
    offset: 5,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.GetV2ThreadsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetV2ThreadsResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

get

Get all comments in a thread.

To view threads on records, you will need the object_configuration:read and record_permission:read scopes.

To view threads on list entries, you will need the list_configuration:read and list_entry:read scopes.

Required scopes: comment:read.

Example Usage

import { Attio } from "attio-js";

const attio = new Attio({
  apiKey: process.env["ATTIO_API_KEY"] ?? "",
});

async function run() {
  const result = await attio.threads.get({
    threadId: "a649e4d9-435c-43fb-83ba-847b4876f27a",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { threadsGet } from "attio-js/funcs/threadsGet.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  apiKey: process.env["ATTIO_API_KEY"] ?? "",
});

async function run() {
  const res = await threadsGet(attio, {
    threadId: "a649e4d9-435c-43fb-83ba-847b4876f27a",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.GetV2ThreadsThreadIdRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetV2ThreadsThreadIdResponse>

Errors

Error Type Status Code Content Type
errors.GetV2ThreadsThreadIdNotFoundError 404 application/json
errors.APIError 4XX, 5XX */*