Files
discoursejs/docs/sdks/topics/README.md

83 KiB
Raw Blame History

Topics

(topics)

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();

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();

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();

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();

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();

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();

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();

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();

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();

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();

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();

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();

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();

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 /