store: Update content-sources API schema
This adds `searchRpm` as a filtered endpoint.
This commit is contained in:
parent
ac4a0829e2
commit
e955293538
2 changed files with 34 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ const config: ConfigFile = {
|
||||||
outputFile: '../../src/store/contentSourcesApi.ts',
|
outputFile: '../../src/store/contentSourcesApi.ts',
|
||||||
exportName: 'contentSourcesApi',
|
exportName: 'contentSourcesApi',
|
||||||
hooks: true,
|
hooks: true,
|
||||||
filterEndpoints: ['listRepositories', 'listRepositoriesRpms'],
|
filterEndpoints: ['listRepositories', 'listRepositoriesRpms', 'searchRpm'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,13 @@ const injectedRtkApi = api.injectEndpoints({
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
searchRpm: build.mutation<SearchRpmApiResponse, SearchRpmApiArg>({
|
||||||
|
query: (queryArg) => ({
|
||||||
|
url: `/rpms/names`,
|
||||||
|
method: "POST",
|
||||||
|
body: queryArg.apiContentUnitSearchRequest,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
overrideExisting: false,
|
overrideExisting: false,
|
||||||
});
|
});
|
||||||
|
|
@ -89,6 +96,11 @@ export type ListRepositoriesRpmsApiArg = {
|
||||||
/** Sort the response based on specific repository parameters. Sort criteria can include `name`, `url`, `status`, and `package_count`. */
|
/** Sort the response based on specific repository parameters. Sort criteria can include `name`, `url`, `status`, and `package_count`. */
|
||||||
sortBy?: string;
|
sortBy?: string;
|
||||||
};
|
};
|
||||||
|
export type SearchRpmApiResponse = /** status 200 OK */ ApiSearchRpmResponse[];
|
||||||
|
export type SearchRpmApiArg = {
|
||||||
|
/** request body */
|
||||||
|
apiContentUnitSearchRequest: ApiContentUnitSearchRequest;
|
||||||
|
};
|
||||||
export type ApiSnapshotResponse = {
|
export type ApiSnapshotResponse = {
|
||||||
/** Count of each content type */
|
/** Count of each content type */
|
||||||
added_counts?: {
|
added_counts?: {
|
||||||
|
|
@ -263,5 +275,24 @@ export type ApiRepositoryRpmCollectionResponse = {
|
||||||
links?: ApiLinks;
|
links?: ApiLinks;
|
||||||
meta?: ApiResponseMetadata;
|
meta?: ApiResponseMetadata;
|
||||||
};
|
};
|
||||||
export const { useListRepositoriesQuery, useListRepositoriesRpmsQuery } =
|
export type ApiSearchRpmResponse = {
|
||||||
injectedRtkApi;
|
/** Package name found */
|
||||||
|
package_name?: string;
|
||||||
|
/** Summary of the package found */
|
||||||
|
summary?: string;
|
||||||
|
};
|
||||||
|
export type ApiContentUnitSearchRequest = {
|
||||||
|
/** Maximum number of records to return for the search */
|
||||||
|
limit?: number;
|
||||||
|
/** Search string to search content unit names */
|
||||||
|
search?: string;
|
||||||
|
/** URLs of repositories to search */
|
||||||
|
urls?: string[];
|
||||||
|
/** List of RepositoryConfig UUIDs to search */
|
||||||
|
uuids?: string[];
|
||||||
|
};
|
||||||
|
export const {
|
||||||
|
useListRepositoriesQuery,
|
||||||
|
useListRepositoriesRpmsQuery,
|
||||||
|
useSearchRpmMutation,
|
||||||
|
} = injectedRtkApi;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue