Skip to content

Latest commit

 

History

History
256 lines (166 loc) · 30.9 KB

File metadata and controls

256 lines (166 loc) · 30.9 KB

Connections

(connections)

Available Operations

  • list - Returns a list of connections, optionally filtered by connection ID.
  • create - Adds a connection using an existing access token, along with optional OAuth or basic authentication credentials, and additional metadata or configuration.
  • get - Returns details of a specific connection identified by its connection ID, associated with the specified integration, with optional parameters for force refresh and returning the refresh token.
  • delete - Deletes a specific connection identified by its connection ID, associated with the specified integration.
  • createMetadata - Set custom metadata for the specified connection.
  • update - Update custom metadata for the specified connection.

list

Returns a list of connections

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  const result = await nango.connections.list("<value>");

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

run();

Parameters

Parameter Type Required Description
connectionId string Filter the list of connections based on this connection ID.
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.

Response

Promise<components.GetConnectionResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

create

Adds a connection for which you already have an access token

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  await nango.connections.create({});

  
}

run();

Parameters

Parameter Type Required Description
request components.CreateConnectionRequest ✔️ 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.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.Response400 400 application/json
errors.SDKError 4xx-5xx /

get

Returns a specific connection

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  await nango.connections.get("<value>", "<value>", false, false);

  
}

run();

Parameters

Parameter Type Required Description
connectionId string ✔️ The connection ID used to create the connection.
providerConfigKey string ✔️ The integration ID used to create the connection (aka Unique Key).
forceRefresh boolean If true, Nango will attempt to refresh the access access token regardless of its expiration status (false by default).
refreshToken boolean If true, return the refresh token as part of the response (false by default).
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.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.Response400 400 application/json
errors.Response404 404 application/json
errors.SDKError 4xx-5xx /

delete

Deletes a specific connection

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  await nango.connections.delete("<value>", "<value>");

  
}

run();

Parameters

Parameter Type Required Description
connectionId string ✔️ The connection ID used to create the connection.
providerConfigKey string ✔️ The integration ID used to create the connection (aka Unique Key).
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.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.Response400 400 application/json
errors.Response404 404 application/json
errors.SDKError 4xx-5xx /

createMetadata

Set custom metadata for the connection.

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  await nango.connections.createMetadata("<value>", "<value>", {});

  
}

run();

Parameters

Parameter Type Required Description
connectionId string ✔️ The connection ID used to create the connection.
providerConfigKey string ✔️ The integration ID used to create the connection (aka Unique Key).
requestBody operations.CreateMetadataRequestBody ✔️ N/A
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.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.Response400 400 application/json
errors.SDKError 4xx-5xx /

update

Update custom metadata for the connection.

Example Usage

import { Nango } from "@speakeasy-sdks/nango";

const nango = new Nango();

async function run() {
  const result = await nango.connections.update("<value>", "<value>", {});

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

run();

Parameters

Parameter Type Required Description
connectionId string ✔️ The connection ID used to create the connection.
providerConfigKey string ✔️ The integration ID used to create the connection (aka Unique Key).
requestBody operations.UpdateMetadataRequestBody ✔️ N/A
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.

Response

Promise<operations.UpdateMetadataResponseBody>

Errors

Error Object Status Code Content Type
errors.Response400 400 application/json
errors.SDKError 4xx-5xx /