UNPKG

balena-sdk

Version:
53 lines (52 loc) 1.78 kB
import type { Params } from 'pinejs-client-core'; import { PinejsClientCore } from 'pinejs-client-core'; import type * as PineClient from '../typings/pinejs-client-core'; import type { ResourceTypeMap } from './types/models'; import type BalenaRequest from 'balena-request'; import type { BalenaRequestOptions } from 'balena-request'; type BalenaRequestSend = ReturnType<(typeof BalenaRequest)['getRequest']>['send']; interface BackendParams { apiUrl: string; apiVersion: string; apiKey?: string; request: { send: BalenaRequestSend; }; auth: import('balena-auth').default; } /** * @class * @classdesc A PineJS Client subclass to communicate with balena. * @private * * @description * This subclass makes use of the [balena-request](https://github.com/balena-io-modules/balena-request) project. */ declare class PinejsClient extends PinejsClientCore<PinejsClient> { backendParams: BackendParams; API_URL: string; API_VERSION: string; constructor(params: Params, backendParams: BackendParams); /** * @summary Perform a network request to balena. * @method * @private * * @param {Object} options - request options * @returns {Promise<any>} response body * * @todo Implement caching support. */ _request(options: BalenaRequestOptions & { method: string; anonymous?: unknown; }): Promise<any>; } export type Pine = PineClient.Pine<ResourceTypeMap>; /** * A variant that makes $select mandatory, helping to create * requests that explicitly fetch only what your code needs. */ export type PineStrict = PineClient.PineStrict<ResourceTypeMap>; export declare const createPinejsClient: (...args: ConstructorParameters<typeof PinejsClient>) => Pine; export {};