Skip to content

Latest commit

 

History

History
162 lines (114 loc) · 11.3 KB

File metadata and controls

162 lines (114 loc) · 11.3 KB

ChannelInvites

(channelInvites)

Overview

Available Operations

list

Example Usage

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

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

async function run() {
  const result = await discord.channelInvites.list({
    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 { channelInvitesList } from "@speakeasy-sdks/discord/funcs/channelInvitesList.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 channelInvitesList(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.ListChannelInvitesRequest ✔️ 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.ResponseBody[]>

Errors

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

create

Example Usage

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

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

async function run() {
  const result = await discord.channelInvites.create({
    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 { channelInvitesCreate } from "@speakeasy-sdks/discord/funcs/channelInvitesCreate.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 channelInvitesCreate(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.CreateChannelInviteRequest ✔️ 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.CreateChannelInviteResponseBody>

Errors

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