api: add new edge endpoints

This commit adds 2 more RTQ Query in preparation of porting edge source code to image-builder-frontend
This commit is contained in:
mgold1234 2023-09-11 17:44:20 +03:00 committed by Thomas Lavocat
parent 5d6b6dfbfe
commit 1bb7519cc4
3 changed files with 50 additions and 3 deletions

View file

@ -27,6 +27,8 @@ const config: ConfigFile = {
'getImageSetViewByID',
'getAllImageSetImagesView',
'getImageSetsDevicesByID',
'deleteImageSet',
'getImageSetImageView',
],
};

View file

@ -3227,7 +3227,7 @@
{
"description": "the image set id",
"in": "path",
"name": "image_set_id",
"name": "imageSetID",
"required": true,
"schema": {
"type": "integer"
@ -3236,7 +3236,7 @@
{
"description": "the image id",
"in": "path",
"name": "image_id",
"name": "imageID",
"required": true,
"schema": {
"type": "integer"
@ -3465,7 +3465,7 @@
{
"description": "Identifier of the ImageSet",
"in": "path",
"name": "ImageSetId",
"name": "imageSetID",
"required": true,
"schema": {
"type": "integer"

View file

@ -32,6 +32,14 @@ const injectedRtkApi = api.injectEndpoints({
},
}),
}),
getImageSetImageView: build.query<
GetImageSetImageViewApiResponse,
GetImageSetImageViewApiArg
>({
query: (queryArg) => ({
url: `/image-sets/view/${queryArg.imageSetId}/versions/${queryArg.imageId}`,
}),
}),
getAllImageSetImagesView: build.query<
GetAllImageSetImagesViewApiResponse,
GetAllImageSetImagesViewApiArg
@ -47,6 +55,15 @@ const injectedRtkApi = api.injectEndpoints({
},
}),
}),
deleteImageSet: build.mutation<
DeleteImageSetApiResponse,
DeleteImageSetApiArg
>({
query: (queryArg) => ({
url: `/image-sets/${queryArg.imageSetId}`,
method: "DELETE",
}),
}),
getAllImages: build.query<GetAllImagesApiResponse, GetAllImagesApiArg>({
query: (queryArg) => ({
url: `/images`,
@ -172,6 +189,14 @@ export type GetImageSetsViewApiArg = {
/** field: return number of image-set view beginning at the offset. */
offset?: number;
};
export type GetImageSetImageViewApiResponse =
/** status 200 OK */ ModelsImageSetImageIdViewApi;
export type GetImageSetImageViewApiArg = {
/** the image set id */
imageSetId: number;
/** the image id */
imageId: number;
};
export type GetAllImageSetImagesViewApiResponse =
/** status 200 OK */ ModelsImagesViewDataApi;
export type GetAllImageSetImagesViewApiArg = {
@ -188,6 +213,11 @@ export type GetAllImageSetImagesViewApiArg = {
/** field: return number of images beginning at the offset. */
offset?: number;
};
export type DeleteImageSetApiResponse = /** status 200 OK */ ModelsImageSetApi;
export type DeleteImageSetApiArg = {
/** Identifier of the ImageSet */
imageSetId: number;
};
export type GetAllImagesApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse;
export type GetAllImagesApiArg = {
@ -436,6 +466,19 @@ export type ModelsImageSetsViewResponseApi = {
count?: number;
data?: ModelsImageSetView[];
};
export type ModelsImageDetailApi = {
additional_packages?: number;
image?: ModelsImage;
packages?: number;
update_added?: number;
update_removed?: number;
update_updated?: number;
};
export type ModelsImageSetImageIdViewApi = {
ImageBuildIsoURL?: string;
ImageDetails?: ModelsImageDetailApi;
ImageSet?: ModelsImageSetApi;
};
export type ModelsImageView = {
CommitCheckSum?: string;
CreatedAt?: ModelsEdgeApiTime;
@ -482,7 +525,9 @@ export type CreateImage = object;
export const {
useListAllImageSetsQuery,
useGetImageSetsViewQuery,
useGetImageSetImageViewQuery,
useGetAllImageSetImagesViewQuery,
useDeleteImageSetMutation,
useGetAllImagesQuery,
useCreateImageMutation,
useCheckImageNameMutation,