balena-sdk
Version:
The Balena JavaScript SDK
127 lines (126 loc) • 3.93 kB
TypeScript
import type { JSONSchema7 } from 'json-schema';
import type { InjectedDependenciesParam, InjectedOptionsParam } from '..';
import type * as DeviceTypeJson from '../types/device-type-json';
export type { DeviceTypeJson };
export interface Config {
deployment: string | null;
deviceUrlsBase: string;
adminUrl: string;
gitServerUrl: string;
ga?: GaConfig;
mixpanelToken?: string;
intercomAppId?: string;
recurlyPublicKey?: string;
stripePublicKey?: string;
freezeBillingVersions?: string[];
DEVICE_ONLINE_ICON: string;
DEVICE_OFFLINE_ICON: string;
signupCodeRequired: boolean;
supportedSocialProviders: string[];
}
export type ConfigVarSchema = JSONSchema7 & {
will_reboot?: boolean;
warning?: string;
};
export interface ConfigVarDefinition {
blackListedNames: string[];
configVarSchema: ConfigVarSchema;
invalidRegex: string;
configVarInvalidRegex: string;
reservedNames: string[];
reservedNamespaces: string[];
whiteListedNames: string[];
whiteListedNamespaces: string[];
}
export interface GaConfig {
site: string;
id: string;
}
declare const getConfigModel: (deps: InjectedDependenciesParam, opts: InjectedOptionsParam) => {
/**
* @summary Get all configuration
* @name getAll
* @public
* @function
* @memberof balena.models.config
*
* @fulfil {Object} - configuration
* @returns {Promise}
*
* @example
* balena.models.config.getAll().then(function(config) {
* console.log(config);
* });
*/
getAll: () => Promise<Config>;
/**
* @summary Get device types
* @name getDeviceTypes
* @public
* @function
* @memberof balena.models.config
*
* @deprecated use balena.models.deviceType.getAll
* @fulfil {Object[]} - device types
* @returns {Promise}
*
* @example
* balena.models.config.getDeviceTypes().then(function(deviceTypes) {
* console.log(deviceTypes);
* });
*/
getDeviceTypes: () => Promise<DeviceTypeJson.DeviceType[]>;
/**
* @summary Get a device type manifest by slug
* @name getDeviceTypeManifestBySlug
* @public
* @function
* @memberof balena.models.config
*
* @deprecated use balena.models.deviceType.getBySlugOrName
* @param {String} slugOrName - device type slug
* @fulfil {Object} - device type manifest
* @returns {Promise}
*
* @example
* balena.models.config.getDeviceTypeManifestBySlug('raspberry-pi').then(function(manifest) {
* console.log(manifest);
* });
*/
getDeviceTypeManifestBySlug: (slugOrName: string) => Promise<DeviceTypeJson.DeviceType>;
/**
* @summary Get configuration/initialization options for a device type
* @name getDeviceOptions
* @public
* @function
* @memberof balena.models.config
*
* @param {String} deviceType - device type slug
* @fulfil {Object[]} - configuration options
* @returns {Promise}
*
* @example
* balena.models.config.getDeviceOptions('raspberry-pi').then(function(options) {
* console.log(options);
* });
*/
getDeviceOptions: (deviceType: string) => Promise<Array<DeviceTypeJson.DeviceTypeOptions | DeviceTypeJson.DeviceInitializationOptions>>;
/**
* @summary Get configuration variables schema for a device type
* @name getConfigVarSchema
* @public
* @function
* @memberof balena.models.config
*
* @param {String} deviceType - device type slug
* @fulfil {Object[]} - configuration options
* @returns {Promise}
*
* @example
* balena.models.config.getConfigVarSchema('raspberry-pi').then(function(options) {
* console.log(options);
* });
*/
getConfigVarSchema: (deviceType?: string) => Promise<ConfigVarDefinition>;
};
export default getConfigModel;