2022-01-26 12:08:38 +05:30
|
|
|
import axios from '../lib/utils/axios_utils';
|
|
|
|
import { buildApiUrl } from './api_utils';
|
|
|
|
|
|
|
|
const PUBLISH_PACKAGE_PATH =
|
|
|
|
'/api/:version/projects/:id/packages/generic/:package_name/:package_version/:file_name';
|
|
|
|
|
|
|
|
export function publishPackage(
|
|
|
|
{ projectPath, name, version, fileName, files },
|
|
|
|
options,
|
|
|
|
axiosOptions = {},
|
|
|
|
) {
|
|
|
|
const url = buildApiUrl(PUBLISH_PACKAGE_PATH)
|
|
|
|
.replace(':id', encodeURIComponent(projectPath))
|
|
|
|
.replace(':package_name', name)
|
|
|
|
.replace(':package_version', version)
|
|
|
|
.replace(':file_name', fileName);
|
|
|
|
|
|
|
|
const defaults = {
|
|
|
|
status: 'default',
|
|
|
|
};
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
return axios.put(url, files[0], {
|
2022-01-26 12:08:38 +05:30
|
|
|
params: Object.assign(defaults, options),
|
|
|
|
...axiosOptions,
|
|
|
|
});
|
|
|
|
}
|