(invites)
- createInvite - Create an invite
- inviteToTopic - Invite to topic
Create an invite
import { SDK } from "@lukehagar/discoursejs";
import { CreateInviteRequest, CreateInviteRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const requestBody: CreateInviteRequestBody = {
email: "not-a-user-yet@example.com",
groupIds: "42,43",
groupNames: "foo,bar",
maxRedemptionsAllowed: 5,
};
const res = await sdk.invites.createInvite(apiKey, apiUsername, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
requestBody |
operations.CreateInviteRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateInviteResponse>
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.invites.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 | / |