Files
discoursejs/docs/sdks/privatemessages

PrivateMessages

(privateMessages)

Available Operations

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.privateMessages.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 /

getUserSentPrivateMessages

Get a list of private messages sent for a user

Example Usage

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

const sdk = new SDK();

async function run() {
  const result = await sdk.privateMessages.getUserSentPrivateMessages("<value>");

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

run();

Parameters

Parameter Type Required Description
username 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.GetUserSentPrivateMessagesResponseBody>

Errors

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

listUserPrivateMessages

Get a list of private messages for a user

Example Usage

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

const sdk = new SDK();

async function run() {
  const result = await sdk.privateMessages.listUserPrivateMessages("<value>");

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

run();

Parameters

Parameter Type Required Description
username 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.ListUserPrivateMessagesResponseBody>

Errors

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