mirror of
https://github.com/LukeHagar/discoursejs.git
synced 2025-12-09 12:27:49 +00:00
PrivateMessages
(privateMessages)
Available Operations
- createTopicPostPM - Creates a new topic, a new post, or a private message
- getUserSentPrivateMessages - Get a list of private messages sent for a user
- listUserPrivateMessages - Get a list of private messages for a user
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.privateMessages.createTopicPostPM({
archetype: "private_message",
raw: "string",
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 | / |
getUserSentPrivateMessages
Get a list of private messages sent for a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { GetUserSentPrivateMessagesRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "string";
const res = await sdk.privateMessages.getUserSentPrivateMessages(username);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.GetUserSentPrivateMessagesResponse>
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";
import { ListUserPrivateMessagesRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "string";
const res = await sdk.privateMessages.listUserPrivateMessages(username);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.ListUserPrivateMessagesResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |