Connections
The 11 operations under connections, as typed calls on the generated REST client.
Available from @codespar/sdk 0.12.0; the version on npm is 0.16.18. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.18, the version this site installs: a call that does not type-check against it 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
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
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
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
Begin the Connect Link OAuth flow for a provider
const = await ..("post", "/v1/connections/start", {
: {
: "srv_0000000000000000",
: "user_0000000000000000",
: "https://example.com/hook",
: "string"
}
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (.) {
.(.);
}Parameters, body and every documented response: POST /v1/connections/start in the HTTP reference.
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
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}
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 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.
PATCH /v1/connections/{id}/metadata
Merge user-editable metadata into a connection
const = await ..("/v1/connections/{id}/metadata", {
: {
: "conn_0000000000000000"
},
: {
: {}
}
});Parameters, body and every documented response: PATCH /v1/connections/{id}/metadata in the HTTP reference.
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
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.