karideo/front/src/app/back-api/data-resource.ts

105 lines
2.4 KiB
TypeScript

/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTCallbacks, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UUID, } from "./model"
export namespace DataResource {
/**
* Insert a new data in the data environment
*/
export function uploadFile({ restConfig, data, }: {
restConfig: RESTConfig,
data: {
file: File,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data//upload/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
});
};
/**
* Get back some data from the data environment
*/
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
export function retrieveDataId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: UUID,
},
data: string,
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Get a thumbnail of from the data environment (if resize is possible)
*/
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
export function retrieveDataThumbnailId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: UUID,
},
data: string,
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data/thumbnail/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Get back some data from the data environment (with a beautiful name (permit download with basic name)
*/
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
export function retrieveDataFull({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
name: string,
id: UUID,
},
data: string,
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data/{id}/{name}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
}