Skip to content

Latest commit

 

History

History
423 lines (320 loc) · 36.4 KB

File metadata and controls

423 lines (320 loc) · 36.4 KB

ChannelEndpoints

Overview

Available Operations

  • list - List all channel endpoints
  • create - Create a channel endpoint
  • retrieve - Retrieve a channel endpoint
  • update - Update a channel endpoint
  • delete - Delete a channel endpoint

list

List all channel endpoints for a resource based on query filters.

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.channelEndpoints.list({
    limit: 10,
    subscriberId: "subscriber-123",
    contextKeys: [
      "tenant:org-123",
      "region:us-east-1",
    ],
    providerId: "slack",
    integrationIdentifier: "slack-prod",
    connectionIdentifier: "slack-connection-abc123",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { channelEndpointsList } from "@novu/api/funcs/channelEndpointsList.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const res = await channelEndpointsList(novu, {
    limit: 10,
    subscriberId: "subscriber-123",
    contextKeys: [
      "tenant:org-123",
      "region:us-east-1",
    ],
    providerId: "slack",
    integrationIdentifier: "slack-prod",
    connectionIdentifier: "slack-connection-abc123",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("channelEndpointsList failed:", res.error);
  }
}

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.ErrorDto 414 application/json
errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
errors.ValidationErrorDto 422 application/json
errors.ErrorDto 500 application/json
errors.SDKError 4XX, 5XX */*

create

Create a new channel endpoint for a resource.

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.channelEndpoints.create({
    subscriberId: "subscriber-123",
    integrationIdentifier: "slack-prod",
    type: "slack_channel",
    endpoint: {
      channelId: "C123456789",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { channelEndpointsCreate } from "@novu/api/funcs/channelEndpointsCreate.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const res = await channelEndpointsCreate(novu, {
    subscriberId: "subscriber-123",
    integrationIdentifier: "slack-prod",
    type: "slack_channel",
    endpoint: {
      channelId: "C123456789",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("channelEndpointsCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
requestBody operations.ChannelEndpointsControllerCreateChannelEndpointRequestBody ✔️ Channel endpoint creation request. The structure varies based on the type field.
idempotencyKey string A header for idempotency purposes
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.ChannelEndpointsControllerCreateChannelEndpointResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 414 application/json
errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
errors.ValidationErrorDto 422 application/json
errors.ErrorDto 500 application/json
errors.SDKError 4XX, 5XX */*

retrieve

Retrieve a specific channel endpoint by its unique identifier.

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.channelEndpoints.retrieve("<value>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { channelEndpointsRetrieve } from "@novu/api/funcs/channelEndpointsRetrieve.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

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

run();

Parameters

Parameter Type Required Description
identifier string ✔️ The unique identifier of the channel endpoint
idempotencyKey string A header for idempotency purposes
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.ChannelEndpointsControllerGetChannelEndpointResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 414 application/json
errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
errors.ValidationErrorDto 422 application/json
errors.ErrorDto 500 application/json
errors.SDKError 4XX, 5XX */*

update

Update an existing channel endpoint by its unique identifier.

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.channelEndpoints.update({
    endpoint: {
      userId: "U123456789",
    },
  }, "<value>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { channelEndpointsUpdate } from "@novu/api/funcs/channelEndpointsUpdate.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const res = await channelEndpointsUpdate(novu, {
    endpoint: {
      userId: "U123456789",
    },
  }, "<value>");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("channelEndpointsUpdate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
identifier string ✔️ The unique identifier of the channel endpoint
updateChannelEndpointRequestDto components.UpdateChannelEndpointRequestDto ✔️ N/A
idempotencyKey string A header for idempotency purposes
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.ChannelEndpointsControllerUpdateChannelEndpointResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 414 application/json
errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
errors.ValidationErrorDto 422 application/json
errors.ErrorDto 500 application/json
errors.SDKError 4XX, 5XX */*

delete

Delete a specific channel endpoint by its unique identifier.

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.channelEndpoints.delete("<value>");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { channelEndpointsDelete } from "@novu/api/funcs/channelEndpointsDelete.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

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

run();

Parameters

Parameter Type Required Description
identifier string ✔️ The unique identifier of the channel endpoint
idempotencyKey string A header for idempotency purposes
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.ChannelEndpointsControllerDeleteChannelEndpointResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 414 application/json
errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
errors.ValidationErrorDto 422 application/json
errors.ErrorDto 500 application/json
errors.SDKError 4XX, 5XX */*