Skip to main content
REST client

Connections

The 10 operations under connections, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

Connections

Available from @codespar/sdk 0.12.0; the version on npm is 0.12.0. Every example on this page is compiled against the installed package when these docs build: a call that does not type-check fails the build.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

GET /v1/connections

GET/v1/connections

List the connections in this project

const  = await ..("/v1/connections");

Parameters, body and every documented response: GET /v1/connections in the HTTP reference.

POST /v1/connections

POST/v1/connections

Register a provider key, or rotate the one already there

const  = await ..("post", "/v1/connections", {
  : {
    : "srv_0000000000000000",
    : "string",
    : "Example",
    : "user_0000000000000000",
    : {}
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/connections in the HTTP reference.

GET /v1/connections/engine/{run_id}/status

GET/v1/connections/engine/{run_id}/status

Poll a browser-driven signup run

const  = await ..("/v1/connections/engine/{run_id}/status", {
  : {
    : "run_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/connections/engine/{run_id}/status in the HTTP reference.

POST /v1/connections/start

POST/v1/connections/start

Begin the Connect Link OAuth flow for a provider

const  = await ..("/v1/connections/start", {
  : {
    : "srv_0000000000000000",
    : "user_0000000000000000",
    : "https://example.com/hook",
    : "string"
  }
});

Parameters, body and every documented response: POST /v1/connections/start in the HTTP reference.

POST /v1/connections/subaccount/{id}/revoke

POST/v1/connections/subaccount/{id}/revoke

Revoke a provisioned subaccount and try to delete it upstream

const  = await ..("post", "/v1/connections/subaccount/{id}/revoke", {
  : {
    : "subaccount_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/connections/subaccount/{id}/revoke in the HTTP reference.

GET /v1/connections/subaccount/{id}/status

GET/v1/connections/subaccount/{id}/status

Read whether a provisioned subaccount can transact yet

const  = await ..("/v1/connections/subaccount/{id}/status", {
  : {
    : "subaccount_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/connections/subaccount/{id}/status in the HTTP reference.

GET /v1/connections/{id}

GET/v1/connections/{id}

Read one connection

const  = await ..("/v1/connections/{id}", {
  : {
    : "conn_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/connections/{id} in the HTTP reference.

DELETE /v1/connections/{id}

DELETE/v1/connections/{id}

Delete a revoked connection for good

const  = await ..("/v1/connections/{id}", {
  : {
    : "conn_0000000000000000"
  }
});

Parameters, body and every documented response: DELETE /v1/connections/{id} in the HTTP reference.

POST /v1/connections/{id}/revoke

POST/v1/connections/{id}/revoke

Revoke a connection and destroy its stored credential

const  = await ..("/v1/connections/{id}/revoke", {
  : {
    : "conn_0000000000000000"
  }
});

Parameters, body and every documented response: POST /v1/connections/{id}/revoke in the HTTP reference.

PUT /v1/connections/{id}/webhook-secret

PUT/v1/connections/{id}/webhook-secret

Seed or rotate the secret that verifies this provider's inbound webhooks

const  = await ..("/v1/connections/{id}/webhook-secret", {
  : {
    : "conn_0000000000000000"
  },
  : {
    : "string"
  }
});

Parameters, body and every documented response: PUT /v1/connections/{id}/webhook-secret in the HTTP reference.

Connections | CodeSpar