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', 'getImageSetViewByID',
'getAllImageSetImagesView', 'getAllImageSetImagesView',
'getImageSetsDevicesByID', 'getImageSetsDevicesByID',
'deleteImageSet',
'getImageSetImageView',
], ],
}; };

View file

@ -3227,7 +3227,7 @@
{ {
"description": "the image set id", "description": "the image set id",
"in": "path", "in": "path",
"name": "image_set_id", "name": "imageSetID",
"required": true, "required": true,
"schema": { "schema": {
"type": "integer" "type": "integer"
@ -3236,7 +3236,7 @@
{ {
"description": "the image id", "description": "the image id",
"in": "path", "in": "path",
"name": "image_id", "name": "imageID",
"required": true, "required": true,
"schema": { "schema": {
"type": "integer" "type": "integer"
@ -3465,7 +3465,7 @@
{ {
"description": "Identifier of the ImageSet", "description": "Identifier of the ImageSet",
"in": "path", "in": "path",
"name": "ImageSetId", "name": "imageSetID",
"required": true, "required": true,
"schema": { "schema": {
"type": "integer" "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< getAllImageSetImagesView: build.query<
GetAllImageSetImagesViewApiResponse, GetAllImageSetImagesViewApiResponse,
GetAllImageSetImagesViewApiArg 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>({ getAllImages: build.query<GetAllImagesApiResponse, GetAllImagesApiArg>({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images`, url: `/images`,
@ -172,6 +189,14 @@ export type GetImageSetsViewApiArg = {
/** field: return number of image-set view beginning at the offset. */ /** field: return number of image-set view beginning at the offset. */
offset?: number; 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 = export type GetAllImageSetImagesViewApiResponse =
/** status 200 OK */ ModelsImagesViewDataApi; /** status 200 OK */ ModelsImagesViewDataApi;
export type GetAllImageSetImagesViewApiArg = { export type GetAllImageSetImagesViewApiArg = {
@ -188,6 +213,11 @@ export type GetAllImageSetImagesViewApiArg = {
/** field: return number of images beginning at the offset. */ /** field: return number of images beginning at the offset. */
offset?: number; offset?: number;
}; };
export type DeleteImageSetApiResponse = /** status 200 OK */ ModelsImageSetApi;
export type DeleteImageSetApiArg = {
/** Identifier of the ImageSet */
imageSetId: number;
};
export type GetAllImagesApiResponse = export type GetAllImagesApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
export type GetAllImagesApiArg = { export type GetAllImagesApiArg = {
@ -436,6 +466,19 @@ export type ModelsImageSetsViewResponseApi = {
count?: number; count?: number;
data?: ModelsImageSetView[]; 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 = { export type ModelsImageView = {
CommitCheckSum?: string; CommitCheckSum?: string;
CreatedAt?: ModelsEdgeApiTime; CreatedAt?: ModelsEdgeApiTime;
@ -482,7 +525,9 @@ export type CreateImage = object;
export const { export const {
useListAllImageSetsQuery, useListAllImageSetsQuery,
useGetImageSetsViewQuery, useGetImageSetsViewQuery,
useGetImageSetImageViewQuery,
useGetAllImageSetImagesViewQuery, useGetAllImageSetImagesViewQuery,
useDeleteImageSetMutation,
useGetAllImagesQuery, useGetAllImagesQuery,
useCreateImageMutation, useCreateImageMutation,
useCheckImageNameMutation, useCheckImageNameMutation,