(topics)
- bookmarkTopic - Bookmark topic
- createTopicPostPM - Creates a new topic, a new post, or a private message
- createTopicTimer - Create topic timer
- getTopic - Get a single topic
- getTopicByExternalId - Get topic by external_id
- inviteToTopic - Invite to topic
- listLatestTopics - Get the latest topics
- listTopTopics - Get the top topics filtered by period
- removeTopic - Remove a topic
- setNotificationLevel - Set notification level
- updateTopic - Update a topic
- updateTopicStatus - Update the status of a topic
- updateTopicTimestamp - Update topic timestamp
Bookmark topic
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();
Parameter | Type | Required | Description |
---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
id |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.BookmarkTopicResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Creates a new topic, a new post, or a private message
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();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateTopicPostPMRequestBody | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateTopicPostPMResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Create topic timer
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();
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. |
Promise<operations.CreateTopicTimerResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get a single topic
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();
Parameter | Type | Required | Description |
---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
id |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetTopicResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get topic by external_id
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();
Parameter | Type | Required | Description |
---|---|---|---|
externalId |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetTopicByExternalIdResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Invite to topic
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();
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. |
Promise<operations.InviteToTopicResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get the latest topics
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();
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. |
Promise<operations.ListLatestTopicsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get the top topics filtered by period
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();
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. |
Promise<operations.ListTopTopicsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Remove a topic
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();
Parameter | Type | Required | Description |
---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
id |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.RemoveTopicResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Set notification level
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();
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. |
Promise<operations.SetNotificationLevelResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update a topic
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();
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. |
Promise<operations.UpdateTopicResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update the status of a topic
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();
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. |
Promise<operations.UpdateTopicStatusResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update topic timestamp
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();
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. |
Promise<operations.UpdateTopicTimestampResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |