npm.io
2.0.29 • Published 2d ago

pinejs-client-fetch

Licence
Apache-2.0
Version
2.0.29
Deps
1
Size
17 kB
Vulns
0
Weekly
5.4K
Stars
1

pinejs-client-fetch

This module provides the programming interface for the pinejs API using fetch.

Usage

import PineFetch from 'pinejs-client-fetch';

const pine = new PineClientFetch(
	{ apiPrefix: 'https://api.balena-cloud.com/v5/' },
	{ fetch: fetch },
);

const result = await pine.get({
	resource: 'application',
	options: {
		$top: 1,
		$select: 'app_name',
	},
})

You can also define extra init options for the fetch calls in the passthrough property:

await pine.get({
    resource: 'application',
    passthrough: {
        headers: {
            authorization: "Bearer " + myBearerToken,
        }
    }
});

Keywords