4.1.3 • Published 11 months ago

@vesselapi/nodesdk v4.1.3

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

Vessel API Node SDK

The Vessel API Node SDK is a NPM library for accessing the Vessel API, a Unified CRM API that provides standardized endpoints for performing operations on common CRM Objects.

SDK Installation

NPM

npm add @vesselapi/nodesdk

Yarn

yarn add @vesselapi/nodesdk

SDK Example Usage

Example

import { VesselAPI } from "@vesselapi/nodesdk";
import { DeleteConnectionSecurity } from "@vesselapi/nodesdk/dist/sdk/models/operations";

async function run() {
    const sdk = new VesselAPI();
    const operationSecurity: DeleteConnectionSecurity = {
        vesselAPIToken: "<YOUR_API_KEY_HERE>",
    };

    const res = await sdk.connections.delete(
        {
            connectionId: "string",
        },
        operationSecurity
    );

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

Available Resources and Operations

connections

  • delete - Delete Connection
  • find - Get Connection
  • list - Get All Connections

integrations

  • list - Get CRM Integrations

webhooks

accounts

calls

contacts

deals

emails

events

attendees

  • batch - Get Batch Event Attendees
  • create - Create Event Attendee
  • details - Get Event Attendee Details
  • find - Get Event Attendee
  • list - Get All Event Attendees
  • search - Search Event Attendees
  • update - Update Event Attendee

leads

notes

passthrough

tasks

users

links

  • create - Exchange Public Token for Access Token

tokens

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.

Error ObjectStatus CodeContent Type
errors.SDKError4xx-5xx/

Example

import { VesselAPI } from "@vesselapi/nodesdk";
import { DeleteConnectionSecurity } from "@vesselapi/nodesdk/dist/sdk/models/operations";

async function run() {
    const sdk = new VesselAPI();
    const operationSecurity: DeleteConnectionSecurity = {
        vesselAPIToken: "<YOUR_API_KEY_HERE>",
    };

    let res;
    try {
        res = await sdk.connections.delete(
            {
                connectionId: "string",
            },
            operationSecurity
        );
    } catch (err) {
        if (err instanceof errors.SDKError) {
            console.error(err); // handle exception
            throw err;
        }
    }

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

Server Selection

Select Server by Index

You can override the default server globally by passing a server index to the serverIdx: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

#ServerVariables
0https://api.vessel.landNone

Example

import { VesselAPI } from "@vesselapi/nodesdk";
import { DeleteConnectionSecurity } from "@vesselapi/nodesdk/dist/sdk/models/operations";

async function run() {
    const sdk = new VesselAPI({
        serverIdx: 0,
    });
    const operationSecurity: DeleteConnectionSecurity = {
        vesselAPIToken: "<YOUR_API_KEY_HERE>",
    };

    const res = await sdk.connections.delete(
        {
            connectionId: "string",
        },
        operationSecurity
    );

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the serverURL: str optional parameter when initializing the SDK client instance. For example:

import { VesselAPI } from "@vesselapi/nodesdk";
import { DeleteConnectionSecurity } from "@vesselapi/nodesdk/dist/sdk/models/operations";

async function run() {
    const sdk = new VesselAPI({
        serverURL: "https://api.vessel.land",
    });
    const operationSecurity: DeleteConnectionSecurity = {
        vesselAPIToken: "<YOUR_API_KEY_HERE>",
    };

    const res = await sdk.connections.delete(
        {
            connectionId: "string",
        },
        operationSecurity
    );

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

Custom HTTP Client

The Typescript SDK makes API calls using the axios HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom AxiosInstance object.

For example, you could specify a header for every request that your sdk makes as follows:

import { @vesselapi/nodesdk } from "VesselAPI";
import axios from "axios";

const httpClient = axios.create({
    headers: {'x-custom-header': 'someValue'}
})

const sdk = new VesselAPI({defaultClient: httpClient});

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

NameTypeScheme
vesselAPITokenapiKeyAPI key

You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:

import { VesselAPI } from "@vesselapi/nodesdk";

async function run() {
    const sdk = new VesselAPI({
        security: {
            vesselAPIToken: "<YOUR_API_KEY_HERE>",
        },
    });

    const res = await sdk.connections.find({
        connectionId: "string",
    });

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

import { VesselAPI } from "@vesselapi/nodesdk";
import { DeleteConnectionSecurity } from "@vesselapi/nodesdk/dist/sdk/models/operations";

async function run() {
    const sdk = new VesselAPI();
    const operationSecurity: DeleteConnectionSecurity = {
        vesselAPIToken: "<YOUR_API_KEY_HERE>",
    };

    const res = await sdk.connections.delete(
        {
            connectionId: "string",
        },
        operationSecurity
    );

    if (res.statusCode == 200) {
        // handle response
    }
}

run();

SDK Generated by Speakeasy

4.1.3

11 months ago

4.1.2

11 months ago

4.1.0

12 months ago

4.1.1

12 months ago

3.43.0

1 year ago

3.36.0

1 year ago

3.36.1

1 year ago

3.35.0

1 year ago

3.54.0

1 year ago

3.50.4

1 year ago

3.50.3

1 year ago

3.50.2

1 year ago

3.50.1

1 year ago

3.50.0

1 year ago

4.0.4

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

3.47.0

1 year ago

3.40.0

1 year ago

3.44.0

1 year ago

3.37.0

1 year ago

3.55.0

1 year ago

3.51.0

1 year ago

3.48.0

1 year ago

3.41.0

1 year ago

3.41.1

1 year ago

3.45.0

1 year ago

3.38.0

1 year ago

3.33.1

1 year ago

3.52.2

1 year ago

3.52.1

1 year ago

3.52.0

1 year ago

3.49.0

1 year ago

3.49.1

1 year ago

3.42.0

1 year ago

3.42.1

1 year ago

3.46.0

1 year ago

3.35.1

1 year ago

3.39.0

1 year ago

3.39.1

1 year ago

3.34.0

1 year ago

3.53.0

1 year ago

3.46.1

1 year ago

3.33.0

1 year ago

3.32.0

1 year ago

3.31.0

1 year ago

3.20.0

2 years ago

3.22.0

2 years ago

3.24.0

1 year ago

3.19.0

2 years ago

3.26.0

1 year ago

3.28.0

1 year ago

3.26.1

1 year ago

3.21.0

2 years ago

3.23.1

1 year ago

3.23.0

2 years ago

3.30.0

1 year ago

3.25.1

1 year ago

3.25.0

1 year ago

3.27.1

1 year ago

3.27.0

1 year ago

3.29.1

1 year ago

3.29.0

1 year ago

3.29.2

1 year ago

3.15.0

2 years ago

3.17.0

2 years ago

3.15.2

2 years ago

3.15.1

2 years ago

3.17.2

2 years ago

3.17.1

2 years ago

3.17.4

2 years ago

3.17.3

2 years ago

3.2.2

2 years ago

3.14.1

2 years ago

3.14.0

2 years ago

3.16.0

2 years ago

3.14.2

2 years ago

3.14.5

2 years ago

3.18.0

2 years ago

3.14.4

2 years ago

3.5.2

2 years ago

2.2.2

2 years ago

2.2.4

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.0

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago