47 KiB
Groups
(groups)
Overview
Available Operations
- addGroupMembers - Add group members
- createGroup - Create a group
- deleteGroup - Delete a group
- getGroup - Get a group
- listGroupMembers - List group members
- listGroups - List groups
- removeGroupMembers - Remove group members
- updateGroup - Update a group
addGroupMembers
Add group members
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.addGroupMembers(985975, {
usernames: "username1,username2",
});
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsAddGroupMembers } from "@lukehagar/discoursejs/funcs/groupsAddGroupMembers.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsAddGroupMembers(sdk, 985975, {
usernames: "username1,username2",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.AddGroupMembersRequestBody | ➖ | 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.AddGroupMembersResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
createGroup
Create a group
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.createGroup();
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsCreateGroup } from "@lukehagar/discoursejs/funcs/groupsCreateGroup.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsCreateGroup(sdk);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateGroupRequestBody | ✔️ | 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.CreateGroupResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
deleteGroup
Delete a group
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.deleteGroup(21302);
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsDeleteGroup } from "@lukehagar/discoursejs/funcs/groupsDeleteGroup.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsDeleteGroup(sdk, 21302);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | 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.DeleteGroupResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
getGroup
Get a group
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.getGroup("name");
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsGetGroup } from "@lukehagar/discoursejs/funcs/groupsGetGroup.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsGetGroup(sdk, "name");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
string | ✔️ | Use group name instead of id | [object Object] |
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.GetGroupResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
listGroupMembers
List group members
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.listGroupMembers("name");
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsListGroupMembers } from "@lukehagar/discoursejs/funcs/groupsListGroupMembers.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsListGroupMembers(sdk, "name");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
string | ✔️ | Use group name instead of id | [object Object] |
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.ListGroupMembersResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
listGroups
List groups
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.listGroups();
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsListGroups } from "@lukehagar/discoursejs/funcs/groupsListGroups.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsListGroups(sdk);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.ListGroupsResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
removeGroupMembers
Remove group members
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.removeGroupMembers(649523, {
usernames: "username1,username2",
});
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsRemoveGroupMembers } from "@lukehagar/discoursejs/funcs/groupsRemoveGroupMembers.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsRemoveGroupMembers(sdk, 649523, {
usernames: "username1,username2",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.RemoveGroupMembersRequestBody | ➖ | 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.RemoveGroupMembersResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
updateGroup
Update a group
Example Usage
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.groups.updateGroup(438471);
// Handle the result
console.log(result)
}
run();
Standalone function
The standalone function version of this method:
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { groupsUpdateGroup } from "@lukehagar/discoursejs/funcs/groupsUpdateGroup.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await groupsUpdateGroup(sdk, 438471);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.UpdateGroupRequestBody | ➖ | 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.UpdateGroupResponseBody>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |