balena-sdk
Version:
The Balena JavaScript SDK
128 lines (127 loc) • 6.26 kB
TypeScript
import type * as BalenaSdk from '..';
import type { InjectedDependenciesParam, InjectedOptionsParam } from '..';
import type { Release, User } from '../types/models';
import type { BuilderUrlDeployOptions } from '../util/builder';
export interface ReleaseRawVersionApplicationPair {
application: string | number;
rawVersion: string;
}
export interface ReleaseWithImageDetails extends Release {
images: Array<{
id: number;
service_name: string;
}>;
user: Pick<User, 'id' | 'username'> | undefined;
}
declare const getReleaseModel: (deps: InjectedDependenciesParam, opts: InjectedOptionsParam) => {
get: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, options?: BalenaSdk.PineOptions<BalenaSdk.Release>) => Promise<BalenaSdk.Release>;
getAllByApplication: (slugOrUuidOrId: string | number, options?: BalenaSdk.PineOptions<BalenaSdk.Release>) => Promise<BalenaSdk.Release[]>;
getLatestByApplication: (slugOrUuidOrId: string | number, options?: BalenaSdk.PineOptions<BalenaSdk.Release>) => Promise<BalenaSdk.Release | undefined>;
getWithImageDetails: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, options?: {
release?: BalenaSdk.PineOptions<BalenaSdk.Release>;
image?: BalenaSdk.PineOptions<BalenaSdk.Image>;
}) => Promise<BalenaSdk.ReleaseWithImageDetails>;
createFromUrl: (slugOrUuidOrId: string | number, urlDeployOptions: BuilderUrlDeployOptions) => Promise<number>;
finalize: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair) => Promise<void>;
setIsInvalidated: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, isInvalidated: boolean) => Promise<void>;
setNote: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, noteOrNull: string | null) => Promise<void>;
setKnownIssueList: (commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, knownIssueListOrNull: string | null) => Promise<void>;
tags: {
/**
* @summary Get all release tags for an application
* @name getAllByApplication
* @public
* @function
* @memberof balena.models.release.tags
*
* @param {String|Number} slugOrUuidOrId - application slug (string), uuid (string) or id (number)
* @param {Object} [options={}] - extra pine options to use
* @fulfil {Object[]} - release tags
* @returns {Promise}
*
* @example
* balena.models.release.tags.getAllByApplication('myorganization/myapp').then(function(tags) {
* console.log(tags);
* });
*
* @example
* balena.models.release.tags.getAllByApplication(999999).then(function(tags) {
* console.log(tags);
* });
*/
getAllByApplication(slugOrUuidOrId: string | number, options?: BalenaSdk.PineOptions<BalenaSdk.ReleaseTag>): Promise<BalenaSdk.ReleaseTag[]>;
/**
* @summary Get all release tags for a release
* @name getAllByRelease
* @public
* @function
* @memberof balena.models.release.tags
*
* @param {String|Number|Object} commitOrIdOrRawVersion - release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release
* @param {Object} [options={}] - extra pine options to use
* @fulfil {Object[]} - release tags
* @returns {Promise}
*
* @example
* balena.models.release.tags.getAllByRelease(123).then(function(tags) {
* console.log(tags);
* });
*
* @example
* balena.models.release.tags.getAllByRelease('7cf02a6').then(function(tags) {
* console.log(tags);
* });
*
* @example
* balena.models.release.tags.getAllByRelease({application: 456, rawVersion: '0.0.0'}).then(function(tags) {
* console.log(tags);
* });
*/
getAllByRelease(commitOrIdOrRawVersion: string | number | ReleaseRawVersionApplicationPair, options?: BalenaSdk.PineOptions<BalenaSdk.ReleaseTag>): Promise<BalenaSdk.ReleaseTag[]>;
/**
* @summary Set a release tag
* @name set
* @public
* @function
* @memberof balena.models.release.tags
*
* @param {String|Number|Object} commitOrIdOrRawVersion - release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release
* @param {String} tagKey - tag key
* @param {String|undefined} value - tag value
*
* @returns {Promise}
*
* @example
* balena.models.release.tags.set(123, 'EDITOR', 'vim');
*
* @example
* balena.models.release.tags.set('7cf02a6', 'EDITOR', 'vim');
*
* @example
* balena.models.release.tags.set({application: 456, rawVersion: '0.0.0'}, 'EDITOR', 'vim');
*/
set: (parentParam: string | number | import("../../typings/utils").Dictionary<unknown>, key: string, value: string) => Promise<void>;
/**
* @summary Remove a release tag
* @name remove
* @public
* @function
* @memberof balena.models.release.tags
*
* @param {String|Number|Object} commitOrIdOrRawVersion - release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release
* @param {String} tagKey - tag key
* @returns {Promise}
*
* @example
* balena.models.release.tags.remove(123, 'EDITOR');
*
* @example
* balena.models.release.tags.remove('7cf02a6', 'EDITOR');
*
* @example
* balena.models.release.tags.remove({application: 456, rawVersion: '0.0.0'}, 'EDITOR');
*/
remove: (parentParam: string | number | import("../../typings/utils").Dictionary<unknown>, key: string) => Promise<void>;
};
};
export default getReleaseModel;