Skip to content

Latest commit

 

History

History
767 lines (563 loc) · 72.4 KB

README.md

File metadata and controls

767 lines (563 loc) · 72.4 KB

Endpoints

Overview

Endpoint related APIs

Available Operations

getEndpoints

This endpoint fetches an endpoints

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.getEndpoints({
    projectID: "<id>",
    nextPageCursor: "01H0JA5MEES38RRK3HTEJC647K",
    ownerId: "01H0JA5MEES38RRK3HTEJC647K",
    perPage: 20,
    prevPageCursor: "01H0JATTVCXZK8FRDX1M1JN3QY",
    q: "endpoint-1",
    sort: "ASC | DESC",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsGetEndpoints } from "convoy.js/funcs/endpoints-get-endpoints.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsGetEndpoints(convoy, {
    projectID: "<id>",
    nextPageCursor: "01H0JA5MEES38RRK3HTEJC647K",
    ownerId: "01H0JA5MEES38RRK3HTEJC647K",
    perPage: 20,
    prevPageCursor: "01H0JATTVCXZK8FRDX1M1JN3QY",
    q: "endpoint-1",
    sort: "ASC | DESC",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsGetEndpoints failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.GetEndpointsBadRequestError 400 application/json
errors.GetEndpointsUnauthorizedError 401 application/json
errors.GetEndpointsNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

createEndpoint

This endpoint creates an endpoint

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.createEndpoint("<id>", {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsCreateEndpoint } from "convoy.js/funcs/endpoints-create-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsCreateEndpoint(convoy, "<id>", {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsCreateEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
body models.ModelsCreateEndpoint ✔️ Endpoint Details
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.CreateEndpointResponse>

Errors

Error Type Status Code Content Type
errors.CreateEndpointBadRequestError 400 application/json
errors.CreateEndpointUnauthorizedError 401 application/json
errors.CreateEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

testOAuth2Connection

This endpoint tests the OAuth2 connection by attempting to exchange a token

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.testOAuth2Connection("<id>", {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsTestOAuth2Connection } from "convoy.js/funcs/endpoints-test-o-auth2-connection.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsTestOAuth2Connection(convoy, "<id>", {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsTestOAuth2Connection failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
body models.ModelsTestOAuth2Request ✔️ OAuth2 Configuration
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.TestOAuth2ConnectionResponse>

Errors

Error Type Status Code Content Type
errors.TestOAuth2ConnectionBadRequestError 400 application/json
errors.TestOAuth2ConnectionUnauthorizedError 401 application/json
errors.TestOAuth2ConnectionNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

getEndpointPeriodFailureRates

Display-only delivery rates for the given endpoint ids over a date range (default last 7 days). Independent of the list so a slow COUNT cannot delay the table.

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.getEndpointPeriodFailureRates("<id>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsGetEndpointPeriodFailureRates } from "convoy.js/funcs/endpoints-get-endpoint-period-failure-rates.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsGetEndpointPeriodFailureRates(convoy, "<id>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsGetEndpointPeriodFailureRates failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointId string[] ➖ Endpoint IDs
startDate string ➖ Start date
endDate string ➖ End date
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.GetEndpointPeriodFailureRatesResponse>

Errors

Error Type Status Code Content Type
errors.GetEndpointPeriodFailureRatesBadRequestError 400 application/json
errors.GetEndpointPeriodFailureRatesUnauthorizedError 401 application/json
errors.GetEndpointPeriodFailureRatesNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

deleteEndpoint

This endpoint deletes an endpoint

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.deleteEndpoint("<id>", "<id>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsDeleteEndpoint } from "convoy.js/funcs/endpoints-delete-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsDeleteEndpoint(convoy, "<id>", "<id>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsDeleteEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
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.DeleteEndpointResponse>

Errors

Error Type Status Code Content Type
errors.DeleteEndpointBadRequestError 400 application/json
errors.DeleteEndpointUnauthorizedError 401 application/json
errors.DeleteEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

getEndpoint

This endpoint fetches an endpoint

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.getEndpoint("<id>", "<id>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsGetEndpoint } from "convoy.js/funcs/endpoints-get-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsGetEndpoint(convoy, "<id>", "<id>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsGetEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
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.GetEndpointResponse>

Errors

Error Type Status Code Content Type
errors.GetEndpointBadRequestError 400 application/json
errors.GetEndpointUnauthorizedError 401 application/json
errors.GetEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

updateEndpoint

This endpoint updates an endpoint

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.updateEndpoint("<id>", "<id>", {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsUpdateEndpoint } from "convoy.js/funcs/endpoints-update-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsUpdateEndpoint(convoy, "<id>", "<id>", {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsUpdateEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
body models.ModelsUpdateEndpoint ✔️ Endpoint Details
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.UpdateEndpointResponse>

Errors

Error Type Status Code Content Type
errors.UpdateEndpointBadRequestError 400 application/json
errors.UpdateEndpointUnauthorizedError 401 application/json
errors.UpdateEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

activateEndpoint

Activated an inactive endpoint

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.activateEndpoint("<id>", "<id>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsActivateEndpoint } from "convoy.js/funcs/endpoints-activate-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsActivateEndpoint(convoy, "<id>", "<id>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsActivateEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
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.ActivateEndpointResponse>

Errors

Error Type Status Code Content Type
errors.ActivateEndpointBadRequestError 400 application/json
errors.ActivateEndpointUnauthorizedError 401 application/json
errors.ActivateEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

expireSecret

This endpoint expires and re-generates the endpoint secret.

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.expireSecret("<id>", "<id>", {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsExpireSecret } from "convoy.js/funcs/endpoints-expire-secret.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsExpireSecret(convoy, "<id>", "<id>", {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsExpireSecret failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
body models.ModelsExpireSecret ✔️ Expire Secret Body Parameters
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.ExpireSecretResponse>

Errors

Error Type Status Code Content Type
errors.ExpireSecretBadRequestError 400 application/json
errors.ExpireSecretUnauthorizedError 401 application/json
errors.ExpireSecretNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*

pauseEndpoint

Toggles an endpoint's status between active and paused states

Example Usage

import { Convoy } from "convoy.js";

const convoy = new Convoy({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await convoy.endpoints.pauseEndpoint("<id>", "<id>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ConvoyCore } from "convoy.js/core.js";
import { endpointsPauseEndpoint } from "convoy.js/funcs/endpoints-pause-endpoint.js";

// Use `ConvoyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const convoy = new ConvoyCore({
  apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await endpointsPauseEndpoint(convoy, "<id>", "<id>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("endpointsPauseEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
projectID string ✔️ Project ID
endpointID string ✔️ Endpoint ID
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.PauseEndpointResponse>

Errors

Error Type Status Code Content Type
errors.PauseEndpointBadRequestError 400 application/json
errors.PauseEndpointUnauthorizedError 401 application/json
errors.PauseEndpointNotFoundError 404 application/json
errors.ConvoyDefaultError 4XX, 5XX */*