Skip to content

Latest commit

 

History

History
363 lines (263 loc) · 24.8 KB

README.md

File metadata and controls

363 lines (263 loc) · 24.8 KB

Notes

(notes)

Overview

Notes are rich text documents that reference a single parent record.

Available Operations

list

List notes for all records or for a specific record.

Required scopes: note:read, object_configuration:read, record_permission: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.notes.list({
    limit: 10,
    offset: 5,
    parentObject: "people",
    parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  });

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

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { notesList } from "attio-js/funcs/notesList.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 notesList(attio, {
    limit: 10,
    offset: 5,
    parentObject: "people",
    parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GetV2NotesRequest ✔️ 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.GetV2NotesResponse>

Errors

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

create

Creates a new note for a given record.

Required scopes: note:read-write, object_configuration:read, record_permission: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.notes.create({
    data: {
      parentObject: "people",
      parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
      title: "Initial Prospecting Call Summary",
      format: "plaintext",
      content: "Introduction\n" +
      "Date and time of the call\n" +
      "Participants\n" +
      "Purpose of the call\n" +
      "Customer Background\n" +
      "Company overview (industry, size, location)\n" +
      "Key business challenges\n" +
      "Current software solutions (if any) and pain points",
      createdAt: "2023-01-01T15:00:00.000000000Z",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { notesCreate } from "attio-js/funcs/notesCreate.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 notesCreate(attio, {
    data: {
      parentObject: "people",
      parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
      title: "Initial Prospecting Call Summary",
      format: "plaintext",
      content: "Introduction\n" +
      "Date and time of the call\n" +
      "Participants\n" +
      "Purpose of the call\n" +
      "Customer Background\n" +
      "Company overview (industry, size, location)\n" +
      "Key business challenges\n" +
      "Current software solutions (if any) and pain points",
      createdAt: "2023-01-01T15:00:00.000000000Z",
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.PostV2NotesRequest ✔️ 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.PostV2NotesResponse>

Errors

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

get

Get a single note by ID.

Required scopes: note:read, object_configuration:read, record_permission: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.notes.get({
    noteId: "ff3f3bd4-40f4-4f80-8187-cd02385af424",
  });

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

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { notesGet } from "attio-js/funcs/notesGet.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 notesGet(attio, {
    noteId: "ff3f3bd4-40f4-4f80-8187-cd02385af424",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GetV2NotesNoteIdRequest ✔️ 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.GetV2NotesNoteIdResponse>

Errors

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

delete

Delete a single note by ID.

Required scopes: note:read-write.

Example Usage

import { Attio } from "attio-js";

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

async function run() {
  const result = await attio.notes.delete({
    noteId: "ff3f3bd4-40f4-4f80-8187-cd02385af424",
  });

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

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "attio-js/core.js";
import { notesDelete } from "attio-js/funcs/notesDelete.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 notesDelete(attio, {
    noteId: "ff3f3bd4-40f4-4f80-8187-cd02385af424",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.DeleteV2NotesNoteIdRequest ✔️ 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.DeleteV2NotesNoteIdResponse>

Errors

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