UNPKG

attio-js

Version:

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

161 lines (110 loc) 11.4 kB
# WorkspaceMembers (*workspaceMembers*) ## Overview ### Available Operations * [list](#list) - List workspace members * [get](#get) - Get a workspace member ## list Lists all workspace members in the workspace. Required scopes: `user_management:read`. ### Example Usage ```typescript import { Attio } from "attio-js"; const attio = new Attio({ apiKey: process.env["ATTIO_API_KEY"] ?? "", }); async function run() { const result = await attio.workspaceMembers.list(); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { AttioCore } from "attio-js/core.js"; import { workspaceMembersList } from "attio-js/funcs/workspaceMembersList.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 workspaceMembersList(attio); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetV2WorkspaceMembersResponse](../../models/operations/getv2workspacemembersresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.APIError | 4XX, 5XX | \*/\* | ## get Gets a single workspace member by ID. Required scopes: `user_management:read`. ### Example Usage ```typescript import { Attio } from "attio-js"; const attio = new Attio({ apiKey: process.env["ATTIO_API_KEY"] ?? "", }); async function run() { const result = await attio.workspaceMembers.get({ workspaceMemberId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b", }); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { AttioCore } from "attio-js/core.js"; import { workspaceMembersGet } from "attio-js/funcs/workspaceMembersGet.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 workspaceMembersGet(attio, { workspaceMemberId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b", }); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetV2WorkspaceMembersWorkspaceMemberIdRequest](../../models/operations/getv2workspacemembersworkspacememberidrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetV2WorkspaceMembersWorkspaceMemberIdResponse](../../models/operations/getv2workspacemembersworkspacememberidresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | | errors.GetV2WorkspaceMembersWorkspaceMemberIdInvalidRequestError | 404 | application/json | | errors.APIError | 4XX, 5XX | \*/\* |