Skip to content

Latest commit

 

History

History
623 lines (439 loc) · 40.7 KB

README.md

File metadata and controls

623 lines (439 loc) · 40.7 KB

Topics

(topics)

Available Operations

bookmarkTopic

Bookmark topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { BookmarkTopicRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";

  const res = await sdk.topics.bookmarkTopic(apiKey, apiUsername, id);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.BookmarkTopicResponse>

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";

async function run() {
  const sdk = new SDK();

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

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CreateTopicPostPMRequestBody ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.CreateTopicPostPMResponse>

Errors

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

createTopicTimer

Create topic timer

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { CreateTopicTimerRequest, CreateTopicTimerRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: CreateTopicTimerRequestBody = {
  time: "",
};

  const res = await sdk.topics.createTopicTimer(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.CreateTopicTimerRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.CreateTopicTimerResponse>

Errors

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

getTopic

Get a single topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { GetTopicRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";

  const res = await sdk.topics.getTopic(apiKey, apiUsername, id);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetTopicResponse>

Errors

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

getTopicByExternalId

Get topic by external_id

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { GetTopicByExternalIdRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const externalId: string = "<value>";

  const res = await sdk.topics.getTopicByExternalId(externalId);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
externalId string ✔️ N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetTopicByExternalIdResponse>

Errors

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

inviteToTopic

Invite to topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { InviteToTopicRequest, InviteToTopicRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: InviteToTopicRequestBody = {};

  const res = await sdk.topics.inviteToTopic(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.InviteToTopicRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.InviteToTopicResponse>

Errors

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

listLatestTopics

Get the latest topics

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { ListLatestTopicsRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const ascending: string = "<value>";
const order: string = "<value>";

  const res = await sdk.topics.listLatestTopics(apiKey, apiUsername, ascending, order);

  if (res.statusCode == 200) {
    // handle response
  }
}

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
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.ListLatestTopicsResponse>

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";
import { ListTopTopicsRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const period: string = "<value>";

  const res = await sdk.topics.listTopTopics(apiKey, apiUsername, period);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
period string Enum: all, yearly, quarterly, monthly, weekly, daily
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.ListTopTopicsResponse>

Errors

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

removeTopic

Remove a topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { RemoveTopicRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";

  const res = await sdk.topics.removeTopic(apiKey, apiUsername, id);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.RemoveTopicResponse>

Errors

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

setNotificationLevel

Set notification level

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { NotificationLevel, SetNotificationLevelRequest, SetNotificationLevelRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: SetNotificationLevelRequestBody = {
  notificationLevel: NotificationLevel.Two,
};

  const res = await sdk.topics.setNotificationLevel(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.SetNotificationLevelRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.SetNotificationLevelResponse>

Errors

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

updateTopic

Update a topic

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { Topic, UpdateTopicRequest, UpdateTopicRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: UpdateTopicRequestBody = {
  topic: {},
};

  const res = await sdk.topics.updateTopic(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.UpdateTopicResponse>

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";
import { Enabled, Status, UpdateTopicStatusRequest, UpdateTopicStatusRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: UpdateTopicStatusRequestBody = {
  enabled: Enabled.False,
  status: Status.PinnedGlobally,
  until: "2030-12-31",
};

  const res = await sdk.topics.updateTopicStatus(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicStatusRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.UpdateTopicStatusResponse>

Errors

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

updateTopicTimestamp

Update topic timestamp

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { UpdateTopicTimestampRequest, UpdateTopicTimestampRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const id: string = "<value>";
const requestBody: UpdateTopicTimestampRequestBody = {
  timestamp: "1594291380",
};

  const res = await sdk.topics.updateTopicTimestamp(apiKey, apiUsername, id, requestBody);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
apiKey string ✔️ N/A
apiUsername string ✔️ N/A
id string ✔️ N/A
requestBody operations.UpdateTopicTimestampRequestBody N/A
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.UpdateTopicTimestampResponse>

Errors

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