Skip to content

Latest commit

 

History

History
239 lines (168 loc) · 16.8 KB

README.md

File metadata and controls

239 lines (168 loc) · 16.8 KB

Channels

(channels)

Overview

Available Operations

get

Example Usage

import { Discord } from "@speakeasy-sdks/discord";

const discord = new Discord({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await discord.channels.get({
    channelId: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { DiscordCore } from "@speakeasy-sdks/discord/core.js";
import { channelsGet } from "@speakeasy-sdks/discord/funcs/channelsGet.js";

// Use `DiscordCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const discord = new DiscordCore({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await channelsGet(discord, {
    channelId: "<value>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ErrorResponse 4XX application/json
errors.SDKError 4xx-5xx /

delete

Example Usage

import { Discord } from "@speakeasy-sdks/discord";

const discord = new Discord({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await discord.channels.delete({
    channelId: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { DiscordCore } from "@speakeasy-sdks/discord/core.js";
import { channelsDelete } from "@speakeasy-sdks/discord/funcs/channelsDelete.js";

// Use `DiscordCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const discord = new DiscordCore({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await channelsDelete(discord, {
    channelId: "<value>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ErrorResponse 4XX application/json
errors.SDKError 4xx-5xx /

update

Example Usage

import { Discord } from "@speakeasy-sdks/discord";

const discord = new Discord({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await discord.channels.update({
    channelId: "<value>",
    requestBody: {},
  });

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

run();

Standalone function

The standalone function version of this method:

import { DiscordCore } from "@speakeasy-sdks/discord/core.js";
import { channelsUpdate } from "@speakeasy-sdks/discord/funcs/channelsUpdate.js";

// Use `DiscordCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const discord = new DiscordCore({
  botToken: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await channelsUpdate(discord, {
    channelId: "<value>",
    requestBody: {},
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ErrorResponse 4XX application/json
errors.SDKError 4xx-5xx /