A fully-featured, strongly-typed TypeScript SDK for FolderHarbor with documentation and tests!
This was made for Hack Club Macondo :3
Run the correct command for your package manager:
npm install @folderharbor/sdkyarn add @folderharbor/sdkpnpm add @folderharbor/sdkbun install @folderharbor/sdkDocs: https://folderharbor.github.io/ts-sdk
To use this SDK in your own code, you need a running FolderHarbor Server.
(if you're just playing around, you can use the official demo, https://demo.fh.novatea.dev)
Once you have one, you can follow either of these starting structures!
const client = new FolderHarbor({ server: "[your server address]" }); // set up the client
await client.auth.login({ username: "[your username]", password: "[your password]" }); // log in
// and you're ready to make calls! :3c
This is if you already have a token for the FolderHarbor server, say if you are making a CLI tool and have the user's token stored on-device.
const client = new FolderHarbor({ server: "[your server address]", token: "[your token]" }); // set up and authenticate
// and you're ready to make calls!
I heavily suggest reading the example and documentation attached to each method before using it! You can see these with your code editor's IntelliSense, or in the documentation.
FHRequestError and FHAuthError)The SDK version should always remain 1:1 with the version of FolderHarbor Server that it is intended to interact with.
However, if I need to push urgent SDK changes without updating the server, I will update the patch version (the last number).
In other words, v1.1.1 SDK is still compatible with v1.1.0 server, but v1.1.1 SDK may not be compatible with v1.2.0 server (or vice versa).
I will communicate this if I do it, in the CHANGELOG.md and/or on https://fh.novatea.dev.
The official FolderHarbor Web Panel implements the SDK! You can see its source code here.
Also, you can see an example implementation of some functions in example.ts!
Finally (though this was mentioned above), methods have examples in their annotations! You can see them in the docs, or with your code editor's IntelliSense (just hover over a method from the SDK).