(destinations)
- create - Create a new destination
- list - List destinations
- get - Get a destination
- update - Update a destination
- delete - Delete a destination
Create a new destination
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.destinations.create({
projectIdOrName: "<value>",
requestBody: {
name: "leadConvertedWebhook",
type: "webhook",
metadata: {
url: "https://webhooks.mailmonkey.com/salesforce-lead-converted",
headers: {
"Authorization": "Bearer 1234",
},
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { destinationsCreate } from "@amp-labs/sdk-node/funcs/destinationsCreate.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 destinationsCreate(sdk, {
projectIdOrName: "<value>",
requestBody: {
name: "leadConvertedWebhook",
type: "webhook",
metadata: {
url: "https://webhooks.mailmonkey.com/salesforce-lead-converted",
headers: {
"Authorization": "Bearer 1234",
},
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateDestinationRequest | ✔️ | 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.CreateDestinationResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.CreateDestinationInputValidationProblem | 400 | application/problem+json |
errors.CreateDestinationDestinationsInputValidationProblem | 422 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
List destinations
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.destinations.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 { destinationsList } from "@amp-labs/sdk-node/funcs/destinationsList.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 destinationsList(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.ListDestinationsRequest | ✔️ | 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.ListDestinationsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Get a destination
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.destinations.get({
projectIdOrName: "<value>",
destination: "<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 { destinationsGet } from "@amp-labs/sdk-node/funcs/destinationsGet.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 destinationsGet(sdk, {
projectIdOrName: "<value>",
destination: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetDestinationRequest | ✔️ | 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.GetDestinationResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.GetDestinationInputValidationProblem | 404 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
Update a destination
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.destinations.update({
projectIdOrName: "<value>",
destination: "<value>",
requestBody: {
updateMask: [
"name",
"metadata.url",
"metadata.headers",
],
destination: {
name: "leadConvertedWebhook",
metadata: {
url: "https://webhooks.mailmonkey.com/salesforce-lead-converted",
headers: {
"Authorization": "Bearer 1234",
},
},
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SDKCore } from "@amp-labs/sdk-node/core.js";
import { destinationsUpdate } from "@amp-labs/sdk-node/funcs/destinationsUpdate.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 destinationsUpdate(sdk, {
projectIdOrName: "<value>",
destination: "<value>",
requestBody: {
updateMask: [
"name",
"metadata.url",
"metadata.headers",
],
destination: {
name: "leadConvertedWebhook",
metadata: {
url: "https://webhooks.mailmonkey.com/salesforce-lead-converted",
headers: {
"Authorization": "Bearer 1234",
},
},
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateDestinationRequest | ✔️ | 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.UpdateDestinationResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.UpdateDestinationInputValidationProblem | 400 | application/problem+json |
errors.UpdateDestinationDestinationsInputValidationProblem | 404 | application/problem+json |
errors.UpdateDestinationDestinationsResponseInputValidationProblem | 422 | application/problem+json |
errors.APIError | 4XX, 5XX | */* |
Delete a destination
import { SDK } from "@amp-labs/sdk-node";
const sdk = new SDK({
apiKeyHeader: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.destinations.delete({
projectIdOrName: "<value>",
destination: "<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 { destinationsDelete } from "@amp-labs/sdk-node/funcs/destinationsDelete.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 destinationsDelete(sdk, {
projectIdOrName: "<value>",
destination: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteDestinationRequest | ✔️ | 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.DeleteDestinationAPIProblem>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |