Skip to main content
Module

x/tpy/mod.ts>default

🔑 A strongly typed Pylon API client.
Go to Latest
class default
import { default } from "https://deno.land/x/tpy@v1.0.0-pre-release-8/mod.ts";

The central entity for interacting with the Pylon API; the entrypoint.

Constructors

new
default(token: string, deploymentID?: StringifiedNumber)

Properties

private
readonly
token: string
readonly
optional
deploymentID: StringifiedNumber

A default deployment ID used to occupy deploymentID parameter entries.

Methods

connectSocket(deploymentID: StringifiedNumber)

Connects to the Pylon workbench WebSocket.

Gets all the guilds the user is in.

getDeployment(deploymentID?: StringifiedNumber)

Gets the deployment information.

getDeploymentIDfromGuild(guildID: StringifiedNumber)

Gets the most recent deployment ID from a guildID.

Gets all guilds a user can edit with Pylon. More specifically, all guilds which the user has manage server or administrator permissions in.

getGuildInfo(guildID: StringifiedNumber)

Gets the raw Discord guild information with deployment information.

getGuildStats(guildID: StringifiedNumber)

Gets the guild computational statistics.

getNamespaceItems<T>(namespace: string, deploymentID?: StringifiedNumber): Promise<KV.GET.ItemsFlattened<T> | undefined>

Gets all the namespace items under the given deployment ID.

getNamespaces(deploymentID?: StringifiedNumber)

Gets all the namespaces under the given deployment ID.

Gets the user's account details associated with the included credentials.

httpRaw<T, Parse extends boolean = true>(
ctx: Context,
resource: `/${string}`,
method?: HTTPVerbs,
requestInit?: RequestInit,
parse?: Parse,
): Promise<Parse extends true ? T : void>

Makes a request to the API and creates possible errors according to the response.

KV(namespace: string, deploymentID?: StringifiedNumber)

Creates a new TpyKV instantiation, much like the Pylon SDK's KVNamespace class.

publishDeployment(body: Deployment.POST.Request<false>, deploymentID?: StringifiedNumber)

Makes a POST request to publish a deployment; returns details of the new deployment.

readyRequest(method: HTTPVerbs, other?: RequestInit): RequestInit

A factory function with default headers, allowing optional specificity.