(connections)
- list - List connections
- generate - Generate a new connection
- get - Get a connection
- delete - Delete a connection
List connections
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.connections.list({
projectIdOrName: "<value>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { connectionsList } from "@amp-labs/sdk-node/funcs/connectionsList.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await connectionsList(sdk, {
projectIdOrName: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListConnectionsRequest | ✔️ | 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. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListConnectionsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ListConnectionsInputValidationProblem | 404 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
For providers which support OAuth2 Authorization Code, it is recommended that you use the /oauth-connect endpoint instead, unless you already have the refresh token and are importing it into Ampersand.
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.connections.generate({
projectIdOrName: "<value>",
requestBody: {
groupRef: "<value>",
consumerRef: "<value>",
provider: "<value>",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { connectionsGenerate } from "@amp-labs/sdk-node/funcs/connectionsGenerate.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await connectionsGenerate(sdk, {
projectIdOrName: "<value>",
requestBody: {
groupRef: "<value>",
consumerRef: "<value>",
provider: "<value>",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GenerateConnectionRequest | ✔️ | 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. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.GenerateConnectionResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.GenerateConnectionInputValidationProblem | 400 | application/problem+json |
errors.GenerateConnectionConnectionsInputValidationProblem | 422 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
Get a connection
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.connections.get({
projectIdOrName: "<value>",
connectionId: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { connectionsGet } from "@amp-labs/sdk-node/funcs/connectionsGet.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await connectionsGet(sdk, {
projectIdOrName: "<value>",
connectionId: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetConnectionRequest | ✔️ | 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. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.GetConnectionResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.GetConnectionInputValidationProblem | 404 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
Delete a connection
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.connections.delete({
projectIdOrName: "<value>",
connectionId: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { connectionsDelete } from "@amp-labs/sdk-node/funcs/connectionsDelete.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await connectionsDelete(sdk, {
projectIdOrName: "<value>",
connectionId: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteConnectionRequest | ✔️ | 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. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.DeleteConnectionAPIProblem>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |