1.0.0 • Published 4 years ago

@element-ts/palloadium v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

palladium

A type-safe http/s request library.

Import

Import what you need. You will most likely not need to import all of these.

import {
    PdRequest,
    PdResponse,
    PdMethod
} from "element-ts/palladium";

Example

Creating a Request

const req: PdRequest = new PdRequest();
req.setMethod(PdMethod.Post);
req.setUrl("my-api-address");
req.setBody({
    name: "Elijah Cobb"
})
req.setBearerToken("my-cool-token");

Fetching Response

const res: PdResponse = await req.request();
const code: number = res.statusCode;
const body: object | undefined = res.getJSON()

Documentation

You can view the declaration files or even the source code on GitHub.

Bugs

If you find any bugs please create an issue on GitHub or if you are old-fashioned email me at elijah@elijahcobb.com.