Files
discoursejs/docs/sdks/topics

Topics

(topics)

Overview

Available Operations

bookmarkTopic

Bookmark topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  await sdk.topics.bookmarkTopic("<value>", "<value>", "<value>");

  
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsBookmarkTopic } from "@lukehagar/discoursejs/funcs/topicsBookmarkTopic.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsBookmarkTopic(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createTopicPostPM

Creates a new topic, a new post, or a private message

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.createTopicPostPM({
    archetype: "private_message",
    raw: "<value>",
    targetRecipients: "blake,sam",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsCreateTopicPostPM } from "@lukehagar/discoursejs/funcs/topicsCreateTopicPostPM.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsCreateTopicPostPM(sdk, {
    archetype: "private_message",
    raw: "<value>",
    targetRecipients: "blake,sam",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createTopicTimer

Create topic timer

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.createTopicTimer("<value>", "<value>", "<value>", {
    time: "",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsCreateTopicTimer } from "@lukehagar/discoursejs/funcs/topicsCreateTopicTimer.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsCreateTopicTimer(sdk, "<value>", "<value>", "<value>", {
    time: "",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.CreateTopicTimerRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.CreateTopicTimerResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

getTopic

Get a single topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.getTopic("<value>", "<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsGetTopic } from "@lukehagar/discoursejs/funcs/topicsGetTopic.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsGetTopic(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetTopicResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

getTopicByExternalId

Get topic by external_id

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  await sdk.topics.getTopicByExternalId("<value>");

  
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsGetTopicByExternalId } from "@lukehagar/discoursejs/funcs/topicsGetTopicByExternalId.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsGetTopicByExternalId(sdk, "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
externalId string ✔️ 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

inviteToTopic

Invite to topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.inviteToTopic("<value>", "<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsInviteToTopic } from "@lukehagar/discoursejs/funcs/topicsInviteToTopic.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsInviteToTopic(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.InviteToTopicRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.InviteToTopicResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

listLatestTopics

Get the latest topics

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.listLatestTopics("<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsListLatestTopics } from "@lukehagar/discoursejs/funcs/topicsListLatestTopics.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsListLatestTopics(sdk, "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
ascending string Defaults to desc, add ascending=true to sort asc
order string Enum: default, created, activity, views, posts, category, likes, op_likes, posters
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.ListLatestTopicsResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

listTopTopics

Get the top topics filtered by period

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.listTopTopics("<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsListTopTopics } from "@lukehagar/discoursejs/funcs/topicsListTopTopics.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsListTopTopics(sdk, "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
period string Enum: all, yearly, quarterly, monthly, weekly, daily
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.ListTopTopicsResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

removeTopic

Remove a topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  await sdk.topics.removeTopic("<value>", "<value>", "<value>");

  
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsRemoveTopic } from "@lukehagar/discoursejs/funcs/topicsRemoveTopic.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsRemoveTopic(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

setNotificationLevel

Set notification level

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.setNotificationLevel("<value>", "<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsSetNotificationLevel } from "@lukehagar/discoursejs/funcs/topicsSetNotificationLevel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsSetNotificationLevel(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.SetNotificationLevelRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.SetNotificationLevelResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

updateTopic

Update a topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.updateTopic("<value>", "<value>", "<value>");

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsUpdateTopic } from "@lukehagar/discoursejs/funcs/topicsUpdateTopic.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsUpdateTopic(sdk, "<value>", "<value>", "<value>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpdateTopicResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

updateTopicStatus

Update the status of a topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.updateTopicStatus("<value>", "<value>", "<value>", {
    enabled: "false",
    status: "pinned_globally",
    until: "2030-12-31",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsUpdateTopicStatus } from "@lukehagar/discoursejs/funcs/topicsUpdateTopicStatus.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsUpdateTopicStatus(sdk, "<value>", "<value>", "<value>", {
    enabled: "true",
    status: "visible",
    until: "2030-12-31",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicStatusRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpdateTopicStatusResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

updateTopicTimestamp

Update topic timestamp

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.topics.updateTopicTimestamp("<value>", "<value>", "<value>", {
    timestamp: "1594291380",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { topicsUpdateTopicTimestamp } from "@lukehagar/discoursejs/funcs/topicsUpdateTopicTimestamp.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await topicsUpdateTopicTimestamp(sdk, "<value>", "<value>", "<value>", {
    timestamp: "1594291380",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicTimestampRequestBody 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpdateTopicTimestampResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /