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

24 KiB
Raw Blame History

Badges

(badges)

Available Operations

adminListBadges

List badges

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.badges.adminListBadges();

  // 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.AdminListBadgesResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createBadge

Create badge

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.badges.createBadge();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.CreateBadgeRequestBody ✔️ 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.CreateBadgeResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

deleteBadge

Delete badge

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  await sdk.badges.deleteBadge(32345);

  
}

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<void>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

listUserBadges

List badges for a user

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.badges.listUserBadges("<value>");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
username string ✔️ 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.ListUserBadgesResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

updateBadge

Update badge

Example Usage

import { SDK } from "@lukehagar/discoursejs";

const sdk = new SDK();

async function run() {
  const result = await sdk.badges.updateBadge(280628);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
id number ✔️ N/A
requestBody operations.UpdateBadgeRequestBody 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.UpdateBadgeResponseBody>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /