Skip to content

Latest commit

 

History

History
151 lines (117 loc) · 13.6 KB

File metadata and controls

151 lines (117 loc) · 13.6 KB

Content

(content)

Overview

Methods related to Content

Available Operations

  • check - Check your content against your preset styleguide.
  • correct - Apply the style guide suggestions directly to your content.

check

Check your content against your preset styleguide.

Example Usage

import { Writer } from "@writerai/writer-sdk";

const writer = new Writer({
  apiKey: "<YOUR_API_KEY_HERE>",
  organizationId: 935464,
});

async function run() {
  const contentRequest = {
    content: "<value>",
    settings: {
      ageAndFamilyStatus: false,
      confidence: false,
      contentSafeguards: false,
      disability: false,
      genderIdentitySensitivity: false,
      genderInclusiveNouns: false,
      genderInclusivePronouns: false,
      grammar: false,
      healthyCommunication: false,
      passiveVoice: false,
      raceEthnicityNationalitySensitivity: false,
      sexualOrientationSensitivity: false,
      spelling: false,
      substanceUseSensitivity: false,
      unclearReference: false,
      wordiness: false,
    },
  };
  const teamId = 38270;
  const organizationId = 919579;
  
  const result = await writer.content.check(contentRequest, teamId, organizationId);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
contentRequest shared.ContentRequest ✔️ N/A
teamId number ✔️ N/A
organizationId number N/A
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.

Response

Promise<operations.ContentCheckResponse>

Errors

Error Object Status Code Content Type
errors.FailResponse 400,401,403,404,500 application/json
errors.SDKError 4xx-5xx /

correct

Apply the style guide suggestions directly to your content.

Example Usage

import { Writer } from "@writerai/writer-sdk";

const writer = new Writer({
  apiKey: "<YOUR_API_KEY_HERE>",
  organizationId: 501355,
});

async function run() {
  const contentRequest = {
    content: "<value>",
    settings: {
      ageAndFamilyStatus: false,
      confidence: false,
      contentSafeguards: false,
      disability: false,
      genderIdentitySensitivity: false,
      genderInclusiveNouns: false,
      genderInclusivePronouns: false,
      grammar: false,
      healthyCommunication: false,
      passiveVoice: false,
      raceEthnicityNationalitySensitivity: false,
      sexualOrientationSensitivity: false,
      spelling: false,
      substanceUseSensitivity: false,
      unclearReference: false,
      wordiness: false,
    },
  };
  const teamId = 31310;
  const xRequestID = "<value>";
  const organizationId = 383223;
  
  const result = await writer.content.correct(contentRequest, teamId, xRequestID, organizationId);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
contentRequest shared.ContentRequest ✔️ N/A
teamId number ✔️ N/A
xRequestID string N/A
organizationId number N/A
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.

Response

Promise<operations.ContentCorrectResponse>

Errors

Error Object Status Code Content Type
errors.FailResponse 400,401,403,404,500 application/json
errors.SDKError 4xx-5xx /