Skip to content

Latest commit

 

History

History
150 lines (105 loc) · 17.6 KB

File metadata and controls

150 lines (105 loc) · 17.6 KB

Translations.Groups

Overview

Available Operations

  • delete - Delete a translation group
  • retrieve - Retrieve a translation group

delete

Delete an entire translation group and all its translations

Example Usage

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

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

async function run() {
  await novu.translations.groups.delete("workflow", "welcome-email");


}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { translationsGroupsDelete } from "@novu/api/funcs/translationsGroupsDelete.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 translationsGroupsDelete(novu, "workflow", "welcome-email");
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("translationsGroupsDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description Example
resourceType operations.TranslationControllerDeleteTranslationGroupEndpointPathParamResourceType ✔️ Resource type workflow
resourceId string ✔️ Resource ID welcome-email
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<void>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

retrieve

Retrieves a single translation group by resource type (workflow, layout) and resource ID (workflowId, layoutId)

Example Usage

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

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

async function run() {
  const result = await novu.translations.groups.retrieve("workflow", "welcome-email");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { translationsGroupsRetrieve } from "@novu/api/funcs/translationsGroupsRetrieve.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 translationsGroupsRetrieve(novu, "workflow", "welcome-email");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("translationsGroupsRetrieve failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description Example
resourceType operations.TranslationControllerGetTranslationGroupEndpointPathParamResourceType ✔️ Resource type workflow
resourceId string ✔️ Resource ID welcome-email
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<components.TranslationGroupDto>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*