Files
discoursejs/docs/sdks/admin/README.md

728 lines
56 KiB
Markdown

# Admin
(*admin*)
## Overview
### Available Operations
* [activateUser](#activateuser) - Activate a user
* [adminGetUser](#admingetuser) - Get a user by id
* [adminListUsers](#adminlistusers) - Get a list of users
* [anonymizeUser](#anonymizeuser) - Anonymize a user
* [deactivateUser](#deactivateuser) - Deactivate a user
* [deleteUser](#deleteuser) - Delete a user
* [logOutUser](#logoutuser) - Log a user out
* [refreshGravatar](#refreshgravatar) - Refresh gravatar
* [silenceUser](#silenceuser) - Silence a user
* [suspendUser](#suspenduser) - Suspend a user
## activateUser
Activate a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.activateUser(203554);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminActivateUser } from "@lukehagar/discoursejs/funcs/adminActivateUser.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 adminActivateUser(sdk, 203554);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.ActivateUserResponseBody](../../sdk/models/operations/activateuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## adminGetUser
Get a user by id
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.adminGetUser(386776);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminAdminGetUser } from "@lukehagar/discoursejs/funcs/adminAdminGetUser.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 adminAdminGetUser(sdk, 386776);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.AdminGetUserResponseBody](../../sdk/models/operations/admingetuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## adminListUsers
Get a list of users
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.adminListUsers({
flag: "new",
});
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminAdminListUsers } from "@lukehagar/discoursejs/funcs/adminAdminListUsers.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 adminAdminListUsers(sdk, {
flag: "new",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request` | [operations.AdminListUsersRequest](../../sdk/models/operations/adminlistusersrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.AdminListUsersResponseBody[]](../../models/.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## anonymizeUser
Anonymize a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.anonymizeUser(418778);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminAnonymizeUser } from "@lukehagar/discoursejs/funcs/adminAnonymizeUser.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 adminAnonymizeUser(sdk, 418778);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.AnonymizeUserResponseBody](../../sdk/models/operations/anonymizeuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## deactivateUser
Deactivate a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.deactivateUser(143950);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminDeactivateUser } from "@lukehagar/discoursejs/funcs/adminDeactivateUser.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 adminDeactivateUser(sdk, 143950);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.DeactivateUserResponseBody](../../sdk/models/operations/deactivateuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## deleteUser
Delete a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.deleteUser(251343);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminDeleteUser } from "@lukehagar/discoursejs/funcs/adminDeleteUser.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 adminDeleteUser(sdk, 251343);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `requestBody` | [operations.DeleteUserRequestBody](../../sdk/models/operations/deleteuserrequestbody.md) | :heavy_minus_sign: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.DeleteUserResponseBody](../../sdk/models/operations/deleteuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## logOutUser
Log a user out
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.logOutUser(379568);
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminLogOutUser } from "@lukehagar/discoursejs/funcs/adminLogOutUser.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 adminLogOutUser(sdk, 379568);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.LogOutUserResponseBody](../../sdk/models/operations/logoutuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## refreshGravatar
Refresh gravatar
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.refreshGravatar("Frances39");
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminRefreshGravatar } from "@lukehagar/discoursejs/funcs/adminRefreshGravatar.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 adminRefreshGravatar(sdk, "Frances39");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `username` | *string* | :heavy_check_mark: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.RefreshGravatarResponseBody](../../sdk/models/operations/refreshgravatarresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## silenceUser
Silence a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.silenceUser(606247, {
postAction: "delete",
silencedTill: "2022-06-01T08:00:00.000Z",
});
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminSilenceUser } from "@lukehagar/discoursejs/funcs/adminSilenceUser.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 adminSilenceUser(sdk, 606247, {
postAction: "delete",
silencedTill: "2022-06-01T08:00:00.000Z",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `requestBody` | [operations.SilenceUserRequestBody](../../sdk/models/operations/silenceuserrequestbody.md) | :heavy_minus_sign: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.SilenceUserResponseBody](../../sdk/models/operations/silenceuserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## suspendUser
Suspend a user
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.admin.suspendUser(970832, {
postAction: "delete",
reason: "<value>",
suspendUntil: "2121-02-22",
});
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { adminSuspendUser } from "@lukehagar/discoursejs/funcs/adminSuspendUser.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 adminSuspendUser(sdk, 970832, {
postAction: "delete",
reason: "<value>",
suspendUntil: "2121-02-22",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | *number* | :heavy_check_mark: | N/A |
| `requestBody` | [operations.SuspendUserRequestBody](../../sdk/models/operations/suspenduserrequestbody.md) | :heavy_minus_sign: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.SuspendUserResponseBody](../../sdk/models/operations/suspenduserresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |