From 747770490596e3abbff9320c781a99c31e7af8d4 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 18 Nov 2024 19:52:15 +0100 Subject: [PATCH] feat(api-client): Add static method getImageById for Image class in api-client --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts_apiclient/classes.cloudlyapiclient.ts | 3 +++ ts_apiclient/classes.image.ts | 13 +++++++++++++ ts_web/00_commitinfo_data.ts | 2 +- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 855ed5b..90631dd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-11-18 - 4.4.0 - feat(api-client) +Add static method getImageById for Image class in api-client + +- Introduced a static method getImageById in the Image class. +- Updated CloudlyApiClient to include the getImageById method in the images interface. + ## 2024-11-18 - 4.3.21 - fix(interfaces) Remove deprecated deployment directive and update related interfaces diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 0035cd1..833f706 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/cloudly', - version: '4.3.21', + version: '4.4.0', description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' } diff --git a/ts_apiclient/classes.cloudlyapiclient.ts b/ts_apiclient/classes.cloudlyapiclient.ts index cdc2c1e..4f1017e 100644 --- a/ts_apiclient/classes.cloudlyapiclient.ts +++ b/ts_apiclient/classes.cloudlyapiclient.ts @@ -157,6 +157,9 @@ export class CloudlyApiClient { public images = { // Images + getImageById: async (imageIdArg: string) => { + return Image.getImageById(this, imageIdArg); + }, getImages: async () => { return Image.getImages(this); }, diff --git a/ts_apiclient/classes.image.ts b/ts_apiclient/classes.image.ts index deeb5b9..b58e6cd 100644 --- a/ts_apiclient/classes.image.ts +++ b/ts_apiclient/classes.image.ts @@ -18,6 +18,19 @@ export class Image implements plugins.servezoneInterfaces.data.IImage { return resultImages; } + public static async getImageById(cloudlyClientRef: CloudlyApiClient, imageIdArg: string) { + const getImageByIdTR = cloudlyClientRef.typedsocketClient.createTypedRequest( + 'getImage' + ); + const response = await getImageByIdTR.fire({ + identity: cloudlyClientRef.identity, + imageId: imageIdArg, + }); + const newImage = new Image(cloudlyClientRef); + Object.assign(newImage, response.image); + return newImage; + } + /** * creates a new image */ diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 0035cd1..833f706 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/cloudly', - version: '4.3.21', + version: '4.4.0', description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' }