
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@digitalocean/dots
Advanced tools
TypeScript client generator based on DigitalOcean's OpenAPI specification.
DoTs
is the official DigitalOcean Typescript Client based on the DO OpenAPIv3 specification.
"type": "module"
in your package.json (for ES module support)The package is published on npmjs.com.
npm i @digitalocean/dots
Note: Comprehensive documentation quality is currently lacking and under development. The documentation is actively being improved and will be updated once fixed.
https://digitaloceandots.readthedocs.io/en/latest/
A quick guide to getting started with client
dots
must be initialized with createDigitalOceanClient()
. A DigitalOcean token is required. This token can be passed in via DigitalOceanApiKeyAuthenticationProvider()
, an example below:
const authProvider = new DigitalOceanApiKeyAuthenticationProvider(token!);
// Create request adapter using the fetch-based implementation
const adapter = new FetchRequestAdapter(authProvider);
// Create the API client
const client = createDigitalOceanClient(adapter);
Find below a working example of creating a DigitalOcean volume via dots
:
import { createDigitalOceanClient, DigitalOceanApiKeyAuthenticationProvider,
FetchRequestAdapter, Volumes_ext4 } from "@digitalocean/dots";
const token = process.env.DIGITALOCEAN_TOKEN;
if (!token) {
throw new Error("DIGITALOCEAN_TOKEN not set");
}
const authProvider = new DigitalOceanApiKeyAuthenticationProvider(token!);
// Create request adapter using the fetch-based implementation
const adapter = new FetchRequestAdapter(authProvider);
// Create the API client
const client = createDigitalOceanClient(adapter);
async function main(): Promise<void> {
try {
const volumeReq: Volumes_ext4 = {
sizeGigabytes: 10,
name: `test-volume`,
description: "Block storage testing",
region: "nyc3",
filesystemType: "ext4",
};
const resp = await client.v2.volumes.post(volumeReq);
if (resp && resp.volume) {
const volume = resp.volume;
console.log(`Created volume ${volume.name} <ID: ${volume.id}>`);
} else {
throw new Error("Failed to create volume or volume is undefined");
}
console.log("Done!");
} catch (err) {
console.error(err);
}
}
main();
Running the above code snippet with tsc && node index.js
would output the following:
Created volume test-volume <ID: 751d0c09-1613-11f0-8aa5-0a58ac147241>
Done!
More working examples can be found in dots/examples
.
This section lists the known issues of the client generator.
value
fields for nested arraysWe welcome contributions! Feel free to get involved in developing this client by visiting our Contribuing Guide for detailed information and guidelines. For feature requests or bug reports, open an issue to help us improve the client.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
FAQs
TypeScript client generator based on DigitalOcean's OpenAPI specification.
The npm package @digitalocean/dots receives a total of 0 weekly downloads. As such, @digitalocean/dots popularity was classified as not popular.
We found that @digitalocean/dots demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.