58 KiB
Users
(users)
Available Operations
- activateUser - Activate a user
- adminGetUser - Get a user by id
- adminListUsers - Get a list of users
- anonymizeUser - Anonymize a user
- changePassword - Change password
- createUser - Creates a user
- deactivateUser - Deactivate a user
- deleteUser - Delete a user
- getUser - Get a single user by username
- getUserEmails - Get email addresses belonging to a user
- getUserExternalId - Get a user by external_id
- getUserIdentiyProviderExternalId - Get a user by identity provider external ID
- listUserActions - Get a list of user actions
- listUserBadges - List badges for a user
- listUsersPublic - Get a public list of users
- logOutUser - Log a user out
- refreshGravatar - Refresh gravatar
- sendPasswordResetEmail - Send password reset email
- silenceUser - Silence a user
- suspendUser - Suspend a user
- updateAvatar - Update avatar
- updateEmail - Update email
- updateUser - Update a user
- updateUsername - Update username
activateUser
Activate a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { ActivateUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 203554;
const res = await sdk.users.activateUser(id);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.ActivateUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
adminGetUser
Get a user by id
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { AdminGetUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 386776;
const res = await sdk.users.adminGetUser(id);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.AdminGetUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
adminListUsers
Get a list of users
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { Flag, QueryParamAsc, QueryParamOrder } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const res = await sdk.users.adminListUsers({
flag: Flag.New,
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AdminListUsersRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.AdminListUsersResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
anonymizeUser
Anonymize a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { AnonymizeUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 418778;
const res = await sdk.users.anonymizeUser(id);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.AnonymizeUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
changePassword
Change password
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { ChangePasswordRequest, ChangePasswordRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const token: string = "<value>";
const requestBody: ChangePasswordRequestBody = {
password: "Gm1zHM7WngzsMbv",
username: "Ines.Grady",
};
const res = await sdk.users.changePassword(token, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token |
string | ✔️ | N/A |
requestBody |
operations.ChangePasswordRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.ChangePasswordResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
createUser
Creates a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { CreateUserRequest, CreateUserRequestBody, ExternalIds } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const requestBody: CreateUserRequestBody = {
email: "Hailey.Effertz62@yahoo.com",
externalIds: {},
name: "<value>",
password: "Pd4wq13VrTPEl8B",
username: "Domenico_Gottlieb",
};
const res = await sdk.users.createUser(apiKey, apiUsername, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
requestBody |
operations.CreateUserRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.CreateUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
deactivateUser
Deactivate a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { DeactivateUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 143950;
const res = await sdk.users.deactivateUser(id);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.DeactivateUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
deleteUser
Delete a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { DeleteUserRequest, DeleteUserRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 251343;
const requestBody: DeleteUserRequestBody = {};
const res = await sdk.users.deleteUser(id, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.DeleteUserRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.DeleteUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
getUser
Get a single user by username
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { GetUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const username: string = "<value>";
const res = await sdk.users.getUser(apiKey, apiUsername, username);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
username |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.GetUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
getUserEmails
Get email addresses belonging to a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { GetUserEmailsRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const res = await sdk.users.getUserEmails(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.GetUserEmailsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
getUserExternalId
Get a user by external_id
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { GetUserExternalIdRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const externalId: string = "<value>";
const res = await sdk.users.getUserExternalId(apiKey, apiUsername, externalId);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
externalId |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.GetUserExternalIdResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
getUserIdentiyProviderExternalId
Get a user by identity provider external ID
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { GetUserIdentiyProviderExternalIdRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const externalId: string = "<value>";
const provider: string = "<value>";
const res = await sdk.users.getUserIdentiyProviderExternalId(apiKey, apiUsername, externalId, provider);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
externalId |
string | ✔️ | N/A |
provider |
string | ✔️ | Authentication provider name. Can be found in the provider callback URL: /auth/{provider}/callback |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.GetUserIdentiyProviderExternalIdResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
listUserActions
Get a list of user actions
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { ListUserActionsRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const filter: string = "<value>";
const offset: number = 620550;
const username: string = "<value>";
const res = await sdk.users.listUserActions(filter, offset, username);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
filter |
string | ✔️ | N/A |
offset |
number | ✔️ | N/A |
username |
string | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.ListUserActionsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
listUserBadges
List badges for a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { ListUserBadgesRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const res = await sdk.users.listUserBadges(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.ListUserBadgesResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
listUsersPublic
Get a public list of users
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { Asc, ListUsersPublicRequest, Order, Period } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const order: Order = Order.TopicCount;
const period: Period = Period.Monthly;
const asc: Asc = Asc.True;
const page: number = 772202;
const res = await sdk.users.listUsersPublic(order, period, asc, page);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
order |
operations.Order | ✔️ | N/A |
period |
operations.Period | ✔️ | N/A |
asc |
operations.Asc | ➖ | N/A |
page |
number | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.ListUsersPublicResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
logOutUser
Log a user out
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { LogOutUserRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 379568;
const res = await sdk.users.logOutUser(id);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.LogOutUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
refreshGravatar
Refresh gravatar
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { RefreshGravatarRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const res = await sdk.users.refreshGravatar(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.RefreshGravatarResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
sendPasswordResetEmail
Send password reset email
Example Usage
import { SDK } from "@lukehagar/discoursejs";
async function run() {
const sdk = new SDK();
const res = await sdk.users.sendPasswordResetEmail({
login: "Bert.Kohler48",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SendPasswordResetEmailRequestBody | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.SendPasswordResetEmailResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
silenceUser
Silence a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { SilenceUserRequest, SilenceUserRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 606247;
const requestBody: SilenceUserRequestBody = {
postAction: "delete",
silencedTill: "2022-06-01T08:00:00.000Z",
};
const res = await sdk.users.silenceUser(id, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.SilenceUserRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.SilenceUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
suspendUser
Suspend a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { SuspendUserRequest, SuspendUserRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const id: number = 970832;
const requestBody: SuspendUserRequestBody = {
postAction: "delete",
reason: "<value>",
suspendUntil: "2121-02-22",
};
const res = await sdk.users.suspendUser(id, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
number | ✔️ | N/A |
requestBody |
operations.SuspendUserRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.SuspendUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
updateAvatar
Update avatar
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { UpdateAvatarRequest, UpdateAvatarRequestBody, UpdateAvatarType } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const requestBody: UpdateAvatarRequestBody = {
type: UpdateAvatarType.Gravatar,
uploadId: 261978,
};
const res = await sdk.users.updateAvatar(username, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
string | ✔️ | N/A |
requestBody |
operations.UpdateAvatarRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.UpdateAvatarResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
updateEmail
Update email
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { UpdateEmailRequest, UpdateEmailRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const requestBody: UpdateEmailRequestBody = {
email: "Jodie.Reichel79@yahoo.com",
};
const res = await sdk.users.updateEmail(username, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
string | ✔️ | N/A |
requestBody |
operations.UpdateEmailRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.UpdateEmailResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
updateUser
Update a user
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { UpdateUserExternalIds, UpdateUserRequest, UpdateUserRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const apiKey: string = "<value>";
const apiUsername: string = "<value>";
const username: string = "<value>";
const requestBody: UpdateUserRequestBody = {
externalIds: {},
};
const res = await sdk.users.updateUser(apiKey, apiUsername, username, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | ✔️ | N/A |
apiUsername |
string | ✔️ | N/A |
username |
string | ✔️ | N/A |
requestBody |
operations.UpdateUserRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.UpdateUserResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |
updateUsername
Update username
Example Usage
import { SDK } from "@lukehagar/discoursejs";
import { UpdateUsernameRequest, UpdateUsernameRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations";
async function run() {
const sdk = new SDK();
const username: string = "<value>";
const requestBody: UpdateUsernameRequestBody = {
newUsername: "<value>",
};
const res = await sdk.users.updateUsername(username, requestBody);
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
string | ✔️ | N/A |
requestBody |
operations.UpdateUsernameRequestBody | ➖ | N/A |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Response
Promise<operations.UpdateUsernameResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4xx-5xx | / |