Skip to content

Latest commit

 

History

History
238 lines (184 loc) · 14.1 KB

File metadata and controls

238 lines (184 loc) · 14.1 KB

ConnectionSettings

(vault.connectionSettings)

Overview

Available Operations

  • list - Get resource settings
  • update - Update settings

list

This endpoint returns custom settings and their defaults required by connection for a given resource.

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.vault.connectionSettings.list({
    unifiedApi: "crm",
    serviceId: "pipedrive",
    resource: "leads",
  });

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

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { vaultConnectionSettingsList } from "@apideck/unify/funcs/vaultConnectionSettingsList.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await vaultConnectionSettingsList(apideck, {
    unifiedApi: "crm",
    serviceId: "pipedrive",
    resource: "leads",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

update

Update default values for a connection's resource settings

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.vault.connectionSettings.update({
    serviceId: "pipedrive",
    unifiedApi: "crm",
    resource: "leads",
    connection: {
      enabled: true,
      settings: {
        "instance_url": "https://eu28.salesforce.com",
        "api_key": "12345xxxxxx",
      },
      metadata: {
        "account": {
          "name": "My Company",
          "id": "c01458a5-7276-41ce-bc19-639906b0450a",
        },
        "plan": "enterprise",
      },
      configuration: [
        {
          resource: "leads",
          defaults: [

          ],
        },
      ],
      customMappings: [

      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { vaultConnectionSettingsUpdate } from "@apideck/unify/funcs/vaultConnectionSettingsUpdate.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await vaultConnectionSettingsUpdate(apideck, {
    serviceId: "pipedrive",
    unifiedApi: "crm",
    resource: "leads",
    connection: {
      enabled: true,
      settings: {
        "instance_url": "https://eu28.salesforce.com",
        "api_key": "12345xxxxxx",
      },
      metadata: {
        "account": {
          "name": "My Company",
          "id": "c01458a5-7276-41ce-bc19-639906b0450a",
        },
        "plan": "enterprise",
      },
      configuration: [
        {
          resource: "leads",
          defaults: [
  
          ],
        },
      ],
      customMappings: [
  
      ],
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*